Changeset 1390 in 3DVCSoftware
- Timestamp:
- 13 Nov 2015, 17:00:20 (11 years ago)
- Location:
- branches/HTM-16.0-MV-draft-5
- Files:
-
- 5 deleted
- 97 edited
-
cfg/3D-HEVC (deleted)
-
cfg/Renderer (deleted)
-
checklist (deleted)
-
codingresults (deleted)
-
doc/VSOCfg.docx (deleted)
-
source/App/TAppDecoder/TAppDecCfg.cpp (modified) (3 diffs)
-
source/App/TAppDecoder/TAppDecCfg.h (modified) (2 diffs)
-
source/App/TAppDecoder/TAppDecTop.cpp (modified) (11 diffs)
-
source/App/TAppDecoder/TAppDecTop.h (modified) (1 diff)
-
source/App/TAppEncoder/TAppEncCfg.cpp (modified) (21 diffs)
-
source/App/TAppEncoder/TAppEncCfg.h (modified) (5 diffs)
-
source/App/TAppEncoder/TAppEncTop.cpp (modified) (35 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/SEI.cpp (modified) (3 diffs)
-
source/Lib/TLibCommon/SEI.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TComCodingStatistics.h (modified) (4 diffs)
-
source/Lib/TLibCommon/TComDataCU.cpp (modified) (62 diffs)
-
source/Lib/TLibCommon/TComDataCU.h (modified) (17 diffs)
-
source/Lib/TLibCommon/TComInterpolationFilter.cpp (modified) (7 diffs)
-
source/Lib/TLibCommon/TComInterpolationFilter.h (modified) (3 diffs)
-
source/Lib/TLibCommon/TComMotionInfo.cpp (modified) (3 diffs)
-
source/Lib/TLibCommon/TComMotionInfo.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComMv.h (modified) (7 diffs)
-
source/Lib/TLibCommon/TComPattern.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TComPic.cpp (modified) (7 diffs)
-
source/Lib/TLibCommon/TComPic.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComPicYuv.cpp (modified) (3 diffs)
-
source/Lib/TLibCommon/TComPicYuv.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TComPrediction.cpp (modified) (21 diffs)
-
source/Lib/TLibCommon/TComPrediction.h (modified) (4 diffs)
-
source/Lib/TLibCommon/TComRdCost.cpp (modified) (26 diffs)
-
source/Lib/TLibCommon/TComRdCost.h (modified) (14 diffs)
-
source/Lib/TLibCommon/TComRom.cpp (modified) (3 diffs)
-
source/Lib/TLibCommon/TComRom.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TComSlice.cpp (modified) (35 diffs)
-
source/Lib/TLibCommon/TComSlice.h (modified) (17 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) (9 diffs)
-
source/Lib/TLibDecoder/SEIread.cpp (modified) (2 diffs)
-
source/Lib/TLibDecoder/SEIread.h (modified) (1 diff)
-
source/Lib/TLibDecoder/TDecCAVLC.cpp (modified) (16 diffs)
-
source/Lib/TLibDecoder/TDecCAVLC.h (modified) (2 diffs)
-
source/Lib/TLibDecoder/TDecCu.cpp (modified) (20 diffs)
-
source/Lib/TLibDecoder/TDecCu.h (modified) (3 diffs)
-
source/Lib/TLibDecoder/TDecEntropy.cpp (modified) (17 diffs)
-
source/Lib/TLibDecoder/TDecEntropy.h (modified) (4 diffs)
-
source/Lib/TLibDecoder/TDecGop.cpp (modified) (2 diffs)
-
source/Lib/TLibDecoder/TDecSbac.cpp (modified) (15 diffs)
-
source/Lib/TLibDecoder/TDecSbac.h (modified) (4 diffs)
-
source/Lib/TLibDecoder/TDecSlice.cpp (modified) (1 diff)
-
source/Lib/TLibDecoder/TDecTop.cpp (modified) (10 diffs)
-
source/Lib/TLibDecoder/TDecTop.h (modified) (3 diffs)
-
source/Lib/TLibEncoder/SEIwrite.cpp (modified) (2 diffs)
-
source/Lib/TLibEncoder/SEIwrite.h (modified) (1 diff)
-
source/Lib/TLibEncoder/TEncCavlc.cpp (modified) (17 diffs)
-
source/Lib/TLibEncoder/TEncCavlc.h (modified) (2 diffs)
-
source/Lib/TLibEncoder/TEncCfg.h (modified) (12 diffs)
-
source/Lib/TLibEncoder/TEncCu.cpp (modified) (67 diffs)
-
source/Lib/TLibEncoder/TEncCu.h (modified) (6 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.cpp (modified) (4 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.h (modified) (3 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) (17 diffs)
-
source/Lib/TLibEncoder/TEncSbac.h (modified) (5 diffs)
-
source/Lib/TLibEncoder/TEncSearch.cpp (modified) (97 diffs)
-
source/Lib/TLibEncoder/TEncSearch.h (modified) (12 diffs)
-
source/Lib/TLibEncoder/TEncSlice.cpp (modified) (15 diffs)
-
source/Lib/TLibEncoder/TEncSlice.h (modified) (1 diff)
-
source/Lib/TLibEncoder/TEncTop.cpp (modified) (12 diffs)
-
source/Lib/TLibEncoder/TEncTop.h (modified) (7 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)
-
source/Lib/TLibVideoIO/TVideoIOYuv.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecCfg.cpp
r1386 r1390 66 66 Bool do_help = false; 67 67 string cfg_TargetDecLayerIdSetFile; 68 #if NH_3D69 string cfg_ScaleOffsetFile;70 #endif71 68 string outputColourSpaceConvert; 72 69 Int warnUnknowParameter = 0; … … 80 77 ("ReconFile,o", m_reconFileName, string(""), "reconstructed YUV output file name\n" 81 78 "YUV writing is skipped if omitted") 82 #if NH_3D83 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")84 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ")85 #endif86 79 ("WarnUnknowParameter,w", warnUnknowParameter, 0, "warn for unknown configuration parameters instead of failing") 87 80 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") … … 148 141 } 149 142 150 #if NH_3D151 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());152 #endif153 143 154 144 if (m_bitstreamFileName.empty()) -
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecCfg.h
r1386 r1390 96 96 Bool m_printPicOutput; ///< Print information on picture output 97 97 Bool m_printReceivedNalus; ///< Print information on received NAL units 98 #if NH_3D99 TChar* m_pchScaleOffsetFile; ///< output coded scale and offset parameters100 Bool m_depth420OutputFlag; ///< output depth layers in 4:2:0101 #endif102 98 103 99 Void xAppendToFileNameEnd( const TChar* pchInputFileName, const TChar* pchStringToAppend, TChar*& rpchOutputFileName); ///< create filenames … … 132 128 m_outputBitDepth[channelTypeIndex] = 0; 133 129 } 134 #if NH_3D135 m_pchScaleOffsetFile = NULL;136 #endif137 130 } 138 131 -
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecTop.cpp
r1386 r1390 94 94 m_cvsStartFound = false; 95 95 #endif 96 #if NH_3D97 m_pScaleOffsetFile = 0;98 #endif99 96 } 100 97 … … 131 128 #endif 132 129 m_reconFileName.clear(); 133 #if NH_3D134 if (m_pchScaleOffsetFile)135 {136 free (m_pchScaleOffsetFile);137 m_pchScaleOffsetFile = NULL;138 }139 #endif140 130 } 141 131 … … 405 395 // initialize global variables 406 396 initROM(); 407 #if NH_3D_DMM408 initWedgeLists();409 #endif410 397 #else 411 398 // create decoder class … … 453 440 m_pcSeiColourRemappingInfoPrevious = NULL; 454 441 } 455 #if NH_3D456 m_cCamParsCollector.uninit();457 if( m_pScaleOffsetFile )458 {459 ::fclose( m_pScaleOffsetFile );460 }461 #endif462 442 } 463 443 … … 465 445 { 466 446 467 #if NH_3D468 m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile );469 #endif470 447 #if NH_MV 471 448 m_dpb.setPrintPicOutput(m_printPicOutput); … … 1059 1036 xFinalizeAU ( ); 1060 1037 1061 #if NH_3D1062 if( m_cCamParsCollector.isInitialized() )1063 {1064 m_cCamParsCollector.setSlice( 0 );1065 }1066 #endif1067 1038 xFlushOutput(); 1068 1039 m_dpb.emptyAllSubDpbs(); … … 1092 1063 m_newVpsActivatedbyCurAu = true; //TBD 1093 1064 m_newVpsActivatedbyCurPic = true; 1094 #if NH_3D_VSO1095 m_dpb.setVPS( m_vps );1096 #endif1097 1065 } 1098 1066 … … 1216 1184 Void TAppDecTop::xFinalizeAU() 1217 1185 { 1218 #if NH_3D1219 if ( !m_curAu.empty())1220 {1221 for (TComList<TComPic*>::iterator it = m_curAu.begin(); it != m_curAu.end(); it++)1222 {1223 TComPic* pic = (*it);1224 if ( !pic->getHasGeneratedRefPics() )1225 {1226 pic->compressMotion(1);1227 }1228 }1229 }1230 #endif1231 1186 } 1232 1187 … … 2688 2643 m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os); 2689 2644 } 2690 #if NH_3D2691 m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );2692 #endif2693 2645 2694 2646 // append pic list of new decoder to PicLists … … 2912 2864 } 2913 2865 2914 #if NH_3D2915 if( m_pchScaleOffsetFile )2916 {2917 m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );2918 if (!m_pScaleOffsetFile)2919 {2920 fprintf(stderr, "\nUnable to open file `%s' for writing decoded Camera Parameters messages\n", m_pchScaleOffsetFile);2921 exit(EXIT_FAILURE);2922 }2923 }2924 #endif2925 2866 } 2926 2867 … … 3011 2952 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 3012 2953 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 3013 #if NH_3D3014 m_depth420OutputFlag && curPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT3015 #else3016 2954 NUM_CHROMA_FORMAT 3017 #endif3018 2955 , m_bClipOutputVideoToRec709Range); 3019 2956 } -
branches/HTM-16.0-MV-draft-5/source/App/TAppDecoder/TAppDecTop.h
r1386 r1390 117 117 118 118 Bool m_reconOpen [ MAX_NUM_LAYERS ]; ///< reconstruction file opened 119 #if NH_3D120 FILE* m_pScaleOffsetFile;121 CamParsCollector m_cCamParsCollector;122 #endif123 119 #else 124 120 TDecTop m_cTDecTop; ///< decoder class -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncCfg.cpp
r1386 r1390 73 73 #if NH_MV 74 74 MULTIVIEWMAIN = 6, 75 #if NH_3D76 MAIN3D = 8,77 #endif78 75 #endif 79 76 MONOCHROME_8 = 1008, … … 120 117 m_targetPivotValue = NULL; 121 118 122 #if KWU_RC_MADPRED_E0227123 m_depthMADPred = 0;124 #endif125 119 } 126 120 … … 181 175 { 182 176 free ( m_pchBaseViewCameraNumbers ); 183 }184 #endif185 #if NH_3D_VSO186 if ( m_pchVSOConfig != NULL)187 {188 free ( m_pchVSOConfig );189 }190 191 if ( m_pchCameraParameterFile != NULL )192 {193 free ( m_pchCameraParameterFile );194 177 } 195 178 #endif … … 276 259 } 277 260 #endif 278 #if NH_3D279 in>>entry.m_interCompPredFlag;280 #endif281 261 282 262 return in; … … 312 292 #if NH_MV 313 293 ,{"multiview-main" , Profile::MULTIVIEWMAIN }, 314 #if NH_3D315 {"3d-main" , Profile::MAIN3D }316 #endif317 294 #endif 318 295 … … 341 318 #if NH_MV 342 319 {"multiview-main" , MULTIVIEWMAIN }, 343 #if NH_3D344 {"3d-main" , MAIN3D },345 #endif346 320 #endif 347 321 {"monochrome", MONOCHROME_8 }, … … 726 700 string cfg_levels; 727 701 string cfg_tiers; 728 #if NH_3D729 cfg_dimensionLength.push_back( 2 ); // depth730 cfg_dimensionLength.push_back( 32 ); // texture731 #else732 702 cfg_dimensionLength.push_back( 64 ); 733 #endif734 703 #endif 735 704 … … 807 776 #if NH_MV 808 777 ("NumberOfLayers", m_numberOfLayers , 1, "Number of layers") 809 #if !NH_3D810 778 ("ScalabilityMask", m_scalabilityMask , 2 , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary") 811 #else812 ("ScalabilityMask", m_scalabilityMask , 3 , "Scalability Mask, 1: Texture 3: Texture + Depth ")813 #endif814 779 ("DimensionIdLen", m_dimensionIdLen , cfg_dimensionLength , "Number of bits used to store dimensions Id") 815 780 ("ViewOrderIndex", m_viewOrderIndex , IntAry1d(1,0), "View Order Index per layer") 816 781 ("ViewId", m_viewId , IntAry1d(1,0), "View Id per View Order Index") 817 782 ("AuxId", m_auxId , IntAry1d(1,0), "AuxId per layer") 818 #if NH_3D_VSO819 ("DepthFlag", m_depthFlag , IntAry1d(1,0), "Depth Flag")820 #endif821 783 ("TargetEncLayerIdList", m_targetEncLayerIdList , IntAry1d(0,0), "LayerIds in Nuh to be encoded") 822 784 ("LayerIdInNuh", m_layerIdInNuh , IntAry1d(1,0), "LayerId in Nuh") … … 1095 1057 #endif 1096 1058 1097 #if KWU_RC_VIEWRC_E02271098 ("ViewWiseTargetBits, -vtbr" , m_viewTargetBits, std::vector<Int>(1, 32), "View-wise target bit-rate setting")1099 ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")1100 #endif1101 #if KWU_RC_MADPRED_E02271102 ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")1103 #endif1104 1059 #if NH_MV 1105 1060 // A lot of this stuff could should actually be derived by the encoder. … … 1282 1237 ("BaseViewCameraNumbers", m_pchBaseViewCameraNumbers, (TChar *) 0 , "Numbers of base views") 1283 1238 #endif 1284 #if NH_3D1285 ("Depth420OutputFlag", m_depth420OutputFlag, true , "Output depth layers in 4:2:0 ")1286 #endif1287 #if NH_3D_VSO1288 ("CameraParameterFile,cpf", m_pchCameraParameterFile, (TChar *) 0 , "Camera Parameter File Name")1289 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )1290 1291 /* View Synthesis Optimization */1292 ("VSOConfig", m_pchVSOConfig , (TChar *) 0 ,"VSO configuration")1293 ("VSO", m_bUseVSO , false ,"Use VSO" )1294 ("VSOMode", m_uiVSOMode , (UInt) 4 ,"VSO Mode")1295 ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 ,"Lambda Scaling for VSO")1296 ("VSOLSTable", m_bVSOLSTable , true ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )1297 ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false ,"Force using Lambda Scale VSO also in non-VSO-Mode")1298 ("AllowNegDist", m_bAllowNegDist , true ,"Allow negative Distortion in VSO")1299 1300 ("UseEstimatedVSD", m_bUseEstimatedVSD , true ,"Model based VSD estimation instead of rendering based for some encoder decisions" )1301 ("VSOEarlySkip", m_bVSOEarlySkip , true ,"Early skip of VSO computation if synthesis error assumed to be zero" )1302 1303 ("WVSO", m_bUseWVSO , true ,"Use depth fidelity term for VSO" )1304 ("VSOWeight", m_iVSOWeight , 10 ,"Synthesized View Distortion Change weight" )1305 ("VSDWeight", m_iVSDWeight , 1 ,"View Synthesis Distortion estimate weight" )1306 ("DWeight", m_iDWeight , 1 ,"Depth Distortion weight" )1307 #endif //HHI_VSO1308 1239 /* 3D- HEVC Tools */ 1309 #if NH_3D_QTL1310 ("QTL" , m_bUseQTL , true , "Use depth quad tree limitation (encoder only)" )1311 #endif1312 #if NH_3D1313 1314 ("IvMvPredFlag" , m_ivMvPredFlag , BoolAry1d(2,true) , "Inter-view motion prediction" )1315 ("IvMvScalingFlag" , m_ivMvScalingFlag , BoolAry1d(2,true) , "Inter-view motion vector scaling" )1316 ("Log2SubPbSizeMinus3" , m_log2SubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size" )1317 ("IvResPredFlag" , m_ivResPredFlag , true , "Inter-view residual prediction" )1318 ("DepthRefinementFlag" , m_depthRefinementFlag , true , "Depth to refine disparity" )1319 ("ViewSynthesisPredFlag" , m_viewSynthesisPredFlag , true , "View synthesis prediction" )1320 ("DepthBasedBlkPartFlag" , m_depthBasedBlkPartFlag , true , "Depth base block partitioning" )1321 ("MpiFlag" , m_mpiFlag , true , "Motion inheritance from texture to depth" )1322 ("Log2MpiSubPbSizeMinus3", m_log2MpiSubPbSizeMinus3 , 0 , "Log2 minus 3 of sub Pb size for MPI" )1323 ("IntraContourFlag" , m_intraContourFlag , true , "Intra contour mode" )1324 ("IntraWedgeFlag" , m_intraWedgeFlag , true , "Intra wedge mode and segmental depth DCs" )1325 ("IntraSdcFlag" , m_intraSdcFlag , true , "Intra depth DCs" )1326 ("QtPredFlag" , m_qtPredFlag , true , "Quad tree prediction from texture to depth")1327 ("InterSdcFlag" , m_interSdcFlag , true , "Inter depth DCs" )1328 ("DepthIntraSkip" , m_depthIntraSkipFlag , true , "Depth intra skip mode" )1329 ("DLT" , m_useDLT , true , "Depth lookup table" )1330 ("IlluCompEnable" , m_abUseIC , true , "Enable illumination compensation" )1331 ("IlluCompLowLatencyEnc" , m_bUseLowLatencyICEnc , false , "Enable low-latency illumination compensation encoding")1332 #endif //NH_3D1333 1240 1334 1241 ; … … 1536 1443 if( cfg_profiles.empty() ) 1537 1444 { 1538 #if NH_3D1539 cfg_profiles = string("main main 3d-main");1540 #else1541 1445 cfg_profiles = string("main main multiview-main"); 1542 #endif1543 1446 fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() ); 1544 1447 anyEmpty = true; … … 1807 1710 xResizeVector( m_auxId ); 1808 1711 1809 #if NH_3D_VSO1810 xResizeVector( m_depthFlag );1811 #endif1812 1712 xResizeVector( m_fQP ); 1813 1713 … … 2017 1917 2018 1918 2019 #if NH_3D_VSO2020 // Table base optimization2021 // Q&D2022 Double adLambdaScaleTable[] =2023 { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,2024 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,2025 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,2026 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,2027 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,2028 0.753550, 0.8000002029 };2030 if ( m_bUseVSO && m_bVSOLSTable )2031 {2032 Int firstDepthLayer = -1;2033 for (Int layer = 0; layer < m_numberOfLayers; layer++ )2034 {2035 if ( m_depthFlag[ layer ] || m_auxId[ layer ] == 2 )2036 {2037 firstDepthLayer = layer;2038 break;2039 }2040 }2041 AOT( firstDepthLayer == -1 );2042 AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));2043 m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];2044 }2045 if ( m_bUseVSO && m_uiVSOMode == 4)2046 {2047 m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );2048 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2049 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2050 (UInt)m_iCodedCamParPrecision,2051 m_FrameSkip,2052 (UInt)m_framesToBeEncoded,2053 m_pchCameraParameterFile,2054 m_pchBaseViewCameraNumbers,2055 NULL,2056 m_cRenModStrParser.getSynthViews(),2057 LOG2_DISP_PREC_LUT );2058 }2059 else if ( m_bUseVSO && m_uiVSOMode != 4 )2060 {2061 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2062 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2063 (UInt)m_iCodedCamParPrecision,2064 m_FrameSkip,2065 (UInt)m_framesToBeEncoded,2066 m_pchCameraParameterFile,2067 m_pchBaseViewCameraNumbers,2068 m_pchVSOConfig,2069 NULL,2070 LOG2_DISP_PREC_LUT );2071 }2072 #if NH_3D2073 else2074 {2075 m_cCameraData .init ( ((UInt) m_iNumberOfViews ),2076 m_internalBitDepth[ CHANNEL_TYPE_LUMA],2077 (UInt) m_iCodedCamParPrecision,2078 m_FrameSkip,2079 (UInt) m_framesToBeEncoded,2080 m_pchCameraParameterFile,2081 m_pchBaseViewCameraNumbers,2082 NULL,2083 NULL,2084 LOG2_DISP_PREC_LUT );2085 }2086 m_cCameraData.check( false, true );2087 #endif2088 #endif2089 1919 2090 1920 // check validity of input parameters … … 2264 2094 xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. "); 2265 2095 2266 #if NH_3D2267 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");2268 #else2269 2096 xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10"); 2270 #endif 2271 2272 #if NH_3D_VSO 2273 if ( m_scalabilityMask & ( 1 << DEPTH_ID ) ) 2274 { 2275 m_dimIds.push_back( m_depthFlag ); 2276 } 2277 #endif 2097 2278 2098 2279 2099 m_dimIds.push_back( m_viewOrderIndex ); … … 2342 2162 xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." ); 2343 2163 2344 #if !H_3D_FCO2345 2164 if ( numDiff == 1 ) 2346 2165 { … … 2353 2172 xConfirmPara( shallBeButIsNotIncreasing, "DimensionIds shall be increasing within one dimension. " ); 2354 2173 } 2355 #endif2356 2174 } 2357 2175 } … … 2560 2378 xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); 2561 2379 xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); 2562 #if NH_3D2563 xConfirmPara( m_log2SubPbSizeMinus3 < 0, "Log2SubPbSizeMinus3 must be equal to 0 or greater.");2564 xConfirmPara( m_log2SubPbSizeMinus3 > 3, "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");2565 xConfirmPara( (1<< ( m_log2SubPbSizeMinus3 + 3) ) > m_uiMaxCUWidth, "Log2SubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2566 2567 xConfirmPara( m_log2MpiSubPbSizeMinus3 < 0, "Log2MpiSubPbSizeMinus3 must be equal to 0 or greater.");2568 xConfirmPara( m_log2MpiSubPbSizeMinus3 > 3, "Log2MpiSubPbSizeMinus3 must be equal to 3 or smaller.");2569 xConfirmPara( (1<< (m_log2MpiSubPbSizeMinus3 + 3)) > m_uiMaxCUWidth, "Log2MpiSubPbSizeMinus3 must be equal to log2(maxCUSize)-3 or smaller.");2570 #endif2571 2380 #if ADAPTIVE_QP_SELECTION 2572 2381 #if NH_MV … … 2629 2438 } 2630 2439 2631 #if NH_3D_VSO2632 xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given");2633 xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" );2634 xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() , "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );2635 xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" );2636 if( m_bUseVSO )2637 {2638 xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given");2639 xConfirmPara( m_uiVSOMode > 4 , "VSO Mode must be less than 5");2640 }2641 #endif2642 2440 // max CU width and height should be power of 2 2643 2441 UInt ui = m_uiMaxCUWidth; … … 3393 3191 xPrintParaVector( "AuxId", m_auxId ); 3394 3192 #endif 3395 #if NH_3D_VSO3396 xPrintParaVector( "DepthLayerFlag", m_depthFlag );3397 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3398 #endif3399 3193 #if NH_MV 3400 3194 xPrintParaVector( "QP" , m_fQP ); … … 3573 3367 #endif 3574 3368 3575 #if KWU_RC_MADPRED_E02273576 printf("Depth based MAD prediction : %d\n", m_depthMADPred);3577 #endif3578 #if KWU_RC_VIEWRC_E02273579 printf("View-wise Rate control : %d\n", m_viewWiseRateCtrl);3580 if(m_viewWiseRateCtrl)3581 {3582 3583 printf("ViewWiseTargetBits : ");3584 for (Int i = 0 ; i < m_iNumberOfViews ; i++)3585 printf("%d ", m_viewTargetBits[i]);3586 printf("\n");3587 }3588 else3589 {3590 printf("TargetBitrate : %d\n", m_RCTargetBitrate );3591 }3592 #endif3593 3369 3594 3370 } 3595 3371 3596 3372 printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); 3597 #if NH_3D_VSO3598 printf("BaseViewCameraNumbers : %s\n", m_pchBaseViewCameraNumbers );3599 printf("Coded Camera Param. Precision : %d\n", m_iCodedCamParPrecision);3600 printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO );3601 3602 if ( m_bUseVSO )3603 {3604 printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO );3605 printf("VSO Mode : %d\n", m_uiVSOMode );3606 printf("VSO Config : %s\n", m_pchVSOConfig );3607 printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0);3608 printf("VSO LS Table : %d\n", m_bVSOLSTable ? 1 : 0);3609 printf("VSO Estimated VSD : %d\n", m_bUseEstimatedVSD ? 1 : 0);3610 printf("VSO Early Skip : %d\n", m_bVSOEarlySkip ? 1 : 0);3611 if ( m_bUseWVSO )3612 {3613 printf("Dist. Weights (VSO/VSD/SAD) : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );3614 }3615 }3616 #endif //HHI_VSO3617 3373 printf("\n"); 3618 3374 #if NH_MV … … 3677 3433 printf(" SignBitHidingFlag:%d ", m_signHideFlag); 3678 3434 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); 3679 #if NH_3D_VSO3680 printf(" VSO:%d ", m_bUseVSO );3681 printf("WVSO:%d ", m_bUseWVSO );3682 #endif3683 #if NH_3D_QTL3684 printf( "QTL:%d " , m_bUseQTL);3685 #endif3686 #if NH_3D3687 printf( "IlluCompEnable:%d " , m_abUseIC);3688 printf( "IlluCompLowLatencyEnc:%d ", m_bUseLowLatencyICEnc);3689 printf( "DLT:%d ", m_useDLT );3690 3691 3692 printf( "IvMvPred:%d %d " , m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1] ? 1 : 0);3693 printf( "IvMvScaling:%d %d " , m_ivMvScalingFlag[0] ? 1 : 0 , m_ivMvScalingFlag[1] ? 1 : 0);3694 3695 printf( "Log2SubPbSizeMinus3:%d " , m_log2SubPbSizeMinus3 );3696 printf( "IvResPred:%d " , m_ivResPredFlag ? 1 : 0 );3697 printf( "DepthRefinement:%d " , m_depthRefinementFlag ? 1 : 0 );3698 printf( "ViewSynthesisPred:%d " , m_viewSynthesisPredFlag ? 1 : 0 );3699 printf( "DepthBasedBlkPart:%d " , m_depthBasedBlkPartFlag ? 1 : 0 );3700 printf( "Mpi:%d " , m_mpiFlag ? 1 : 0 );3701 printf( "Log2MpiSubPbSizeMinus3:%d " , m_log2MpiSubPbSizeMinus3 );3702 printf( "IntraContour:%d " , m_intraContourFlag ? 1 : 0 );3703 printf( "IntraWedge:%d " , m_intraWedgeFlag ? 1 : 0 );3704 printf( "IntraSdc:%d " , m_intraSdcFlag ? 1 : 0 );3705 printf( "QtPred:%d " , m_qtPredFlag ? 1 : 0 );3706 printf( "InterSdc:%d " , m_interSdcFlag ? 1 : 0 );3707 printf( "DepthIntraSkip:%d " , m_depthIntraSkipFlag ? 1 : 0 );3708 #endif3709 3435 3710 3436 printf("\n\n"); -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncCfg.h
r1386 r1390 44 44 #include <sstream> 45 45 #include <vector> 46 #if NH_3D47 #include "TAppCommon/TAppComCamPara.h"48 #include "TLibRenderer/TRenModel.h"49 #include "TLibRenderer/TRenModSetupStrParser.h"50 #endif51 46 //! \ingroup TAppEncoder 52 47 //! \{ … … 80 75 IntAry1d m_viewOrderIndex; ///< view order index 81 76 IntAry1d m_auxId; ///< auxiliary id 82 #if NH_3D_VSO83 IntAry1d m_depthFlag; ///< depth flag84 #endif85 77 IntAry1d m_targetEncLayerIdList; ///< layer Ids in Nuh to be encoded 86 78 IntAry1d m_layerIdInNuh; ///< layer Id in Nuh for each layer … … 131 123 Bool m_singleLayerForNonIrapFlag; 132 124 Bool m_higherLayerIrapSkipFlag; 133 #if NH_3D134 Bool m_abUseIC;135 Bool m_bUseLowLatencyICEnc;136 #endif137 125 #endif 138 126 // Lambda modifiers … … 464 452 #endif 465 453 466 #if KWU_RC_VIEWRC_E0227467 vector<Int> m_viewTargetBits;468 Bool m_viewWiseRateCtrl; ///< Flag for using view-wise rate control469 #endif470 #if KWU_RC_MADPRED_E0227471 UInt m_depthMADPred;472 #endif473 454 474 455 ScalingListMode m_useScalingListId; ///< using quantization matrix … … 527 508 #endif 528 509 529 #if NH_3D530 // Output Format531 Bool m_depth420OutputFlag; ///< Output depth layers in 4:2:0 format532 #endif533 510 // Camera parameters 534 #if NH_3D_VSO535 TChar* m_pchCameraParameterFile; ///< camera parameter file536 TAppComCamPara m_cCameraData;537 Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters538 TChar* m_pchVSOConfig;539 Bool m_bUseVSO; ///< flag for using View Synthesis Optimization540 Bool m_bVSOLSTable; ///< Depth QP dependent Lagrange parameter optimization (m23714)541 Bool m_bVSOEarlySkip; ///< Early skip of VSO computation (JCT3V-A0093 modification 4)542 543 //// Used for development by GT, might be removed later544 Double m_dLambdaScaleVSO; ///< Scaling factor for Lambda in VSO mode545 Bool m_bForceLambdaScaleVSO; ///< Use Lambda Scale for depth even if VSO is turned off546 Bool m_bAllowNegDist; ///< Allow negative distortion in VSO547 UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full548 549 // SAIT_VSO_EST_A0033550 Bool m_bUseEstimatedVSD; ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3)551 552 // LGE_WVSO_A0119553 Bool m_bUseWVSO; ///< flag for using View Synthesis Optimization554 Int m_iVSOWeight;555 Int m_iVSDWeight;556 Int m_iDWeight;557 558 // Ren Model String559 TRenModSetupStrParser m_cRenModStrParser;560 #endif561 #if NH_3D562 Bool m_useDLT; ///< flag for using DLT563 #endif564 #if NH_3D_QTL565 Bool m_bUseQTL; ///< flag for using depth QuadTree Limitation566 #endif567 #if NH_3D568 BoolAry1d m_ivMvPredFlag;569 BoolAry1d m_ivMvScalingFlag;570 Int m_log2SubPbSizeMinus3;571 Bool m_ivResPredFlag;572 Bool m_depthRefinementFlag;573 Bool m_viewSynthesisPredFlag;574 Bool m_depthBasedBlkPartFlag;575 Bool m_mpiFlag;576 Int m_log2MpiSubPbSizeMinus3;577 Bool m_intraContourFlag;578 Bool m_intraWedgeFlag;579 Bool m_intraSdcFlag;580 Bool m_qtPredFlag;581 Bool m_interSdcFlag;582 Bool m_depthIntraSkipFlag;583 #endif584 511 // internal member functions 585 512 Void xCheckParameter (); ///< check validity of configuration values -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncTop.cpp
r1386 r1390 87 87 #endif 88 88 89 #if NH_3D 90 vps.createCamPars(m_iNumberOfViews); 91 #endif 92 93 #if NH_3D_DLT 94 TComDLT dlt = TComDLT(); 95 #endif 89 96 90 97 91 #if NH_MV … … 145 139 xSetDpbSize ( vps ); 146 140 xSetVPSVUI ( vps ); 147 #if NH_3D148 xSetCamPara ( vps );149 #endif150 #if NH_3D_VSO151 m_ivPicLists.setVPS ( &vps );152 #endif153 #if NH_3D_DLT154 xDeriveDltArray ( vps, &dlt );155 #endif156 141 if ( m_targetEncLayerIdList.size() == 0 ) 157 142 { … … 184 169 } 185 170 186 #if NH_3D187 // Set 3d tool parameters188 for (Int d = 0; d < 2; d++)189 {190 m_sps3dExtension.setIvDiMcEnabledFlag ( d, m_ivMvPredFlag[d] );191 m_sps3dExtension.setIvMvScalEnabledFlag ( d, m_ivMvScalingFlag[d] );192 if (d == 0 )193 {194 m_sps3dExtension.setLog2IvmcSubPbSizeMinus3 ( d, m_log2SubPbSizeMinus3 );195 m_sps3dExtension.setIvResPredEnabledFlag ( d, m_ivResPredFlag );196 m_sps3dExtension.setDepthRefEnabledFlag ( d, m_depthRefinementFlag );197 m_sps3dExtension.setVspMcEnabledFlag ( d, m_viewSynthesisPredFlag );198 m_sps3dExtension.setDbbpEnabledFlag ( d, m_depthBasedBlkPartFlag );199 }200 else201 {202 m_sps3dExtension.setTexMcEnabledFlag ( d, m_mpiFlag );203 m_sps3dExtension.setLog2TexmcSubPbSizeMinus3( d, m_log2MpiSubPbSizeMinus3);204 m_sps3dExtension.setIntraContourEnabledFlag ( d, m_intraContourFlag );205 m_sps3dExtension.setIntraDcOnlyWedgeEnabledFlag ( d, m_intraSdcFlag || m_intraWedgeFlag );206 m_sps3dExtension.setCqtCuPartPredEnabledFlag ( d, m_qtPredFlag );207 m_sps3dExtension.setInterDcOnlyEnabledFlag ( d, m_interSdcFlag );208 m_sps3dExtension.setSkipIntraEnabledFlag ( d, m_depthIntraSkipFlag );209 }210 }211 #endif212 171 213 172 … … 219 178 m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); 220 179 m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); 221 #if NH_3D222 Int profileIdc = -1;223 for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )224 {225 Int lsIdx = vps.olsIdxToLsIdx( olsIdx );226 for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )227 {228 if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )229 {230 Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );231 if ( ptlIdx != -1 )232 {233 Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();234 if (profileIdc == -1)235 {236 profileIdc = curProfileIdc;237 }238 else239 {240 if ( profileIdc != curProfileIdc )241 {242 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );243 exit(EXIT_FAILURE);244 }245 }246 }247 }248 }249 }250 251 if (profileIdc == -1 )252 {253 fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );254 exit(EXIT_FAILURE);255 }256 m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );257 #endif258 180 } 259 181 … … 278 200 m_cTEncTop.setViewId ( vps.getViewId ( layerId ) ); 279 201 m_cTEncTop.setViewIndex ( vps.getViewIndex ( layerId ) ); 280 #if NH_3D_VSO281 Bool isDepth = ( vps.getDepthId ( layerId ) != 0 ) ;282 Bool isAuxDepth = ( vps.getAuxId ( layerId ) == 2 ) ; // TBD: define 2 as AUX_DEPTH283 m_cTEncTop.setIsDepth ( isDepth );284 m_cTEncTop.setIsAuxDepth ( isAuxDepth );285 //====== Camera Parameters =========286 m_cTEncTop.setCameraParameters ( &m_cCameraData );287 //====== VSO =========288 m_cTEncTop.setRenderModelParameters ( &m_cRenModStrParser );289 m_cTEncTop.setForceLambdaScaleVSO ( isDepth || isAuxDepth ? m_bForceLambdaScaleVSO : false );290 m_cTEncTop.setLambdaScaleVSO ( isDepth || isAuxDepth ? m_dLambdaScaleVSO : 1 );291 m_cTEncTop.setVSOMode ( isDepth || isAuxDepth ? m_uiVSOMode : 0 );292 293 m_cTEncTop.setAllowNegDist ( isDepth || isAuxDepth ? m_bAllowNegDist : false );294 295 // SAIT_VSO_EST_A0033296 m_cTEncTop.setUseEstimatedVSD ( isDepth || isAuxDepth ? m_bUseEstimatedVSD : false );297 298 // LGE_WVSO_A0119299 m_cTEncTop.setUseWVSO ( isDepth || isAuxDepth ? m_bUseWVSO : false );300 m_cTEncTop.setVSOWeight ( isDepth || isAuxDepth ? m_iVSOWeight : 0 );301 m_cTEncTop.setVSDWeight ( isDepth || isAuxDepth ? m_iVSDWeight : 0 );302 m_cTEncTop.setDWeight ( isDepth || isAuxDepth ? m_iDWeight : 0 );303 #endif // H_3D_VSO304 #if NH_3D305 #if NH_3D_IC306 m_cTEncTop.setUseIC ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );307 m_cTEncTop.setUseICLowLatencyEnc ( m_bUseLowLatencyICEnc );308 #endif309 310 311 m_cTEncTop.setUseDMM ( isDepth ? m_intraWedgeFlag : false );312 m_cTEncTop.setUseSDC ( isDepth ? m_intraSdcFlag : false );313 m_cTEncTop.setUseDLT ( isDepth ? m_useDLT : false );314 #endif315 #if NH_3D_QTL316 m_cTEncTop.setUseQTL ( isDepth || isAuxDepth ? m_bUseQTL : false );317 #endif318 #if NH_3D319 m_cTEncTop.setSps3dExtension ( m_sps3dExtension );320 #endif // NH_3D321 202 322 203 m_cTEncTop.setIvPicLists ( &m_ivPicLists ); … … 324 205 m_cTEncTop.setVPS(&vps); 325 206 326 #if NH_3D_DLT327 m_cTEncTop.setDLT(dlt);328 #endif329 207 330 208 #if NH_MV … … 438 316 m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset ); 439 317 440 #if NH_3D441 m_cTEncTop.setChromaFormatIdc ( isDepth ? CHROMA_400 : m_chromaFormatIDC );442 #else443 318 m_cTEncTop.setChromaFormatIdc ( m_chromaFormatIDC ); 444 #endif445 319 446 320 #if ADAPTIVE_QP_SELECTION … … 651 525 m_cTEncTop.setScalingListFileName ( m_scalingListFileName ); 652 526 m_cTEncTop.setSignHideFlag ( m_signHideFlag); 653 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227654 if(!m_cTEncTop.getIsDepth()) //only for texture655 {656 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );657 }658 else659 {660 m_cTEncTop.setUseRateCtrl ( 0 );661 }662 #else663 527 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 664 #endif665 #if !KWU_RC_VIEWRC_E0227666 528 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); 667 #endif668 529 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); 669 530 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); … … 677 538 #endif 678 539 679 #if KWU_RC_MADPRED_E0227680 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())681 {682 m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred : 0);683 if(m_cTEncTop.getUseDepthMADPred())684 {685 m_cTEncTop.setCamParam(&m_cCameraData);686 }687 }688 #endif689 #if KWU_RC_VIEWRC_E0227690 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())691 {692 m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);693 if(m_iNumberOfViews == 1)694 {695 if(m_viewWiseRateCtrl)696 {697 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);698 }699 else700 {701 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );702 }703 }704 else705 {706 if(m_viewWiseRateCtrl)707 {708 m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);709 }710 else711 {712 if(m_iNumberOfViews == 2)713 {714 if(m_cTEncTop.getViewId() == 0)715 {716 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*80)/100 );717 }718 else if(m_cTEncTop.getViewId() == 1)719 {720 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*20)/100 );721 }722 }723 else if(m_iNumberOfViews == 3)724 {725 if(m_cTEncTop.getViewId() == 0)726 {727 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*66)/100 );728 }729 else if(m_cTEncTop.getViewId() == 1)730 {731 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );732 }733 else if(m_cTEncTop.getViewId() == 2)734 {735 m_cTEncTop.setTargetBitrate ( (m_RCTargetBitrate*17)/100 );736 }737 }738 else739 {740 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );741 }742 }743 }744 }745 #endif746 540 m_cTEncTop.setTransquantBypassEnableFlag ( m_TransquantBypassEnableFlag ); 747 541 m_cTEncTop.setCUTransquantBypassFlagForceValue ( m_CUTransquantBypassFlagForce ); … … 790 584 } 791 585 #endif 792 #if NH_3D_VSO793 if ( m_bUseVSO )794 {795 if ( m_uiVSOMode == 4 )796 {797 #if H_3D_VSO_EARLY_SKIP798 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );799 #else800 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );801 #endif802 for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )803 {804 TEncTop* pcEncTop = m_acTEncTopList[ layer ];805 Int iViewNum = pcEncTop->getViewIndex();806 Int iContent = pcEncTop->getIsDepth() || pcEncTop->getIsAuxDepth() ? 1 : 0;807 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);808 809 Bool bUseVSO = (iNumOfModels != 0);810 811 pcEncTop->setUseVSO( bUseVSO );812 pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );813 814 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )815 {816 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;817 818 m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;819 m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );820 }821 }822 }823 else824 {825 AOT(true);826 }827 }828 #endif829 586 } 830 587 … … 834 591 // initialize global variables 835 592 initROM(); 836 #if NH_3D_DMM837 initWedgeLists( true );838 #endif839 593 840 594 for( Int layer=0; layer < m_numberOfLayers; layer++) … … 900 654 for(Int layer=0; layer<m_numberOfLayers; layer++) 901 655 { 902 #if KWU_RC_MADPRED_E0227903 m_acTEncTopList[layer]->init( isFieldCoding, this );904 #else905 656 m_acTEncTopList[layer]->init( isFieldCoding ); 906 #endif907 657 } 908 658 #else … … 932 682 } 933 683 934 #if !NH_3D935 684 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 936 #endif937 685 TComPicYuv* pcPicYuvRec = NULL; 938 686 … … 968 716 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 969 717 970 #if NH_3D971 TComPicYuv* picYuvOrg[2];972 TComPicYuv picYuvTrueOrg[2];973 for (Int d = 0; d < 2 ; d++)974 {975 picYuvOrg[d] = new TComPicYuv;976 picYuvOrg[d] ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );977 picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );978 }979 #else980 718 TComPicYuv cPicYuvTrueOrg; 981 719 … … 991 729 cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 992 730 } 993 #endif994 731 #if NH_MV 995 732 while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos ) … … 997 734 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 998 735 { 999 #if NH_3D1000 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];1001 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];1002 #endif1003 736 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 1004 737 { … … 1036 769 for ( Int gopId=0; gopId < gopSize; gopId++ ) 1037 770 { 1038 #if NH_3D_VSO1039 UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );1040 if ( iNextPoc < m_framesToBeEncoded )1041 {1042 m_cCameraData.update( iNextPoc );1043 }1044 #endif1045 771 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 1046 772 { 1047 #if NH_3D1048 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ];1049 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ];1050 #endif1051 773 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 1052 774 { … … 1054 776 } 1055 777 1056 #if NH_3D_VSO1057 if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )1058 {1059 m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );1060 m_acTEncTopList[layer] ->setDispCoeff( m_cCameraData.getDispCoeff() );1061 }1062 #endif1063 778 1064 779 Int iNumEncoded = 0; … … 1127 842 #endif 1128 843 1129 #if NH_3D1130 // delete original YUV buffer1131 for (Int d = 0; d < 2; d++)1132 {1133 picYuvOrg[d]->destroy();1134 delete picYuvOrg[d];1135 picYuvOrg[d] = NULL;1136 1137 picYuvTrueOrg[d].destroy();1138 }1139 #else1140 844 // delete original YUV buffer 1141 845 pcPicYuvOrg->destroy(); 1142 846 delete pcPicYuvOrg; 1143 847 pcPicYuvOrg = NULL; 1144 #endif1145 848 1146 849 #if !NH_MV … … 1148 851 m_cTEncTop.deletePicBuffer(); 1149 852 #endif 1150 #if !NH_3D1151 853 cPicYuvTrueOrg.destroy(); 1152 #endif1153 854 1154 855 // delete buffers & classes … … 1158 859 printRateSummary(); 1159 860 1160 #if NH_3D_REN_MAX_DEV_OUT1161 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();1162 1163 if ( !(dMaxDispDiff < 0) )1164 {1165 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );1166 }1167 #endif1168 861 1169 862 return; … … 1202 895 { 1203 896 rpcPicYuvRec = new TComPicYuv; 1204 #if NH_3D1205 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );1206 #else1207 897 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 1208 #endif1209 898 1210 899 } … … 1284 973 if (m_pchReconFileList[layerIdx]) 1285 974 { 1286 #if NH_3D1287 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT, m_isTopFieldFirst );1288 #else1289 975 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst ); 1290 #endif1291 976 } 1292 977 } … … 1341 1026 if (m_pchReconFileList[layerIdx]) 1342 1027 { 1343 #if NH_3D1344 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT );1345 #else1346 1028 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 1347 #endif1348 1029 1349 1030 } … … 1470 1151 } 1471 1152 1472 #if NH_3D_DLT1473 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)1474 {1475 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv;1476 TComPicYuv* pcDepthPicYuvTrueOrg = new TComPicYuv;1477 // allocate original YUV buffer1478 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1479 pcDepthPicYuvTrueOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false );1480 1481 TVideoIOYuv* depthVideoFile = new TVideoIOYuv;1482 1483 UInt uiMaxDepthValue = ((1 << m_inputBitDepth[CHANNEL_TYPE_LUMA])-1);1484 1485 std::vector<Bool> abValidDepths(256, false);1486 1487 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );1488 1489 Int iHeight = pcDepthPicYuvOrg->getHeight(COMPONENT_Y);1490 Int iWidth = pcDepthPicYuvOrg->getWidth(COMPONENT_Y);1491 Int iStride = pcDepthPicYuvOrg->getStride(COMPONENT_Y);1492 1493 Pel* pInDM = pcDepthPicYuvOrg->getAddr(COMPONENT_Y);1494 1495 for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )1496 {1497 depthVideoFile->read( pcDepthPicYuvOrg, pcDepthPicYuvTrueOrg, IPCOLOURSPACE_UNCHANGED, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );1498 1499 // check all pixel values1500 for (Int i=0; i<iHeight; i++)1501 {1502 Int rowOffset = i*iStride;1503 1504 for (Int j=0; j<iWidth; j++)1505 {1506 Pel depthValue = pInDM[rowOffset+j];1507 abValidDepths[depthValue] = true;1508 }1509 }1510 }1511 1512 depthVideoFile->close();1513 delete depthVideoFile;1514 1515 pcDepthPicYuvOrg->destroy();1516 delete pcDepthPicYuvOrg;1517 pcDepthPicYuvTrueOrg->destroy();1518 delete pcDepthPicYuvTrueOrg;1519 1520 // convert boolean array to idx2Depth LUT1521 std::vector<Int> aiIdx2DepthValue(256, 0);1522 Int iNumDepthValues = 0;1523 for(Int p=0; p<=uiMaxDepthValue; p++)1524 {1525 if( abValidDepths[p] == true)1526 {1527 aiIdx2DepthValue[iNumDepthValues++] = p;1528 }1529 }1530 1531 if( uiNumFrames == 0 || gCeilLog2(iNumDepthValues) == m_inputBitDepth[CHANNEL_TYPE_LUMA] )1532 {1533 dlt->setUseDLTFlag(layer, false);1534 }1535 1536 // assign LUT1537 if( dlt->getUseDLTFlag(layer) )1538 {1539 dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);1540 }1541 }1542 #endif1543 1153 1544 1154 #if NH_MV … … 1570 1180 1571 1181 1572 #if NH_3D1573 vps.initViewCompLayer( );1574 #endif1575 1182 } 1576 1183 … … 1649 1256 Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps ); 1650 1257 Int maxTid = -1; 1651 #if NH_3D1652 if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1653 {1654 if ( m_depthFlag[ curLayerIdInVps] == m_depthFlag[ refLayerIdInVps ] )1655 {1656 #endif1657 1258 for( Int i = 0; i < ( getGOPSize() + 1); i++ ) 1658 1259 { … … 1661 1262 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++) 1662 1263 { 1663 #if NH_3D1664 if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )1665 #else1666 1264 if ( vps.getIdDirectRefLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh ) 1667 #endif1668 1265 { 1669 1266 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 ); … … 1672 1269 } 1673 1270 } 1674 #if NH_3D1675 }1676 else1677 {1678 if( m_depthFlag[ curLayerIdInVps ] && ( m_mpiFlag|| m_qtPredFlag || m_intraContourFlag ) )1679 {1680 Int nuhLayerIdTex = vps.getLayerIdInNuh( vps.getViewIndex( curLayerIdInNuh ), false, 0 );1681 if ( nuhLayerIdTex == refLayerIdInNuh )1682 {1683 for( Int i = 0; i < ( getGOPSize() + 1); i++ )1684 {1685 GOPEntry geCur = m_GOPListMvc[curLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1686 GOPEntry geRef = m_GOPListMvc[refLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1687 if ( geCur.m_interCompPredFlag )1688 {1689 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1690 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1691 }1692 }1693 }1694 }1695 if( !m_depthFlag[ curLayerIdInVps ] && vps.getNumRefListLayers( curLayerIdInNuh) > 0 && ( m_depthRefinementFlag || m_viewSynthesisPredFlag || m_depthBasedBlkPartFlag ) )1696 {1697 for( Int i = 0; i < ( getGOPSize() + 1); i++ )1698 {1699 GOPEntry geCur = m_GOPListMvc[curLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1700 GOPEntry geRef = m_GOPListMvc[refLayerIdInVps][( i < getGOPSize() ? i : MAX_GOP )];1701 1702 if ( geCur.m_interCompPredFlag )1703 {1704 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++ )1705 {1706 Int nuhLayerIdDep = vps.getLayerIdInNuh( vps.getViewIndex( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[j] ) ), true, 0 );1707 if ( nuhLayerIdDep == refLayerIdInNuh )1708 {1709 Bool refLayerZero = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );1710 maxTid = std::max( maxTid, refLayerZero ? 0 : geRef.m_temporalId );1711 }1712 }1713 }1714 }1715 }1716 }1717 } // if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )1718 vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );1719 #endif1720 1271 } // Loop curLayerIdInVps 1721 1272 } // Loop refLayerIdInVps … … 1766 1317 1767 1318 // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry 1768 #if NH_3D1769 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )1770 {1771 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh , k ) );1772 #else1773 1319 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ ) 1774 1320 { 1775 1321 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh , k ) ); 1776 #endif1777 1322 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1778 1323 { … … 1792 1337 { 1793 1338 Bool referenceLayerFoundFlag = false; 1794 #if NH_3D1795 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )1796 {1797 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdRefListLayer( layerIdInNuh, k) );1798 #else1799 1339 for (Int k = 0; k < vps.getNumDirectRefLayers( layerIdInNuh ); k++ ) 1800 1340 { 1801 1341 Int refLayerIdInVps = vps.getLayerIdInVps( vps.getIdDirectRefLayer( layerIdInNuh, k) ); 1802 #endif1803 1342 if ( vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId && ( tId == 0 || vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId ) ) 1804 1343 { … … 1929 1468 break; 1930 1469 case Profile::MULTIVIEWMAIN: 1931 #if NH_3D1932 case Profile::MAIN3D:1933 #endif1934 1470 ptl->setMax12bitConstraintFlag ( true ); 1935 1471 ptl->setMax12bitConstraintFlag ( true ); … … 1953 1489 1954 1490 Bool anyDepth = false; 1955 #if NH_3D1956 for ( Int i = 0; i < m_numberOfLayers; i++ )1957 {1958 vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );1959 anyDepth = anyDepth || m_depthFlag[ i ];1960 }1961 #endif1962 1491 1963 1492 vps.setRepFormatIdxPresentFlag( anyDepth ); … … 2364 1893 } 2365 1894 2366 #if NH_3D2367 Void TAppEncTop::xSetCamPara ( TComVPS& vps )2368 {2369 vps.setCpPrecision( m_cCameraData.getCamParsCodedPrecision());2370 2371 for ( Int n = 1; n < vps.getNumViews(); n++ )2372 {2373 Int i = vps.getViewOIdxList( n );2374 Int iInVps = vps.getVoiInVps ( i );2375 vps.setNumCp( iInVps, n);2376 2377 if ( vps.getNumCp( iInVps ) > 0 )2378 {2379 vps.setCpInSliceSegmentHeaderFlag( iInVps, m_cCameraData.getVaryingCameraParameters() );2380 2381 for( Int m = 0; m < vps.getNumCp( iInVps ); m++ )2382 {2383 vps.setCpRefVoi( iInVps, m, vps.getViewOIdxList( m ) );2384 if( !vps.getCpInSliceSegmentHeaderFlag( iInVps ) )2385 {2386 Int j = vps.getCpRefVoi( iInVps, m );2387 Int jInVps = vps.getVoiInVps( j );2388 2389 vps.setVpsCpScale ( iInVps, jInVps, m_cCameraData.getCodedScale() [ jInVps ][ iInVps ] ) ;2390 vps.setVpsCpInvScale( iInVps, jInVps, m_cCameraData.getCodedScale() [ iInVps ][ jInVps ] ) ;2391 vps.setVpsCpOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ jInVps ][ iInVps ] ) ;2392 vps.setVpsCpInvOff ( iInVps, jInVps, m_cCameraData.getCodedOffset()[ iInVps ][ jInVps ] ) ;2393 }2394 }2395 }2396 }2397 vps.deriveCpPresentFlag();2398 }2399 #endif2400 1895 2401 1896 … … 2409 1904 2410 1905 2411 #if NH_3D_DLT2412 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT* dlt )2413 {2414 Int iNumDepthViews = 0;2415 Bool bDltPresentFlag = false;2416 2417 for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )2418 {2419 Bool isDepth = ( vps.getDepthId( layer ) == 1 );2420 2421 if ( isDepth )2422 {2423 iNumDepthViews++;2424 }2425 2426 dlt->setUseDLTFlag( layer , isDepth && m_useDLT );2427 if( dlt->getUseDLTFlag( layer ) )2428 {2429 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, dlt);2430 bDltPresentFlag = bDltPresentFlag || dlt->getUseDLTFlag(layer);2431 dlt->setInterViewDltPredEnableFlag(layer, (dlt->getUseDLTFlag(layer) && (layer>1)));2432 2433 // ----------------------------- determine whether to use bit-map -----------------------------2434 Bool bDltBitMapRepFlag = false;2435 UInt uiNumBitsNonBitMap = 0;2436 UInt uiNumBitsBitMap = 0;2437 2438 UInt uiMaxDiff = 0;2439 UInt uiMinDiff = MAX_INT;2440 UInt uiLengthMinDiff = 0;2441 UInt uiLengthDltDiffMinusMin = 0;2442 2443 std::vector<Int> aiIdx2DepthValue_coded(256, 0);2444 UInt uiNumDepthValues_coded = 0;2445 2446 uiNumDepthValues_coded = dlt->getNumDepthValues(layer);2447 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )2448 {2449 aiIdx2DepthValue_coded[ui] = dlt->idx2DepthValue(layer, ui);2450 }2451 2452 if( dlt->getInterViewDltPredEnableFlag( layer ) )2453 {2454 AOF( vps.getDepthId( 1 ) == 1 );2455 AOF( layer > 1 );2456 // assumes ref layer id to be 12457 std::vector<Int> piRefDLT = dlt->idx2DepthValue( 1 );2458 UInt uiRefNum = dlt->getNumDepthValues( 1 );2459 dlt->getDeltaDLT(layer, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);2460 }2461 2462 std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);2463 2464 for (UInt d = 1; d < uiNumDepthValues_coded; d++)2465 {2466 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];2467 2468 if ( uiMaxDiff < puiDltDiffValues[d] )2469 {2470 uiMaxDiff = puiDltDiffValues[d];2471 }2472 2473 if ( uiMinDiff > puiDltDiffValues[d] )2474 {2475 uiMinDiff = puiDltDiffValues[d];2476 }2477 }2478 2479 // counting bits2480 // diff coding branch2481 uiNumBitsNonBitMap += 8; // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])2482 2483 if ( uiNumDepthValues_coded > 1 )2484 {2485 uiNumBitsNonBitMap += 8; // u(v) bits for max_diff[ layerId ]2486 }2487 2488 if ( uiNumDepthValues_coded > 2 )2489 {2490 uiLengthMinDiff = (UInt) gCeilLog2(uiMaxDiff + 1);2491 uiNumBitsNonBitMap += uiLengthMinDiff; // u(v) bits for min_diff[ layerId ]2492 }2493 2494 uiNumBitsNonBitMap += 8; // u(v) bits for dlt_depth_value0[ layerId ]2495 2496 if (uiMaxDiff > uiMinDiff)2497 {2498 uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);2499 uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1); // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]2500 }2501 2502 // bit map branch2503 uiNumBitsBitMap = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA];2504 2505 // determine bDltBitMapFlag2506 bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;2507 2508 dlt->setUseBitmapRep(layer, bDltBitMapRepFlag);2509 }2510 }2511 2512 dlt->setDltPresentFlag( bDltPresentFlag );2513 dlt->setNumDepthViews ( iNumDepthViews );2514 dlt->setDepthViewBitDepth( m_inputBitDepth[CHANNEL_TYPE_LUMA] );2515 }2516 #endif2517 1906 //! \} -
branches/HTM-16.0-MV-draft-5/source/App/TAppEncoder/TAppEncTop.h
r1386 r1390 46 46 #include "TLibCommon/AccessUnit.h" 47 47 #include "TAppEncCfg.h" 48 #if NH_3D_VSO49 #include "../../Lib/TLibRenderer/TRenTop.h"50 #endif51 48 52 #if KWU_RC_MADPRED_E022753 class TEncTop;54 #endif55 49 //! \ingroup TAppEncoder 56 50 //! \{ … … 90 84 #endif 91 85 92 #if NH_3D93 TComSps3dExtension m_sps3dExtension; ///< Currently all layers share the same sps 3D Extension94 #endif95 86 96 87 UInt m_essentialBytes; 97 88 UInt m_totalBytes; 98 #if NH_3D_VSO99 TRenTop m_cRendererTop;100 TRenModel m_cRendererModel;101 #endif102 89 protected: 103 90 // initialization … … 144 131 Void xSetDpbSize ( TComVPS& vps ); 145 132 Void xSetVPSVUI ( TComVPS& vps ); 146 #if NH_3D147 Void xSetCamPara ( TComVPS& vps );148 #endif149 133 GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc ); 150 134 Int xGetMax( std::vector<Int>& vec); 151 135 Bool xLayerIdInTargetEncLayerIdList( Int nuhLayerId ); 152 #endif153 #if NH_3D_DLT154 Void xDeriveDltArray( TComVPS& vps, TComDLT* dlt );155 Void xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);156 136 #endif 157 137 -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/RendererMain.cpp
r1386 r1390 35 35 #include <time.h> 36 36 #include "../../Lib/TLibCommon/CommonDef.h" 37 #if NH_3D_VSO38 #include "TAppRendererTop.h"39 // ====================================================================================================================40 // Main function41 // ====================================================================================================================42 43 int main(int argc, char* argv[])44 {45 46 TAppRendererTop cTAppRendererTop;47 48 // print information49 fprintf( stdout, "\n" );50 fprintf( stdout, "3D-HTM software: Renderer Version [%s]", NV_VERSION);51 fprintf( stdout, NVM_ONOS );52 fprintf( stdout, NVM_COMPILEDBY );53 fprintf( stdout, NVM_BITS );54 fprintf( stdout, "\n" );55 56 // create application renderer class57 cTAppRendererTop.create();58 59 // parse configuration60 if(!cTAppRendererTop.parseCfg( argc, argv ))61 {62 cTAppRendererTop.destroy();63 return 1;64 }65 66 // starting time67 double dResult;68 long lBefore = clock();69 70 // call rendering function71 cTAppRendererTop.go();72 73 // ending time74 dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;75 printf("\n Total Time: %12.3f sec.\n", dResult);76 77 // destroy application renderer class78 cTAppRendererTop.destroy();79 80 return 0;81 }82 #else83 37 84 38 #include <iostream> … … 89 43 } 90 44 91 #endif // NH_3D92 45 -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererCfg.cpp
r1386 r1390 44 44 #include "../../Lib/TAppCommon/program_options_lite.h" 45 45 46 #if NH_3D_VSO47 48 using namespace std;49 namespace po = df::program_options_lite;50 51 // ====================================================================================================================52 // Local constants53 // ====================================================================================================================54 55 #define MAX_INPUT_VIEW_NUM 1056 #define MAX_OUTPUT_VIEW_NUM 6457 58 // ====================================================================================================================59 // Constructor / destructor / initialization / destroy60 // ====================================================================================================================61 62 63 TAppRendererCfg::TAppRendererCfg()64 {65 66 }67 68 TAppRendererCfg::~TAppRendererCfg()69 {70 for(Int i = 0; i< m_pchVideoInputFileList.size(); i++ )71 {72 if ( m_pchVideoInputFileList[i] != NULL )73 free (m_pchVideoInputFileList[i]);74 }75 76 for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ )77 {78 if ( m_pchDepthInputFileList[i] != NULL )79 free (m_pchDepthInputFileList[i]);80 }81 82 for(Int i = 0; i< m_pchSynthOutputFileList.size(); i++ )83 {84 if ( m_pchSynthOutputFileList[i] != NULL )85 free (m_pchSynthOutputFileList[i]);86 }87 88 if ( m_pchVideoInputFileBaseName ) free( m_pchVideoInputFileBaseName );89 if ( m_pchDepthInputFileBaseName ) free( m_pchDepthInputFileBaseName );90 if ( m_pchSynthOutputFileBaseName ) free( m_pchSynthOutputFileBaseName);91 if ( m_pchCameraParameterFile ) free( m_pchCameraParameterFile );92 if ( m_pchBaseViewCameraNumbers ) free( m_pchBaseViewCameraNumbers );93 if ( m_pchSynthViewCameraNumbers ) free( m_pchSynthViewCameraNumbers );94 if ( m_pchViewConfig ) free( m_pchViewConfig );95 }96 97 Void TAppRendererCfg::create()98 {99 }100 101 Void TAppRendererCfg::destroy()102 {103 }104 105 // ====================================================================================================================106 // Public member functions107 // ====================================================================================================================108 109 /** \param argc number of arguments110 \param argv array of arguments111 \retval true when success112 */113 Bool TAppRendererCfg::parseCfg( Int argc, TChar* argv[] )114 {115 bool do_help = false;116 117 po::Options opts;118 opts.addOptions()119 ("help", do_help, false, "this help text")120 ("c", po::parseConfigFile, "configuration file name")121 122 /* File I/O */123 ("VideoInputFileBaseName,v", m_pchVideoInputFileBaseName, (TChar*) 0, "Basename to generate video input file names")124 ("DepthInputFileBaseName,d", m_pchDepthInputFileBaseName, (TChar*) 0, "Basename to generate depth input file names")125 ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (TChar*) 0, "Basename to generate synthesized output file names")126 ("ContOutputFileNumbering", m_bContOutputFileNumbering , false , "Continuous Output File Numbering")127 ("Sweep" , m_bSweep , false , "Store all views in first Output File")128 129 ("VideoInputFile_%d,v_%d", m_pchVideoInputFileList , (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv video input file name %d")130 ("DepthInputFile_%d,d_%d", m_pchDepthInputFileList , (TChar *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")131 ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList, (TChar *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")132 133 ("InputBitDepth", m_inputBitDepth[0], 8, "Bit-depth of input file")134 ("OutputBitDepth", m_outputBitDepth[0], 0, "Bit-depth of output file (default:InternalBitDepth)")135 ("InternalBitDepth", m_internalBitDepth[0], 0, "Bit-depth the renderer operates at. (default:InputBitDepth)" "If different to InputBitDepth, source data will be converted")136 137 ("InputBitDepthC", m_inputBitDepth[1], 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")138 ("OutputBitDepthC", m_outputBitDepth[1], 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")139 ("InternalBitDepthC", m_internalBitDepth[1], 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")140 141 /* Source Specification */142 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width")143 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height")144 ("FrameSkip,-fs", m_iFrameSkip, 0, "Number of frames to skip at start of input YUV")145 ("FramesToBeRendered,f", m_iFramesToBeRendered, 0, "Number of frames to be rendered (default=all)")146 147 /* Camera Specification */148 ("CameraParameterFile,-cpf", m_pchCameraParameterFile, (TChar *) 0, "Camera Parameter File Name")149 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (TChar *) 0, "Numbers of base views")150 ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers, (TChar *) 0, "Numbers of views to synthesis")151 ("ViewConfig" , m_pchViewConfig, (TChar *) 0, "View Configuration" )152 153 /* Renderer Modes */154 ("Log2SamplingFactor", m_iLog2SamplingFactor, 0, "Factor for horizontal up sampling before processing" )155 ("UVup" , m_bUVUp , true, "Up sampling of chroma planes before processing" )156 ("PreProcMode" , m_iPreProcMode , 0, "Depth preprocessing: 0 = None, 1 = Binomial filtering" )157 ("PreFilterSize" , m_iPreFilterSize , 0, "For PreProcMode 1: Half Size of filter kernel" )158 ("SimEnhance" , m_bSimEnhance , true, "Similarity enhancement of video" )159 ("BlendMode" , m_iBlendMode , 0, "Blending of left and right image: 0: average, 1: only holes from right, 2: only holes from left, 3: first view in BaseViewOrder as main view" )160 ("BlendZThresPerc" , m_iBlendZThresPerc , 30, "Z-difference threshold for blending in percent of total Z-range" )161 ("BlendUseDistWeight", m_bBlendUseDistWeight , true, "0: blend using average; 1: blend factor depends on view distance" )162 ("BlendHoleMargin" , m_iBlendHoleMargin , 6, "Margin around holes to fill with other view" )163 ("InterpolationMode" , m_iInterpolationMode , 4, "0: NN, 1:linear (int), 2:linear (double) , 3:cubic Hermite spline (double), 4: 8-tap (int)" )164 ("HoleFillingMode" , m_iHoleFillingMode , 1, "0: None, 1: line wise background extension" )165 ("PostProcMode" , m_iPostProcMode , 0, "0: None, 1: horizontal 3-tap median" )166 ("RenderMode" , m_iRenderMode , 0, "0: Use renderer, 1: use model renderer, 10: create used pels map")167 ("ShiftPrecision" , m_iShiftPrecision , 2, "Shift Precision for Interpolation Mode 4" )168 ("TemporalDepthFilter", m_bTempDepthFilter , false, "Temporal depth filtering" )169 ("RenderDirection" , m_iRenderDirection , 0, "0: Interpolate, 1: Extrapolate from left, 2: Extrapolate from right")170 ("UsedPelMapMarExt" , m_iUsedPelMapMarExt , 0, "Margin Extension in Pels for used pels map generation" );171 172 po::setDefaults(opts);173 po::scanArgv(opts, argc, (const char**) argv);174 175 if (argc == 1 || do_help)176 {177 /* argc == 1: no options have been specified */178 po::doHelp(cout, opts);179 xPrintUsage();180 return false;181 }182 183 /*184 * Set any derived parameters before checking185 */186 187 /* rules for input, output and internal bitdepths as per help text */188 if (!m_internalBitDepth[0]) { m_internalBitDepth[0] = m_inputBitDepth[0]; }189 if (!m_internalBitDepth[1]) { m_internalBitDepth[1] = m_internalBitDepth[0]; }190 if (!m_inputBitDepth[1]) { m_inputBitDepth[1] = m_inputBitDepth[0]; }191 if (!m_outputBitDepth[0]) { m_outputBitDepth[0] = m_internalBitDepth[0]; }192 if (!m_outputBitDepth[1]) { m_outputBitDepth[1] = m_internalBitDepth[1]; }193 194 UInt uiInputBitDepth = 8;195 UInt uiCamParPrecision = 5;196 197 m_bUseSetupString = ( m_pchViewConfig != NULL ) && ( m_iRenderMode != 0);198 199 if ( m_iRenderMode == 10 )200 {201 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,202 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );203 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();204 m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;205 m_iRenderDirection = 1;206 }207 else208 {209 if ( m_bUseSetupString )210 {211 std::vector<Int> iaTempViews;212 std::vector<Int>* piaTempViews;213 m_cCameraData .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );214 m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );215 piaTempViews = m_cRenModStrParser.getSynthViews();216 m_iNumberOfOutputViews = (Int) m_cRenModStrParser.getNumOfModels();217 m_iNumberOfInputViews = (Int) m_cRenModStrParser.getNumOfBaseViews();218 m_bContOutputFileNumbering = true;219 220 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,221 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );222 }223 else224 {225 m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,226 m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );227 m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();228 m_iNumberOfInputViews = (Int) m_cCameraData.getBaseViewNumbers() .size();229 }230 }231 232 if (m_pchSynthOutputFileBaseName != NULL)233 xConfirmParameter( strrchr(m_pchSynthOutputFileBaseName,'$') == 0, "'$' must be a character in SynthOutputFileBaseName");234 235 if (m_pchDepthInputFileBaseName != NULL)236 xConfirmParameter( strrchr(m_pchDepthInputFileBaseName, '$') == 0, "'$' must be a character in DepthInputFileBaseName" );237 238 if (m_pchVideoInputFileBaseName != NULL)239 xConfirmParameter( strrchr(m_pchVideoInputFileBaseName, '$') == 0, "'$' must be a character in VideoInputFileBaseName" );240 241 xCreateFileNames();242 243 /*244 * check validity of input parameters245 */246 xCheckParameter();247 m_cCameraData.check( m_iRenderDirection == 0, m_iFramesToBeRendered != 0 );248 249 // print-out parameters250 xPrintParameter();251 252 return true;253 }254 255 256 // ====================================================================================================================257 // Private member functions258 // ====================================================================================================================259 260 Void TAppRendererCfg::xCheckParameter()261 {262 bool check_failed = false; /* abort if there is a fatal configuration problem */263 #define xConfirmPara(a,b) check_failed |= xConfirmParameter(a,b)264 // check range of parameters265 266 /// File I/O267 268 // source specification269 xConfirmPara( m_iSourceWidth <= 0, "Source width must be greater than 0" );270 xConfirmPara( m_iSourceHeight <= 0, "Source height must be greater than 0" );271 xConfirmPara( m_iFrameSkip < 0, "Frame Skipping must be more than or equal to 0" );272 xConfirmPara( m_iFramesToBeRendered < 0, "Total Number Of Frames rendered must be more than 1" );273 274 // bit depth275 xConfirmPara( m_internalBitDepth[0] != m_internalBitDepth[1], "InternalBitDepth for luma and chroma must be equal. ");276 xConfirmPara( m_inputBitDepth[0] < 8, "InputBitDepth must be at least 8" );277 xConfirmPara( m_inputBitDepth[1] < 8, "InputBitDepthC must be at least 8" );278 279 // camera specification280 xConfirmPara( m_iNumberOfInputViews > MAX_INPUT_VIEW_NUM , "NumberOfInputViews must be less than of equal to MAX_INPUT_VIEW_NUM");281 xConfirmPara( m_iNumberOfOutputViews > MAX_OUTPUT_VIEW_NUM, "NumberOfOutputViews must be less than of equal to MAX_OUTPUT_VIEW_NUM");282 283 284 xConfirmPara( m_iRenderDirection < 0 || m_iRenderDirection > 2 , "RenderDirection must be greater than or equal to 0 and less than 3");285 xConfirmPara(m_iNumberOfOutputViews < 1, "Number of OutputViews must be greater or equal to 1");286 if ( m_iRenderDirection == 0 )287 {288 xConfirmPara( m_iNumberOfInputViews < 2, "Number of InputViews must be more than or equal to 2");289 }290 else291 {292 xConfirmPara( m_iNumberOfInputViews < 1, "Number of InputViews must be more than or equal to 1");293 }294 295 xConfirmPara( m_iLog2SamplingFactor < 0 || m_iLog2SamplingFactor > 4, "Log2SamplingFactor must be more than or equal to 0 and less than 5" );296 xConfirmPara( m_iPreProcMode < 0 || m_iPreProcMode > 1, "PreProcMode must be more than or equal to 0 and less than 2" );297 298 299 xConfirmPara( m_iPreFilterSize < 0 || m_iPreFilterSize > 3, "PreFilterSize must be more than or equal to 0 and less than 4" );300 xConfirmPara( m_iBlendMode < 0 || m_iBlendMode > 3, "BlendMode must be more than or equal to 0 and less than 4" );301 xConfirmPara( m_iBlendZThresPerc < 0 || m_iBlendZThresPerc > 100,"BlendZThresPerc must be more than or equal to 0 and less than 101" );302 xConfirmPara( m_iBlendHoleMargin < 0 || m_iBlendHoleMargin > 20,"BlendHoleMargin must be more than or equal to 0 and less than 19" );303 xConfirmPara( m_iInterpolationMode < 0 || m_iInterpolationMode > 4, "InterpolationMode must be more than or equal to 0 and less than 5" );304 xConfirmPara( m_iHoleFillingMode < 0 || m_iHoleFillingMode > 1, "HoleFillingMode must be more than or equal to 0 and less than 2" );305 xConfirmPara( m_iPostProcMode < 0 || m_iPostProcMode > 2, "PostProcMode must be more than or equal to 0 and less than 3" );306 307 Int iNumNonNULL;308 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews) && m_pchDepthInputFileList[iNumNonNULL]; iNumNonNULL++) {}; xConfirmPara( iNumNonNULL < m_iNumberOfInputViews, "Number of DepthInputFiles must be greater than or equal to number of BaseViewNumbers" );309 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfInputViews) && m_pchVideoInputFileList[iNumNonNULL]; iNumNonNULL++) {}; xConfirmPara( iNumNonNULL < m_iNumberOfInputViews, "Number of DepthInputFiles must be greater than or equal to number of BaseViewNumbers" );310 311 312 if ( !m_bSweep )313 {314 for (iNumNonNULL = 0; (iNumNonNULL < m_iNumberOfOutputViews) && m_pchSynthOutputFileList[iNumNonNULL]; iNumNonNULL++) {}; xConfirmPara( iNumNonNULL < m_iNumberOfOutputViews, "Number of SynthOutputFiles must be greater than or equal to number of SynthViewNumbers" );315 }316 else317 {318 xConfirmPara( iNumNonNULL < 1, "Number of SynthOutputFiles must be equal to or more than 1" );319 }320 321 #undef xConfirmPara322 if ( check_failed )323 {324 exit(EXIT_FAILURE);325 }326 327 }328 329 330 331 Void TAppRendererCfg::xPrintParameter()332 {333 printf("\n");334 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)335 {336 printf("InputVideoFile_%i : %s\n", iCounter, m_pchVideoInputFileList[iCounter]);337 }338 for( Int iCounter = 0; iCounter < m_iNumberOfInputViews; iCounter++)339 {340 printf("InputDepthFile_%i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]);341 }342 343 for( Int iCounter = 0; iCounter < m_iNumberOfOutputViews; iCounter++)344 {345 printf("SynthOutputFile_%i : %s\n", iCounter, m_pchSynthOutputFileList[iCounter]);346 }347 348 printf("Format : %dx%d \n", m_iSourceWidth, m_iSourceHeight );349 printf("Frame index : %d - %d (%d frames)\n", m_iFrameSkip, m_iFrameSkip+m_iFramesToBeRendered-1, m_iFramesToBeRendered);350 printf("CameraParameterFile : %s\n", m_pchCameraParameterFile );351 printf("BaseViewNumbers : %s (%d views) \n", m_pchBaseViewCameraNumbers , m_iNumberOfInputViews );352 printf("Sweep : %d\n", m_bSweep );353 354 if ( m_bUseSetupString )355 {356 printf("ViewConfig : %s\n", m_pchViewConfig );357 }358 else359 {360 printf("SynthViewNumbers : %s (%d views) \n", m_pchSynthViewCameraNumbers, m_iNumberOfOutputViews );361 }362 363 printf("Log2SamplingFactor : %d\n", m_iLog2SamplingFactor );364 printf("UVUp : %d\n", m_bUVUp );365 printf("PreProcMode : %d\n", m_iPreProcMode );366 printf("PreFilterSize : %d\n", m_iPreFilterSize );367 printf("SimEnhance : %d\n", m_bSimEnhance );368 printf("BlendMode : %d\n", m_iBlendMode );369 printf("BlendZThresPerc : %d\n", m_iBlendZThresPerc );370 printf("BlendUseDistWeight : %d\n", m_bBlendUseDistWeight );371 printf("BlendHoleMargin : %d\n", m_iBlendHoleMargin );372 printf("InterpolationMode : %d\n", m_iInterpolationMode );373 printf("HoleFillingMode : %d\n", m_iHoleFillingMode );374 printf("PostProcMode : %d\n", m_iPostProcMode );375 printf("ShiftPrecision : %d\n", m_iShiftPrecision );376 printf("TemporalDepthFilter : %d\n", m_bTempDepthFilter );377 printf("RenderMode : %d\n", m_iRenderMode );378 printf("RendererDirection : %d\n", m_iRenderDirection );379 380 if (m_iRenderMode == 10 )381 {382 printf("UsedPelMapMarExt : %d\n", m_iUsedPelMapMarExt );383 }384 385 printf("\n");386 387 // printf("TOOL CFG: ");388 // printf("ALF:%d ", m_bUseALF );389 // printf("\n");390 391 fflush(stdout);392 }393 394 Void TAppRendererCfg::xPrintUsage()395 {396 printf( "\n" );397 printf( " Example: TAppRenderer.exe -c test.cfg\n\n");398 }399 400 Bool TAppRendererCfg::xConfirmParameter(Bool bflag, const char* message)401 {402 if (!bflag)403 return false;404 405 printf("Error: %s\n",message);406 return true;407 }408 409 410 Void TAppRendererCfg::xCreateFileNames()411 {412 if ( m_iRenderMode == 10 )413 return;414 415 Int iPrecBefore;416 Int iPrecAfter;417 418 xGetMaxPrecision( m_cCameraData.getSynthViewNumbers(), iPrecBefore, iPrecAfter );419 420 421 if (iPrecBefore > LOG10_VIEW_NUM_PREC )422 {423 std::cerr << "Error: View Numbers with more than " << LOG10_VIEW_NUM_PREC << " digits are not supported" << std::endl;424 exit(EXIT_FAILURE);425 }426 427 AOT( !m_bContOutputFileNumbering && (m_cCameraData.getSynthViewNumbers().size() != m_iNumberOfOutputViews ));428 for(Int iIdx = 0; iIdx < m_iNumberOfOutputViews; iIdx++)429 {430 //GT; Create ReconFileNames431 if (m_pchSynthOutputFileList[iIdx] == NULL )432 {433 if ( m_bContOutputFileNumbering )434 {435 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], (Int) ((iIdx+1) * VIEW_NUM_PREC) , 2, 0 );436 }437 else438 {439 xAddNumberToFileName( m_pchSynthOutputFileBaseName, m_pchSynthOutputFileList[iIdx], m_cCameraData.getSynthViewNumbers()[iIdx], iPrecBefore, iPrecAfter );440 }441 }442 }443 444 xGetMaxPrecision( m_cCameraData.getBaseViewNumbers(), iPrecBefore, iPrecAfter );445 for(Int iIdx = 0; iIdx < m_cCameraData.getBaseViewNumbers().size() ; iIdx++)446 {447 //GT; Create ReconFileNames448 if (m_pchVideoInputFileList[iIdx] == NULL )449 {450 xAddNumberToFileName( m_pchVideoInputFileBaseName, m_pchVideoInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );451 }452 453 if (m_pchDepthInputFileList[iIdx] == NULL )454 {455 xAddNumberToFileName( m_pchDepthInputFileBaseName, m_pchDepthInputFileList[iIdx], m_cCameraData.getBaseViewNumbers()[iIdx], iPrecBefore, iPrecAfter );456 }457 }458 }459 460 Void TAppRendererCfg::xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter )461 {462 463 if ( pchSourceFileName == NULL )464 {465 std::cerr << "No BaseName for file name generation given." << std::endl;466 AOT(true);467 exit(EXIT_FAILURE);468 }469 470 TChar pchNumberBuffer[2* LOG10_VIEW_NUM_PREC + 2];471 TChar pchPrintBuffer[10];472 473 Double dNumberToAdd = ( (Double) iNumberToAdd ) / VIEW_NUM_PREC;474 475 UInt uiWidth = uiPrecBefore;476 477 if (uiPrecAfter != 0)478 {479 uiWidth += uiPrecAfter + 1;480 }481 482 sprintf( pchPrintBuffer, "%%0%d.%df", uiWidth, uiPrecAfter );483 sprintf( pchNumberBuffer, pchPrintBuffer, dNumberToAdd );484 485 if ( uiPrecAfter > 0 ) pchNumberBuffer[ uiPrecBefore ] = '_';486 487 size_t iInLength = strlen(pchSourceFileName);488 size_t iAddLength = strlen(pchNumberBuffer);489 490 rpchTargetFileName = (TChar*) malloc(iInLength+iAddLength+1);491 492 TChar* pchPlaceHolder = strrchr(pchSourceFileName,'$');493 assert( pchPlaceHolder );494 495 size_t iCharsToPlaceHolder = pchPlaceHolder - pchSourceFileName;496 size_t iCharsToEnd = iInLength - iCharsToPlaceHolder;497 498 strncpy(rpchTargetFileName , pchSourceFileName , iCharsToPlaceHolder);499 strncpy(rpchTargetFileName+iCharsToPlaceHolder , pchNumberBuffer , iAddLength );500 strncpy(rpchTargetFileName+iCharsToPlaceHolder+iAddLength, pchSourceFileName+iCharsToPlaceHolder+1, iCharsToEnd-1 );501 rpchTargetFileName[iInLength+iAddLength-1] = '\0';502 }503 504 Void TAppRendererCfg::xGetMaxPrecision( IntAry1d aiIn, Int& iPrecBefore, Int& iPrecAfter )505 {506 iPrecBefore = 0;507 iPrecAfter = 0;508 509 for (UInt uiK = 0; uiK < aiIn.size(); uiK ++ )510 {511 if ( aiIn[uiK] == 0 ) continue;512 513 Int iCurPrec;514 iCurPrec = 0;515 for ( Int iCur = aiIn[uiK]; iCur != 0; iCur /= 10, iCurPrec++ );516 iPrecBefore = max(iPrecBefore, iCurPrec - LOG10_VIEW_NUM_PREC );517 518 iCurPrec = 0;519 for ( Int iCur = 1; aiIn[uiK] % iCur == 0; iCur *= 10, iCurPrec++);520 iCurPrec = LOG10_VIEW_NUM_PREC - std::min((Int) LOG10_VIEW_NUM_PREC, iCurPrec-1 );521 iPrecAfter = max(iPrecAfter, iCurPrec );522 }523 }524 525 #endif -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererCfg.h
r1386 r1390 47 47 #include <vector> 48 48 49 #if NH_3D_VSO50 51 // ====================================================================================================================52 // Class definition53 // ====================================================================================================================54 55 /// encoder configuration class56 class TAppRendererCfg57 {58 protected:59 60 //// file I/O ////61 TChar* m_pchVideoInputFileBaseName; ///< input video file base name, placeholder for numbering $$62 TChar* m_pchDepthInputFileBaseName; ///< input depth file base name, placeholder for numbering $$63 TChar* m_pchSynthOutputFileBaseName; ///< output synth file base name, placeholder for numbering $$64 Bool m_bContOutputFileNumbering; ///< use continous numbering instead of view numbering65 Bool m_bSweep; ///< 1: Store view range in file66 67 68 // bit-depth ( Currently internal, output and input luma and chroma bit-depth are required to be equal to 8 )69 Int m_inputBitDepth[2]; ///< bit-depth of input file (luma/chroma component)70 Int m_outputBitDepth[2]; ///< bit-depth of output file (luma/chroma component)71 Int m_internalBitDepth[2]; ///< bit-depth renderer operates at in luma/chroma (input/output files will be converted)72 73 74 // derived75 std::vector<TChar*> m_pchVideoInputFileList; ///< source file names76 std::vector<TChar*> m_pchDepthInputFileList; ///< source depth file names77 std::vector<TChar*> m_pchSynthOutputFileList; ///< output reconstruction file names78 79 //// source specification ////80 Int m_iSourceWidth; ///< source width in pixel81 Int m_iSourceHeight; ///< source height in pixel82 Int m_iFrameSkip; ///< number of skipped frames from the beginning83 Int m_iFramesToBeRendered; ///< number of rendered frames84 85 ////camera specification ////86 TChar* m_pchCameraParameterFile; ///< camera parameter file87 TChar* m_pchSynthViewCameraNumbers; ///< numbers of views to synthesize88 TChar* m_pchViewConfig; ///< String to setup renderer89 TChar* m_pchBaseViewCameraNumbers; ///< numbers of base views90 91 // derived92 TAppComCamPara m_cCameraData; ///< class to store camera parameters93 TRenModSetupStrParser m_cRenModStrParser; ///< class to manage View to be rendered94 Bool m_bUseSetupString; ///< true if setup string is used95 96 Int m_iNumberOfInputViews; ///< number of input Views97 Int m_iNumberOfOutputViews; ///< number views to synthesize98 99 //// renderer Modes ////100 Int m_iRenderDirection; ///< 0: interpolate, 1: extrapolate from left, 2: extrapolate from right101 102 Int m_iLog2SamplingFactor; ///< factor for horizontal upsampling before processing103 Bool m_bUVUp; ///< upsampling of chroma planes before processing104 Int m_iPreProcMode; ///< depth pre-processing: 0 = none, 1 = binominal filtering105 Int m_iPreFilterSize; ///< for PreProcMode = 1: size of filter kernel106 Bool m_bSimEnhance; ///< Similarity enhancement before blending107 Int m_iBlendMode; ///< merging of left and right image: 0 = average, 1 = only holes from right, 2 = only holes from left108 Int m_iBlendZThresPerc; ///< z-difference threshold for blending in percent of total z-range109 Bool m_bBlendUseDistWeight; ///< 0: blend using average; 1: blend factor depends on view distance110 Int m_iBlendHoleMargin; ///< Margin around boundaries111 Bool m_bTempDepthFilter; ///< Zheijang temporal enhancement filter112 Int m_iInterpolationMode; ///< 0: NN, 1: linear, 2: cspline113 Int m_iHoleFillingMode; ///< 0: none, 1: line wise background extension114 Int m_iPostProcMode; ///< 0: none, 1: horizontal 3-tap median115 Int m_iRenderMode; ///< 0: use renderer116 Int m_iShiftPrecision; ///< Precision used for Interpolation Mode 4117 Int m_iUsedPelMapMarExt; ///< Used Pel map extra margin118 119 Void xCheckParameter (); ///< check validity of configuration values120 Void xPrintParameter (); ///< print configuration values121 Void xPrintUsage (); ///< print usage122 123 Void xCreateFileNames();124 Void xGetMaxPrecision( IntAry1d adIn, Int& iPrecBefore, Int& iPrecAfter );125 Void xAddNumberToFileName( TChar* pchSourceFileName, TChar*& rpchTargetFileName, Int iNumberToAdd, UInt uiPrecBefore, UInt uiPrecAfter );126 public:127 TAppRendererCfg();128 virtual ~TAppRendererCfg();129 130 public:131 Void create (); ///< create option handling class132 Void destroy (); ///< destroy option handling class133 Bool parseCfg ( Int argc, TChar* argv[] ); ///< parse configuration file to fill member variables134 Bool xConfirmParameter(Bool bflag, const TChar* message);135 136 137 };// END CLASS DEFINITION TAppRendererCfg138 139 #endif // __TAppRENDERERCFG__140 49 #endif // NH_3D -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererTop.cpp
r1386 r1390 41 41 #include "TAppRendererTop.h" 42 42 43 #if NH_3D_VSO44 45 // ====================================================================================================================46 // Constructor / destructor / initialization / destroy47 // ====================================================================================================================48 49 TAppRendererTop::TAppRendererTop()50 {51 52 }53 54 TAppRendererTop::~TAppRendererTop()55 {56 57 }58 59 60 Void TAppRendererTop::xCreateLib()61 {62 m_pcRenTop = new TRenTop();63 64 for(Int iViewIdx=0; iViewIdx<m_iNumberOfInputViews; iViewIdx++)65 {66 TVideoIOYuv* pcVideoInput = new TVideoIOYuv;67 TVideoIOYuv* pcDepthInput = new TVideoIOYuv;68 69 // ( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )70 71 pcVideoInput->open( m_pchVideoInputFileList[iViewIdx], false, m_inputBitDepth, m_internalBitDepth, m_internalBitDepth ); // read mode72 pcDepthInput->open( m_pchDepthInputFileList[iViewIdx], false, m_inputBitDepth, m_internalBitDepth, m_internalBitDepth ); // read mode73 pcVideoInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight, CHROMA_420 );74 pcDepthInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight, CHROMA_420 );75 76 m_apcTVideoIOYuvVideoInput.push_back( pcVideoInput );77 m_apcTVideoIOYuvDepthInput.push_back( pcDepthInput );78 }79 80 for(Int iViewIdx=0; iViewIdx<m_iNumberOfOutputViews; iViewIdx++)81 {82 TVideoIOYuv* pcSynthOutput = new TVideoIOYuv;83 pcSynthOutput->open( m_pchSynthOutputFileList[iViewIdx], true, m_outputBitDepth, m_internalBitDepth, m_internalBitDepth ); // write mode84 m_apcTVideoIOYuvSynthOutput.push_back( pcSynthOutput );85 }86 }87 88 89 Void TAppRendererTop::xDestroyLib()90 {91 delete m_pcRenTop;92 93 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )94 {95 m_apcTVideoIOYuvVideoInput[iViewIdx]->close();96 m_apcTVideoIOYuvDepthInput[iViewIdx]->close();97 98 delete m_apcTVideoIOYuvDepthInput[iViewIdx];99 delete m_apcTVideoIOYuvVideoInput[iViewIdx];100 };101 102 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfOutputViews; iViewIdx++ )103 {104 m_apcTVideoIOYuvSynthOutput[iViewIdx]->close();105 delete m_apcTVideoIOYuvSynthOutput[iViewIdx];106 };107 }108 109 Void TAppRendererTop::xInitLib()110 {111 m_pcRenTop->init(112 m_iSourceWidth,113 m_iSourceHeight,114 (m_iRenderDirection != 0),115 m_iLog2SamplingFactor,116 m_iLog2SamplingFactor+m_iShiftPrecision,117 m_bUVUp,118 m_iPreProcMode,119 m_iPreFilterSize,120 m_iBlendMode,121 m_iBlendZThresPerc,122 m_bBlendUseDistWeight,123 m_iBlendHoleMargin,124 m_iInterpolationMode,125 m_iHoleFillingMode,126 m_iPostProcMode,127 m_iUsedPelMapMarExt128 );129 }130 131 // ====================================================================================================================132 // Public member functions133 // ====================================================================================================================134 135 136 137 Void TAppRendererTop::render()138 {139 xCreateLib();140 xInitLib();141 142 // Create Buffers Input Views;143 std::vector<TComPicYuv*> apcPicYuvBaseVideo;144 std::vector<TComPicYuv*> apcPicYuvBaseDepth;145 146 // TemporalImprovement Filter147 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;148 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;149 150 Int aiPad[2] = { 0, 0 };151 152 TComPicYuv* pcNewOrg = new TComPicYuv;153 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );154 155 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )156 {157 TComPicYuv* pcNewVideoPic = new TComPicYuv;158 TComPicYuv* pcNewDepthPic = new TComPicYuv;159 160 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );161 apcPicYuvBaseVideo.push_back(pcNewVideoPic);162 163 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true);164 apcPicYuvBaseDepth.push_back(pcNewDepthPic);165 166 //Temporal improvement Filter167 if ( m_bTempDepthFilter )168 {169 pcNewVideoPic = new TComPicYuv;170 pcNewDepthPic = new TComPicYuv;171 172 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );173 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);174 175 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );176 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);177 }178 }179 180 // Create Buffer for synthesized View181 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;182 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );183 184 Bool bAnyEOS = false;185 186 Int iNumOfRenderedFrames = 0;187 Int iFrame = 0;188 189 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )190 {191 if ( iFrame >= m_iFrameSkip )192 {193 // read in depth and video194 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )195 {196 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx],pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;197 198 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();199 200 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();201 202 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx],pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;203 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();204 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();205 206 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )207 {208 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );209 }210 }211 }212 else213 {214 std::cout << "Skipping Frame " << iFrame << std::endl;215 216 iFrame++;217 continue;218 }219 220 m_cCameraData.update( (UInt)iFrame - m_iFrameSkip );221 222 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )223 {224 Int iLeftBaseViewIdx = -1;225 Int iRightBaseViewIdx = -1;226 227 Bool bIsBaseView = false;228 229 Int iRelDistToLeft;230 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );231 Bool bHasLView = ( iLeftBaseViewIdx != -1 );232 Bool bHasRView = ( iRightBaseViewIdx != -1 );233 Bool bRender = true;234 235 Int iBlendMode = m_iBlendMode;236 Int iSimEnhBaseView = 0;237 238 switch( m_iRenderDirection )239 {240 /// INTERPOLATION241 case 0:242 AOF( bHasLRView || bIsBaseView );243 244 if ( !bHasLRView && bIsBaseView && m_iBlendMode == 0 )245 {246 bRender = false;247 }248 else249 {250 if ( bIsBaseView )251 {252 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );253 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];254 255 if ( m_iBlendMode == 1 )256 {257 if ( iSortedBaseViewIdx - 1 >= 0 )258 {259 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];260 bRender = true;261 }262 else263 {264 bRender = false;265 }266 }267 else if ( m_iBlendMode == 2 )268 {269 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )270 {271 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];272 bRender = true;273 }274 else275 {276 bRender = false;277 }278 }279 }280 281 if ( m_iBlendMode == 3 )282 {283 if ( bIsBaseView && (iLeftBaseViewIdx == 0) )284 {285 bRender = false;286 }287 else288 {289 Int iDistLeft = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx ] );290 Int iDistRight = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iRightBaseViewIdx] );291 292 Int iFillViewIdx = iDistLeft > iDistRight ? iLeftBaseViewIdx : iRightBaseViewIdx;293 294 if( m_cCameraData.getBaseId2SortedId()[0] < m_cCameraData.getBaseId2SortedId() [iFillViewIdx] )295 {296 iBlendMode = 1;297 iLeftBaseViewIdx = 0;298 iRightBaseViewIdx = iFillViewIdx;299 }300 else301 {302 iBlendMode = 2;303 iLeftBaseViewIdx = iFillViewIdx;304 iRightBaseViewIdx = 0;305 }306 307 }308 }309 else310 {311 iBlendMode = m_iBlendMode;312 }313 }314 315 if ( m_bSimEnhance )316 {317 if ( m_iNumberOfInputViews == 3 && m_cCameraData.getRelSynthViewNumbers()[ iSynthViewIdx ] < VIEW_NUM_PREC )318 {319 iSimEnhBaseView = 2; // Take middle view320 }321 else322 {323 iSimEnhBaseView = 1; // Take left view324 }325 }326 327 if ( bRender )328 {329 std::cout << "Rendering Frame " << iFrame330 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx ] / VIEW_NUM_PREC331 << " Left BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iLeftBaseViewIdx ] / VIEW_NUM_PREC332 << " Right BaseView: " << (Double) m_cCameraData.getBaseViewNumbers() [iRightBaseViewIdx] / VIEW_NUM_PREC333 << " BlendMode: " << iBlendMode334 << std::endl;335 336 m_pcRenTop->setShiftLUTs(337 m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],338 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx],339 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],340 m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx][iSynthViewIdx],341 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx],342 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx ],343 344 iRelDistToLeft345 );346 347 m_pcRenTop->interpolateView(348 apcPicYuvBaseVideo[iLeftBaseViewIdx ],349 apcPicYuvBaseDepth[iLeftBaseViewIdx ],350 apcPicYuvBaseVideo[iRightBaseViewIdx],351 apcPicYuvBaseDepth[iRightBaseViewIdx],352 pcPicYuvSynthOut,353 iBlendMode,354 iSimEnhBaseView355 );356 }357 else358 {359 AOT(iLeftBaseViewIdx != iRightBaseViewIdx );360 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut );361 std::cout << "Copied Frame " << iFrame362 << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC363 << " (BaseView) " << std::endl;364 }365 366 break;367 /// EXTRAPOLATION FROM LEFT368 case 1:369 if ( !bHasLView ) // View to render is BaseView370 {371 bRender = false;372 }373 374 if ( bIsBaseView )375 {376 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );377 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];378 if ( iSortedBaseViewIdx - 1 >= 0 )379 {380 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx - 1];381 }382 else383 {384 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;385 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original386 bRender = false;387 }388 }389 390 391 if (bRender)392 {393 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;394 m_pcRenTop->setShiftLUTs( m_cCameraData.getSynthViewShiftLUTD()[iLeftBaseViewIdx ][iSynthViewIdx],395 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, NULL, -1 );396 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iLeftBaseViewIdx ], apcPicYuvBaseDepth[iLeftBaseViewIdx ], pcPicYuvSynthOut, true );397 }398 break;399 /// EXTRAPOLATION FROM RIGHT400 case 2: // extrapolation from right401 if ( !bHasRView ) // View to render is BaseView402 {403 bRender = false;404 }405 406 if ( bIsBaseView )407 {408 409 AOF( iLeftBaseViewIdx == iRightBaseViewIdx );410 Int iSortedBaseViewIdx = m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx];411 if ( iSortedBaseViewIdx + 1 < m_iNumberOfInputViews )412 {413 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iSortedBaseViewIdx + 1];414 }415 else416 {417 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;418 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original419 bRender = false;420 }421 }422 423 if ( bRender )424 {425 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;426 m_pcRenTop->setShiftLUTs( NULL, NULL,NULL, m_cCameraData.getSynthViewShiftLUTD()[iRightBaseViewIdx ][iSynthViewIdx],427 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx],NULL, iRelDistToLeft);428 m_pcRenTop->extrapolateView( apcPicYuvBaseVideo[iRightBaseViewIdx ], apcPicYuvBaseDepth[iRightBaseViewIdx ], pcPicYuvSynthOut, false);429 }430 break;431 }432 433 // Write Output434 435 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0, 0, 0, 0, CHROMA_420 );436 }437 iFrame++;438 iNumOfRenderedFrames++;439 }440 441 // Delete Buffers442 pcNewOrg->destroy();443 delete pcNewOrg;444 445 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )446 {447 apcPicYuvBaseVideo[uiBaseView]->destroy();448 delete apcPicYuvBaseVideo[uiBaseView];449 450 apcPicYuvBaseDepth[uiBaseView]->destroy();451 delete apcPicYuvBaseDepth[uiBaseView];452 453 // Temporal Filter454 if ( m_bTempDepthFilter )455 {456 apcPicYuvLastBaseVideo[uiBaseView]->destroy();457 delete apcPicYuvLastBaseVideo[uiBaseView];458 459 apcPicYuvLastBaseDepth[uiBaseView]->destroy();460 delete apcPicYuvLastBaseDepth[uiBaseView];461 }462 }463 464 pcPicYuvSynthOut->destroy();465 delete pcPicYuvSynthOut;466 467 xDestroyLib();468 469 }470 471 Void TAppRendererTop::go()472 {473 switch ( m_iRenderMode )474 {475 case 0:476 render();477 break;478 #if NH_3D_VSO479 case 1:480 renderModel();481 break;482 #endif483 case 10:484 renderUsedPelsMap( );485 break;486 default:487 AOT(true);488 }489 490 #if NH_3D_REN_MAX_DEV_OUT491 Double dMaxDispDiff = m_cCameraData.getMaxShiftDeviation();492 493 if ( !(dMaxDispDiff < 0) )494 {495 printf("\n Max. possible shift error: %12.3f samples.\n", dMaxDispDiff );496 }497 #endif498 }499 500 #if NH_3D_VSO501 Void TAppRendererTop::renderModel()502 {503 if ( m_bUseSetupString )504 {505 xRenderModelFromString();506 }507 else508 {509 xRenderModelFromNums();510 }511 }512 513 514 515 Void TAppRendererTop::xRenderModelFromString()516 {517 xCreateLib();518 xInitLib();519 520 // Create Buffers Input Views;521 std::vector<TComPicYuv*> apcPicYuvBaseVideo;522 std::vector<TComPicYuv*> apcPicYuvBaseDepth;523 524 525 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )526 {527 TComPicYuv* pcNewVideoPic = new TComPicYuv;528 TComPicYuv* pcNewDepthPic = new TComPicYuv;529 530 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );531 apcPicYuvBaseVideo.push_back(pcNewVideoPic);532 533 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );534 apcPicYuvBaseDepth.push_back(pcNewDepthPic);535 }536 537 Int aiPad[2] = { 0, 0 };538 TComPicYuv* pcNewOrg = new TComPicYuv;539 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );540 541 // Init Model542 TRenModel cCurModel;543 544 AOT( m_iLog2SamplingFactor != 0 );545 #if H_3D_VSO_EARLY_SKIP546 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );547 #else548 cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );549 #endif550 551 cCurModel.setupPart( 0, m_iSourceHeight );552 553 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )554 {555 Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewIdx, 1);556 557 for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )558 {559 Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;560 m_cRenModStrParser.getSingleModelData ( iViewIdx, 1, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;561 cCurModel .createSingleModel ( iViewIdx, 1, iModelNum, iLeftViewNum, iRightViewNum, false, iBlendMode );562 }563 }564 565 // Create Buffer for synthesized View566 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;567 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );568 569 Bool bAnyEOS = false;570 571 Int iNumOfRenderedFrames = 0;572 Int iFrame = 0;573 574 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )575 {576 577 if ( iFrame >= m_iFrameSkip )578 {579 // read in depth and video580 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )581 {582 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;583 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();584 585 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;586 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();587 }588 }589 else590 {591 iFrame++;592 continue;593 }594 595 596 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )597 {598 TComPicYuv* pcPicYuvVideo = apcPicYuvBaseVideo[iBaseViewIdx];599 TComPicYuv* pcPicYuvDepth = apcPicYuvBaseDepth[iBaseViewIdx];600 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx ];601 cCurModel.setBaseView( iBaseViewSIdx, pcPicYuvVideo, pcPicYuvDepth, NULL, NULL );602 }603 604 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ));605 606 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )607 {608 // setup virtual views609 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];610 611 cCurModel.setErrorMode( iBaseViewSIdx, 1, 0 );612 Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iBaseViewSIdx, 1);613 for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )614 {615 Int iOrgRefBaseViewSIdx;616 Int iLeftBaseViewSIdx;617 Int iRightBaseViewSIdx;618 Int iSynthViewRelNum;619 Int iModelNum;620 Int iBlendMode;621 622 m_cRenModStrParser.getSingleModelData(iBaseViewSIdx, 1, iCurView, iModelNum, iBlendMode, iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );623 624 Int iLeftBaseViewIdx = -1;625 Int iRightBaseViewIdx = -1;626 627 TComPicYuv* pcPicYuvOrgRef = NULL;628 Int** ppiShiftLUTLeft = NULL;629 Int** ppiShiftLUTRight = NULL;630 Int** ppiBaseShiftLUTLeft = NULL;631 Int** ppiBaseShiftLUTRight = NULL;632 633 634 Int iDistToLeft = -1;635 636 Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum );637 638 if ( iLeftBaseViewSIdx != -1 )639 {640 iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ];641 ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ];642 }643 644 if ( iRightBaseViewSIdx != -1 )645 {646 iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ];647 ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];648 }649 650 if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )651 {652 653 ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ];654 ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ];655 iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);656 }657 658 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;659 660 cCurModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );661 662 Int iViewPos;663 if (iLeftBaseViewSIdx != -1 && iRightBaseViewSIdx != -1)664 {665 iViewPos = VIEWPOS_MERGED;666 }667 else if ( iLeftBaseViewSIdx != -1 )668 {669 iViewPos = VIEWPOS_LEFT;670 }671 else if ( iRightBaseViewSIdx != -1 )672 {673 iViewPos = VIEWPOS_RIGHT;674 }675 else676 {677 AOT(true);678 }679 680 cCurModel.getSynthVideo ( iModelNum, iViewPos, pcPicYuvSynthOut );681 682 // Write Output683 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0 ,0 ,0, 0, CHROMA_420 );684 }685 }686 iFrame++;687 iNumOfRenderedFrames++;688 }689 690 // Delete Buffers691 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )692 {693 apcPicYuvBaseVideo[uiBaseView]->destroy();694 delete apcPicYuvBaseVideo[uiBaseView];695 696 apcPicYuvBaseDepth[uiBaseView]->destroy();697 delete apcPicYuvBaseDepth[uiBaseView];698 }699 pcPicYuvSynthOut->destroy();700 delete pcPicYuvSynthOut;701 702 xDestroyLib();703 }704 705 706 Void TAppRendererTop::xRenderModelFromNums()707 {708 xCreateLib();709 xInitLib();710 711 // Create Buffers Input Views;712 std::vector<TComPicYuv*> apcPicYuvBaseVideo;713 std::vector<TComPicYuv*> apcPicYuvBaseDepth;714 715 716 Int aiPad[2] = { 0, 0 };717 TComPicYuv* pcNewOrg = new TComPicYuv;718 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );719 720 721 // Init Model722 TRenModel cCurModel;723 724 AOT( m_iLog2SamplingFactor != 0 );725 726 #if H_3D_VSO_EARLY_SKIP727 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );728 #else729 cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );730 #endif731 cCurModel.setupPart( 0, m_iSourceHeight );732 733 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )734 {735 TComPicYuv* pcNewVideoPic = new TComPicYuv;736 TComPicYuv* pcNewDepthPic = new TComPicYuv;737 738 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );739 apcPicYuvBaseVideo.push_back(pcNewVideoPic);740 741 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );742 apcPicYuvBaseDepth.push_back(pcNewDepthPic);743 }744 745 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )746 {747 Int iLeftBaseViewIdx = -1;748 Int iRightBaseViewIdx = -1;749 Bool bIsBaseView = false;750 751 Int iRelDistToLeft;752 m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );753 754 if (m_iRenderDirection == 1 )755 {756 iRightBaseViewIdx = -1;757 AOT( iLeftBaseViewIdx == -1);758 }759 760 if (m_iRenderDirection == 2 )761 {762 iLeftBaseViewIdx = -1;763 AOT( iRightBaseViewIdx == -1);764 }765 766 Int iLeftBaseViewSIdx = -1;767 Int iRightBaseViewSIdx = -1;768 769 if (iLeftBaseViewIdx != -1 )770 {771 iLeftBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iLeftBaseViewIdx];772 }773 774 if (iRightBaseViewIdx != -1 )775 {776 iRightBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iRightBaseViewIdx];777 }778 cCurModel.createSingleModel(-1, -1, iSynthViewIdx, iLeftBaseViewSIdx, iRightBaseViewSIdx, false, m_iBlendMode );779 }780 781 // Create Buffer for synthesized View782 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;783 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );784 785 Bool bAnyEOS = false;786 787 Int iNumOfRenderedFrames = 0;788 Int iFrame = 0;789 790 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )791 {792 793 if ( iFrame >= m_iFrameSkip )794 {795 // read in depth and video796 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )797 {798 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;799 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();800 801 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;802 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();803 804 if ( iFrame >= m_iFrameSkip )805 {806 Int iBaseViewSIdx = m_cCameraData.getBaseId2SortedId()[iBaseViewIdx];807 cCurModel.setBaseView( iBaseViewSIdx, apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], NULL, NULL );808 }809 }810 }811 else812 {813 iFrame++;814 continue;815 }816 m_cCameraData.update( (UInt) (iFrame - m_iFrameSkip ));817 for(Int iSynthViewIdx=0; iSynthViewIdx < m_iNumberOfOutputViews; iSynthViewIdx++ )818 {819 820 Int iLeftBaseViewIdx = -1;821 Int iRightBaseViewIdx = -1;822 823 Bool bIsBaseView = false;824 825 Int iRelDistToLeft;826 Bool bHasLRView = m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftBaseViewIdx, iRightBaseViewIdx, iRelDistToLeft, bIsBaseView );827 Bool bHasLView = ( iLeftBaseViewIdx != -1 );828 Bool bHasRView = ( iRightBaseViewIdx != -1 );829 830 switch( m_iRenderDirection )831 {832 /// INTERPOLATION833 case 0:834 assert( bHasLRView || bIsBaseView );835 836 if ( !bHasLRView && bIsBaseView ) // View to render is BaseView837 {838 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;839 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original840 }841 else // Render842 {843 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;844 cCurModel.setSingleModel( iSynthViewIdx,845 m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx] ,846 m_cCameraData.getBaseViewShiftLUTI ()[iLeftBaseViewIdx ][iRightBaseViewIdx],847 m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx][iSynthViewIdx] ,848 m_cCameraData.getBaseViewShiftLUTI ()[iRightBaseViewIdx][iLeftBaseViewIdx] ,849 iRelDistToLeft,850 NULL );851 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_MERGED, pcPicYuvSynthOut );852 }853 break;854 /// EXTRAPOLATION FROM LEFT855 case 1:856 857 if ( !bHasLView ) // View to render is BaseView858 {859 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;860 apcPicYuvBaseVideo[iLeftBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original861 }862 else // Render863 {864 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;865 cCurModel.setSingleModel( iSynthViewIdx, m_cCameraData.getSynthViewShiftLUTI()[iLeftBaseViewIdx ][iSynthViewIdx], NULL, NULL, NULL, -1, NULL);866 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_LEFT, pcPicYuvSynthOut );867 }868 break;869 /// EXTRAPOLATION FROM RIGHT870 case 2: // extrapolation from right871 if ( !bHasRView ) // View to render is BaseView872 {873 std::cout << "Copied Frame " << iFrame << " of BaseView " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;874 apcPicYuvBaseVideo[iRightBaseViewIdx]->copyToPic( pcPicYuvSynthOut ); // Copy Original875 }876 else // Render877 {878 std::cout << "Rendering Frame " << iFrame << " of View " << (Double) m_cCameraData.getSynthViewNumbers()[iSynthViewIdx] / VIEW_NUM_PREC << std::endl;879 cCurModel.setSingleModel( iSynthViewIdx, NULL , NULL, m_cCameraData.getSynthViewShiftLUTI()[iRightBaseViewIdx ][iSynthViewIdx], NULL, -1, NULL);880 cCurModel.getSynthVideo ( iSynthViewIdx, VIEWPOS_RIGHT, pcPicYuvSynthOut );881 }882 break;883 }884 885 // Write Output886 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0 ,0 ,0, 0, CHROMA_420 );887 }888 iFrame++;889 iNumOfRenderedFrames++;890 }891 892 // Delete Buffers893 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )894 {895 apcPicYuvBaseVideo[uiBaseView]->destroy();896 delete apcPicYuvBaseVideo[uiBaseView];897 898 apcPicYuvBaseDepth[uiBaseView]->destroy();899 delete apcPicYuvBaseDepth[uiBaseView];900 }901 pcPicYuvSynthOut->destroy();902 delete pcPicYuvSynthOut;903 904 xDestroyLib();905 906 }907 #endif908 909 Void TAppRendererTop::renderUsedPelsMap( )910 {911 xCreateLib();912 xInitLib();913 914 // Create Buffers Input Views;915 std::vector<TComPicYuv*> apcPicYuvBaseVideo;916 std::vector<TComPicYuv*> apcPicYuvBaseDepth;917 918 // TemporalImprovement Filter919 std::vector<TComPicYuv*> apcPicYuvLastBaseVideo;920 std::vector<TComPicYuv*> apcPicYuvLastBaseDepth;921 922 Int aiPad[2] = { 0, 0 };923 924 TComPicYuv* pcNewOrg = new TComPicYuv;925 pcNewOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );926 927 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )928 {929 TComPicYuv* pcNewVideoPic = new TComPicYuv;930 TComPicYuv* pcNewDepthPic = new TComPicYuv;931 932 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight,CHROMA_420, 1, 1, 1, true );933 apcPicYuvBaseVideo.push_back(pcNewVideoPic);934 935 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1, true );936 apcPicYuvBaseDepth.push_back(pcNewDepthPic);937 938 939 //Temporal improvement Filter940 if ( m_bTempDepthFilter )941 {942 pcNewVideoPic = new TComPicYuv;943 pcNewDepthPic = new TComPicYuv;944 945 pcNewVideoPic->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1, 1 , true);946 apcPicYuvLastBaseVideo.push_back(pcNewVideoPic);947 948 pcNewDepthPic->create( m_iSourceWidth, m_iSourceHeight,CHROMA_420, 1, 1, 1 , true);949 apcPicYuvLastBaseDepth.push_back(pcNewDepthPic);950 }951 }952 953 // Create Buffer for synthesized View954 TComPicYuv* pcPicYuvSynthOut = new TComPicYuv;955 pcPicYuvSynthOut->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, 1, 1 ,1, true);956 957 Bool bAnyEOS = false;958 959 Int iNumOfRenderedFrames = 0;960 Int iFrame = 0;961 962 while ( ( ( iNumOfRenderedFrames < m_iFramesToBeRendered ) || ( m_iFramesToBeRendered == 0 ) ) && !bAnyEOS )963 {964 if ( iFrame >= m_iFrameSkip )965 {966 // read in depth and video967 for(Int iBaseViewIdx=0; iBaseViewIdx < m_iNumberOfInputViews; iBaseViewIdx++ )968 {969 m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->read( apcPicYuvBaseVideo[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;970 apcPicYuvBaseVideo[iBaseViewIdx]->extendPicBorder();971 bAnyEOS |= m_apcTVideoIOYuvVideoInput[iBaseViewIdx]->isEof();972 973 m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->read( apcPicYuvBaseDepth[iBaseViewIdx], pcNewOrg, IPCOLOURSPACE_UNCHANGED, aiPad, CHROMA_420 ) ;974 apcPicYuvBaseDepth[iBaseViewIdx]->extendPicBorder();975 bAnyEOS |= m_apcTVideoIOYuvDepthInput[iBaseViewIdx]->isEof();976 977 if ( m_bTempDepthFilter && (iFrame >= m_iFrameSkip) )978 {979 m_pcRenTop->temporalFilterVSRS( apcPicYuvBaseVideo[iBaseViewIdx], apcPicYuvBaseDepth[iBaseViewIdx], apcPicYuvLastBaseVideo[iBaseViewIdx], apcPicYuvLastBaseDepth[iBaseViewIdx], ( iFrame == m_iFrameSkip) );980 }981 }982 }983 else984 {985 std::cout << "Skipping Frame " << iFrame << std::endl;986 987 iFrame++;988 continue;989 }990 m_cCameraData.update( (UInt) ( iFrame - m_iFrameSkip ) );991 992 for(Int iViewIdx=1; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )993 {994 std::cout << "Rendering UsedPelsMap for Frame " << iFrame << " of View " << (Double) m_cCameraData.getBaseViewNumbers()[iViewIdx] << std::endl;995 996 Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx];997 Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0];998 999 AOT( iViewSIdx == iFirstViewSIdx );1000 1001 Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx);1002 1003 m_pcRenTop->setShiftLUTs(1004 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],1005 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1006 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1007 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],1008 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1009 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],1010 -11011 );1012 1013 m_pcRenTop->getUsedSamplesMap( apcPicYuvBaseDepth[0], pcPicYuvSynthOut, bFirstIsLeft );1014 1015 // Write Output1016 m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0, 0, 0, 0, CHROMA_420 );1017 1018 }1019 iFrame++;1020 iNumOfRenderedFrames++;1021 }1022 1023 // Delete Buffers1024 1025 pcNewOrg->destroy();1026 delete pcNewOrg;1027 1028 for ( UInt uiBaseView = 0; uiBaseView < m_iNumberOfInputViews; uiBaseView++ )1029 {1030 apcPicYuvBaseVideo[uiBaseView]->destroy();1031 delete apcPicYuvBaseVideo[uiBaseView];1032 1033 apcPicYuvBaseDepth[uiBaseView]->destroy();1034 delete apcPicYuvBaseDepth[uiBaseView];1035 1036 // Temporal Filter1037 if ( m_bTempDepthFilter )1038 {1039 apcPicYuvLastBaseVideo[uiBaseView]->destroy();1040 delete apcPicYuvLastBaseVideo[uiBaseView];1041 1042 apcPicYuvLastBaseDepth[uiBaseView]->destroy();1043 delete apcPicYuvLastBaseDepth[uiBaseView];1044 }1045 }1046 pcPicYuvSynthOut->destroy();1047 delete pcPicYuvSynthOut;1048 1049 xDestroyLib();1050 1051 }1052 #endif -
branches/HTM-16.0-MV-draft-5/source/App/TAppRenderer/TAppRendererTop.h
r1386 r1390 40 40 #define __TAppRendererTOP__ 41 41 #include "../../Lib/TLibCommon/CommonDef.h" 42 #if NH_3D_VSO43 #include "../../Lib/TLibRenderer/TRenTop.h"44 #include "../../Lib/TLibVideoIO/TVideoIOYuv.h"45 #include "TAppRendererCfg.h"46 #include "TAppRendererTop.h"47 #include "../../Lib/TLibRenderer/TRenModel.h"48 49 // ====================================================================================================================50 // Class definition51 // ====================================================================================================================52 53 /// encoder application class54 class TAppRendererTop : public TAppRendererCfg55 {56 private:57 // class interface58 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvVideoInput;59 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvDepthInput;60 std::vector<TVideoIOYuv*> m_apcTVideoIOYuvSynthOutput;61 62 // RendererInterface63 TRenTop* m_pcRenTop;64 65 protected:66 // initialization67 Void xCreateLib (); ///< create renderer class and video io68 Void xInitLib (); ///< initialize renderer class69 Void xDestroyLib (); ///< destroy renderer class and video io70 #if NH_3D_VSO71 Void xRenderModelFromString(); ///< render using model using setup string72 Void xRenderModelFromNums(); ///< render using model using synth view numbers73 #endif74 75 public:76 TAppRendererTop();77 virtual ~TAppRendererTop();78 79 Void render (); ///< main encoding function80 #if NH_3D_VSO81 Void renderModel ();82 #endif83 Void go ();84 Void renderUsedPelsMap();85 86 };// END CLASS DEFINITION TAppRendererTop87 88 89 #endif // NH_3D90 42 #endif // __TAppRendererTOP__ -
branches/HTM-16.0-MV-draft-5/source/Lib/TAppCommon/TAppComCamPara.cpp
r1386 r1390 49 49 #include <functional> 50 50 #include <string> 51 #if NH_3D_VSO52 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( TChar* 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 TChar* pcNextStart = pchViewNumberString;134 TChar* pcEnd = pcNextStart + iIdx;135 TChar* 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( TChar* pchCfgFileName )195 {196 assert( pchCfgFileName != NULL );197 198 std::ifstream cCfgStream( pchCfgFileName, std::ifstream::in );199 if( !cCfgStream )200 {201 std::cerr << "Failed to open camera parameter file: `" << pchCfgFileName << "'" << std::endl;202 exit( EXIT_FAILURE );203 }204 205 Int iLineNumber = 0;206 do207 {208 std::string cLine;209 getline( cCfgStream, cLine );210 iLineNumber++;211 212 size_t iStart = cLine.find_first_not_of( " \t\n\r" );213 214 if( iStart == std::string::npos )215 {216 continue;217 }218 219 if( cLine[iStart] == '#' )220 {221 continue;222 }223 224 TChar* pcNextStart = (TChar*) cLine.data();225 TChar* pcEnd = pcNextStart + cLine.length();226 227 std::vector<Double> caNewLine;228 caNewLine.clear();229 230 TChar* pcOldStart = 0;231 while( pcNextStart < pcEnd )232 {233 errno = 0;234 caNewLine.push_back( strtod( pcNextStart, &pcNextStart ) ) ;235 236 if( errno == ERANGE || ( pcNextStart == pcOldStart ) )237 {238 std::cerr << "Failed reading config file: `" << pchCfgFileName << "' Error parsing double values in Line: " << iLineNumber << ' ' << std::endl;239 assert( 0 );240 exit( EXIT_FAILURE );241 };242 pcOldStart = pcNextStart;243 244 while( ( pcNextStart < pcEnd ) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++;245 }246 247 if ( ( caNewLine.size() != 2 ) && ( caNewLine.size() != 7 ) && ( caNewLine.size() != 6 ) && ( caNewLine.size() != 8 ) )248 {249 std::cerr << "Failed reading config file: `" << pchCfgFileName << "'" << std::endl;250 std::cerr << "Invalid number of entries" << std::endl;251 AOF(false);252 exit( EXIT_FAILURE );253 }254 m_aadCameraParameters.push_back( caNewLine );255 }256 while( cCfgStream );257 }258 259 Void260 TAppComCamPara::xGetCodedCameraData( UInt uiSourceView, UInt uiTargetView, Bool bByIdx, UInt uiFrame, Int& riScale, Int& riOffset, Int& riPrecision )261 {262 if( bByIdx )263 {264 uiSourceView = m_aiBaseViews[ uiSourceView ];265 uiTargetView = m_aiBaseViews[ uiTargetView ];266 }267 268 Int iFoundLine = -1;269 for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ )270 {271 if ( m_aadCameraParameters[uiCurViewLine].size() == 2 )272 continue;273 274 if( ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 3 ] * m_dViewNumPrec ) == uiSourceView )275 && ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 2 ] * m_dViewNumPrec ) == uiTargetView )276 )277 {278 if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 0 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] >= uiFrame ) )279 {280 if( iFoundLine != -1 )281 {282 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;283 AOT(true);284 exit( EXIT_FAILURE );285 }286 else287 {288 iFoundLine = uiCurViewLine;289 }290 }291 }292 }293 294 if ( iFoundLine == -1 )295 {296 std::cerr << "Error CameraParameters for SourceView " << (Double) uiSourceView / m_dViewNumPrec << " and Target View " << (Double) uiTargetView / m_dViewNumPrec << " and Frame " << uiFrame << " not found." << std::endl;297 AOT(true);298 exit( EXIT_FAILURE );299 }300 301 riScale = (Int)( m_aadCameraParameters[ iFoundLine ][ 4 ] );302 riOffset = (Int)( m_aadCameraParameters[ iFoundLine ][ 5 ] );303 riPrecision = (Int)( m_aadCameraParameters[ iFoundLine ][ 6 ] );304 }305 306 Bool307 TAppComCamPara::xGetCameraDataRow( Int iView, UInt uiFrame, UInt& ruiFoundLine )308 {309 ruiFoundLine = -1;310 for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ )311 {312 if( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 0 ] * m_dViewNumPrec ) == iView )313 {314 if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 2 ] >= uiFrame ) )315 {316 if( ruiFoundLine != -1 )317 {318 std::cerr << "Error CameraParameters for View " << (Double) iView / m_dViewNumPrec << " and Frame " << uiFrame << " given multiple times." << std::endl;319 exit( EXIT_FAILURE );320 }321 else322 {323 ruiFoundLine = uiCurViewLine;324 }325 }326 }327 }328 return ( ruiFoundLine == -1 );329 }330 331 332 Void333 TAppComCamPara::xGetSortedViewList( const std::vector<Int>& raiViews, std::vector<Int>& raiSortedViews, std::vector<Int>& raiId2SortedId, std::vector<Int>& raiSortedId2Id )334 {335 AOF( raiViews.size() > 0 );336 Int iNumViews = (Int)raiViews.size();337 raiId2SortedId = std::vector<Int>( raiViews.size(), -1 );338 raiSortedId2Id.clear();339 raiSortedViews.clear();340 for( Int iSortId = 0; iSortId < iNumViews; iSortId++ )341 {342 Int iLeftMostBaseId = -1;343 for( Int iBaseId = 0; iLeftMostBaseId == -1 && iBaseId < iNumViews; iBaseId++ )344 {345 if( raiId2SortedId[ iBaseId ] == -1 )346 {347 UInt uiFoundLine = -1;348 xGetCameraDataRow( raiViews[ iBaseId ], 0, uiFoundLine );349 AOT( uiFoundLine == -1 ); // something wrong350 Double dXPos = m_aadCameraParameters[ uiFoundLine ][ 4 ];351 Double dZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ];352 Double dZFar = m_aadCameraParameters[ uiFoundLine ][ 7 ];353 Double dSign = ( dZFar > 0 ? 1.0 : -1.0 );354 Bool bLeftMost = true;355 AOF( dZNear * dZFar > 0.0 ); // otherwise, z parameters are not correct356 357 for( Int iTestBaseId = 0; bLeftMost && iTestBaseId < iNumViews; iTestBaseId++ )358 {359 if( iTestBaseId != iBaseId && raiId2SortedId[ iTestBaseId ] == -1 )360 {361 UInt uiFoundLineTest = -1;362 xGetCameraDataRow( raiViews[ iTestBaseId ], 0, uiFoundLineTest );363 AOT( uiFoundLineTest == -1 ); // something wrong364 Double dXPosTest = m_aadCameraParameters[ uiFoundLineTest ][ 4 ];365 Double dZNearTest = m_aadCameraParameters[ uiFoundLineTest ][ 6 ];366 Double dZFarTest = m_aadCameraParameters[ uiFoundLineTest ][ 7 ];367 AOF( dZNearTest * dZFarTest > 0.0 ); // otherwise, z parameters are not correct368 AOF( dZNearTest * dSign > 0.0 ); // otherwise, z parameters are not consistent369 Double dDeltaXPos = dSign * ( dXPosTest - dXPos );370 bLeftMost = ( bLeftMost && dDeltaXPos > 0.0 );371 }372 }373 if( bLeftMost )374 {375 iLeftMostBaseId = iBaseId;376 }377 }378 }379 AOT( iLeftMostBaseId == -1 ); // something wrong380 raiId2SortedId[ iLeftMostBaseId ] = iSortId;381 raiSortedId2Id.push_back( iLeftMostBaseId );382 raiSortedViews.push_back( raiViews[ iLeftMostBaseId ] );383 }384 385 // sanity check386 if( iNumViews > 2 )387 {388 Int iDeltaView = gSign( raiSortedViews[ 1 ] - raiSortedViews[ 0 ] );389 Bool bOutOfOrder = false;390 for( Int iSIdx = 2; iSIdx < iNumViews; iSIdx++ )391 {392 bOutOfOrder = ( bOutOfOrder || iDeltaView * gSign( raiSortedViews[ iSIdx ] - raiSortedViews[ iSIdx - 1 ] ) < 0 );393 }394 if( bOutOfOrder )395 {396 std::cerr << "ERROR: View numbering must be strictly increasing or decreasing from left to right" << std::endl;397 exit(EXIT_FAILURE);398 }399 }400 }401 402 403 404 405 Bool406 TAppComCamPara::xGetCamParsChangeFlag()407 {408 Bool bChangeDetected = false;409 for( Int iBaseViewId = 0; !bChangeDetected && iBaseViewId < m_iNumberOfBaseViews; iBaseViewId++ )410 {411 if ( m_bSetupFromCoded )412 {413 for( Int iTargetViewId = 0; !bChangeDetected && iTargetViewId < m_iNumberOfBaseViews; iTargetViewId++ )414 {415 Int iTargetView = m_aiBaseViews[iTargetViewId];416 Int iSourceView = m_aiBaseViews[iBaseViewId ];417 418 Int iS1 ,iSX;419 Int iO1 ,iOX;420 Int iP1 ,iPX;421 422 if ( iSourceView == iTargetView )423 continue;424 425 xGetCodedCameraData( iSourceView, iTargetView, false, 0, iS1, iO1, iP1 );426 for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )427 {428 xGetCodedCameraData( iSourceView, iTargetView, false, uiFrameId, iSX, iOX, iPX );429 430 if( iS1 != iSX || iO1 != iOX || iP1 != iPX )431 {432 bChangeDetected = true;433 }434 }435 }436 }437 else438 {439 Int iBaseView = m_aiBaseViews[ iBaseViewId ];440 Double dFL1, dFLX;441 Double dCP1, dCPX;442 Double dCS1, dCSX;443 Double dZN1, dZNX;444 Double dZF1, dZFX;445 Bool bInterpolated;446 xGetGeometryData( iBaseView, m_uiFirstFrameId, dFL1, dCP1, dCS1, bInterpolated ); AOT( bInterpolated );447 xGetZNearZFar ( iBaseView, m_uiFirstFrameId, dZN1, dZF1 );448 449 for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ )450 {451 xGetGeometryData( iBaseView, uiFrameId, dFLX, dCPX, dCSX, bInterpolated ); AOT( bInterpolated );452 xGetZNearZFar ( iBaseView, uiFrameId, dZNX, dZFX );453 454 if( dFL1 != dFLX || dCP1 != dCPX || dCS1 != dCSX || dZN1 != dZNX || dZF1 != dZFX )455 {456 bChangeDetected = true;457 }458 }459 }460 }461 return bChangeDetected;462 }463 464 Int465 TAppComCamPara::xGetViewId( std::vector<Int> aiViewList, Int iBaseView )466 {467 Int iViewId = -1;468 for( Int iId = 0; iId < (Int)aiViewList.size(); iId++ )469 {470 if( aiViewList[ iId ] == iBaseView )471 {472 iViewId = iId;473 break;474 }475 }476 AOT( iViewId == -1 );477 return iViewId;478 }479 480 Int481 TAppComCamPara::xGetBaseViewId( Int iBaseView )482 {483 return xGetViewId( m_aiBaseViews, iBaseView );484 }485 486 487 Bool488 TAppComCamPara::xGetLeftRightView( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx )489 {490 Bool bFoundLRView = false;491 Int iLeftView = -1;492 Int iRightView = -1;493 Int iLeftViewIdx = -1;494 Int iRightViewIdx = -1;495 Bool bDecencdingVN = ( aiSortedViews.size() >= 2 && aiSortedViews[ 0 ] > aiSortedViews[ 1 ] );496 Int iFactor = ( bDecencdingVN ? -1 : 1 );497 498 for( Int iIdx = -1; iIdx < (Int)aiSortedViews.size(); iIdx++ )499 {500 if( iIdx == -1 )501 {502 if( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor > 0 )503 {504 bFoundLRView = false;505 iLeftView = -1;506 iRightView = aiSortedViews[ iIdx + 1 ];507 iLeftViewIdx = -1;508 iRightViewIdx = iIdx + 1;509 break;510 }511 }512 else if ( iIdx == (Int)aiSortedViews.size() - 1 )513 {514 if( ( aiSortedViews[ iIdx ] - iView ) * iFactor < 0 )515 {516 bFoundLRView = false;517 iLeftView = aiSortedViews[ iIdx ];518 iRightView = -1;519 iLeftViewIdx = iIdx;520 iRightViewIdx = -1;521 break;522 }523 }524 else525 {526 if( ( ( aiSortedViews[ iIdx ] - iView ) * iFactor <= 0 ) && ( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor >= 0 ) )527 {528 bFoundLRView = true;529 iLeftView = aiSortedViews[ iIdx ];530 iRightView = aiSortedViews[ iIdx + 1 ];531 iLeftViewIdx = iIdx;532 iRightViewIdx = iIdx + 1;533 break;534 }535 }536 }537 538 if ( ( iView == iLeftView ) || ( iView == iRightView ) )539 {540 iLeftViewIdx = ( iView == iLeftView ) ? iLeftViewIdx : iRightViewIdx;541 iRightViewIdx = iLeftViewIdx;542 iLeftView = iView;543 iRightView = iView;544 bFoundLRView = false;545 }546 547 riLeftView = iLeftView;548 riRightView = iRightView;549 riLeftSortedViewIdx = iLeftViewIdx;550 riRightSortedViewIdx = iRightViewIdx;551 552 return bFoundLRView;553 }554 555 556 Void557 TAppComCamPara::xGetPrevAndNextBaseView( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum )558 {559 Int iLeftView;560 Int iRightView;561 Int iDummy;562 xGetLeftRightView( iTargetViewNum, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy );563 564 if( iLeftView == iRightView )565 {566 riPrevBaseViewNum = iLeftView;567 riNextBaseViewNum = iLeftView;568 }569 else570 {571 Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] );572 Bool bNextViewIsLeft = ( bDecencdingVN ? ( iSourceViewNum < iTargetViewNum ) : ( iSourceViewNum > iTargetViewNum ) );573 if ( bNextViewIsLeft )574 {575 riPrevBaseViewNum = iRightView;576 riNextBaseViewNum = iLeftView;577 }578 else579 {580 riPrevBaseViewNum = iLeftView;581 riNextBaseViewNum = iRightView;582 }583 }584 }585 586 587 Void588 TAppComCamPara::xGetZNearZFar( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar )589 {590 UInt uiFoundLine = -1;591 if( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) || !( m_aadCameraParameters[ uiFoundLine ].size() < 8 ) )592 {593 rdZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ];594 rdZFar = m_aadCameraParameters[ uiFoundLine ][ 7 ];595 }596 else597 {598 std::cerr << "No ZNear or no ZFar for View " << (Double)iView / m_dViewNumPrec << " and Frame " << uiFrame << " given in CameraParameterFile" << std::endl;599 exit( EXIT_FAILURE );600 }601 }602 603 Void604 TAppComCamPara::xGetGeometryData( Int iView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated )605 {606 UInt uiFoundLine = -1;607 if ( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) && xIsIn( m_aiSortedBaseViews, iView ))608 {609 AOT( m_aadCameraParameters[ uiFoundLine ].size() < 6 );610 rbInterpolated = false;611 rdFocalLength = m_aadCameraParameters[ uiFoundLine ][ 3 ];612 rdPosition = m_aadCameraParameters[ uiFoundLine ][ 4 ];613 rdCameraShift = m_aadCameraParameters[ uiFoundLine ][ 5 ];614 }615 else616 {617 UInt uiLeftViewLine;618 UInt uiRightViewLine;619 Int iLeftView;620 Int iRightView;621 Int iDummy;622 623 if( !xGetLeftRightView( iView, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy ) ||624 xGetCameraDataRow( iLeftView, uiFrame, uiLeftViewLine ) ||625 xGetCameraDataRow( iRightView, uiFrame, uiRightViewLine )626 )627 {628 std::cerr << "No left or no right base view next to view " << (Double)iView / m_dViewNumPrec << " for Frame " << uiFrame << " given in CameraParameterFile" << std::endl;629 AOT(true);630 exit( EXIT_FAILURE );631 }632 AOT( m_aadCameraParameters[ uiLeftViewLine ].size() < 6 );633 AOT( m_aadCameraParameters[ uiRightViewLine ].size() < 6 );634 635 // Linear Interpolation636 Double dFactor = ( (Double)( iView - iLeftView ) ) / ( (Double)( iRightView - iLeftView ) );637 rdFocalLength = m_aadCameraParameters[ uiLeftViewLine ][ 3 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 3 ] - m_aadCameraParameters[ uiLeftViewLine ][ 3 ] );638 rdPosition = m_aadCameraParameters[ uiLeftViewLine ][ 4 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 4 ] - m_aadCameraParameters[ uiLeftViewLine ][ 4 ] );639 rdCameraShift = m_aadCameraParameters[ uiLeftViewLine ][ 5 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 5 ] - m_aadCameraParameters[ uiLeftViewLine ][ 5 ] );640 rbInterpolated = true;641 }642 }643 644 Bool645 TAppComCamPara::xGetShiftParameterReal( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Double& rdScale, Double& rdOffset )646 {647 AOT( m_bSetupFromCoded );648 649 Bool bInterpolatedSource;650 Double dMinDepthSource;651 Double dMaxDepthSource;652 Double dFocalLengthSource;653 Double dPositionSource;654 Double dIntersectionSource;655 656 Bool bInterpolatedTarget;657 Double dPositionTarget;658 Double dIntersectionTarget;659 Double dFocalLengthTarget;660 661 Int iTargetViewNum;662 Int iSourceViewNum;663 664 if( bByIdx )665 {666 iSourceViewNum = m_aiBaseViews[ uiSourceView ];667 iTargetViewNum = ( bExternal ? m_aiSynthViews[ uiTargetView ] : m_aiBaseViews[ uiTargetView ] );668 }669 else670 {671 iSourceViewNum = (Int) uiSourceView;672 iTargetViewNum = (Int) uiTargetView;673 }674 675 xGetGeometryData( iSourceViewNum, uiFrame, dFocalLengthSource, dPositionSource, dIntersectionSource, bInterpolatedSource );676 xGetZNearZFar ( iSourceViewNum, uiFrame, dMinDepthSource, dMaxDepthSource );677 xGetGeometryData( iTargetViewNum, uiFrame, dFocalLengthTarget, dPositionTarget, dIntersectionTarget, bInterpolatedTarget );678 679 Double dFactor = dFocalLengthSource * ( dPositionTarget - dPositionSource );680 rdScale = dFactor * ( 1.0 / dMinDepthSource - 1.0 / dMaxDepthSource ) / (Double)( ( 1 << m_uiInputBitDepth ) - 1 );681 rdOffset = dFactor / dMaxDepthSource - dIntersectionTarget + dIntersectionSource;682 683 return ( bInterpolatedSource || bInterpolatedTarget );684 }685 686 687 Void688 TAppComCamPara::xGetShiftParameterCoded( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bByIdx, Int& riScale, Int& riOffset )689 {690 if ( m_bSetupFromCoded )691 {692 if ( uiSourceView == uiTargetView )693 {694 riScale = 0;695 riOffset = 0;696 return;697 }698 Int iCamParsCodedPrecision;699 xGetCodedCameraData( uiSourceView, uiTargetView, bByIdx, uiFrame, riScale, riOffset, iCamParsCodedPrecision );700 701 if ( m_bCamParsCodedPrecSet )702 {703 AOT( m_uiCamParsCodedPrecision != (UInt) iCamParsCodedPrecision );704 }705 else706 {707 m_uiCamParsCodedPrecision = (UInt) iCamParsCodedPrecision;708 m_bCamParsCodedPrecSet = true;709 }710 }711 else712 {713 Double dScale, dOffset;714 Bool bInterpolated = xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, false, bByIdx, dScale, dOffset );715 AOT( bInterpolated ); // must be base view716 717 Double dMultOffset = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 ) );718 Double dMultScale = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 + m_uiInputBitDepth ) );719 riOffset = (Int)floor( dMultOffset * dOffset + .5 );720 riScale = (Int)floor( dMultScale * dScale + .5 );721 }722 }723 724 725 Void726 TAppComCamPara::xGetShiftParameterInt( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Int64& riScale, Int64& riOffset )727 {728 Int iTargetViewNum;729 Int iSourceViewNum;730 Int iPrevBaseViewNum;731 Int iNextBaseViewNum;732 Int iTargetViewRelNum;733 734 if( bByIdx )735 {736 737 iSourceViewNum = m_aiBaseViews[ uiSourceView ];738 739 if ( bExternal )740 {741 iTargetViewNum = m_aiSynthViews [ uiTargetView ];742 iTargetViewRelNum = m_aiRelSynthViewsNum[ uiTargetView ];743 }744 else745 {746 iTargetViewNum = m_aiBaseViews [ uiTargetView ];747 iTargetViewRelNum = m_aiBaseId2SortedId [ uiTargetView ] * ((Int) m_dViewNumPrec );748 }749 }750 else751 {752 iSourceViewNum = (Int) uiSourceView;753 iTargetViewNum = (Int) uiTargetView;754 755 if ( bExternal )756 {757 iTargetViewRelNum = m_aiRelSynthViewsNum[ xGetViewId( m_aiSynthViews, (Int) uiTargetView )];758 }759 else760 {761 iTargetViewRelNum = m_aiBaseId2SortedId[ xGetBaseViewId( uiTargetView) ] * ((Int) m_dViewNumPrec );762 }763 }764 xGetPrevAndNextBaseView( iSourceViewNum, iTargetViewNum, iPrevBaseViewNum, iNextBaseViewNum );765 AOT( iPrevBaseViewNum == -1 ); // should not happen766 AOT( iNextBaseViewNum == -1 ); // should not happen767 768 Int iSrcId = xGetBaseViewId( iSourceViewNum );769 Int iPrevId = xGetBaseViewId( iPrevBaseViewNum );770 Int iNextId = xGetBaseViewId( iNextBaseViewNum );771 AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iPrevId ] ); // coded scale and offset must be set772 AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iNextId ] ); // coded scale and offset must be set773 774 Int iNextBaseViewRelNum = m_aiBaseId2SortedId[ iNextId ] * ((Int) m_dViewNumPrec );775 Int iPrevBaseViewRelNum = m_aiBaseId2SortedId[ iPrevId ] * ((Int) m_dViewNumPrec );776 777 Int64 iPrevScale = (Int64)m_aaiCodedScale [ iSrcId ][ iPrevId ];778 Int64 iNextScale = (Int64)m_aaiCodedScale [ iSrcId ][ iNextId ];779 Int64 iPrevOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iPrevId ] << m_uiBitDepthForLUT;780 Int64 iNextOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iNextId ] << m_uiBitDepthForLUT;781 782 if( iPrevBaseViewNum == iNextBaseViewNum )783 {784 riScale = iNextScale;785 riOffset = iNextOffset;786 }787 else788 {789 riScale = Int64( iTargetViewRelNum - iPrevBaseViewRelNum ) * iNextScale;790 riScale += Int64( iNextBaseViewRelNum - iTargetViewRelNum ) * iPrevScale;791 riOffset = Int64( iTargetViewRelNum - iPrevBaseViewRelNum ) * iNextOffset;792 riOffset += Int64( iNextBaseViewRelNum - iTargetViewRelNum ) * iPrevOffset;793 Int64 iD = Int64( iNextBaseViewRelNum - iPrevBaseViewRelNum );794 Int64 iSA = ( riScale > 0 ? iD / 2 : -iD / 2 );795 Int64 iOA = ( riOffset > 0 ? iD / 2 : -iD / 2 );796 riScale = ( riScale + iSA ) / iD;797 riOffset = ( riOffset + iOA ) / iD;798 }799 }800 801 802 Void803 TAppComCamPara::xSetCodedScaleOffset( UInt uiFrame )804 {805 for( UInt uiSourceId = 0; uiSourceId < m_iNumberOfBaseViews; uiSourceId++ )806 {807 for( UInt uiTargetId = 0; uiTargetId < m_iNumberOfBaseViews; uiTargetId++ )808 {809 Int iScale, iOffset;810 xGetShiftParameterCoded( uiSourceId, uiTargetId, uiFrame, true, iScale, iOffset );811 m_aaiCodedScale [ uiSourceId ][ uiTargetId ] = iScale;812 m_aaiCodedOffset [ uiSourceId ][ uiTargetId ] = iOffset;813 m_aaiScaleAndOffsetSet [ uiSourceId ][ uiTargetId ] = 1;814 }815 }816 }817 818 819 Void820 TAppComCamPara::xSetShiftParametersAndLUT( UInt uiNumberSourceViews, UInt uiNumberTargetViews, UInt uiFrame, Bool bExternalReference , Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams )821 {822 if( uiNumberSourceViews <= 1 || uiNumberTargetViews == 0 )823 {824 return;825 }826 AOF( radShiftParams != NULL && raiShiftParams != NULL && radLUT != NULL && raiLUT != NULL );827 AOF( m_uiBitDepthForLUT == 8 );828 829 Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 );830 Int iLog2DivChroma = iLog2DivLuma + 1;831 832 Double dMaxDispDev = 0.0;833 Double dMaxRndDispDvL = 0.0;834 Double dMaxRndDispDvC = 0.0;835 836 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )837 {838 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )839 {840 841 // integer-valued scale and offset842 Int64 iScale, iOffset;843 xGetShiftParameterInt ( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, iScale, iOffset );844 raiShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = iScale;845 raiShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = iOffset;846 847 // offsets including rounding offsets848 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 );849 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );850 851 // real-valued scale and offset852 Double dScale, dOffset;853 854 if ( m_bSetupFromCoded )855 {856 dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma ));857 dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));858 }859 else860 {861 xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, dScale, dOffset );862 }863 864 radShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = dScale;865 radShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = dOffset;866 867 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )868 {869 // real-valued look-up tables870 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );871 Double dShiftChroma = dShiftLuma / 2;872 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;873 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;874 875 // integer-valued look-up tables876 Int64 iTempScale = (Int64)uiDepthValue * iScale;877 Int64 iTestScale = ( iTempScale + iOffset ); // for checking accuracy of camera parameters878 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma;879 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;880 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;881 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;882 883 // maximum deviation884 #if NH_3D_REN_MAX_DEV_OUT885 m_dMaxShiftDeviation = std::max( m_dMaxShiftDeviation, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) / Double( 1 << m_iLog2Precision ) );886 #endif887 dMaxDispDev = std::max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );888 dMaxRndDispDvL = std::max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) );889 dMaxRndDispDvC = std::max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );890 }891 892 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];893 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];894 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];895 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];896 }897 }898 899 // check maximum deviation900 Double dMaxAllowedDispDev = Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ); // counting only the impact of camera parameter rounding901 Double dMaxAllowedRndDispDvL = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ); // final rounding and impact of camera parameter rounding902 Double dMaxAllowedRndDispDvC = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ) / 2.0; // final rounding and impact of camera parameter rounding903 904 if( ( dMaxDispDev >= dMaxAllowedDispDev || dMaxRndDispDvL >= dMaxAllowedRndDispDvL || dMaxRndDispDvC >= dMaxAllowedRndDispDvC ) && !m_bSetupFromCoded )905 {906 std::cout << "Warning: Something wrong with the accuracy of coded camera parameters:" << std::endl;907 if( dMaxDispDev >= dMaxAllowedDispDev )908 {909 std::cout << " max disparity difference is " << dMaxDispDev << " (allowed: " << dMaxAllowedDispDev << ")" << std::endl;910 }911 if( dMaxRndDispDvL >= dMaxAllowedRndDispDvL )912 {913 std::cout << " max rnd luma disp diff is " << dMaxRndDispDvL << " (allowed: " << dMaxAllowedRndDispDvL << ")" << std::endl;914 }915 if( dMaxRndDispDvC >= dMaxAllowedRndDispDvC )916 {917 std::cout << " max rnd chroma disp diff is " << dMaxRndDispDvC << " (allowed: " << dMaxAllowedRndDispDvC << ")" << std::endl;918 }919 }920 }921 922 Void923 TAppComCamPara::xSetShiftParametersAndLUT( UInt uiFrame )924 {925 xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 );926 xSetCodedScaleOffset ( uiFrame );927 xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, uiFrame, false, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT, m_adBaseViewShiftParameter, m_aiBaseViewShiftParameter );928 xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, uiFrame, true, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter );929 };930 931 932 Void933 TAppComCamPara::xGetCameraShifts( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Double& rdCamPosShift, Double& rdPicPosShift )934 {935 Double dDummy, dCamPosSource, dCamPosTarget, dPicPosSource, dPicPosTarget;936 Bool bInterpolatedSource, bInterpolatedTarget;937 Int iTargetViewNum = m_aiBaseViews[ uiTargetView ];938 Int iSourceViewNum = m_aiBaseViews[ uiSourceView ];939 940 xGetGeometryData( iSourceViewNum, uiFrame, dDummy, dCamPosSource, dPicPosSource, bInterpolatedSource );941 xGetGeometryData( iTargetViewNum, uiFrame, dDummy, dCamPosTarget, dPicPosTarget, bInterpolatedTarget );942 AOT( bInterpolatedSource || bInterpolatedTarget );943 944 rdCamPosShift = ( dCamPosTarget - dCamPosSource );945 rdPicPosShift = -( dPicPosTarget - dPicPosSource ); // to be consistent946 }947 948 949 950 951 952 953 TAppComCamPara::TAppComCamPara()954 {955 m_dViewNumPrec = VIEW_NUM_PREC; // fixed956 m_iLog2Precision = -1;957 m_uiInputBitDepth = 0;958 m_uiBitDepthForLUT = 8; // fixed959 m_uiFirstFrameId = 0;960 m_uiLastFrameId = 0;961 962 m_iNumberOfBaseViews = -1;963 m_iNumberOfSynthViews = -1;964 965 m_uiCamParsCodedPrecision = 0;966 m_bCamParsVaryOverTime = true;967 968 m_aaiCodedScale = 0;969 m_aaiCodedOffset = 0;970 m_aaiScaleAndOffsetSet = 0;971 972 m_adBaseViewShiftParameter = 0;973 m_aiBaseViewShiftParameter = 0;974 m_adSynthViewShiftParameter = 0;975 m_aiSynthViewShiftParameter = 0;976 977 m_adBaseViewShiftLUT = 0;978 m_aiBaseViewShiftLUT = 0;979 m_adSynthViewShiftLUT = 0;980 m_aiSynthViewShiftLUT = 0;981 982 m_bSetupFromCoded = false;983 m_bCamParsCodedPrecSet = false;984 985 #if NH_3D_REN_MAX_DEV_OUT986 m_dMaxShiftDeviation = -1;987 #endif988 989 }990 991 992 TAppComCamPara::~TAppComCamPara()993 {994 xDeleteArray( m_adBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews );995 xDeleteArray( m_aiBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews );996 xDeleteArray( m_adBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 );997 xDeleteArray( m_aiBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 );998 999 xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));1000 xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));1001 xDeleteArray( m_adSynthViewShiftLUT, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews), 2 );1002 xDeleteArray( m_aiSynthViewShiftLUT, m_iNumberOfBaseViews, std::max( (Int)1 ,m_iNumberOfSynthViews), 2 );1003 1004 xDeleteArray( m_aaiCodedScale, m_iNumberOfBaseViews );1005 xDeleteArray( m_aaiCodedOffset, m_iNumberOfBaseViews );1006 xDeleteArray( m_aaiScaleAndOffsetSet, m_iNumberOfBaseViews );1007 1008 }1009 1010 Void1011 TAppComCamPara::xSetupBaseViewsFromCoded()1012 {1013 //===== get and sort views given in camera parameter file and set list of base views and related arrays =====1014 // get left-right order and coding order from cfg-file1015 std::vector<Int> aiViewOrderIdx; // Left Right Order1016 std::vector<Int> aiViewId ; // Coding Order1017 1018 Int iMinViewOrderIdx = MAX_INT;1019 for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )1020 {1021 if (m_aadCameraParameters[uiRow].size() != 2 )1022 break;1023 1024 Int iViewOrderIdx = (Int)( m_aadCameraParameters[ uiRow ][ 1 ] );1025 iMinViewOrderIdx = std::min( iViewOrderIdx, iMinViewOrderIdx );1026 1027 aiViewOrderIdx .push_back( iViewOrderIdx );1028 aiViewId .push_back( (Int) m_aadCameraParameters[ uiRow ][ 0 ] );1029 }1030 1031 // create base view numbers1032 AOT( aiViewId.size() != aiViewOrderIdx.size() );1033 m_iNumberOfBaseViews = (Int) aiViewId.size();1034 for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )1035 {1036 aiViewOrderIdx[iCurBaseView] = ( aiViewOrderIdx[iCurBaseView] - iMinViewOrderIdx);1037 m_aiBaseViews .push_back( aiViewOrderIdx[iCurBaseView] * ( (Int) m_dViewNumPrec) );1038 m_aiBaseId2SortedId.push_back( iCurBaseView );1039 m_aiBaseSortedId2Id.push_back( iCurBaseView );1040 }1041 1042 m_iNumberOfBaseViews = (Int) m_aiBaseViews.size();1043 1044 std::vector<Int> aiSortedViewOrderIdx = aiViewOrderIdx;1045 1046 // sort base views according to View Order Idx1047 m_aiSortedBaseViews = m_aiBaseViews;1048 for (Int iCurBaseView = 1; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )1049 {1050 Int iCurViewOrder = aiSortedViewOrderIdx[iCurBaseView];1051 for (Int iCurSearchPos = iCurBaseView; iCurSearchPos >= 0; iCurSearchPos-- )1052 {1053 if ( iCurViewOrder < aiSortedViewOrderIdx[iCurSearchPos] )1054 {1055 Int iTempViewId = m_aiSortedBaseViews[iCurSearchPos];1056 m_aiSortedBaseViews[iCurSearchPos] = m_aiSortedBaseViews[iCurBaseView];1057 m_aiSortedBaseViews[iCurBaseView ] = iTempViewId;1058 1059 Int iTempViewOrderIdx = aiSortedViewOrderIdx[iCurSearchPos];1060 aiSortedViewOrderIdx[iCurSearchPos] = aiSortedViewOrderIdx[iCurBaseView];1061 aiSortedViewOrderIdx[iCurBaseView ] = iTempViewOrderIdx;1062 1063 Int iTempPos = m_aiBaseSortedId2Id[iCurSearchPos];1064 m_aiBaseSortedId2Id[iCurSearchPos] = m_aiBaseSortedId2Id[iCurBaseView];1065 m_aiBaseSortedId2Id[iCurBaseView] = iTempPos;1066 iCurBaseView--;1067 }1068 }1069 }1070 1071 for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ )1072 {1073 m_aiBaseId2SortedId[m_aiBaseSortedId2Id[iCurBaseView]] = iCurBaseView;1074 }1075 1076 m_aiViewsInCfgFile = m_aiSortedBaseViews;1077 1078 // check1079 if( m_aiViewsInCfgFile.size() < 2 )1080 {1081 std::cerr << "Failed reading camera parameter file" << std::endl;1082 std::cerr << "At least two views must be given" << std::endl;1083 AOT(true);1084 exit( EXIT_FAILURE );1085 }1086 1087 // translate coding order to view order1088 for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )1089 {1090 if (m_aadCameraParameters[uiRow].size() == 2 )1091 continue;1092 1093 m_aadCameraParameters[ uiRow ][ 2 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 2 ] ) ];1094 m_aadCameraParameters[ uiRow ][ 3 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 3 ] ) ];1095 }1096 }1097 1098 Void TAppComCamPara::xSetupBaseViews( TChar* pchBaseViewNumbers, UInt uiNumBaseViews )1099 {1100 // init list1101 std::vector<Int> aiViewsInCfg;1102 for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ )1103 {1104 aiViewsInCfg.push_back( (Int)( m_aadCameraParameters[ uiRow ][ 0 ] * m_dViewNumPrec ) );1105 }1106 // remove duplicated items1107 std::sort( aiViewsInCfg.begin(), aiViewsInCfg.end() );1108 std::vector<Int>::iterator cIterNewEnd = std::unique( aiViewsInCfg.begin(), aiViewsInCfg.end() );1109 aiViewsInCfg.erase( cIterNewEnd, aiViewsInCfg.end() );1110 // sort (from left to right)1111 std::vector<Int> aiDummyI2SI, aiDummySI2I;1112 xGetSortedViewList( aiViewsInCfg, m_aiViewsInCfgFile, aiDummyI2SI, aiDummySI2I );1113 // check1114 if( m_aiViewsInCfgFile.size() < 2 )1115 {1116 std::cerr << "Failed reading config file" << std::endl;1117 std::cerr << "At least two views must be given" << std::endl;1118 exit( EXIT_FAILURE );1119 }1120 1121 1122 1123 //===== set list of base views and related arrays =====1124 if( pchBaseViewNumbers == 0 )1125 {1126 std::cerr << "BaseViewCameraNumbers must be given" << std::endl;1127 exit( EXIT_FAILURE );1128 };1129 1130 convertNumberString( pchBaseViewNumbers, m_aiBaseViews, m_dViewNumPrec );1131 while( (UInt)m_aiBaseViews.size() > uiNumBaseViews )1132 {1133 m_aiBaseViews.pop_back();1134 }1135 xGetSortedViewList( m_aiBaseViews, m_aiSortedBaseViews, m_aiBaseId2SortedId, m_aiBaseSortedId2Id );1136 m_iNumberOfBaseViews = (Int)m_aiBaseViews.size();1137 }1138 1139 1140 Void1141 TAppComCamPara::init( UInt uiNumBaseViews,1142 UInt uiInputBitDepth,1143 UInt uiCodedCamParsPrecision,1144 UInt uiStartFrameId,1145 UInt uiNumFrames,1146 TChar* pchCfgFileName,1147 TChar* pchBaseViewNumbers,1148 TChar* pchSynthViewNumbers,1149 std::vector<Int>* paiSynthViewNumbers,1150 Int iLog2Precision )1151 {1152 //===== set miscellaneous variables =====1153 m_uiInputBitDepth = uiInputBitDepth;1154 m_uiFirstFrameId = uiStartFrameId;1155 m_uiLastFrameId = uiStartFrameId + uiNumFrames - 1;1156 m_uiCamParsCodedPrecision = uiCodedCamParsPrecision;1157 m_iLog2Precision = iLog2Precision;1158 1159 xReadCameraParameterFile( pchCfgFileName );1160 1161 m_bSetupFromCoded = ( m_aadCameraParameters[ 0 ].size() == 2 );1162 1163 if ( m_bSetupFromCoded )1164 {1165 std::cout << "Detected decoded camera parameter file. Overwriting base view settings from cfg file. " << std::endl;1166 xSetupBaseViewsFromCoded();1167 }1168 else1169 {1170 xSetupBaseViews( pchBaseViewNumbers, uiNumBaseViews );1171 }1172 1173 //===== set list of external (virtual) views =====1174 m_aiSynthViews.clear();1175 1176 if( pchSynthViewNumbers != 0 || paiSynthViewNumbers != 0)1177 {1178 std::vector<Int> aiTmpSynthViews;1179 1180 AOT( ( pchSynthViewNumbers != NULL ) && ( paiSynthViewNumbers != NULL ) );1181 1182 if ( pchSynthViewNumbers != NULL )1183 {1184 convertNumberString( pchSynthViewNumbers, aiTmpSynthViews, m_dViewNumPrec );1185 }1186 else1187 {1188 aiTmpSynthViews = (*paiSynthViewNumbers);1189 }1190 1191 for( UInt uiSId = 0; uiSId < (UInt)aiTmpSynthViews.size(); uiSId++ )1192 {1193 1194 Int iViewNumPrec = (Int) m_dViewNumPrec;1195 Int iLeftBaseViewIdx = aiTmpSynthViews[ uiSId ] / iViewNumPrec;1196 Int iRightBaseViewIdx = ( aiTmpSynthViews[ uiSId ] + (iViewNumPrec - 1) ) / iViewNumPrec;1197 1198 if ( iLeftBaseViewIdx < 0 || iRightBaseViewIdx >= m_iNumberOfBaseViews )1199 {1200 std::cerr << "SynthViewCameraNumbers must be greater and equal to 0 and smaller than number of base views" << std::endl;1201 AOT(true);1202 exit( EXIT_FAILURE );1203 }1204 1205 Int64 iLeftBaseViewRelNum = iLeftBaseViewIdx * iViewNumPrec;1206 Int64 iRightBaseViewRelNum = iRightBaseViewIdx * iViewNumPrec;1207 1208 Int64 iDiffBaseViewRelNum = iRightBaseViewRelNum - iLeftBaseViewRelNum;1209 1210 Int64 iSynthViewRelNum = aiTmpSynthViews[ uiSId ];1211 Int64 iLeftBaseNum = m_aiSortedBaseViews[ iLeftBaseViewIdx ];1212 Int64 iRightBaseNum = m_aiSortedBaseViews[ iRightBaseViewIdx ];1213 Int64 iDiffBaseNum = iRightBaseNum - iLeftBaseNum;1214 Int64 iSynthViewNum;1215 1216 if ( iDiffBaseViewRelNum != 0)1217 {1218 AOT( (Int) iDiffBaseViewRelNum != iViewNumPrec );1219 Int iFact = iDiffBaseNum > 0 ? 1 : -1;1220 iSynthViewNum = iLeftBaseNum + ( iDiffBaseNum * ( iSynthViewRelNum - iLeftBaseViewRelNum ) + (iViewNumPrec >> 1) * iFact ) / ( iViewNumPrec );1221 }1222 else1223 {1224 iSynthViewNum = iLeftBaseNum;1225 }1226 1227 m_aiRelSynthViewsNum.push_back( aiTmpSynthViews[ uiSId ] );1228 m_aiSynthViews .push_back( (Int) iSynthViewNum );1229 }1230 }1231 m_iNumberOfSynthViews = (Int)m_aiSynthViews.size();1232 1233 1234 //===== set derived parameters =====1235 m_bCamParsVaryOverTime = xGetCamParsChangeFlag();1236 1237 1238 //===== create arrays =====1239 xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT, m_adBaseViewShiftParameter, m_aiBaseViewShiftParameter );1240 xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter );1241 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedScale );1242 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedOffset );1243 xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet );1244 xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 );1245 1246 //===== init arrays for first frame =====1247 xSetShiftParametersAndLUT( m_uiFirstFrameId );1248 }1249 1250 1251 Void1252 TAppComCamPara::check( Bool bCheckViewRange, Bool bCheckFrameRange )1253 {1254 if( bCheckFrameRange )1255 {1256 Double dDummy;1257 1258 for( UInt uiBaseView = 0; uiBaseView < m_aiBaseViews.size(); uiBaseView++ )1259 {1260 if ( m_bSetupFromCoded )1261 {1262 for( UInt uiTargetView = 0; uiTargetView < m_aiBaseViews.size(); uiTargetView++ )1263 {1264 if ( uiTargetView == uiBaseView )1265 continue;1266 1267 for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )1268 {1269 Int iDummy;1270 1271 xGetCodedCameraData( uiBaseView, uiTargetView, true , uiFrame, iDummy, iDummy, iDummy );1272 }1273 }1274 }1275 else1276 {1277 for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )1278 {1279 Bool bInterpolatedCur;1280 xGetGeometryData( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur );1281 xGetZNearZFar ( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy );1282 1283 if( bInterpolatedCur )1284 {1285 std::cerr << "Error: CameraParameters for BaseView " << (Double)m_aiBaseViews[ uiBaseView ] / m_dViewNumPrec << " and Frame " << uiFrame << " not defined. " << std::endl;1286 exit( EXIT_FAILURE );1287 }1288 }1289 }1290 }1291 1292 Bool bIgnoreFirst = true;1293 for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )1294 {1295 if ( xIsIn(m_aiViewsInCfgFile, m_aiSynthViews[ uiERView ] ) )1296 {1297 if ( bIgnoreFirst )1298 {1299 std::cout << "Ignoring CameraParameterFile entries for virtual view(s): " ;1300 //GT: Integer precision virtual view camera parameters are always interpolated from coded views camera parameters.1301 bIgnoreFirst = false;1302 }1303 std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ;1304 }1305 }1306 if ( !bIgnoreFirst )1307 {1308 std::cout << std::endl;1309 }1310 1311 Bool bInterpolateFirst = true;1312 Bool bAnyInterpolated = false;1313 for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )1314 {1315 Bool bInterpolated = false;1316 for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ )1317 {1318 Bool bInterpolatedCur;1319 xGetGeometryData( m_aiSynthViews[ uiERView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur );1320 bInterpolated |= bInterpolatedCur;1321 }1322 1323 if( bInterpolated )1324 {1325 bAnyInterpolated = true;1326 if ( bInterpolateFirst )1327 {1328 std::cout << "Interpolating camera parameters for virtual view(s): " ;1329 bInterpolateFirst = false;1330 }1331 std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ;1332 }1333 }1334 if ( bAnyInterpolated )1335 std::cout << std::endl;1336 }1337 1338 if( bCheckViewRange )1339 {1340 Bool bAllExist = true;1341 for( Int iSynthViewIdx = 0; iSynthViewIdx < m_iNumberOfSynthViews; iSynthViewIdx++ )1342 {1343 Bool bIsBaseView;1344 Int iDummy;1345 Bool bExist = getLeftRightBaseView( iSynthViewIdx, iDummy, iDummy, iDummy, bIsBaseView );1346 bAllExist &= ( bExist || bIsBaseView );1347 }1348 if( !bAllExist )1349 {1350 std::cerr << "SynthViewNumbers must be within the range of BaseViewNumbers" << std::endl;1351 exit( EXIT_FAILURE );1352 }1353 }1354 }1355 1356 1357 Void1358 TAppComCamPara::update( UInt uiFrameId )1359 {1360 1361 m_iCurrentFrameId = uiFrameId;1362 m_bCamParsCodedPrecSet = false;1363 1364 if ( m_bCamParsVaryOverTime )1365 {1366 xSetShiftParametersAndLUT( m_uiFirstFrameId + uiFrameId );1367 }1368 }1369 1370 #if NH_3D_VSO1371 Void1372 TAppComCamPara::setDispCoeff( UInt uiFrameId, Int iViewIdx )1373 {1374 UInt uiFrame = m_uiFirstFrameId + uiFrameId;1375 Int iSourceViewNum = m_aiBaseViews[ iViewIdx ];1376 Double dBaseLine = 0.0;1377 Double dFL1 = 1.0, dCS1 = 1.0, dCP1 = 1.0, dZN1 = 1.0, dZF1 = 1.0;1378 Bool bInterpolated = false;1379 double dPos[3] = {0.0, 0.0, 0.0};1380 1381 if( m_iNumberOfBaseViews == 3 )1382 {1383 xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated );1384 xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated );1385 xGetGeometryData( m_aiBaseViews[2], uiFrame, dFL1, dPos[2], dCS1, bInterpolated );1386 1387 xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated );1388 xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 );1389 1390 dBaseLine = ( std::max( dPos[0], std::max( dPos[1], dPos[2] ) ) - std::min( dPos[0], std::min( dPos[1], dPos[2] ) ) ) / 2.0;1391 }1392 else if( m_iNumberOfBaseViews == 2 )1393 {1394 xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated );1395 xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated );1396 1397 xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated );1398 xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 );1399 1400 dBaseLine = dPos[0] - dPos[1];1401 }1402 1403 m_dDispCoeff = fabs( dFL1 * ( dBaseLine / 2.0 ) / 255.0 * ( 1.0/dZN1 - 1.0/dZF1 ) );1404 }1405 #endif1406 1407 Bool1408 TAppComCamPara::getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView )1409 {1410 Int iLeftSortedViewIdx, iRightSortedViewIdx, iDummy;1411 Bool bExist = xGetLeftRightView( m_aiSynthViews[ iSynthViewIdx ], m_aiSortedBaseViews, iDummy, iDummy, iLeftSortedViewIdx, iRightSortedViewIdx );1412 rbIsBaseView = ( iLeftSortedViewIdx == iRightSortedViewIdx && iLeftSortedViewIdx != -1 );1413 1414 Int iLeftViewIdx = ( iLeftSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iLeftSortedViewIdx ] : -1 );1415 Int iRightViewIdx = ( iRightSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iRightSortedViewIdx ] : -1 );1416 1417 if ( iLeftSortedViewIdx != -1 && iRightSortedViewIdx != -1 )1418 {1419 riRelDistToLeft = getRelDistLeft( iSynthViewIdx, iLeftViewIdx, iRightViewIdx);1420 }1421 else1422 {1423 riRelDistToLeft = -1;1424 }1425 1426 riLeftViewIdx = iLeftViewIdx;1427 riRightViewIdx = iRightViewIdx;1428 1429 return bExist;1430 }1431 1432 Bool1433 TAppComCamPara::xIsIn( std::vector<Int>& rVec, Int iElem)1434 {1435 Bool bFound = false;1436 for (Int idx = 0; idx < rVec.size() && !bFound; idx++)1437 {1438 bFound = bFound || rVec[idx] == iElem;1439 }1440 return bFound;1441 }1442 1443 Int TAppComCamPara::getRelDistLeft( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx )1444 {1445 //GT: Get normalized distance1446 Int iLeftViewDist = abs ( m_aiBaseId2SortedId[ iLeftViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]);1447 Int iRightViewDist = abs ( m_aiBaseId2SortedId[ iRightViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]);1448 Int64 iDistSum = iLeftViewDist + iRightViewDist;1449 return (iDistSum == 0) ? (1 << (REN_VDWEIGHT_PREC -1) ) : (Int) (( (((Int64) iLeftViewDist ) << REN_VDWEIGHT_PREC ) + (iDistSum >> 1) ) / iDistSum );1450 }1451 1452 Int1453 TAppComCamPara::synthRelNum2Idx( Int iRelNum )1454 {1455 return xGetViewId(m_aiRelSynthViewsNum, iRelNum );1456 }1457 #endif -
branches/HTM-16.0-MV-draft-5/source/Lib/TAppCommon/TAppComCamPara.h
r1386 r1390 67 67 Bool m_bCamParsCodedPrecSet; ///< Coded Cam Para precision set for current frame; 68 68 69 #if NH_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; … … 124 121 Bool xGetLeftRightView ( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx ); 125 122 Void xGetPrevAndNextBaseView ( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum ); 126 #if !KWU_RC_MADPRED_E0227127 123 Void xGetZNearZFar ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar ); 128 124 Void xGetGeometryData ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated ); 129 #endif130 125 Void xSetupBaseViewsFromCoded (); 131 126 Void xSetupBaseViews ( TChar* pchBaseViewNumbers, UInt uiNumBaseViews ); … … 184 179 UInt getCurFrameId () { return m_iCurrentFrameId; } 185 180 static Void convertNumberString ( TChar* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec ); 186 #if NH_3D_REN_MAX_DEV_OUT 187 Double getMaxShiftDeviation () { return m_dMaxShiftDeviation; }; 188 #endif 189 190 #if NH_3D_VSO 191 // SAIT_VSO_EST_A033 192 Void setDispCoeff ( UInt uiStartFrameId, Int iViewIdx ); 193 Double getDispCoeff () { return m_dDispCoeff; } 194 #endif 181 195 182 196 183 // function for getting parameters and parameter arrays … … 217 204 Int** getCodedOffset () { return m_aaiCodedOffset; } 218 205 219 #if KWU_RC_MADPRED_E0227220 Void xGetZNearZFar ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar );221 Void xGetGeometryData ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated );222 #endif223 206 }; 224 207 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/CommonDef.h
r1387 r1390 71 71 // ==================================================================================================================== 72 72 #if NH_MV 73 #define NV_VERSION "1 6.0" ///< Current software version74 #define HM_VERSION "16. 7" ///<73 #define NV_VERSION "15.2" ///< Current software version 74 #define HM_VERSION "16.6" ///< 75 75 #else 76 76 #define NV_VERSION "16.7" ///< Current software version … … 368 368 #endif 369 369 370 #if NH_3D_MLC || NH_3D_ARP371 #define MRG_MAX_NUM_CANDS_MEM (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction372 #endif373 370 374 371 #if NH_MV … … 442 439 #endif 443 440 444 #if NH_3D_VSO445 //PICYUV446 #define PICYUV_PAD 16447 448 //RENDERER449 450 451 #define REN_BIT_DEPTH 8452 #define REN_LUMA_MARGIN ( PICYUV_PAD + 1 ) // + g_uiMaxCuWidth instead of 1 ???453 #define REN_VDWEIGHT_PREC 8454 #define REN_IS_FILLED ( 1 << REN_VDWEIGHT_PREC )455 #define REN_USED_PEL ( (1 << REN_BIT_DEPTH) - 1 )456 #define REN_UNUSED_PEL 0457 #define REN_IS_HOLE 0458 #if NH_3D_VSO459 #define ENC_INTERNAL_BIT_DEPTH REN_BIT_DEPTH // consider making this a variable460 #endif461 462 463 // CAMERA PARAMETERS464 #define LOG2_DISP_PREC_LUT 2 ///< log2 of disparity precision used in integer disparity LUTs465 #define STD_CAM_PARAMETERS_PRECISION 5 ///< quarter luma sample accuarcy for derived disparities (as default)466 467 #endif // end of NH_3D468 441 //! \} 469 442 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/ContextTables.h
r1313 r1390 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 NH_3D_DIS54 #define NUM_DIS_FLAG_CTX 155 #define NUM_DIS_TYPE_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 … … 162 158 #define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX 1 163 159 164 #if NH_3D_ARP 165 #define NUM_ARPW_CTX 3 ///< number of context models for weighting factor index used by advanced residual prediction 166 #endif 167 168 #if NH_3D_IC 169 #define NUM_IC_FLAG_CTX 1 ///< number of context models for illumination compensation flag 170 #endif 160 171 161 #define NUM_CROSS_COMPONENT_PREDICTION_CTX 10 172 162 173 163 #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' 174 164 175 #if NH_3D_DMM176 #define NUM_NOTDMM_FLAG_CTX 1 ///< number of context models for not-DMM flag177 #define NUM_DMM_MODE_CTX 1 ///< number of context models for DMM modes178 #endif179 #if NH_3D_DMM || NH_3D_SDC_INTRA180 #define NUM_DDC_DATA_CTX 1 ///< number of context models for deltaDC data (DMM or SDC)181 #endif182 #if NH_3D_SDC_INTRA183 #define SDC_NUM_RESIDUAL_FLAG_CTX 1184 #define SDC_NUM_RESIDUAL_CTX 1185 #define NUM_SDC_FLAG_CTX 1 ///< number of context186 #define NUM_DDC_FLAG_CTX 2 ///< number of context models for deltaDC flag (SDC only)187 #endif188 #if NH_3D_DBBP189 #define DBBP_NUM_FLAG_CTX 1190 #endif191 165 // ==================================================================================================================== 192 166 // Tables … … 218 192 { CNU, CNU, CNU, }, 219 193 }; 220 #if NH_3D_DIS221 static const UChar222 INIT_DIS_FLAG[3][NUM_DIS_FLAG_CTX] =223 {224 { 185 },225 { 185 },226 { 185 },227 };228 static const UChar229 INIT_DIS_TYPE[3][NUM_DIS_TYPE_CTX] =230 {231 { 137 },232 { 137 },233 { 137 },234 };235 #endif236 194 static const UChar 237 195 INIT_MERGE_FLAG_EXT[NUMBER_OF_SLICE_TYPES][NUM_MERGE_FLAG_EXT_CTX] = … … 540 498 //! \} 541 499 542 #if NH_3D_ARP 543 static const UChar 544 INIT_ARPW[3][NUM_ARPW_CTX] = 545 { 546 { 162, 153, 162 }, 547 { 162, 153, 162 }, 548 { 162, 153, 162 }, 549 }; 500 550 501 551 502 #endif 552 #if NH_3D_IC553 static const UChar554 INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] =555 {556 { 154 },557 { 154 },558 { 154 },559 };560 561 #endif562 563 #if NH_3D_DMM564 static const UChar565 INIT_NOTDMM_FLAG[3][NUM_NOTDMM_FLAG_CTX] =566 {567 { 154 },568 { 141 },569 { 155 },570 };571 static const UChar572 INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] =573 {574 { CNU },575 { CNU },576 { CNU }577 };578 #endif579 #if NH_3D_DMM || NH_3D_SDC_INTRA580 static const UChar581 INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] =582 {583 { CNU },584 { CNU },585 { CNU },586 };587 #endif588 #if NH_3D_SDC_INTRA589 static const UChar590 INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] =591 {592 { CNU },593 { CNU },594 { CNU },595 };596 static const UChar597 INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] =598 {599 { 155 },600 { 155 },601 { 155 },602 };603 static const UChar604 INIT_SDC_FLAG[3][NUM_SDC_FLAG_CTX] =605 {606 { 154 },607 { 154 },608 { 154 },609 };610 static const UChar611 INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] =612 {613 {0 , CNU},614 {0 , CNU},615 {64, CNU}616 };617 #endif618 #if NH_3D_DBBP619 static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =620 {621 { CNU },622 { CNU },623 { CNU },624 };625 #endif626 627 #endif -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/SEI.cpp
r1386 r1390 170 170 case SEI::MULTIVIEW_ACQUISITION_INFO: return "Multiview acquisition information"; 171 171 case SEI::MULTIVIEW_VIEW_POSITION: return "Multiview view position"; 172 #if NH_3D173 case SEI::ALTERNATIVE_DEPTH_INFO: return "Alternative depth information";174 #endif175 172 #endif 176 173 default: return "Unknown"; … … 242 239 case SEI::MULTIVIEW_ACQUISITION_INFO : return new SEIMultiviewAcquisitionInfo; 243 240 case SEI::MULTIVIEW_VIEW_POSITION : return new SEIMultiviewViewPosition; 244 #if NH_3D245 case SEI::ALTERNATIVE_DEPTH_INFO : return new SEIAlternativeDepthInfo;246 #endif247 241 default: assert( false ); return NULL; 248 242 } … … 1447 1441 1448 1442 1449 #if NH_3D1450 Void SEIAlternativeDepthInfo::setupFromCfgFile(const TChar* cfgFile)1451 {1452 // Set default values1453 IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes;1454 1455 defAppLayerIds .clear();1456 defAppPocs .clear();1457 defAppTids .clear();1458 defAppVclNaluTypes.clear();1459 1460 Int defSeiNaluId = 0;1461 Int defPositionInSeiNalu = 0;1462 Bool defModifyByEncoder = false;1463 1464 // Setup config file options1465 po::Options opts;1466 xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder );1467 1468 opts.addOptions()1469 ("AlternativeDepthInfoCancelFlag" , m_alternativeDepthInfoCancelFlag , false , "AlternativeDepthInfoCancelFlag" )1470 ("DepthType" , m_depthType , 1 , "DepthType" )1471 ("NumConstituentViewsGvdMinus1" , m_numConstituentViewsGvdMinus1 , 1 , "NumConstituentViewsGvdMinus1" )1472 ("DepthPresentGvdFlag" , m_depthPresentGvdFlag , false , "DepthPresentGvdFlag" )1473 ("ZGvdFlag" , m_zGvdFlag , false , "ZGvdFlag" )1474 ("IntrinsicParamGvdFlag" , m_intrinsicParamGvdFlag , false , "IntrinsicParamGvdFlag" )1475 ("RotationGvdFlag" , m_rotationGvdFlag , false , "RotationGvdFlag" )1476 ("TranslationGvdFlag" , m_translationGvdFlag , false , "TranslationGvdFlag" )1477 ("SignGvdZNearFlag_%d" , m_signGvdZNearFlag , BoolAry1d(3,0), 3 , "SignGvdZNearFlag" )1478 ("ExpGvdZNear_%d" , m_expGvdZNear , IntAry1d (3,0), 3 , "ExpGvdZNear" )1479 ("ManLenGvdZNearMinus1_%d" , m_manLenGvdZNearMinus1 , IntAry1d (3,0), 3 , "ManLenGvdZNearMinus1" )1480 ("ManGvdZNear_%d" , m_manGvdZNear , IntAry1d (3,0), 3 , "ManGvdZNear" )1481 ("SignGvdZFarFlag_%d" , m_signGvdZFarFlag , BoolAry1d(3,0), 3 , "SignGvdZFarFlag" )1482 ("ExpGvdZFar_%d" , m_expGvdZFar , IntAry1d (3,0), 3 , "ExpGvdZFar" )1483 ("ManLenGvdZFarMinus1_%d" , m_manLenGvdZFarMinus1 , IntAry1d (3,0), 3 , "ManLenGvdZFarMinus1" )1484 ("ManGvdZFar_%d" , m_manGvdZFar , IntAry1d (3,0), 3 , "ManGvdZFar" )1485 ("PrecGvdFocalLength" , m_precGvdFocalLength , 18 , "PrecGvdFocalLength" )1486 ("PrecGvdPrincipalPoint" , m_precGvdPrincipalPoint , 18 , "PrecGvdPrincipalPoint" )1487 ("PrecGvdRotationParam" , m_precGvdRotationParam , 18 , "PrecGvdRotationParam" )1488 ("PrecGvdTranslationParam" , m_precGvdTranslationParam , 18 , "PrecGvdTranslationParam" )1489 ("SignGvdFocalLengthX_%d" , m_signGvdFocalLengthX , BoolAry1d(3,0), 3 ,"SignGvdFocalLengthX" )1490 ("ExpGvdFocalLengthX_%d" , m_expGvdFocalLengthX , IntAry1d (3,0), 3 ,"ExpGvdFocalLengthX" )1491 ("ManGvdFocalLengthX_%d" , m_manGvdFocalLengthX , IntAry1d (3,0), 3 ,"ManGvdFocalLengthX" )1492 ("SignGvdFocalLengthY_%d" , m_signGvdFocalLengthY , BoolAry1d(3,0), 3 ,"SignGvdFocalLengthY" )1493 ("ExpGvdFocalLengthY_%d" , m_expGvdFocalLengthY , IntAry1d (3,0), 3 ,"ExpGvdFocalLengthY" )1494 ("ManGvdFocalLengthY_%d" , m_manGvdFocalLengthY , IntAry1d (3,0), 3 ,"ManGvdFocalLengthY" )1495 ("SignGvdPrincipalPointX_%d" , m_signGvdPrincipalPointX , BoolAry1d(3,0), 3 ,"SignGvdPrincipalPointX" )1496 ("ExpGvdPrincipalPointX_%d" , m_expGvdPrincipalPointX , IntAry1d (3,0), 3 ,"ExpGvdPrincipalPointX" )1497 ("ManGvdPrincipalPointX_%d" , m_manGvdPrincipalPointX , IntAry1d (3,0), 3 ,"ManGvdPrincipalPointX" )1498 ("SignGvdPrincipalPointY_%d" , m_signGvdPrincipalPointY , BoolAry1d(3,0), 3 ,"SignGvdPrincipalPointY" )1499 ("ExpGvdPrincipalPointY_%d" , m_expGvdPrincipalPointY , IntAry1d (3,0), 3 ,"ExpGvdPrincipalPointY" )1500 ("ManGvdPrincipalPointY_%d" , m_manGvdPrincipalPointY , IntAry1d (3,0), 3 ,"ManGvdPrincipalPointY" )1501 ("SignGvdR00_%d" , m_signGvdR00 , BoolAry1d(3,0), 3 ,"SignGvdR00" )1502 ("ExpGvdR00_%d" , m_expGvdR00 , IntAry1d (3,0), 3 ,"ExpGvdR00" )1503 ("ManGvdR00_%d" , m_manGvdR00 , IntAry1d (3,0), 3 ,"ManGvdR00" )1504 ("SignGvdR01_%d" , m_signGvdR01 , BoolAry1d(3,0), 3 ,"SignGvdR01" )1505 ("ExpGvdR01_%d" , m_expGvdR01 , IntAry1d (3,0), 3 ,"ExpGvdR01" )1506 ("ManGvdR01_%d" , m_manGvdR01 , IntAry1d (3,0), 3 ,"ManGvdR01" )1507 ("SignGvdR02_%d" , m_signGvdR02 , BoolAry1d(3,0), 3 ,"SignGvdR02" )1508 ("ExpGvdR02_%d" , m_expGvdR02 , IntAry1d (3,0), 3 ,"ExpGvdR02" )1509 ("ManGvdR02_%d" , m_manGvdR02 , IntAry1d (3,0), 3 ,"ManGvdR02" )1510 ("SignGvdR10_%d" , m_signGvdR10 , BoolAry1d(3,0), 3 ,"SignGvdR10" )1511 ("ExpGvdR10_%d" , m_expGvdR10 , IntAry1d (3,0), 3 ,"ExpGvdR10" )1512 ("ManGvdR10_%d" , m_manGvdR10 , IntAry1d (3,0), 3 ,"ManGvdR10" )1513 ("SignGvdR11_%d" , m_signGvdR11 , BoolAry1d(3,0), 3 ,"SignGvdR11" )1514 ("ExpGvdR11_%d" , m_expGvdR11 , IntAry1d (3,0), 3 ,"ExpGvdR11" )1515 ("ManGvdR11_%d" , m_manGvdR11 , IntAry1d (3,0), 3 ,"ManGvdR11" )1516 ("SignGvdR12_%d" , m_signGvdR12 , BoolAry1d(3,0), 3 ,"SignGvdR12" )1517 ("ExpGvdR12_%d" , m_expGvdR12 , IntAry1d (3,0), 3 ,"ExpGvdR12" )1518 ("ManGvdR12_%d" , m_manGvdR12 , IntAry1d (3,0), 3 ,"ManGvdR12" )1519 ("SignGvdR20_%d" , m_signGvdR20 , BoolAry1d(3,0), 3 ,"SignGvdR20" )1520 ("ExpGvdR20_%d" , m_expGvdR20 , IntAry1d (3,0), 3 ,"ExpGvdR20" )1521 ("ManGvdR20_%d" , m_manGvdR20 , IntAry1d (3,0), 3 ,"ManGvdR20" )1522 ("SignGvdR21_%d" , m_signGvdR21 , BoolAry1d(3,0), 3 ,"SignGvdR21" )1523 ("ExpGvdR21_%d" , m_expGvdR21 , IntAry1d (3,0), 3 ,"ExpGvdR21" )1524 ("ManGvdR21_%d" , m_manGvdR21 , IntAry1d (3,0), 3 ,"ManGvdR21" )1525 ("SignGvdR22_%d" , m_signGvdR22 , BoolAry1d(3,0), 3 ,"SignGvdR22" )1526 ("ExpGvdR22_%d" , m_expGvdR22 , IntAry1d (3,0), 3 ,"ExpGvdR22" )1527 ("ManGvdR22_%d" , m_manGvdR22 , IntAry1d (3,0), 3 ,"ManGvdR22" )1528 ("SignGvdTX_%d" , m_signGvdTX , BoolAry1d(3,0), 3 ,"SignGvdTX" )1529 ("ExpGvdTX_%d" , m_expGvdTX , IntAry1d (3,0), 3 ,"ExpGvdTX" )1530 ("ManGvdTX_%d" , m_manGvdTX , IntAry1d (3,0), 3 ,"ManGvdTX" )1531 ("MinOffsetXInt" , m_minOffsetXInt , 0 , "MinOffsetXInt" )1532 ("MinOffsetXFrac" , m_minOffsetXFrac , 0 , "MinOffsetXFrac" )1533 ("MaxOffsetXInt" , m_maxOffsetXInt , 0 , "MaxOffsetXInt" )1534 ("MaxOffsetXFrac" , m_maxOffsetXFrac , 0 , "MaxOffsetXFrac" )1535 ("OffsetYPresentFlag" , m_offsetYPresentFlag , false , "OffsetYPresentFlag" )1536 ("MinOffsetYInt" , m_minOffsetYInt , 0 , "MinOffsetYInt" )1537 ("MinOffsetYFrac" , m_minOffsetYFrac , 0 , "MinOffsetYFrac" )1538 ("MaxOffsetYInt" , m_maxOffsetYInt , 0 , "MaxOffsetYInt" )1539 ("MaxOffsetYFrac" , m_maxOffsetYFrac , 0 , "MaxOffsetYFrac" )1540 ("WarpMapSizePresentFlag" , m_warpMapSizePresentFlag , false , "WarpMapSizePresentFlag" )1541 ("WarpMapWidthMinus2" , m_warpMapWidthMinus2 , 0 , "WarpMapWidthMinus2" )1542 ("WarpMapHeightMinus2" , m_warpMapHeightMinus2 , 0 , "WarpMapHeightMinus2" )1543 ;1544 1545 po::setDefaults(opts);1546 1547 // Parse the cfg file1548 po::ErrorReporter err;1549 po::parseConfigFile( opts, cfgFile, err );1550 };1551 Bool SEIAlternativeDepthInfo::checkCfg( const TComSlice* slice )1552 {1553 // Check config values1554 Bool wrongConfig = false;1555 1556 1557 xCheckCfgRange( wrongConfig, m_alternativeDepthInfoCancelFlag , 0 , 1, "alternative_depth_info_cancel_flag");1558 xCheckCfgRange( wrongConfig, m_depthType , 0 , 1, "depth_type" );1559 1560 xCheckCfgRange( wrongConfig, m_numConstituentViewsGvdMinus1 , 1 , 1, "num_constituent_views_gvd_minus1 "); // 1: 3 views only, cuurent.1561 xCheckCfgRange( wrongConfig, m_depthPresentGvdFlag , 0 , 1, "depth_present_gvd_flag" );1562 xCheckCfgRange( wrongConfig, m_zGvdFlag , 0 , 1, "z_gvd_flag" );1563 xCheckCfgRange( wrongConfig, m_intrinsicParamGvdFlag , 0 , 1, "intrinsic_param_gvd_flag" );1564 xCheckCfgRange( wrongConfig, m_rotationGvdFlag , 0 , 1, "rotation_gvd_flag" );1565 xCheckCfgRange( wrongConfig, m_translationGvdFlag , 0 , 1, "translation_gvd_flag" );1566 1567 return wrongConfig;1568 1569 };1570 1571 UInt SEIAlternativeDepthInfo::getManGvdFocalLengthXLen ( Int i, int j ) const1572 {1573 UInt rval;1574 rval = xGetSyntaxElementLen( m_expGvdFocalLengthX[i][j], m_precGvdFocalLength, m_manGvdFocalLengthX[i][j] );1575 if (rval == 0)1576 return m_precGvdFocalLength;1577 else1578 return rval;1579 };1580 1581 UInt SEIAlternativeDepthInfo::getManGvdFocalLengthYLen ( Int i, int j ) const1582 {1583 UInt rval;1584 rval = xGetSyntaxElementLen( m_expGvdFocalLengthY[i][j], m_precGvdFocalLength, m_manGvdFocalLengthY[i][j] );1585 if (rval == 0)1586 return m_precGvdFocalLength;1587 else1588 return rval;1589 };1590 1591 UInt SEIAlternativeDepthInfo::getManGvdPrincipalPointXLen ( Int i, int j ) const1592 {1593 UInt rval;1594 rval = xGetSyntaxElementLen( m_expGvdPrincipalPointX[i][j], m_precGvdPrincipalPoint, m_manGvdPrincipalPointX[i][j] );1595 if (rval == 0)1596 return m_precGvdPrincipalPoint;1597 else1598 return rval;1599 };1600 1601 UInt SEIAlternativeDepthInfo::getManGvdPrincipalPointYLen ( Int i, int j ) const1602 {1603 UInt rval;1604 rval = xGetSyntaxElementLen( m_expGvdPrincipalPointY[i][j], m_precGvdPrincipalPoint, m_manGvdPrincipalPointY[i][j] );1605 if (rval == 0)1606 return m_precGvdPrincipalPoint;1607 else1608 return rval;1609 };1610 1611 UInt SEIAlternativeDepthInfo::getManGvdTXLen ( Int i, int j ) const1612 {1613 UInt rval;1614 rval = xGetSyntaxElementLen( m_expGvdTX[i][j], m_precGvdTranslationParam, m_manGvdTX[i][j] );1615 if (rval == 0)1616 return m_precGvdTranslationParam;1617 else1618 return rval;1619 };1620 1621 UInt SEIAlternativeDepthInfo::xGetSyntaxElementLen( Int expo, Int prec, Int val ) const1622 {1623 UInt len;1624 if( expo == 0 )1625 {1626 len = std::max(0, prec - 30 );1627 }1628 else1629 {1630 len = std::max( 0, expo + prec - 31 );1631 }1632 1633 assert( val >= 0 );1634 assert( val <= ( ( 1 << len )- 1) );1635 return len;1636 }1637 1443 1638 1444 #endif 1639 1640 #endif -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/SEI.h
r1386 r1390 112 112 MULTIVIEW_ACQUISITION_INFO = 179, 113 113 MULTIVIEW_VIEW_POSITION = 180 114 #if NH_3D115 ,ALTERNATIVE_DEPTH_INFO = 181116 #endif117 114 118 115 }; … … 1132 1129 }; 1133 1130 1134 #if NH_3D1135 class SEIAlternativeDepthInfo : public SEI1136 {1137 public:1138 PayloadType payloadType( ) const { return ALTERNATIVE_DEPTH_INFO; }1139 SEIAlternativeDepthInfo ( ) { };1140 ~SEIAlternativeDepthInfo( ) { };1141 SEI* getCopy( ) const { return new SEIAlternativeDepthInfo(*this); };1142 1143 Void setupFromCfgFile( const TChar* cfgFile );1144 Bool checkCfg ( const TComSlice* slice );1145 1146 UInt getManGvdFocalLengthXLen ( Int i, Int j ) const;1147 UInt getManGvdFocalLengthYLen ( Int i, Int j ) const;1148 UInt getManGvdPrincipalPointXLen ( Int i, Int j ) const;1149 UInt getManGvdPrincipalPointYLen ( Int i, Int j ) const;1150 //UInt getManGvdRLen ( Int i, int j ) const;1151 UInt getManGvdTXLen ( Int i, Int j ) const;1152 UInt xGetSyntaxElementLen ( Int expo, Int prec, Int val ) const;1153 1154 Void resizeArrays( )1155 {1156 const Int numViews = 3; // getNumConstituentViewsGvdMinus1() + 1;1157 1158 m_signGvdZNearFlag.resize(3);1159 m_expGvdZNear.resize(3);1160 m_manLenGvdZNearMinus1.resize(3);1161 m_manGvdZNear.resize(3);1162 m_signGvdZFarFlag.resize(3);1163 m_expGvdZFar.resize(3);1164 m_manLenGvdZFarMinus1.resize(3);1165 m_manGvdZFar.resize(3);1166 1167 m_signGvdFocalLengthX.resize(3);1168 m_expGvdFocalLengthX.resize(3);1169 m_manGvdFocalLengthX.resize(3);1170 m_signGvdFocalLengthY.resize(3);1171 m_expGvdFocalLengthY.resize(3);1172 m_manGvdFocalLengthY.resize(3);1173 m_signGvdPrincipalPointX.resize(3);1174 m_expGvdPrincipalPointX.resize(3);1175 m_manGvdPrincipalPointX.resize(3);1176 m_signGvdPrincipalPointY.resize(3);1177 m_expGvdPrincipalPointY.resize(3);1178 m_manGvdPrincipalPointY.resize(3);1179 1180 m_signGvdR00.resize(3);1181 m_expGvdR00.resize(3);1182 m_manGvdR00.resize(3);1183 m_signGvdR01.resize(3);1184 m_expGvdR01.resize(3);1185 m_manGvdR01.resize(3);1186 m_signGvdR02.resize(3);1187 m_expGvdR02.resize(3);1188 m_manGvdR02.resize(3);1189 m_signGvdR10.resize(3);1190 m_expGvdR10.resize(3);1191 m_manGvdR10.resize(3);1192 m_signGvdR11.resize(3);1193 m_expGvdR11.resize(3);1194 m_manGvdR11.resize(3);1195 m_signGvdR12.resize(3);1196 m_expGvdR12.resize(3);1197 m_manGvdR12.resize(3);1198 m_signGvdR20.resize(3);1199 m_expGvdR20.resize(3);1200 m_manGvdR20.resize(3);1201 m_signGvdR21.resize(3);1202 m_expGvdR21.resize(3);1203 m_manGvdR21.resize(3);1204 m_signGvdR22.resize(3);1205 m_expGvdR22.resize(3);1206 m_manGvdR22.resize(3);1207 1208 m_signGvdTX.resize(3);1209 m_expGvdTX.resize(3);1210 m_manGvdTX.resize(3);1211 1212 for( Int i = 0; i < numViews; i++ )1213 {1214 m_signGvdZNearFlag[i].resize(3);1215 m_expGvdZNear[i].resize(3);1216 m_manLenGvdZNearMinus1[i].resize(3);1217 m_manGvdZNear[i].resize(3);1218 m_signGvdZFarFlag[i].resize(3);1219 m_expGvdZFar[i].resize(3);1220 m_manLenGvdZFarMinus1[i].resize(3);1221 m_manGvdZFar[i].resize(3);1222 1223 m_signGvdFocalLengthX[i].resize(3);1224 m_expGvdFocalLengthX[i].resize(3);1225 m_manGvdFocalLengthX[i].resize(3);1226 m_signGvdFocalLengthY[i].resize(3);1227 m_expGvdFocalLengthY[i].resize(3);1228 m_manGvdFocalLengthY[i].resize(3);1229 m_signGvdPrincipalPointX[i].resize(3);1230 m_expGvdPrincipalPointX[i].resize(3);1231 m_manGvdPrincipalPointX[i].resize(3);1232 m_signGvdPrincipalPointY[i].resize(3);1233 m_expGvdPrincipalPointY[i].resize(3);1234 m_manGvdPrincipalPointY[i].resize(3);1235 1236 m_signGvdR00[i].resize(3);1237 m_expGvdR00[i].resize(3);1238 m_manGvdR00[i].resize(3);1239 m_signGvdR01[i].resize(3);1240 m_expGvdR01[i].resize(3);1241 m_manGvdR01[i].resize(3);1242 m_signGvdR02[i].resize(3);1243 m_expGvdR02[i].resize(3);1244 m_manGvdR02[i].resize(3);1245 m_signGvdR10[i].resize(3);1246 m_expGvdR10[i].resize(3);1247 m_manGvdR10[i].resize(3);1248 m_signGvdR11[i].resize(3);1249 m_expGvdR11[i].resize(3);1250 m_manGvdR11[i].resize(3);1251 m_signGvdR12[i].resize(3);1252 m_expGvdR12[i].resize(3);1253 m_manGvdR12[i].resize(3);1254 m_signGvdR20[i].resize(3);1255 m_expGvdR20[i].resize(3);1256 m_manGvdR20[i].resize(3);1257 m_signGvdR21[i].resize(3);1258 m_expGvdR21[i].resize(3);1259 m_manGvdR21[i].resize(3);1260 m_signGvdR22[i].resize(3);1261 m_expGvdR22[i].resize(3);1262 m_manGvdR22[i].resize(3);1263 1264 m_signGvdTX[i].resize(3);1265 m_expGvdTX[i].resize(3);1266 m_manGvdTX[i].resize(3);1267 }1268 1269 }1270 1271 Bool m_alternativeDepthInfoCancelFlag;1272 Int m_depthType;1273 Int m_numConstituentViewsGvdMinus1;1274 Bool m_depthPresentGvdFlag;1275 Bool m_zGvdFlag;1276 Bool m_intrinsicParamGvdFlag;1277 Bool m_rotationGvdFlag;1278 Bool m_translationGvdFlag;1279 BoolAry2d m_signGvdZNearFlag;1280 IntAry2d m_expGvdZNear;1281 IntAry2d m_manLenGvdZNearMinus1;1282 IntAry2d m_manGvdZNear;1283 BoolAry2d m_signGvdZFarFlag;1284 IntAry2d m_expGvdZFar;1285 IntAry2d m_manLenGvdZFarMinus1;1286 IntAry2d m_manGvdZFar;1287 Int m_precGvdFocalLength;1288 Int m_precGvdPrincipalPoint;1289 Int m_precGvdRotationParam;1290 Int m_precGvdTranslationParam;1291 BoolAry2d m_signGvdFocalLengthX;1292 IntAry2d m_expGvdFocalLengthX;1293 IntAry2d m_manGvdFocalLengthX;1294 BoolAry2d m_signGvdFocalLengthY;1295 IntAry2d m_expGvdFocalLengthY;1296 IntAry2d m_manGvdFocalLengthY;1297 BoolAry2d m_signGvdPrincipalPointX;1298 IntAry2d m_expGvdPrincipalPointX;1299 IntAry2d m_manGvdPrincipalPointX;1300 BoolAry2d m_signGvdPrincipalPointY;1301 IntAry2d m_expGvdPrincipalPointY;1302 IntAry2d m_manGvdPrincipalPointY;1303 1304 BoolAry2d m_signGvdR00;1305 IntAry2d m_expGvdR00;1306 IntAry2d m_manGvdR00;1307 BoolAry2d m_signGvdR01;1308 IntAry2d m_expGvdR01;1309 IntAry2d m_manGvdR01;1310 BoolAry2d m_signGvdR02;1311 IntAry2d m_expGvdR02;1312 IntAry2d m_manGvdR02;1313 BoolAry2d m_signGvdR10;1314 IntAry2d m_expGvdR10;1315 IntAry2d m_manGvdR10;1316 BoolAry2d m_signGvdR11;1317 IntAry2d m_expGvdR11;1318 IntAry2d m_manGvdR11;1319 BoolAry2d m_signGvdR12;1320 IntAry2d m_expGvdR12;1321 IntAry2d m_manGvdR12;1322 BoolAry2d m_signGvdR20;1323 IntAry2d m_expGvdR20;1324 IntAry2d m_manGvdR20;1325 BoolAry2d m_signGvdR21;1326 IntAry2d m_expGvdR21;1327 IntAry2d m_manGvdR21;1328 BoolAry2d m_signGvdR22;1329 IntAry2d m_expGvdR22;1330 IntAry2d m_manGvdR22;1331 1332 BoolAry2d m_signGvdTX;1333 IntAry2d m_expGvdTX;1334 IntAry2d m_manGvdTX;1335 1336 Int m_minOffsetXInt;1337 Int m_minOffsetXFrac;1338 Int m_maxOffsetXInt;1339 Int m_maxOffsetXFrac;1340 Bool m_offsetYPresentFlag;1341 Int m_minOffsetYInt;1342 Int m_minOffsetYFrac;1343 Int m_maxOffsetYInt;1344 Int m_maxOffsetYFrac;1345 Bool m_warpMapSizePresentFlag;1346 Int m_warpMapWidthMinus2;1347 Int m_warpMapHeightMinus2;1348 };1349 1350 1131 #endif 1351 1132 #endif 1352 #endif1353 1133 1354 1134 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComCodingStatistics.h
r1386 r1390 81 81 STATS__CABAC_BITS__ESCAPE_BITS, 82 82 83 #if NH_3D_DBBP84 STATS__CABAC_BITS__DBBP_FLAG,85 #endif86 #if NH_3D_ARP87 STATS__CABAC_BITS__ARP_FLAG,88 #endif89 83 STATS__CABAC_BITS__SAO, 90 84 STATS__CABAC_TRM_BITS, … … 99 93 STATS__CABAC_BITS__ALIGNED_ESCAPE_BITS, 100 94 101 #if NH_3D_IC102 STATS__CABAC_BITS__3D_IC,103 #endif104 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER105 STATS__CABAC_BITS__DELTADC_SIGN_EP,106 STATS__CABAC_BITS__DELTADC_PREFIX,107 STATS__CABAC_BITS__DELTADC_SUFFIX_EP,108 #endif109 #if NH_3D_DMM110 STATS__CABAC_BITS__NOTDMM_FLAG,111 STATS__CABAC_BITS__DMMMODE,112 STATS__CABAC_BITS__DMM1_BITS_EP,113 #endif114 #if NH_3D_SDC_INTRA115 STATS__CABAC_BITS__SDC_INTRA_FLAG,116 STATS__CABAC_BITS__SDC_DELTADC_FLAG,117 #endif118 95 119 96 STATS__NUM_STATS … … 156 133 "CABAC_BITS__SIGN_BIT", 157 134 "CABAC_BITS__ESCAPE_BITS", 158 #if NH_3D_DBBP159 "CABAC_BITS__DBBP_FLAG",160 #endif161 135 "CABAC_BITS__SAO", 162 136 "CABAC_TRM_BITS", … … 171 145 "CABAC_BITS__ALIGNED_ESCAPE_BITS" 172 146 173 #if NH_3D_IC174 "CABAC_BITS__3D_IC"175 #endif176 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER177 ,"STATS__CABAC_BITS__DELTADC_SIGN_EP"178 ,"STATS__CABAC_BITS__DELTADC_PREFIX"179 ,"STATS__CABAC_BITS__DELTADC_SUFFIX_EP"180 #endif181 #if NH_3D_DMM182 ,"STATS__CABAC_BITS__NOTDMM_FLAG"183 ,"STATS__CABAC_BITS__DMMMODE"184 ,"STATS__CABAC_BITS__DMM1_BITS_EP"185 #endif186 #if NH_3D_SDC_INTRA187 ,"STATS__CABAC_BITS__SDC_INTRA_FLAG"188 ,"STATS__CABAC_BITS__SDC_DELTADC_FLAG"189 #endif190 147 }; 191 148 assert(STATS__NUM_STATS == sizeof(statNames)/sizeof(TChar *) && name < STATS__NUM_STATS); -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComDataCU.cpp
r1386 r1390 55 55 56 56 m_skipFlag = NULL; 57 #if NH_3D_DIS58 m_bDISFlag = NULL;59 m_ucDISType = NULL;60 #endif61 57 m_pePartSize = NULL; 62 58 m_pePredMode = NULL; … … 104 100 } 105 101 106 #if NH_3D_DMM107 for( Int i = 0; i < NUM_DMM; i++ )108 {109 m_dmmDeltaDC[i][0] = NULL;110 m_dmmDeltaDC[i][1] = NULL;111 }112 m_dmm1WedgeTabIdx = NULL;113 #endif114 #if NH_3D_SDC_INTRA115 m_pbSDCFlag = NULL;116 m_apSegmentDCOffset[0] = NULL;117 m_apSegmentDCOffset[1] = NULL;118 #endif119 102 120 103 m_bDecSubCu = false; 121 104 122 #if NH_3D_NBDV123 m_pDvInfo = NULL;124 #endif125 #if NH_3D_VSP126 m_piVSPFlag = NULL;127 #endif128 #if NH_3D_SPIVMP129 m_pbSPIVMPFlag = NULL;130 #endif131 #if NH_3D_ARP132 m_puhARPW = NULL;133 #endif134 #if NH_3D_IC135 m_pbICFlag = NULL;136 #endif137 #if NH_3D_DBBP138 m_pbDBBPFlag = NULL;139 #endif140 105 141 106 } … … 167 132 m_ChromaQpAdj = new UChar[ uiNumPartition ]; 168 133 m_skipFlag = new Bool[ uiNumPartition ]; 169 #if NH_3D_DIS170 m_bDISFlag = new Bool[ uiNumPartition ];171 m_ucDISType = (UChar*)xMalloc(UChar, uiNumPartition);172 #endif173 134 m_pePartSize = new SChar[ uiNumPartition ]; 174 135 memset( m_pePartSize, NUMBER_OF_PART_SIZES,uiNumPartition * sizeof( *m_pePartSize ) ); … … 178 139 m_pbMergeFlag = (Bool* )xMalloc(Bool, uiNumPartition); 179 140 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 180 #if NH_3D_VSP181 m_piVSPFlag = (SChar* )xMalloc(SChar, uiNumPartition);182 #endif183 #if NH_3D_SPIVMP184 m_pbSPIVMPFlag = (Bool* )xMalloc(Bool, uiNumPartition);185 #endif186 141 187 142 for (UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) … … 201 156 } 202 157 203 #if NH_3D_NBDV204 m_pDvInfo = (DisInfo* )xMalloc(DisInfo, uiNumPartition);205 #endif206 158 207 159 … … 242 194 } 243 195 244 #if NH_3D_ARP245 m_puhARPW = (UChar* )xMalloc(UChar, uiNumPartition);246 #endif247 #if NH_3D_IC248 m_pbICFlag = (Bool* )xMalloc(Bool, uiNumPartition);249 #endif250 #if NH_3D_DMM251 for( Int i = 0; i < NUM_DMM; i++ )252 {253 m_dmmDeltaDC[i][0] = (Pel* )xMalloc(Pel, uiNumPartition);254 m_dmmDeltaDC[i][1] = (Pel* )xMalloc(Pel, uiNumPartition);255 }256 m_dmm1WedgeTabIdx = (UInt*)xMalloc(UInt, uiNumPartition);257 #endif258 #if NH_3D_SDC_INTRA259 m_pbSDCFlag = (Bool*)xMalloc(Bool, uiNumPartition);260 m_apSegmentDCOffset[0] = (Pel*)xMalloc(Pel, uiNumPartition);261 m_apSegmentDCOffset[1] = (Pel*)xMalloc(Pel, uiNumPartition);262 #endif263 #if NH_3D_DBBP264 m_pbDBBPFlag = (Bool* )xMalloc(Bool, uiNumPartition);265 #endif266 196 267 197 } … … 319 249 } 320 250 321 #if NH_3D_DIS322 if ( m_bDISFlag ) { delete[] m_bDISFlag; m_bDISFlag = NULL; }323 if ( m_ucDISType ) { xFree(m_ucDISType); m_ucDISType = NULL; }324 #endif325 251 326 252 if ( m_pePartSize ) … … 360 286 } 361 287 362 #if NH_3D_VSP363 if ( m_piVSPFlag )364 {365 xFree(m_piVSPFlag);366 m_piVSPFlag = NULL;367 }368 #endif369 #if NH_3D_SPIVMP370 if ( m_pbSPIVMPFlag ) { xFree(m_pbSPIVMPFlag); m_pbSPIVMPFlag = NULL; }371 #endif372 288 373 289 … … 455 371 m_acCUMvField[rpl].destroy(); 456 372 } 457 #if NH_3D_NBDV 458 if ( m_pDvInfo ) { xFree(m_pDvInfo); m_pDvInfo = NULL; } 459 #endif 460 461 462 #if NH_3D_ARP 463 if ( m_puhARPW ) { xFree(m_puhARPW); m_puhARPW = NULL; } 464 #endif 465 #if NH_3D_IC 466 if ( m_pbICFlag ) { xFree(m_pbICFlag); m_pbICFlag = NULL; } 467 #endif 468 469 #if NH_3D_DMM 470 for( Int i = 0; i < NUM_DMM; i++ ) 471 { 472 if ( m_dmmDeltaDC[i][0] ) { xFree( m_dmmDeltaDC[i][0] ); m_dmmDeltaDC[i][0] = NULL; } 473 if ( m_dmmDeltaDC[i][1] ) { xFree( m_dmmDeltaDC[i][1] ); m_dmmDeltaDC[i][1] = NULL; } 474 } 475 if ( m_dmm1WedgeTabIdx ) { xFree( m_dmm1WedgeTabIdx ); m_dmm1WedgeTabIdx = NULL; } 476 #endif 477 #if NH_3D_SDC_INTRA 478 if ( m_pbSDCFlag ) { xFree(m_pbSDCFlag); m_pbSDCFlag = NULL; } 479 if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]); m_apSegmentDCOffset[0] = NULL; } 480 if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]); m_apSegmentDCOffset[1] = NULL; } 481 #endif 482 #if NH_3D_DBBP 483 if ( m_pbDBBPFlag ) { xFree(m_pbDBBPFlag); m_pbDBBPFlag = NULL; } 484 #endif 373 374 375 485 376 486 377 } … … 572 463 memset( m_skipFlag , false, m_uiNumPartition * sizeof( *m_skipFlag ) ); 573 464 574 #if NH_3D_DIS575 memset( m_bDISFlag , false, m_uiNumPartition * sizeof( *m_bDISFlag ) );576 memset( m_ucDISType , false, m_uiNumPartition * sizeof( *m_ucDISType ) );577 #endif578 465 579 466 memset( m_pePartSize , NUMBER_OF_PART_SIZES, m_uiNumPartition * sizeof( *m_pePartSize ) ); … … 585 472 memset( m_puhHeight , maxCUHeight, m_uiNumPartition * sizeof( *m_puhHeight ) ); 586 473 587 #if NH_3D_IC588 memset( m_pbICFlag , false, m_uiNumPartition * sizeof( *m_pbICFlag ) );589 #endif590 474 for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) 591 475 { … … 606 490 memset( m_puhMergeIndex , 0, m_uiNumPartition * sizeof( *m_puhMergeIndex ) ); 607 491 608 #if NH_3D_VSP609 memset( m_piVSPFlag , 0, m_uiNumPartition * sizeof( *m_piVSPFlag ) );610 #endif611 #if NH_3D_SPIVMP612 memset( m_pbSPIVMPFlag , 0, m_uiNumPartition * sizeof( *m_pbSPIVMPFlag ) );613 #endif614 #if NH_3D_SDC_INTRA615 memset( m_pbSDCFlag, false, m_uiNumPartition * sizeof( *m_pbSDCFlag ) );616 #endif617 #if NH_3D_DBBP618 memset( m_pbDBBPFlag , false, m_uiNumPartition * sizeof( *m_pbDBBPFlag ));619 #endif620 492 621 493 for (UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) … … 624 496 } 625 497 626 #if NH_3D_ARP 627 memset( m_puhARPW , 0, m_uiNumPartition * sizeof( *m_puhARPW ) ); 628 #endif 629 630 631 #if NH_3D_DMM 632 for( Int i = 0; i < NUM_DMM; i++ ) 633 { 634 memset( m_dmmDeltaDC[i][0], 0, m_uiNumPartition * sizeof( *m_dmmDeltaDC[i][0] ) ); 635 memset( m_dmmDeltaDC[i][1], 0, m_uiNumPartition * sizeof( *m_dmmDeltaDC[i][1] ) ); 636 } 637 memset( m_dmm1WedgeTabIdx, 0, m_uiNumPartition * sizeof( *m_dmm1WedgeTabIdx ) ); 638 #endif 639 #if NH_3D_SDC_INTRA 640 memset( m_pbSDCFlag, false, m_uiNumPartition * sizeof( *m_pbSDCFlag ) ); 641 memset( m_apSegmentDCOffset[0], 0, m_uiNumPartition * sizeof( *m_apSegmentDCOffset[0] ) ); 642 memset( m_apSegmentDCOffset[1], 0, m_uiNumPartition * sizeof( *m_apSegmentDCOffset[1] ) ); 643 #endif 498 499 644 500 645 501 memset( m_puhInterDir , 0, m_uiNumPartition * sizeof( *m_puhInterDir ) ); … … 743 599 } 744 600 m_skipFlag[ui] = false; 745 #if NH_3D_DIS746 m_bDISFlag[ui] = false;747 m_ucDISType[ui] = 0;748 #endif749 601 m_pePartSize[ui] = NUMBER_OF_PART_SIZES; 750 602 m_pePredMode[ui] = NUMBER_OF_PREDICTION_MODES; … … 755 607 m_pbMergeFlag[ui] = 0; 756 608 m_puhMergeIndex[ui] = 0; 757 #if NH_3D_VSP758 m_piVSPFlag[ui] = 0;759 #endif760 #if NH_3D_SPIVMP761 m_pbSPIVMPFlag[ui] = 0;762 #endif763 609 764 610 for (UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) … … 772 618 m_puhCbf[comp][ui] = 0; 773 619 } 774 #if NH_3D_ARP 775 m_puhARPW[ui] = 0; 776 #endif 777 #if NH_3D_IC 778 m_pbICFlag[ui] = false; 779 #endif 780 781 782 #if NH_3D_DMM 783 for( Int i = 0; i < NUM_DMM; i++ ) 784 { 785 m_dmmDeltaDC[i][0] [ui] = 0; 786 m_dmmDeltaDC[i][1] [ui] = 0; 787 } 788 m_dmm1WedgeTabIdx [ui] = 0; 789 #endif 790 #if NH_3D_SDC_INTRA 791 m_pbSDCFlag [ui] = false; 792 m_apSegmentDCOffset[0][ui] = 0; 793 m_apSegmentDCOffset[1][ui] = 0; 794 #endif 795 #if NH_3D_DBBP 796 m_pbDBBPFlag[ui] = false; 797 #endif 620 621 798 622 } 799 623 … … 849 673 memset( m_pbMergeFlag, 0, iSizeInBool ); 850 674 memset( m_puhMergeIndex, 0, iSizeInUchar ); 851 #if NH_3D_VSP852 memset( m_piVSPFlag, 0, sizeof( SChar ) * m_uiNumPartition );853 #endif854 #if NH_3D_SPIVMP855 memset( m_pbSPIVMPFlag, 0, sizeof( Bool ) * m_uiNumPartition );856 #endif857 675 858 676 for (UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) … … 876 694 memset( m_puhHeight, uhHeight, iSizeInUchar ); 877 695 memset( m_pbIPCMFlag, 0, iSizeInBool ); 878 #if NH_3D_ARP879 memset( m_puhARPW, 0, iSizeInUchar );880 #endif881 #if NH_3D_IC882 memset( m_pbICFlag, 0, iSizeInBool );883 #endif884 #if NH_3D_DMM885 for( Int i = 0; i < NUM_DMM; i++ )886 {887 memset( m_dmmDeltaDC[i][0], 0, sizeof(Pel ) * m_uiNumPartition );888 memset( m_dmmDeltaDC[i][1], 0, sizeof(Pel ) * m_uiNumPartition );889 }890 memset( m_dmm1WedgeTabIdx, 0, sizeof(UInt) * m_uiNumPartition );891 #endif892 #if NH_3D_SDC_INTRA893 memset( m_pbSDCFlag, 0, sizeof(Bool) * m_uiNumPartition );894 memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition );895 memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition );896 #endif897 #if NH_3D_DBBP898 memset( m_pbDBBPFlag, 0, sizeof(Bool) * m_uiNumPartition );899 #endif900 696 901 697 for (UInt ui = 0; ui < m_uiNumPartition; ui++) 902 698 { 903 699 m_skipFlag[ui] = false; 904 #if NH_3D_DIS905 m_bDISFlag[ui] = false;906 m_ucDISType[ui] = 0;907 #endif908 700 909 701 m_pePartSize[ui] = NUMBER_OF_PART_SIZES; … … 918 710 m_apiMVPNum[rpl][ui] = -1; 919 711 } 920 #if NH_3D_DIS921 m_bDISFlag[ui] = pcCU->getDISFlag(uiPartOffset+ui);922 m_ucDISType[ui] = pcCU->getDISType(uiPartOffset+ui);923 #endif924 #if NH_3D_VSP925 m_piVSPFlag[ui] = pcCU->m_piVSPFlag[uiPartOffset+ui];926 m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];927 #endif928 #if NH_3D_SPIVMP929 m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];930 #endif931 #if NH_3D_ARP932 m_puhARPW [ui] = pcCU->getARPW( uiPartOffset+ui );933 #endif934 #if NH_3D_IC935 m_pbICFlag [ui] = pcCU->m_pbICFlag[uiPartOffset+ui];936 #endif937 #if NH_3D_DMM938 for( Int i = 0; i < NUM_DMM; i++ )939 {940 m_dmmDeltaDC[i][0] [ui] = pcCU->m_dmmDeltaDC[i][0] [uiPartOffset+ui];941 m_dmmDeltaDC[i][1] [ui] = pcCU->m_dmmDeltaDC[i][1] [uiPartOffset+ui];942 }943 m_dmm1WedgeTabIdx [ui] = pcCU->m_dmm1WedgeTabIdx [uiPartOffset+ui];944 #endif945 #if NH_3D_SDC_INTRA946 m_pbSDCFlag [ui] = pcCU->m_pbSDCFlag [ uiPartOffset + ui ];947 m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0] [ uiPartOffset + ui ];948 m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ];949 #endif950 #if NH_3D_DBBP951 m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui];952 #endif953 712 } 954 713 … … 1009 768 1010 769 m_skipFlag=pcCU->getSkipFlag() + uiPart; 1011 #if NH_3D_DIS1012 m_bDISFlag = pcCU->getDISFlag() + uiPart;1013 m_ucDISType = pcCU->getDISType() + uiPart;1014 #endif1015 770 1016 771 m_phQP=pcCU->getQP() + uiPart; … … 1019 774 m_pePredMode=pcCU->getPredictionMode() + uiPart; 1020 775 m_CUTransquantBypass = pcCU->getCUTransquantBypass()+uiPart; 1021 #if NH_3D_NBDV1022 m_pDvInfo = pcCU->getDvInfo() + uiPart;1023 #endif1024 776 1025 777 m_pbMergeFlag = pcCU->getMergeFlag() + uiPart; 1026 778 m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; 1027 #if NH_3D_VSP1028 m_piVSPFlag = pcCU->getVSPFlag() + uiPart;1029 #endif1030 #if NH_3D_SPIVMP1031 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiPart;1032 #endif1033 #if NH_3D_ARP1034 m_puhARPW = pcCU->getARPW() + uiPart;1035 #endif1036 #if NH_3D_IC1037 m_pbICFlag = pcCU->getICFlag() + uiPart;1038 #endif1039 779 1040 780 for (UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) … … 1053 793 m_explicitRdpcmMode[comp] = pcCU->getExplicitRdpcmMode(ComponentID(comp)) + uiPart; 1054 794 } 1055 #if NH_3D_DMM1056 for( Int i = 0; i < NUM_DMM; i++ )1057 {1058 m_dmmDeltaDC[i][0] = pcCU->getDmmDeltaDC( (DmmID)i, 0 ) + uiPart;1059 m_dmmDeltaDC[i][1] = pcCU->getDmmDeltaDC( (DmmID)i, 1 ) + uiPart;1060 }1061 m_dmm1WedgeTabIdx = pcCU->getDmm1WedgeTabIdx() + uiPart;1062 #endif1063 #if NH_3D_SDC_INTRA1064 m_pbSDCFlag = pcCU->getSDCFlag() + uiPart;1065 m_apSegmentDCOffset[0] = pcCU->getSDCSegmentDCOffset(0) + uiPart;1066 m_apSegmentDCOffset[1] = pcCU->getSDCSegmentDCOffset(1) + uiPart;1067 #endif1068 #if NH_3D_DBBP1069 m_pbDBBPFlag = pcCU->getDBBPFlag() + uiPart;1070 #endif1071 795 1072 796 m_puhDepth=pcCU->getDepth() + uiPart; … … 1113 837 } 1114 838 1115 #if NH_3D_NBDV1116 Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx)1117 {1118 m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx;1119 }1120 #endif1121 839 1122 840 // Copy inter prediction info from the biggest CU 1123 #if NH_3D_NBDV1124 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList , Bool bNBDV )1125 #else1126 841 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ) 1127 #endif1128 842 { 1129 843 m_pcPic = pcCU->getPic(); … … 1147 861 1148 862 m_skipFlag = pcCU->getSkipFlag () + uiAbsPartIdx; 1149 #if NH_3D_DIS1150 m_bDISFlag = pcCU->getDISFlag () + uiAbsPartIdx;1151 m_ucDISType = pcCU->getDISType() + uiAbsPartIdx;1152 #endif1153 863 1154 864 m_pePartSize = pcCU->getPartitionSize () + uiAbsPartIdx; 1155 #if NH_3D_NBDV1156 if(bNBDV == true)1157 {1158 m_puhWidth = pcCU->getWidth () + uiAbsPartIdx;1159 m_puhHeight = pcCU->getHeight() + uiAbsPartIdx;1160 m_puhDepth = pcCU->getDepth () + uiAbsPartIdx;1161 }1162 else1163 {1164 #endif1165 865 m_pePredMode = pcCU->getPredictionMode() + uiAbsPartIdx; 1166 866 m_ChromaQpAdj = pcCU->getChromaQpAdj() + uiAbsPartIdx; … … 1174 874 m_pbMergeFlag = pcCU->getMergeFlag() + uiAbsPartIdx; 1175 875 m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; 1176 #if NH_3D_VSP1177 m_piVSPFlag = pcCU->getVSPFlag() + uiAbsPartIdx;1178 m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx;1179 #endif1180 #if NH_3D_SPIVMP1181 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiAbsPartIdx;1182 #endif1183 876 1184 877 m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx; 1185 878 m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx; 1186 #if NH_3D_ARP1187 m_puhARPW = pcCU->getARPW() + uiAbsPartIdx;1188 #endif1189 #if NH_3D_DBBP1190 m_pbDBBPFlag = pcCU->getDBBPFlag() + uiAbsPartIdx;1191 #endif1192 879 1193 880 m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx ); 1194 #if NH_3D_NBDV1195 }1196 #endif1197 #if NH_3D_IC1198 m_pbICFlag = pcCU->getICFlag() + uiAbsPartIdx;1199 #endif1200 881 1201 882 } … … 1221 902 Int sizeInChar = sizeof( SChar ) * uiNumPartition; 1222 903 memcpy( m_skipFlag + uiOffset, pcCU->getSkipFlag(), sizeof( *m_skipFlag ) * uiNumPartition ); 1223 #if NH_3D_DIS1224 memcpy( m_bDISFlag + uiOffset, pcCU->getDISFlag(), sizeof( *m_bDISFlag ) * uiNumPartition );1225 memcpy( m_ucDISType + uiOffset, pcCU->getDISType(), sizeof( *m_ucDISType ) * uiNumPartition);1226 #endif1227 904 memcpy( m_phQP + uiOffset, pcCU->getQP(), sizeInChar ); 1228 905 memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(), sizeof( *m_pePartSize ) * uiNumPartition ); … … 1232 909 memcpy( m_pbMergeFlag + uiOffset, pcCU->getMergeFlag(), iSizeInBool ); 1233 910 memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); 1234 #if NH_3D_VSP1235 memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( SChar ) * uiNumPartition );1236 memcpy( m_pDvInfo + uiOffset, pcCU->getDvInfo(), sizeof( *m_pDvInfo ) * uiNumPartition );1237 #endif1238 #if NH_3D_SPIVMP || NH_3D_DBBP1239 memcpy( m_pbSPIVMPFlag + uiOffset, pcCU->getSPIVMPFlag(), sizeof( Bool ) * uiNumPartition );1240 #endif1241 911 1242 912 for (UInt ch=0; ch<numValidChan; ch++) … … 1255 925 memcpy( m_explicitRdpcmMode[comp] + uiOffset, pcCU->getExplicitRdpcmMode(ComponentID(comp)) , iSizeInUchar ); 1256 926 } 1257 #if NH_3D_DMM1258 for( Int i = 0; i < NUM_DMM; i++ )1259 {1260 memcpy( m_dmmDeltaDC[i][0] + uiOffset, pcCU->getDmmDeltaDC( (DmmID)i, 0 ), sizeof(Pel ) * uiNumPartition );1261 memcpy( m_dmmDeltaDC[i][1] + uiOffset, pcCU->getDmmDeltaDC( (DmmID)i, 1 ), sizeof(Pel ) * uiNumPartition );1262 }1263 memcpy( m_dmm1WedgeTabIdx + uiOffset, pcCU->getDmm1WedgeTabIdx(), sizeof(UInt) * uiNumPartition );1264 #endif1265 #if NH_3D_SDC_INTRA1266 memcpy( m_pbSDCFlag + uiOffset, pcCU->getSDCFlag(), sizeof( *m_pbSDCFlag ) * uiNumPartition );1267 memcpy( m_apSegmentDCOffset[0] + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition);1268 memcpy( m_apSegmentDCOffset[1] + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition);1269 #endif1270 #if NH_3D_DBBP1271 memcpy( m_pbDBBPFlag + uiOffset, pcCU->getDBBPFlag(), iSizeInBool );1272 #endif1273 #if NH_3D_ARP1274 memcpy( m_puhARPW + uiOffset, pcCU->getARPW(), iSizeInUchar );1275 #endif1276 927 1277 928 memcpy( m_puhDepth + uiOffset, pcCU->getDepth(), iSizeInUchar ); … … 1314 965 } 1315 966 1316 #if NH_3D_IC1317 memcpy( m_pbICFlag + uiOffset, pcCU->getICFlag(), iSizeInBool );1318 #endif1319 967 1320 968 m_uiTotalBins += pcCU->getTotalBins(); … … 1338 986 1339 987 memcpy( pCtu->getSkipFlag() + m_absZIdxInCtu, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition ); 1340 #if NH_3D_DIS1341 memcpy( pCtu->getDISFlag() + m_absZIdxInCtu, m_bDISFlag, sizeof( *m_bDISFlag ) * m_uiNumPartition );1342 memcpy( pCtu->getDISType() + m_absZIdxInCtu, m_ucDISType, sizeof( *m_ucDISType ) * m_uiNumPartition );1343 #endif1344 988 1345 989 memcpy( pCtu->getQP() + m_absZIdxInCtu, m_phQP, sizeInChar ); 1346 #if NH_3D_NBDV1347 memcpy( pCtu->getDvInfo() + m_absZIdxInCtu, m_pDvInfo, sizeof(* m_pDvInfo) * m_uiNumPartition );1348 #endif1349 990 1350 991 memcpy( pCtu->getPartitionSize() + m_absZIdxInCtu, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition ); … … 1354 995 memcpy( pCtu->getMergeFlag() + m_absZIdxInCtu, m_pbMergeFlag, iSizeInBool ); 1355 996 memcpy( pCtu->getMergeIndex() + m_absZIdxInCtu, m_puhMergeIndex, iSizeInUchar ); 1356 #if NH_3D_VSP1357 memcpy( pCtu->getVSPFlag() + m_absZIdxInCtu, m_piVSPFlag, sizeof( SChar ) * m_uiNumPartition );1358 #endif1359 #if NH_3D_DBBP1360 memcpy( pCtu->getDvInfo() + m_absZIdxInCtu, m_pDvInfo, sizeof( *m_pDvInfo ) * m_uiNumPartition );1361 #endif1362 #if NH_3D_SPIVMP1363 memcpy( pCtu->getSPIVMPFlag() + m_absZIdxInCtu, m_pbSPIVMPFlag, sizeof( Bool ) * m_uiNumPartition );1364 #endif1365 997 1366 998 for (UInt ch=0; ch<numValidChan; ch++) … … 1380 1012 } 1381 1013 1382 #if NH_3D_DMM1383 for( Int i = 0; i < NUM_DMM; i++ )1384 {1385 memcpy( pCtu->getDmmDeltaDC( (DmmID)i, 0 ) + m_absZIdxInCtu, m_dmmDeltaDC[i][0], sizeof(Pel ) * m_uiNumPartition );1386 memcpy( pCtu->getDmmDeltaDC( (DmmID)i, 1 ) + m_absZIdxInCtu, m_dmmDeltaDC[i][1], sizeof(Pel ) * m_uiNumPartition );1387 }1388 memcpy( pCtu->getDmm1WedgeTabIdx() + m_absZIdxInCtu, m_dmm1WedgeTabIdx, sizeof(UInt) * m_uiNumPartition );1389 #endif1390 #if NH_3D_SDC_INTRA1391 memcpy( pCtu->getSDCFlag() + m_absZIdxInCtu, m_pbSDCFlag, sizeof(Bool) * m_uiNumPartition );1392 memcpy( pCtu->getSDCSegmentDCOffset(0) + m_absZIdxInCtu, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition);1393 memcpy( pCtu->getSDCSegmentDCOffset(1) + m_absZIdxInCtu, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition);1394 #endif1395 #if NH_3D_DBBP1396 memcpy( pCtu->getDBBPFlag() + m_absZIdxInCtu, m_pbDBBPFlag, iSizeInBool );1397 #endif1398 #if NH_3D_ARP1399 memcpy( pCtu->getARPW() + m_absZIdxInCtu, m_puhARPW, iSizeInUchar );1400 #endif1401 1014 1402 1015 memcpy( pCtu->getDepth() + m_absZIdxInCtu, m_puhDepth, iSizeInUchar ); … … 1432 1045 } 1433 1046 1434 #if NH_3D_IC1435 memcpy( pCtu->getICFlag() + m_absZIdxInCtu, m_pbICFlag, sizeof( *m_pbICFlag ) * m_uiNumPartition );1436 #endif1437 1047 pCtu->getTotalBins() = m_uiTotalBins; 1438 1048 } 1439 #if H_3D_SPIVMP1440 memcpy( rpcCU->getSPIVMPFlag() + uiPartOffset, m_pbSPIVMPFlag, sizeof(Bool) * uiQNumPart );1441 #endif1442 1049 1443 1050 … … 1842 1449 } 1843 1450 iLeftIntraDir = pcCULeft ? ( pcCULeft->isIntra( LeftPartIdx ) ? pcCULeft->getIntraDir( chType, LeftPartIdx ) : DC_IDX ) : DC_IDX; 1844 #if NH_3D_DMM1845 mapDmmToIntraDir( iLeftIntraDir );1846 #endif1847 1451 1848 1452 // Get intra direction of above PU … … 1854 1458 } 1855 1459 iAboveIntraDir = pcCUAbove ? ( pcCUAbove->isIntra( AbovePartIdx ) ? pcCUAbove->getIntraDir( chType, AbovePartIdx ) : DC_IDX ) : DC_IDX; 1856 #if NH_3D_DMM1857 mapDmmToIntraDir( iAboveIntraDir );1858 #endif1859 1460 1860 1461 … … 1990 1591 return uiCtx; 1991 1592 } 1992 #if NH_3D_ARP 1993 UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx ) 1994 { 1995 const TComDataCU* pcTempCU; 1996 UInt uiTempPartIdx; 1997 UInt uiCtx = 0; 1998 1999 pcTempCU = getPULeft( uiTempPartIdx, m_absZIdxInCtu + uiAbsPartIdx ); 2000 uiCtx = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0; 2001 return uiCtx; 2002 } 2003 #endif 2004 #if NH_3D_DBBP 2005 Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride) 2006 { 2007 const TComSPS* sps = getSlice()->getSPS(); 2008 UInt uiMaxCUWidth = sps->getMaxCUWidth(); 2009 UInt uiMaxCUHeight = sps->getMaxCUHeight(); 2010 2011 // get coded and reconstructed depth view 2012 TComPicYuv* depthPicYuv = NULL; 2013 Pel* pDepthPels = NULL; 2014 2015 // DBBP is a texture coding tool 2016 assert( !getSlice()->getIsDepth() ); 2017 2018 #if H_3D_FCO 2019 TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 2020 2021 if( depthPic && depthPic->getPicYuvRec() != NULL && depthPic->getIsDepth() ) // depth first 2022 { 2023 depthPicYuv = depthPic->getPicYuvRec(); 2024 depthPicYuv->extendPicBorder(); 2025 2026 // get collocated depth block for current CU 2027 uiDepthStride = depthPicYuv->getStride(); 2028 pDepthPels = depthPicYuv->getLumaAddr( getAddr(), uiAbsPartIdx ); 2029 } 2030 else // texture first 2031 #else 2032 { 2033 DisInfo DvInfo = getDvInfo(uiAbsPartIdx); 2034 2035 TComPic* baseDepthPic = getSlice()->getIvPic (true, DvInfo.m_aVIdxCan); 2036 2037 if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL ) 2038 { 2039 return NULL; 2040 } 2041 2042 depthPicYuv = baseDepthPic->getPicYuvRec(); 2043 depthPicYuv->extendPicBorder(); 2044 uiDepthStride = depthPicYuv->getStride(COMPONENT_Y); 2045 2046 Int iBlkX = ( getCtuRsAddr() % baseDepthPic->getFrameWidthInCtus() ) * uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCtu()+uiAbsPartIdx ] ]; 2047 Int iBlkY = ( getCtuRsAddr() / baseDepthPic->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCtu()+uiAbsPartIdx ] ]; 2048 2049 Int iPictureWidth = depthPicYuv->getWidth(COMPONENT_Y); 2050 Int iPictureHeight = depthPicYuv->getHeight(COMPONENT_Y); 2051 2052 2053 Bool depthRefineFlag = false; 2054 #if NH_3D_NBDV_REF 2055 depthRefineFlag = m_pcSlice->getDepthRefinementFlag(); 2056 #endif // NH_3D_NBDV_REF 2057 2058 TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV; 2059 if( depthRefineFlag ) 2060 { 2061 cDv.setVer(0); 2062 } 2063 2064 Int depthPosX = Clip3(0, iPictureWidth - 1, iBlkX + ((cDv.getHor()+2)>>2)); 2065 Int depthPosY = Clip3(0, iPictureHeight - 1, iBlkY + ((cDv.getVer()+2)>>2)); 2066 2067 pDepthPels = depthPicYuv->getAddr(COMPONENT_Y) + depthPosX + depthPosY * uiDepthStride; 2068 } 2069 #endif 2070 2071 AOF( depthPicYuv != NULL ); 2072 AOF( pDepthPels != NULL ); 2073 AOF( uiDepthStride != 0 ); 2074 2075 return pDepthPels; 2076 } 2077 #endif 2078 2079 #if NH_3D_DBBP 2080 Void TComDataCU::setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2081 { 2082 setSubPart( bDBBPFlag, m_pbDBBPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2083 } 2084 #endif 1593 2085 1594 2086 1595 … … 2170 1679 } 2171 1680 2172 #if NH_3D_DIS2173 Void TComDataCU::setDISFlagSubParts( Bool bDIS, UInt uiAbsPartIdx, UInt uiDepth )2174 {2175 assert( sizeof( *m_bDISFlag) == 1 );2176 memset( m_bDISFlag + uiAbsPartIdx, bDIS, m_pcPic->getNumPartitionsInCtu() >> ( 2 * uiDepth ) );2177 }2178 2179 Void TComDataCU::setDISTypeSubParts(UChar ucDISType, UInt uiAbsPartIdx, UInt uiDepth )2180 {2181 assert( sizeof( *m_ucDISType) == 1 );2182 memset( m_ucDISType + uiAbsPartIdx, ucDISType, m_pcPic->getNumPartitionsInCtu() >> ( 2 * uiDepth ) );2183 }2184 #endif2185 1681 2186 1682 Void TComDataCU::setPredModeSubParts( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ) … … 2336 1832 } 2337 1833 2338 #if NH_3D_SDC_INTRA2339 Void TComDataCU::setSDCFlagSubParts ( Bool bSDCFlag, UInt absPartIdx, UInt depth )2340 {2341 assert( sizeof( *m_pbSDCFlag) == 1 );2342 memset( m_pbSDCFlag + absPartIdx, bSDCFlag, m_pcPic->getNumPartitionsInCtu() >> ( 2 * depth ) );2343 }2344 2345 Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx )2346 {2347 if( getSlice()->getIsDepth() && isIntra(uiAbsPartIdx) && getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N )2348 {2349 UInt lumaPredMode = getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx );2350 if( lumaPredMode < NUM_INTRA_MODE ) { return true; }2351 #if NH_3D_DMM2352 if( isDmmMode( lumaPredMode ) ) { return true; }2353 #endif2354 }2355 return false;2356 }2357 #endif2358 1834 2359 1835 Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) … … 2367 1843 } 2368 1844 2369 #if NH_3D_SPIVMP 2370 Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2371 { 2372 setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2373 } 2374 #endif 2375 2376 #if NH_3D_VSP 2377 Void TComDataCU::setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2378 { 2379 setSubPart<SChar>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2380 } 2381 template<typename T> 2382 Void TComDataCU::setSubPartT( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ) 2383 { 2384 UInt uiCurrPartNumQ = (m_pcPic->getNumPartitionsInCtu() >> (2 * uiCUDepth)) >> 2; 2385 switch ( m_pePartSize[ uiCUAddr ] ) 2386 { 2387 case SIZE_2Nx2N: 2388 for (UInt ui = 0; ui < 4 * uiCurrPartNumQ; ui++) 2389 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2390 2391 break; 2392 case SIZE_2NxN: 2393 for (UInt ui = 0; ui < 2 * uiCurrPartNumQ; ui++) 2394 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2395 break; 2396 case SIZE_Nx2N: 2397 for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) 2398 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2399 for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) 2400 puhBaseLCU[uiCUAddr + 2 * uiCurrPartNumQ + ui] = uiParameter; 2401 break; 2402 case SIZE_NxN: 2403 for (UInt ui = 0; ui < uiCurrPartNumQ; ui++) 2404 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2405 break; 2406 case SIZE_2NxnU: 2407 if ( uiPUIdx == 0 ) 2408 { 2409 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2410 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2411 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2412 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; 2413 2414 } 2415 else if ( uiPUIdx == 1 ) 2416 { 2417 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2418 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2419 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1) + (uiCurrPartNumQ << 1); ui++) 2420 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; 2421 2422 } 2423 else 2424 { 2425 assert(0); 2426 } 2427 break; 2428 case SIZE_2NxnD: 2429 if ( uiPUIdx == 0 ) 2430 { 2431 for (UInt ui = 0; ui < ((uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1)); ui++) 2432 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2433 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2434 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + ui] = uiParameter; 2435 2436 } 2437 else if ( uiPUIdx == 1 ) 2438 { 2439 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2440 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2441 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 1); ui++) 2442 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + ui] = uiParameter; 2443 2444 } 2445 else 2446 { 2447 assert(0); 2448 } 2449 break; 2450 case SIZE_nLx2N: 2451 if ( uiPUIdx == 0 ) 2452 { 2453 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2454 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2455 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2456 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2457 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2458 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2459 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2460 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2461 2462 } 2463 else if ( uiPUIdx == 1 ) 2464 { 2465 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2466 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2467 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2468 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2469 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2470 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2471 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2472 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2473 2474 } 2475 else 2476 { 2477 assert(0); 2478 } 2479 break; 2480 case SIZE_nRx2N: 2481 if ( uiPUIdx == 0 ) 2482 { 2483 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2484 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2485 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2486 puhBaseLCU[uiCUAddr + uiCurrPartNumQ + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2487 for (UInt ui = 0; ui < (uiCurrPartNumQ + (uiCurrPartNumQ >> 2)); ui++) 2488 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2489 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2490 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + uiCurrPartNumQ + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2491 2492 } 2493 else if ( uiPUIdx == 1 ) 2494 { 2495 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2496 puhBaseLCU[uiCUAddr + ui] = uiParameter; 2497 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2498 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2499 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2500 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + ui] = uiParameter; 2501 for (UInt ui = 0; ui < (uiCurrPartNumQ >> 2); ui++) 2502 puhBaseLCU[uiCUAddr + (uiCurrPartNumQ << 1) + (uiCurrPartNumQ >> 1) + ui] = uiParameter; 2503 2504 } 2505 else 2506 { 2507 assert(0); 2508 } 2509 break; 2510 default: 2511 assert( 0 ); 2512 } 2513 2514 } 2515 #endif 1845 2516 1846 2517 1847 Void TComDataCU::setInterDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) … … 2599 1929 2600 1930 // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx 2601 #if NH_3D_IC || NH_3D_VSP2602 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU) const2603 {2604 UInt uiNumPartition = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition;2605 UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0;2606 2607 switch ( m_pePartSize[uiTmpAbsPartIdx] )2608 {2609 case SIZE_2NxN:2610 riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1;2611 break;2612 case SIZE_Nx2N:2613 riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2;2614 break;2615 case SIZE_NxN:2616 riWidth = getWidth( uiTmpAbsPartIdx ) >> 1; riHeight = getHeight( uiTmpAbsPartIdx ) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx;2617 break;2618 case SIZE_2NxnU:2619 riWidth = getWidth( uiTmpAbsPartIdx );2620 riHeight = ( uiPartIdx == 0 ) ? getHeight( uiTmpAbsPartIdx ) >> 2 : ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 );2621 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3;2622 break;2623 case SIZE_2NxnD:2624 riWidth = getWidth( uiTmpAbsPartIdx );2625 riHeight = ( uiPartIdx == 0 ) ? ( getHeight( uiTmpAbsPartIdx ) >> 2 ) + ( getHeight( uiTmpAbsPartIdx ) >> 1 ) : getHeight( uiTmpAbsPartIdx ) >> 2;2626 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3);2627 break;2628 case SIZE_nLx2N:2629 riWidth = ( uiPartIdx == 0 ) ? getWidth( uiTmpAbsPartIdx ) >> 2 : ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 );2630 riHeight = getHeight( uiTmpAbsPartIdx );2631 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4;2632 break;2633 case SIZE_nRx2N:2634 riWidth = ( uiPartIdx == 0 ) ? ( getWidth( uiTmpAbsPartIdx ) >> 2 ) + ( getWidth( uiTmpAbsPartIdx ) >> 1 ) : getWidth( uiTmpAbsPartIdx ) >> 2;2635 riHeight = getHeight( uiTmpAbsPartIdx );2636 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4);2637 break;2638 default:2639 assert ( m_pePartSize[uiTmpAbsPartIdx] == SIZE_2Nx2N );2640 riWidth = getWidth( uiTmpAbsPartIdx ); riHeight = getHeight( uiTmpAbsPartIdx ); ruiPartAddr = 0;2641 break;2642 }2643 }2644 #else2645 1931 2646 1932 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const … … 2683 1969 } 2684 1970 } 2685 #endif2686 1971 2687 1972 // static member function … … 2933 2218 } 2934 2219 2935 #if NH_3D 2936 Bool TComDataCU::hasEqualMotion( Int dirA, const TComMvField* mvFieldA, Int dirB, const TComMvField* mvFieldB ) 2937 { 2938 return ( dirA == dirB && 2939 ( ( dirA & 1 ) == 0 || mvFieldA[0] == mvFieldB[0] ) && 2940 ( ( dirA & 2 ) == 0 || mvFieldA[1] == mvFieldB[1] ) 2941 ); 2942 } 2943 #endif 2944 2945 #if NH_3D_VSP 2946 /** Add a VSP merging candidate 2947 * \Inputs 2948 * \param uiPUIdx: PU index within a CU 2949 * \param ucVspMergePos: Specify the VSP merge candidate position 2950 * \param mrgCandIdx: Target merge candidate index. At encoder, it is set equal to -1, such that the whole merge candidate list will be constructed. 2951 * \param pDinfo: The "disparity information" derived from neighboring blocks. Type 1 MV. 2952 * \param uiCount: The next position to add VSP merge candidate 2953 * 2954 * \Outputs 2955 * \param uiCount: The next position to add merge candidate. Will be updated if VSP is successfully added 2956 * \param abCandIsInter: abCandIsInter[iCount] tells that VSP candidate is an Inter candidate, if VSP is successfully added 2957 * \param pcMvFieldNeighbours: Return combined motion information, then stored to a global buffer 2958 * 1) the "disparity vector". Type 1 MV. To be used to fetch a depth block. 2959 * 2) the ref index /list. Type 2 reference picture pointer, typically for texture 2960 * \param puhInterDirNeighbours: Indicate the VSP prediction direction. 2961 * \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 2962 * 2963 * \Return 2964 * true: if the VSP candidate is added at the target position 2965 * false: otherwise 2966 */ 2967 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount) 2968 { 2969 if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getViewSynthesisPredFlag( ) || m_pcSlice->getIsDepth() || pDInfo->m_aVIdxCan == -1) 2970 { 2971 return false; 2972 } 2973 2974 Int refViewIdx = pDInfo->m_aVIdxCan; 2975 TComPic* picDepth = getSlice()->getIvPic( true, refViewIdx ); 2976 2977 if( picDepth == NULL ) // No depth reference avail 2978 { 2979 // Is this allowed to happen? When not an assertion should be added here! 2980 return false; 2981 } 2982 2983 TComMvField mvVSP[2]; 2984 UChar dirVSP; 2985 Bool refViewAvailFlag = false; 2986 UChar predFlag[2] = {0, 0}; 2987 2988 for( Int iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ ) 2989 { 2990 RefPicList eRefPicListX = RefPicList( iRefListIdX ); 2991 for ( Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicListX) && !refViewAvailFlag; i++ ) 2992 { 2993 Int viewIdxRefInListX = m_pcSlice->getRefPic(eRefPicListX, i)->getViewIndex(); 2994 if ( viewIdxRefInListX == refViewIdx ) 2995 { 2996 refViewAvailFlag = true; 2997 predFlag[iRefListIdX] = 1; 2998 mvVSP[0+iRefListIdX].setMvField( pDInfo->m_acNBDV, i ); 2999 #if NH_3D_NBDV 3000 mvVSP[0+iRefListIdX].getMv().setIDVFlag (false); 3001 #endif 3002 } 3003 } 3004 } 3005 3006 dirVSP = (predFlag[0] | (predFlag[1] << 1)); 3007 m_mergCands[MRG_VSP].setCand( mvVSP, dirVSP, true 3008 #if NH_3D_SPIVMP 3009 , false 3010 #endif 3011 ); 3012 if ( mrgCandIdx == iCount ) 3013 { 3014 return true; 3015 } 3016 3017 iCount++; 3018 3019 return false; 3020 } 3021 #endif 3022 3023 #if NH_3D_IV_MERGE 3024 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ) 3025 { 3026 for(Int iLoop = 0; iLoop < 2; iLoop ++ ) 3027 { 3028 /// iLoop = 0 --> IvMCShift 3029 /// iLoop = 1 --> IvDCShift (Derived from IvDC) 3030 if(ivCandDir[iLoop + 2]) 3031 { 3032 TComMvField tmpMV[2]; 3033 UChar tmpDir = ivCandDir[iLoop + 2]; 3034 if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) 3035 { 3036 tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3037 } 3038 if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) 3039 { 3040 tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3041 } 3042 3043 // Prune IvMC vs. IvMcShift 3044 Bool bRemove = false; 3045 if( !iLoop && ivCandDir[0] > 0) 3046 { 3047 if( hasEqualMotion(tmpDir, tmpMV, m_mergCands[MRG_IVMC].m_uDir, m_mergCands[MRG_IVMC].m_cMvField )) 3048 { 3049 bRemove = true; 3050 } 3051 } 3052 if(!bRemove) 3053 { 3054 #if NH_3D_NBDV 3055 if(iLoop) // For IvMcShift candidate 3056 { 3057 tmpMV[0].getMv().setIDVFlag (false); 3058 tmpMV[1].getMv().setIDVFlag (false); 3059 } 3060 #endif 3061 m_mergCands[MRG_IVSHIFT].setCand(tmpMV, tmpDir, false, false); 3062 if( mrgCandIdx == iCount ) 3063 { 3064 return true; 3065 } 3066 iCount++; 3067 } 3068 break; 3069 } 3070 } 3071 return false; 3072 } 3073 3074 #endif 3075 #if NH_3D_MLC 3076 /** Construct a extended list of merging candidates 3077 * \param pcMvFieldNeighbours 3078 * \param puhInterDirNeighbours 3079 * \param vspFlag 3080 * \param pbSPIVMPFlag 3081 * \param numValidMergeCand 3082 */ 3083 Void TComDataCU::buildMCL(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 3084 #if NH_3D_VSP 3085 , Int* vspFlag 3086 #endif 3087 #if NH_3D_SPIVMP 3088 , Bool* pbSPIVMPFlag 3089 #endif 3090 , Int& numValidMergeCand 3091 ) 3092 { 3093 if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0)) 3094 { 3095 return; 3096 } 3097 3098 3099 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 3100 if ( g_traceMergeCandListConst ) 3101 { 3102 for (Int i = 0; i<MRG_IVSHIFT+1; i++) 3103 { 3104 m_mergCands[i].print( i ); 3105 } 3106 } 3107 #endif 3108 3109 3110 Int iCount = 0; 3111 TComMv cZeroMv; 3112 3113 // init temporal list 3114 TComMvField extMergeCandList[MRG_MAX_NUM_CANDS_MEM << 1]; 3115 UChar uhInterDirNeighboursExt[MRG_MAX_NUM_CANDS_MEM]; 3116 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3117 { 3118 uhInterDirNeighboursExt[ui] = puhInterDirNeighbours[ui]; 3119 extMergeCandList[ui<<1].setMvField(cZeroMv, NOT_VALID); 3120 extMergeCandList[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID); 3121 #if NH_3D_VSP 3122 vspFlag[ui] = 0; 3123 #endif 3124 } 3125 3126 // insert MPI ... IvShift candidate to extMergeCandList 3127 for (Int i=0; i<=MRG_IVSHIFT; i++) 3128 { 3129 if (m_mergCands[i].m_bAvailable) 3130 { 3131 m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt 3132 #if NH_3D_VSP 3133 , vspFlag 3134 #endif 3135 #if NH_3D_SPIVMP 3136 , pbSPIVMPFlag 3137 #endif 3138 ); 3139 iCount++; 3140 if (iCount >= getSlice()->getMaxNumMergeCand()) 3141 break; 3142 } 3143 } 3144 3145 Int iCountBase = m_numSpatialCands; 3146 // insert remaining base candidates to extMergeCandList 3147 while (iCount < getSlice()->getMaxNumMergeCand() && iCountBase < getSlice()->getMaxNumMergeCand()) 3148 { 3149 uhInterDirNeighboursExt[iCount] = puhInterDirNeighbours[iCountBase]; 3150 extMergeCandList[iCount<<1].setMvField(pcMvFieldNeighbours[iCountBase<<1].getMv(), pcMvFieldNeighbours[iCountBase<<1].getRefIdx()); 3151 if ( getSlice()->isInterB() ) 3152 { 3153 extMergeCandList[(iCount<<1)+1].setMvField(pcMvFieldNeighbours[(iCountBase<<1)+1].getMv(), pcMvFieldNeighbours[(iCountBase<<1)+1].getRefIdx()); 3154 } 3155 iCountBase++; 3156 iCount++; 3157 } 3158 3159 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ ) 3160 { 3161 puhInterDirNeighbours[ui] = 0; 3162 pcMvFieldNeighbours[ui<<1].setMvField(cZeroMv, NOT_VALID); 3163 pcMvFieldNeighbours[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID); 3164 } 3165 3166 // copy extMergeCandList to output 3167 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ ) 3168 { 3169 puhInterDirNeighbours[ui] = uhInterDirNeighboursExt[ui]; 3170 pcMvFieldNeighbours[ui<<1].setMvField(extMergeCandList[ui<<1].getMv(), extMergeCandList[ui<<1].getRefIdx()); 3171 3172 if ( getSlice()->isInterB() ) 3173 { 3174 pcMvFieldNeighbours[(ui<<1)+1].setMvField(extMergeCandList[(ui<<1)+1].getMv(), extMergeCandList[(ui<<1)+1].getRefIdx()); 3175 } 3176 } 3177 3178 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 3179 if ( g_traceMergeCandListConst ) 3180 { 3181 std::cout << std::setfill(' ') << std::setw( 15 ) 3182 << "Num" << std::setw( 15 ) 3183 << "Dir " << std::setw( 15 ) 3184 << "L0 RefIdx" << std::setw( 15 ) 3185 << "L0 Hor" << std::setw( 15 ) 3186 << "L0 Ver" << std::setw( 15 ) 3187 << "L1 RefIdx" << std::setw( 15 ) 3188 << "L1 Hor" << std::setw( 15 ) 3189 << "L1 Ver" << std::setw( 15 ) 3190 << std::endl; 3191 3192 // copy extMergeCandList to output 3193 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ ) 3194 { 3195 UChar curDir = puhInterDirNeighbours[ui]; 3196 TComMvField& curf = pcMvFieldNeighbours[ui<<1]; 3197 TComMvField& curf2 = pcMvFieldNeighbours[(ui<<1)+1]; 3198 3199 std::cout << std::setfill(' ') << std::setw( 15 ) 3200 << ui << std::setw( 15 ) 3201 << (UInt) curDir << std::setw( 15 ) 3202 << ((curDir & 1) ? curf.getRefIdx() : MIN_INT) << std::setw( 15 ) 3203 << ((curDir & 1) ? curf.getMv().getHor() : MIN_INT) << std::setw( 15 ) 3204 << ((curDir & 1) ? curf.getMv().getVer() : MIN_INT) << std::setw( 15 ); 3205 3206 if ( getSlice()->isInterB() ) 3207 { 3208 std::cout << ((curDir & 2) ? curf2.getRefIdx() : MIN_INT) << std::setw( 15 ) 3209 << ((curDir & 1) ? curf2.getMv().getHor() : MIN_INT) << std::setw( 15 ) 3210 << ((curDir & 1) ? curf2.getMv().getVer() : MIN_INT) << std::setw( 15 ); 3211 } 3212 std::cout << std::endl; 3213 } 3214 } 3215 #endif 3216 numValidMergeCand = iCount; 3217 assert(iCount == getSlice()->getMaxNumMergeCand()); 3218 } 3219 3220 3221 3222 /** Derive 3D merge candidates 3223 * \param uiAbsPartIdx 3224 * \param uiPUIdx 3225 * \param pcMvFieldNeighbours 3226 * \param puhInterDirNeighbours 3227 * \param pcMvFieldSP 3228 * \param puhInterDirNeighbours 3229 * \param numValidMergeCand 3230 */ 3231 Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 3232 #if NH_3D_SPIVMP 3233 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP 3234 #endif 3235 , Int& numValidMergeCand, Int mrgCandIdx 3236 ) 3237 { 3238 #if NH_3D_IV_MERGE 3239 TComMv cZeroMv; 3240 TComMvField tmpMV[2]; 3241 #endif 3242 3243 ////////////////////////////////// 3244 //////// GET DISPARITIES //////// 3245 ////////////////////////////////// 3246 #if NH_3D_IV_MERGE 3247 DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); 3248 m_cDefaultDisInfo = cDisInfo; 3249 #elif NH_3D_VSP 3250 // for xAddVspCand() 3251 DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); 3252 #endif 3253 3254 if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0)) 3255 { 3256 return; 3257 } 3258 numValidMergeCand = getSlice()->getMaxNumMergeCand(); 3259 ////////////////////////////////// 3260 //////// DERIVE LOCATIONS //////// 3261 ////////////////////////////////// 3262 // compute the location of the current PU 3263 Int xP, yP, nPSW, nPSH; 3264 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 3265 3266 Int iCount = 0; 3267 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 3268 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 3269 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 3270 #if NH_3D_TEXT_MERGE 3271 Bool bMPIFlag = getSlice()->getMpiFlag(); 3272 Int tmpDir; 3273 #endif 3274 #if NH_3D_IV_MERGE || NH_3D_TEXT_MERGE 3275 Bool bIsDepth = getSlice()->getIsDepth(); 3276 #endif 3277 3278 #if NH_3D_IC 3279 Bool bICFlag = getICFlag(uiAbsPartIdx); 3280 #endif 3281 #if NH_3D_ARP 3282 Bool bARPFlag = getARPW(uiAbsPartIdx) > 0; 3283 #endif 3284 #if NH_3D_DBBP 3285 Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx); 3286 assert(bDBBPFlag == getDBBPFlag(0)); 3287 #endif 3288 3289 #if NH_3D_NBDV 3290 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 3291 { 3292 pcMFieldNeighbours[i<<1 ].getMv().setIDVFlag (false); 3293 pcMFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false); 3294 } 3295 #endif 3296 // init containers 3297 for (Int i = 0; i<MRG_IVSHIFT+1; i++) 3298 m_mergCands[i].init(); 3299 3300 m_numSpatialCands = 0; 3301 3302 ////////////////////////////////// 3303 ///////// GET VSP FLAGS ////////// 3304 ////////////////////////////////// 3305 //left 3306 UInt uiLeftPartIdx = 0; 3307 const TComDataCU* pcCULeft = 0; 3308 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3309 3310 if (getAvailableFlagA1()) 3311 { 3312 m_mergCands[MRG_A1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands] 3313 #if NH_3D_VSP 3314 , (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0 3315 #if NH_3D_IC 3316 && !bICFlag 3317 #endif 3318 #if NH_3D_ARP 3319 && !bARPFlag 3320 #endif 3321 #if NH_3D_DBBP 3322 && !bDBBPFlag 3323 #endif 3324 ) 3325 #endif 3326 #if NH_3D_SPIVMP 3327 , false 3328 #endif 3329 ); 3330 m_numSpatialCands++; 3331 } 3332 3333 // above 3334 if (getAvailableFlagB1()) 3335 { 3336 m_mergCands[MRG_B1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands] 3337 #if NH_3D_VSP 3338 , false 3339 #endif 3340 #if NH_3D_SPIVMP 3341 , false 3342 #endif 3343 ); 3344 m_numSpatialCands++; 3345 } 3346 3347 // above right 3348 if (getAvailableFlagB0()) 3349 { 3350 m_mergCands[MRG_B0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands] 3351 #if NH_3D_VSP 3352 , false 3353 #endif 3354 #if NH_3D_SPIVMP 3355 , false 3356 #endif 3357 ); 3358 m_numSpatialCands++; 3359 } 3360 3361 // left bottom 3362 if (getAvailableFlagA0()) 3363 { 3364 m_mergCands[MRG_A0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands] 3365 #if NH_3D_VSP 3366 , false 3367 #endif 3368 #if NH_3D_SPIVMP 3369 , false 3370 #endif 3371 ); 3372 m_numSpatialCands++; 3373 } 3374 3375 // above left 3376 if (getAvailableFlagB2()) 3377 { 3378 m_mergCands[MRG_B2].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands] 3379 #if NH_3D_VSP 3380 , false 3381 #endif 3382 #if NH_3D_SPIVMP 3383 , false 3384 #endif 3385 ); 3386 m_numSpatialCands++; 3387 } 3388 3389 3390 #if NH_3D_TEXT_MERGE 3391 3392 ///////////////////////////////////////////// 3393 //////// TEXTURE MERGE CANDIDATE (T) //////// 3394 ///////////////////////////////////////////// 3395 3396 bMPIFlag &= (nPSW + nPSH > 12); 3397 if( bMPIFlag) 3398 { 3399 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 3400 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 3401 tmpDir = 0; 3402 3403 Bool bSPIVMPFlag = false; 3404 3405 TComPic * pcTexPic = m_pcSlice->getTexturePic(); 3406 #if H_3D_FCO 3407 if (pcTexPic && pcTexPic->getReconMark()) 3408 { 3409 #endif 3410 TComPicYuv* pcTexRec = pcTexPic->getPicYuvRec (); 3411 UInt uiPartAddr; 3412 Int iWidth, iHeight; 3413 Int iCurrPosX, iCurrPosY; 3414 3415 this->getPartIndexAndSize( uiPUIdx, uiPartAddr, iWidth, iHeight ); 3416 pcTexRec->getTopLeftSamplePos( this->getCtuRsAddr(), this->getZorderIdxInCtu() + uiPartAddr, iCurrPosX, iCurrPosY ); 3417 3418 Int iPUWidth, iPUHeight, iNumPart, iNumPartLine; 3419 this->getSPPara(iWidth, iHeight, iNumPart, iNumPartLine, iPUWidth, iPUHeight); 3420 3421 for (Int i=0; i<iNumPart; i++) 3422 { 3423 puhInterDirSP[i] = 0; 3424 pcMvFieldSP[2*i].getMv().set(0, 0); 3425 pcMvFieldSP[2*i+1].getMv().set(0, 0); 3426 pcMvFieldSP[2*i].setRefIdx(-1); 3427 pcMvFieldSP[2*i+1].setRefIdx(-1); 3428 } 3429 3430 Int iTexCUAddr; 3431 Int iTexAbsPartIdx; 3432 TComDataCU* pcTexCU; 3433 Int iPartition = 0; 3434 Int iInterDirSaved = 0; 3435 TComMvField cMvFieldSaved[2]; 3436 3437 Int iOffsetX = iPUWidth/2;; 3438 Int iOffsetY = iPUHeight/2; 3439 3440 Int iTexPosX, iTexPosY; 3441 #if NH_3D_INTEGER_MV_DEPTH 3442 const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 3443 #endif 3444 Int iCenterPosX = iCurrPosX + ( ( iWidth / iPUWidth ) >> 1 ) * iPUWidth + ( iPUWidth >> 1 ); 3445 Int iCenterPosY = iCurrPosY + ( ( iHeight / iPUHeight ) >> 1 ) * iPUHeight + (iPUHeight >> 1); 3446 Int iTexCenterCUAddr, iTexCenterAbsPartIdx; 3447 3448 if(iWidth == iPUWidth && iHeight == iPUHeight) 3449 { 3450 iCenterPosX = iCurrPosX + (iWidth >> 1); 3451 iCenterPosY = iCurrPosY + (iHeight >> 1); 3452 } 3453 3454 // derivation of center motion parameters from the collocated texture CU 3455 3456 pcTexRec->getCUAddrAndPartIdx( iCenterPosX , iCenterPosY , iTexCenterCUAddr, iTexCenterAbsPartIdx ); 3457 TComDataCU* pcDefaultCU = pcTexPic->getCtu( iTexCenterCUAddr ); 3458 3459 if( pcDefaultCU->getPredictionMode( iTexCenterAbsPartIdx ) != MODE_INTRA ) 3460 { 3461 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 3462 { 3463 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 3464 3465 TComMvField cDefaultMvField; 3466 pcDefaultCU->getMvField( pcDefaultCU, iTexCenterAbsPartIdx, eCurrRefPicList, cDefaultMvField ); 3467 Int iDefaultRefIdx = cDefaultMvField.getRefIdx(); 3468 if (iDefaultRefIdx >= 0) 3469 { 3470 Int iDefaultRefPOC = pcDefaultCU->getSlice()->getRefPOC(eCurrRefPicList, iDefaultRefIdx); 3471 for (Int iRefPicList = 0; iRefPicList < m_pcSlice->getNumRefIdx( eCurrRefPicList ); iRefPicList++) 3472 { 3473 if (iDefaultRefPOC == m_pcSlice->getRefPOC(eCurrRefPicList, iRefPicList)) 3474 { 3475 bSPIVMPFlag = true; 3476 #if NH_3D_INTEGER_MV_DEPTH 3477 TComMv cMv = cDefaultMvField.getMv() + cMvRounding; 3478 cMv >>= 2; 3479 #else 3480 TComMv cMv = cDefaultMvField.getMv(); 3481 #endif 3482 cMvFieldSaved[eCurrRefPicList].setMvField(cMv, iRefPicList) ; 3483 break; 3484 } 3485 } 3486 } 3487 } 3488 } 3489 if ( bSPIVMPFlag == true ) 3490 { 3491 iInterDirSaved = (cMvFieldSaved[0].getRefIdx()!=-1 ? 1: 0) + (cMvFieldSaved[1].getRefIdx()!=-1 ? 2: 0); 3492 tmpDir = iInterDirSaved; 3493 tmpMV[0] = cMvFieldSaved[0]; 3494 tmpMV[1] = cMvFieldSaved[1]; 3495 } 3496 3497 if ( iInterDirSaved != 0 ) 3498 { 3499 for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iPUHeight) 3500 { 3501 for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iPUWidth) 3502 { 3503 iTexPosX = j + iOffsetX; 3504 iTexPosY = i + iOffsetY; 3505 pcTexRec->getCUAddrAndPartIdx( iTexPosX, iTexPosY, iTexCUAddr, iTexAbsPartIdx ); 3506 pcTexCU = pcTexPic->getCtu( iTexCUAddr ); 3507 3508 if( pcTexCU && !pcTexCU->isIntra(iTexAbsPartIdx) ) 3509 { 3510 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 3511 { 3512 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 3513 TComMvField cTexMvField; 3514 pcTexCU->getMvField( pcTexCU, iTexAbsPartIdx, eCurrRefPicList, cTexMvField ); 3515 Int iValidDepRef = getPic()->isTextRefValid( eCurrRefPicList, cTexMvField.getRefIdx() ); 3516 if( (cTexMvField.getRefIdx()>=0) && ( iValidDepRef >= 0 ) ) 3517 { 3518 #if NH_3D_INTEGER_MV_DEPTH 3519 TComMv cMv = cTexMvField.getMv() + cMvRounding; 3520 cMv >>=2; 3521 #else 3522 TComMv cMv = cTexMvField.getMv(); 3523 #endif 3524 pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iValidDepRef); 3525 } 3526 } 3527 } 3528 puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0); 3529 if (puhInterDirSP[iPartition] == 0) 3530 { 3531 if (iInterDirSaved != 0) 3532 { 3533 puhInterDirSP[iPartition] = iInterDirSaved; 3534 pcMvFieldSP[2*iPartition] = cMvFieldSaved[0]; 3535 pcMvFieldSP[2*iPartition + 1] = cMvFieldSaved[1]; 3536 } 3537 } 3538 3539 iPartition ++; 3540 } 3541 } 3542 } 3543 #if H_3D_FCO 3544 } 3545 #endif 3546 if( tmpDir != 0 ) 3547 { 3548 Int iCnloop = 0; 3549 for(iCnloop = 0; iCnloop < 2; iCnloop ++) 3550 { 3551 if ( !m_mergCands[MRG_A1+iCnloop].m_bAvailable ) // pruning to A1, B1 3552 { 3553 continue; 3554 } 3555 if (hasEqualMotion( tmpDir, tmpMV, m_mergCands[MRG_A1+iCnloop].m_uDir, m_mergCands[MRG_A1+iCnloop].m_cMvField ) ) 3556 { 3557 m_mergCands[MRG_A1+iCnloop].m_bAvailable = false; 3558 break; 3559 } 3560 } 3561 m_mergCands[MRG_T].setCand( tmpMV, tmpDir, false, bSPIVMPFlag); 3562 3563 if ( mrgCandIdx == iCount ) 3564 { 3565 return; 3566 } 3567 iCount ++; 3568 } 3569 } 3570 #endif 3571 3572 #if NH_3D_IV_MERGE 3573 ///////////////////////////////////////////////////////////////// 3574 //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC Candidates ///// 3575 ///////////////////////////////////////////////////////////////// 3576 3577 // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; 3578 // An enumerator would be appropriate here! 3579 TComMv ivCandMv [8]; 3580 Int ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; 3581 3582 // { IvMC, IvDC, IvMCShift, IvDCShift }; 3583 Int ivCandDir [4] = {0, 0, 0, 0}; 3584 3585 Bool ivMvPredFlag = getSlice()->getIvMvPredFlag(); 3586 3587 ivMvPredFlag &= (nPSW + nPSH > 12); 3588 if ( ivMvPredFlag && cDisInfo.m_aVIdxCan!=-1) 3589 { 3590 #if NH_3D_IC 3591 getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP, bICFlag ); 3592 #else 3593 getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP, false ); 3594 #endif 3595 } 3596 3597 /////////////////////////////////////////////// 3598 //////// INTER VIEW MOTION COMP(IvMC) ///////// 3599 /////////////////////////////////////////////// 3600 if( getSlice()->getIsDepth() ) 3601 { 3602 ivCandDir[1] = ivCandDir[2] = ivCandDir[3] = 0; 3603 } 3604 3605 if( ivCandDir[0] ) 3606 { 3607 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 3608 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 3609 3610 if( ( ivCandDir[0] & 1 ) == 1 ) 3611 { 3612 tmpMV[0].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 3613 } 3614 if( ( ivCandDir[0] & 2 ) == 2 ) 3615 { 3616 tmpMV[1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 3617 } 3618 3619 Bool bRemoveSpa = false; //pruning 3620 3621 if (!bIsDepth) 3622 { 3623 for(Int i = 0; i < 2; i ++) 3624 { 3625 if ( !m_mergCands[MRG_A1 + i].m_bAvailable ) // pruning to A1, B1 3626 { 3627 continue; 3628 } 3629 if (hasEqualMotion(ivCandDir[0], tmpMV, m_mergCands[MRG_A1+i].m_uDir, m_mergCands[MRG_A1+i].m_cMvField) ) 3630 { 3631 m_mergCands[MRG_A1+i].m_bAvailable = false; 3632 break; 3633 } 3634 } 3635 } 3636 else 3637 { 3638 if( hasEqualMotion( ivCandDir[0], tmpMV, m_mergCands[MRG_T].m_uDir, m_mergCands[MRG_T].m_cMvField ) ) 3639 { 3640 bRemoveSpa = true; 3641 } 3642 } 3643 if (!bRemoveSpa) 3644 { 3645 Bool spiMvpFlag = false; 3646 if(!m_pcSlice->getIsDepth()) 3647 { 3648 spiMvpFlag = true; 3649 } 3650 #if NH_3D_DBBP 3651 spiMvpFlag &= !bDBBPFlag; 3652 #endif 3653 3654 m_mergCands[MRG_IVMC].setCand( tmpMV, ivCandDir[0], false, spiMvpFlag); 3655 3656 if ( mrgCandIdx == iCount ) 3657 { 3658 return; 3659 } 3660 iCount ++; 3661 } 3662 } 3663 3664 // early termination 3665 if (iCount == getSlice()->getMaxNumMergeCand()) 3666 { 3667 return; 3668 } 3669 #endif 3670 3671 iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable; 3672 3673 #if NH_3D_VSP 3674 ///////////////////////////////////////////////// 3675 //////// VIEW SYNTHESIS PREDICTION (VSP) //////// 3676 ///////////////////////////////////////////////// 3677 if (iCount<getSlice()->getMaxNumMergeCand()) 3678 { 3679 if ( 3680 (!getAvailableFlagA1() || !(pcCULeft->getVSPFlag(uiLeftPartIdx) != 0)) && 3681 #if NH_3D_IC 3682 !bICFlag && 3683 #endif 3684 #if NH_3D_ARP 3685 !bARPFlag && 3686 #endif 3687 #if NH_3D 3688 (nPSW + nPSH > 12) && 3689 #endif 3690 #if NH_3D_DBBP 3691 !bDBBPFlag && 3692 #endif 3693 xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) ) 3694 { 3695 return; 3696 } 3697 3698 // early termination 3699 if (iCount == getSlice()->getMaxNumMergeCand()) 3700 { 3701 return; 3702 } 3703 } 3704 #endif 3705 3706 iCount += m_mergCands[MRG_B0].m_bAvailable; 3707 3708 #if NH_3D_IV_MERGE 3709 ///////////////////////////////////////////// 3710 //////// INTER VIEW DISP COMP (IvDC) //////// 3711 ///////////////////////////////////////////// 3712 if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() ) 3713 { 3714 assert(iCount < getSlice()->getMaxNumMergeCand()); 3715 3716 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 3717 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 3718 if( ( ivCandDir[1] & 1 ) == 1 ) 3719 { 3720 tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 3721 } 3722 if( ( ivCandDir[1] & 2 ) == 2 ) 3723 { 3724 tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 3725 } 3726 3727 Bool bRemoveSpa = false; //pruning to A1, B1 3728 for(Int i = 0; i < 2; i ++) 3729 { 3730 if ( !m_mergCands[MRG_A1+i].m_bAvailable ) 3731 { 3732 continue; 3733 } 3734 if ( hasEqualMotion(ivCandDir[1], tmpMV, m_mergCands[MRG_A1+i].m_uDir, m_mergCands[MRG_A1+i].m_cMvField) ) 3735 { 3736 bRemoveSpa = true; 3737 break; 3738 } 3739 } 3740 if(!bRemoveSpa) 3741 { 3742 #if NH_3D_NBDV 3743 tmpMV[0].getMv().setIDVFlag (false); 3744 tmpMV[1].getMv().setIDVFlag (false); 3745 #endif 3746 m_mergCands[MRG_IVDC].setCand( tmpMV, ivCandDir[1], false, false); 3747 3748 if ( mrgCandIdx == iCount ) 3749 return; 3750 iCount ++; 3751 3752 // early termination 3753 if (iCount == getSlice()->getMaxNumMergeCand()) 3754 { 3755 return; 3756 } 3757 } 3758 } 3759 #endif // H_3D_IV_MERGE 3760 3761 iCount += m_mergCands[MRG_A0].m_bAvailable + m_mergCands[MRG_B2].m_bAvailable; 3762 3763 #if NH_3D_IV_MERGE 3764 //////////////////////////////////////////////////// 3765 //////// SHIFTED IV (IvMCShift + IvDCShift) //////// 3766 //////////////////////////////////////////////////// 3767 if( ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() ) 3768 { 3769 if(xAddIvMRGCand( mrgCandIdx, iCount, ivCandDir, ivCandMv, ivCandRefIdx ) ) 3770 { 3771 return; 3772 } 3773 //early termination 3774 if (iCount == getSlice()->getMaxNumMergeCand()) 3775 { 3776 return; 3777 } 3778 } 3779 #endif 3780 } 3781 #endif 2220 2221 3782 2222 3783 2223 //! Construct a list of merging candidates 3784 #if NH_3D3785 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )3786 #else3787 2224 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) const 3788 #endif3789 2225 { 3790 2226 UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx; 3791 #if NH_3D_MLC3792 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];3793 #else3794 2227 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 3795 #endif3796 2228 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3797 2229 { … … 3823 2255 if ( isAvailableA1 ) 3824 2256 { 3825 #if NH_3D_MLC3826 m_bAvailableFlagA1 = 1;3827 #endif3828 2257 abCandIsInter[iCount] = true; 3829 2258 // get Inter Dir … … 3858 2287 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 3859 2288 { 3860 #if NH_3D_MLC3861 m_bAvailableFlagB1 = 1;3862 #endif3863 2289 abCandIsInter[iCount] = true; 3864 2290 // get Inter Dir … … 3892 2318 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 3893 2319 { 3894 #if NH_3D_MLC3895 m_bAvailableFlagB0 = 1;3896 #endif3897 2320 abCandIsInter[iCount] = true; 3898 2321 // get Inter Dir … … 3926 2349 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 3927 2350 { 3928 #if NH_3D_MLC3929 m_bAvailableFlagA0 = 1;3930 #endif3931 2351 abCandIsInter[iCount] = true; 3932 2352 // get Inter Dir … … 3963 2383 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 3964 2384 { 3965 #if NH_3D_MLC3966 m_bAvailableFlagB2 = 1;3967 #endif3968 2385 abCandIsInter[iCount] = true; 3969 2386 // get Inter Dir … … 4047 2464 if ( getSlice()->isInterB() ) 4048 2465 { 4049 #if NH_3D_TMVP4050 iRefIdx = 0;4051 #endif4052 2466 bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_1, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx); 4053 2467 if( bExistMV == false ) … … 4066 2480 puhInterDirNeighbours[uiArrayAddr] = dir; 4067 2481 abCandIsInter[uiArrayAddr] = true; 4068 #if NH_3D_NBDV4069 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false);4070 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);4071 #endif4072 2482 4073 2483 if ( mrgCandIdx == iCount ) … … 4087 2497 UInt uiCutoff = uiArrayAddr; 4088 2498 4089 #if NH_3D_MLC4090 if ( getSlice()->isInterB() && iCount<5)4091 #else4092 2499 if ( getSlice()->isInterB() ) 4093 #endif4094 2500 { 4095 2501 static const UInt NUM_PRIORITY_LIST=12; … … 4334 2740 const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth(); 4335 2741 const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight(); 4336 #if NH_3D_TMVP4337 Int refIdx_Col = refIdx;4338 #else4339 2742 const Int refIdx_Col = refIdx; 4340 #endif4341 2743 TComMv cColMv; 4342 2744 UInt partIdxRB; … … 4372 2774 } 4373 2775 } 4374 #if NH_3D_TMVP4375 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col , 0 ) )4376 #else4377 2776 if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, absPartAddr, cColMv, refIdx_Col ) ) 4378 #endif4379 2777 { 4380 2778 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 4384 2782 UInt uiPartIdxCenter; 4385 2783 xDeriveCenterIdx( partIdx, uiPartIdxCenter ); 4386 #if NH_3D_TMVP4387 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, refIdx_Col , 0 ))4388 #else4389 2784 if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter, cColMv, refIdx_Col )) 4390 #endif4391 2785 { 4392 2786 pInfo->m_acMvCand[pInfo->iN++] = cColMv; … … 4411 2805 UInt partAddr; 4412 2806 4413 #if NH_3D_DBBP4414 if( getDBBPFlag(0) )4415 {4416 return true;4417 }4418 #endif4419 2807 4420 2808 getPartIndexAndSize( puIdx, partAddr, width, height ); … … 4431 2819 const TComSPS &sps=*(m_pcSlice->getSPS()); 4432 2820 Int iMvShift = 2; 4433 #if NH_3D_INTEGER_MV_DEPTH4434 if( getSlice()->getIsDepth() )4435 iMvShift = 0;4436 #endif4437 2821 4438 2822 Int iOffset = 8; … … 4663 3047 } 4664 3048 4665 #if NH_3D_TMVP4666 Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG ) const4667 #else4668 3049 Bool TComDataCU::xGetColMVP( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const 4669 #endif4670 3050 { 4671 3051 const UInt absPartAddr = partUnitIdx; … … 4698 3078 } 4699 3079 4700 #if NH_3D_TMVP4701 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm();4702 #else4703 3080 const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm(); 4704 #endif4705 3081 const Bool bIsColRefLongTerm = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx); 4706 3082 4707 3083 if ( bIsCurrRefLongTerm != bIsColRefLongTerm ) 4708 3084 { 4709 #if NH_3D_TMVP4710 Int iAlterRefIdx = m_pcSlice->getAlterRefIdx(eRefPicList);4711 if(bMRG && iAlterRefIdx > 0)4712 {4713 refIdx = iAlterRefIdx;4714 bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm();4715 assert(bIsCurrRefLongTerm == bIsColRefLongTerm);4716 }4717 else4718 {4719 #endif4720 3085 return false; 4721 #if NH_3D_TMVP4722 }4723 #endif4724 3086 } 4725 3087 // Scale the vector. 4726 3088 const TComMv &cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(absPartAddr); 4727 3089 4728 #if NH_3D_TMVP4729 if ( bIsCurrRefLongTerm || bIsColRefLongTerm )4730 #else4731 3090 if ( bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/ ) 4732 #endif 4733 { 4734 #if NH_3D_TMVP 4735 const Int iCurrViewId = m_pcSlice->getViewId (); 4736 const Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, refIdx)->getViewId (); 4737 const Int iColViewId = pColCtu->getSlice()->getViewId(); 4738 const Int iColRefViewId = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(absPartAddr))->getViewId(); 4739 Int scale = 4096; 4740 if ( iCurrRefViewId != iCurrViewId && iColViewId != iColRefViewId ) 4741 { 4742 scale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId ); 4743 } 4744 if ( bMRG && scale != 4096 && m_pcSlice->getIvMvScalingFlag( ) ) 4745 { 4746 rcMv = cColMv.scaleMv( scale ); 4747 } 4748 else 4749 { 4750 #endif 3091 { 4751 3092 rcMv = cColMv; 4752 #if NH_3D_TMVP4753 }4754 #endif4755 3093 } 4756 3094 else … … 4807 3145 } 4808 3146 4809 #if NH_3D4810 Void TComDataCU::compressMV(Int scale)4811 {4812 Int scaleFactor = (4 / scale ) * AMVP_DECIMATION_FACTOR / m_unitSize;4813 #else4814 3147 Void TComDataCU::compressMV() 4815 3148 { 4816 3149 Int scaleFactor = 4 * AMVP_DECIMATION_FACTOR / m_unitSize; 4817 #endif4818 3150 if (scaleFactor > 0) 4819 3151 { … … 4824 3156 } 4825 3157 } 4826 #if NH_3D4827 Void TComDataCU::printMV( )4828 {4829 4830 for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++)4831 {4832 std::cout << "L" << i;4833 m_acCUMvField[i].print(m_pePredMode);4834 }4835 4836 }4837 #endif4838 3158 4839 3159 UInt TComDataCU::getCoefScanIdx(const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) const … … 4867 3187 4868 3188 UInt uiDirMode = getIntraDir(toChannelType(compID), uiAbsPartIdx); 4869 #if NH_3D_DMM4870 mapDmmToIntraDir( uiDirMode );4871 #endif4872 3189 4873 3190 if (uiDirMode==DM_CHROMA_IDX) … … 4876 3193 const UInt partsPerMinCU = 1<<(2*(sps->getMaxTotalCUDepth() - sps->getLog2DiffMaxMinCodingBlockSize())); 4877 3194 uiDirMode = getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, getPic()->getChromaFormat(), partsPerMinCU)); 4878 #if NH_3D_DMM4879 mapDmmToIntraDir( uiDirMode );4880 #endif4881 3195 } 4882 3196 … … 4902 3216 } 4903 3217 4904 #if NH_3D_VSO 4905 Void TComDataCU::getPosInPic( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) const 4906 { 4907 riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX(); 4908 riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 4909 } 4910 #endif 4911 4912 #if NH_3D_IV_MERGE 4913 Void TComDataCU::getDispforDepth (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp) 4914 { 4915 assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N); 4916 4917 TComMv cMv; 4918 if ( getSlice()->getDefaultRefViewIdxAvailableFlag() ) 4919 { 4920 Int iViewIdx = getSlice()->getDefaultRefViewIdx(); 4921 pDisp->m_aVIdxCan = iViewIdx; 4922 Int iDisp = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 )) ]; 4923 4924 cMv.setHor(iDisp); 4925 cMv.setVer(0); 4926 pDisp->m_acNBDV = cMv; 4927 pDisp->m_aVIdxCan = iViewIdx; 4928 } 4929 } 4930 #endif 4931 4932 #if NH_3D_DIS 4933 Bool TComDataCU::getNeighDepth ( UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index ) 4934 { 4935 assert(uiPartIdx==0); 4936 const UInt uiPartIdxLT = getZorderIdxInCtu() + uiPartAddr; 4937 const Int iPartIdxStride = getPic()->getNumPartInCtuWidth(); 4938 4939 UInt uiMidPart, uiPartNeighbor; 4940 const TComDataCU* pcCUNeighbor; 4941 Bool bDepAvail = false; 4942 Pel *pDepth = this->getPic()->getPicYuvRec()->getAddr(COMPONENT_Y); 4943 Int iDepStride = this->getPic()->getPicYuvRec()->getStride(COMPONENT_Y); 4944 4945 Int xP, yP, nPSW, nPSH; 4946 this->getPartPosition( uiPartIdx, xP, yP, nPSW, nPSH ); 4947 4948 switch( index ) 4949 { 4950 case 0: // Mid Left 4951 uiMidPart = g_auiZscanToRaster[uiPartIdxLT] + (nPSH>>1) / this->getPic()->getMinCUHeight() * iPartIdxStride; 4952 pcCUNeighbor = this->getPULeft( uiPartNeighbor, g_auiRasterToZscan[uiMidPart] ); 4953 if ( pcCUNeighbor ) 4954 { 4955 if( !this->getSlice()->getPPS()->getConstrainedIntraPred() ) 4956 { 4957 *pNeighDepth = pDepth[ (yP+(nPSH>>1)) * iDepStride + (xP-1) ]; 4958 bDepAvail = true; 4959 } 4960 else if ( pcCUNeighbor->getPredictionMode( uiPartNeighbor ) == MODE_INTRA ) 4961 { 4962 *pNeighDepth = pDepth[ (yP+(nPSH>>1)) * iDepStride + (xP-1) ]; 4963 bDepAvail = true; 4964 } 4965 } 4966 break; 4967 case 1: // Mid Above 4968 uiMidPart = g_auiZscanToRaster[uiPartIdxLT] + (nPSW>>1) / this->getPic()->getMinCUWidth(); 4969 pcCUNeighbor = this->getPUAbove( uiPartNeighbor, g_auiRasterToZscan[uiMidPart] ); 4970 if( pcCUNeighbor ) 4971 { 4972 if( !this->getSlice()->getPPS()->getConstrainedIntraPred() ) 4973 { 4974 *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP + (nPSW>>1)) ]; 4975 bDepAvail = true; 4976 } 4977 else if ( pcCUNeighbor->getPredictionMode( uiPartNeighbor ) == MODE_INTRA ) 4978 { 4979 *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP + (nPSW>>1)) ]; 4980 bDepAvail = true; 4981 } 4982 } 4983 break; 4984 default: 4985 break; 4986 } 4987 4988 return bDepAvail; 4989 } 4990 #endif 4991 #if NH_3D_NBDV 4992 //Notes from QC: 4993 //TBD#1: DoNBDV related contributions are just partially integrated under the marco of NH_3D_NBDV_REF, remove this comment once DoNBDV and BVSP are done 4994 //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 4995 //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 4996 Void TComDataCU::getDisMvpCandNBDV( DisInfo* pDInfo 4997 #if NH_3D_NBDV_REF 4998 , Bool bDepthRefine 4999 #endif 5000 ) 5001 { 5002 //// ******* Init variables ******* ///// 5003 // Init disparity struct for results 5004 pDInfo->m_aVIdxCan = -1; 5005 5006 // Init struct for disparities from MCP neighboring blocks 5007 IDVInfo cIDVInfo; 5008 cIDVInfo.m_bFound = false; 5009 UInt uiPartIdx = 0; 5010 UInt uiPartAddr = 0; 5011 for (UInt iCurDvMcpCand = 0; iCurDvMcpCand < IDV_CANDS; iCurDvMcpCand++) 5012 { 5013 for (UInt iList = 0; iList < 2; iList++) 5014 { 5015 cIDVInfo.m_acMvCand[iList][iCurDvMcpCand].setZero(); 5016 cIDVInfo.m_aVIdxCan[iList][iCurDvMcpCand] = 0; 5017 cIDVInfo.m_bAvailab[iList][iCurDvMcpCand] = false; 5018 } 5019 } 5020 #if NH_3D_NBDV_REF 5021 if( !m_pcSlice->getDepthRefinementFlag( ) ) 5022 { 5023 bDepthRefine = false; 5024 } 5025 #endif 5026 // Get Positions 5027 PartSize eCUMode = getPartitionSize( uiPartAddr ); 5028 assert(eCUMode == SIZE_2Nx2N); 5029 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 5030 5031 deriveLeftRightTopIdxGeneral(uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT ); 5032 deriveLeftBottomIdxGeneral (uiPartAddr, uiPartIdx, uiPartIdxLB ); 5033 5034 //// ******* Get disparity from temporal neighboring blocks ******* ///// 5035 if ( getSlice()->getEnableTMVPFlag() ) 5036 { 5037 TComMv cColMv; 5038 Int iTargetViewIdx = 0; 5039 Int iTStartViewIdx = 0; 5040 5041 ///*** Derive center position *** 5042 UInt uiPartIdxCenter; 5043 Int uiLCUIdx = getCtuRsAddr(); 5044 xDeriveCenterIdx(uiPartIdx, uiPartIdxCenter ); 5045 5046 ///*** Search temporal candidate pictures for disparity vector *** 5047 const Int iNumCandPics = getPic()->getNumDdvCandPics(); 5048 for(Int curCandPic = 0; curCandPic < iNumCandPics; curCandPic++) 5049 { 5050 RefPicList eCurRefPicList = REF_PIC_LIST_0 ; 5051 Int curCandPicRefIdx = 0; 5052 if( curCandPic == 0 ) 5053 { 5054 eCurRefPicList = RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0); 5055 curCandPicRefIdx = getSlice()->getColRefIdx(); 5056 } 5057 else 5058 { 5059 eCurRefPicList = getPic()->getRapRefList(); 5060 curCandPicRefIdx = getPic()->getRapRefIdx(); 5061 } 5062 5063 Bool bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, uiLCUIdx, uiPartIdxCenter, cColMv, iTargetViewIdx, iTStartViewIdx ); 5064 5065 if( bCheck ) 5066 { 5067 pDInfo->m_acNBDV = cColMv; 5068 pDInfo->m_aVIdxCan = iTargetViewIdx; 5069 5070 #if NH_3D_NBDV_REF 5071 TComPic* picDepth = NULL; 5072 #if H_3D_FCO 5073 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 5074 if ( picDepth->getPicYuvRec() != NULL ) 5075 { 5076 cColMv.setZero(); 5077 } 5078 else // Go back with virtual depth 5079 { 5080 picDepth = getSlice()->getIvPic( true, iTargetViewIdx ); 5081 } 5082 5083 assert(picDepth != NULL); 5084 #else 5085 picDepth = getSlice()->getIvPic( true, iTargetViewIdx ); 5086 #endif 5087 if (picDepth && bDepthRefine) 5088 { 5089 estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv ); 5090 } 5091 pDInfo->m_acDoNBDV = cColMv; 5092 #endif //NH_3D_NBDV_REF 5093 return; 5094 } 5095 } 5096 } 5097 5098 UInt uiIdx = 0; 5099 Bool bCheckMcpDv = false; 5100 const TComDataCU* pcTmpCU = NULL; 5101 5102 //// ******* Get disparity from left block ******* ///// 5103 #if NH_3D_FIX_TICKET_91 5104 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB); 5105 #else 5106 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); 5107 #endif 5108 bCheckMcpDv = true; 5109 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT 5110 #if NH_3D_NBDV_REF 5111 , bDepthRefine 5112 #endif 5113 ) ) 5114 return; 5115 5116 //// ******* Get disparity from above block ******* ///// 5117 pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true); 5118 if(pcTmpCU != NULL ) 5119 { 5120 bCheckMcpDv = ( ( getCtuRsAddr() - pcTmpCU->getCtuRsAddr() ) == 0); 5121 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVE 5122 #if NH_3D_NBDV_REF 5123 , bDepthRefine 5124 #endif 5125 ) ) 5126 return; 5127 } 5128 5129 //// ******* Search MCP blocks ******* ///// 5130 if( cIDVInfo.m_bFound ) 5131 { 5132 for( Int curPos = 0 ; curPos < IDV_CANDS ; curPos++ ) 5133 { 5134 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5135 { 5136 if( cIDVInfo.m_bAvailab[iList][curPos] ) 5137 { 5138 TComMv cDispVec = cIDVInfo.m_acMvCand[iList][ curPos ]; 5139 pDInfo->m_acNBDV = cDispVec; 5140 pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ]; 5141 #if NH_3D_NBDV_REF 5142 #if H_3D_FCO 5143 TComPic* picDepth = NULL; 5144 5145 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 5146 if ( picDepth->getPicYuvRec() != NULL ) 5147 { 5148 cDispVec.setZero(); 5149 } 5150 else // Go back with virtual depth 5151 { 5152 picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan ); 5153 } 5154 5155 assert(picDepth != NULL); 5156 #else 5157 TComPic* picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan ); 5158 #endif 5159 5160 if (picDepth && bDepthRefine) 5161 { 5162 estimateDVFromDM (pDInfo->m_aVIdxCan, uiPartIdx, picDepth, uiPartAddr, &cDispVec); 5163 } 5164 pDInfo->m_acDoNBDV = cDispVec; 5165 #endif 5166 return; 5167 } 5168 } 5169 } 5170 } 5171 5172 TComMv defaultDV(0, 0); 5173 pDInfo->m_acNBDV = defaultDV; 5174 5175 if (getSlice()->getDefaultRefViewIdxAvailableFlag()) 5176 { 5177 pDInfo->m_aVIdxCan = getSlice()->getDefaultRefViewIdx(); 5178 5179 #if NH_3D_NBDV_REF 5180 TComPic* picDepth = NULL; 5181 #if H_3D_FCO 5182 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 5183 if ( picDepth->getPicYuvRec() != NULL ) 5184 { 5185 defaultDV.setZero(); 5186 } 5187 else // Go back with virtual depth 5188 { 5189 picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx()); 5190 } 5191 5192 assert(picDepth != NULL); 5193 #else 5194 picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx()); 5195 #endif 5196 if (picDepth && bDepthRefine) 5197 { 5198 estimateDVFromDM(getSlice()->getDefaultRefViewIdx(), uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view 5199 } 5200 pDInfo->m_acDoNBDV = defaultDV; 5201 #endif 5202 } 5203 } 5204 5205 #if NH_3D_NBDV_REF 5206 Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iBlkWidth, Int iBlkHeight, Int* aiShiftLUT ) 5207 { 5208 Int iPictureWidth = pcBaseViewDepthPicYuv->getWidth(COMPONENT_Y); 5209 Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight(COMPONENT_Y); 5210 5211 Int depthStartPosX = Clip3(0, iPictureWidth - 1, iBlkX + ((mv->getHor()+2)>>2)); 5212 Int depthStartPosY = Clip3(0, iPictureHeight - 1, iBlkY + ((mv->getVer()+2)>>2)); 5213 Int depthEndPosX = Clip3(0, iPictureWidth - 1, iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2)); 5214 Int depthEndPosY = Clip3(0, iPictureHeight - 1, iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2)); 5215 5216 Pel* depthTL = pcBaseViewDepthPicYuv->getAddr(COMPONENT_Y); 5217 Int depStride = pcBaseViewDepthPicYuv->getStride(COMPONENT_Y); 5218 5219 Pel maxDepthVal = 0; 5220 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthStartPosY) * depStride + depthStartPosX ]); // Left Top 5221 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthEndPosY) * depStride + depthStartPosX ]); // Left Bottom 5222 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthStartPosY) * depStride + depthEndPosX ]); // Right Top 5223 maxDepthVal = std::max( maxDepthVal, depthTL[ (depthEndPosY) * depStride + depthEndPosX ]); // Right Bottom 5224 5225 return aiShiftLUT[ maxDepthVal ]; 5226 } 5227 5228 Void TComDataCU::estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred ) 5229 { 5230 if (picDepth) 5231 { 5232 UInt uiAbsPartAddrCurrCU = m_absZIdxInCtu + uiPartAddr; 5233 Int iWidth, iHeight; 5234 getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); // The modified value of uiPartAddr won't be used any more 5235 5236 TComPicYuv* pcBaseViewDepthPicYuv = picDepth->getPicYuvRec(); 5237 const TComSPS &sps =*(getSlice()->getSPS()); 5238 Int iBlkX = ( getCtuRsAddr() % picDepth->getFrameWidthInCtus() ) * sps.getMaxCUWidth() + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ]; 5239 Int iBlkY = ( getCtuRsAddr() / picDepth->getFrameWidthInCtus() ) * sps.getMaxCUHeight() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ]; 5240 5241 Int* aiShiftLUT = getSlice()->getDepthToDisparityB(refViewIdx ); 5242 5243 Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT ); 5244 cMvPred->setHor( iDisp ); 5245 } 5246 } 5247 #endif //NH_3D_NBDV_REF 5248 5249 5250 Bool TComDataCU::xCheckSpatialNBDV( const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos 5251 #if NH_3D_NBDV_REF 5252 , Bool bDepthRefine 5253 #endif 5254 ) 5255 { 5256 if( pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 5257 { 5258 Bool bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5259 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5260 { 5261 RefPicList eRefPicList = RefPicList(iList); 5262 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5263 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5264 5265 if( refId >= 0) 5266 { 5267 Int refViewIdx = pcTmpCU->getSlice()->getRefPic(eRefPicList, refId)->getViewIndex(); 5268 if (refViewIdx != m_pcSlice->getViewIndex()) 5269 { 5270 pNbDvInfo->m_acNBDV = cMvPred; 5271 pNbDvInfo->m_aVIdxCan = refViewIdx; 5272 #if NH_3D_NBDV_REF 5273 TComPic* picDepth = NULL; 5274 assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC()); 5275 #if H_3D_FCO 5276 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 5277 if ( picDepth->getPicYuvRec() != NULL ) 5278 { 5279 cMvPred.setZero(); 5280 } 5281 else// Go back with virtual depth 5282 { 5283 picDepth = getSlice()->getIvPic (true, refViewIdx ); 5284 } 5285 assert(picDepth != NULL); 5286 #else 5287 picDepth = getSlice()->getIvPic (true, refViewIdx ); 5288 #endif 5289 UInt uiPartIdx = 0; //Notes from MTK: Please confirm that using 0 as partition index and partition address is correct for CU-level DoNBDV 5290 UInt uiPartAddr = 0; //QC: confirmed 5291 5292 if (picDepth && bDepthRefine) 5293 { 5294 estimateDVFromDM(refViewIdx, uiPartIdx, picDepth, uiPartAddr, &cMvPred ); 5295 } 5296 pNbDvInfo->m_acDoNBDV = cMvPred; 5297 #endif 5298 return true; 5299 } 5300 else if ( bSearchForMvpDv && cMvPred.getIDVFlag() && bTmpIsSkipped ) 5301 { 5302 assert( uiMvpDvPos < IDV_CANDS ); 5303 paIDVInfo->m_acMvCand[iList][ uiMvpDvPos ] = TComMv( cMvPred.getIDVHor(), cMvPred.getIDVVer() ); 5304 //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. 5305 paIDVInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = cMvPred.getIDVVId(); 5306 paIDVInfo->m_bAvailab[iList][ uiMvpDvPos ] = true; 5307 paIDVInfo->m_bFound = true; 5308 } 5309 } 5310 } 5311 } 5312 return false; 5313 } 5314 5315 Void TComDataCU::xDeriveRightBottomNbIdx(Int &riLCUIdxRBNb, Int &riPartIdxRBNb ) 5316 { 5317 UInt uiPartIdx = 0; 5318 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInCtuWidth(); 5319 Int uiLCUIdx = getCtuRsAddr(); 5320 5321 UInt uiPartIdxRB; 5322 deriveRightBottomIdx(uiPartIdx, uiPartIdxRB ); 5323 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 5324 5325 if (( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) 5326 { 5327 riLCUIdxRBNb = -1; 5328 riPartIdxRBNb = -1; 5329 } 5330 else if(( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 5331 { 5332 riLCUIdxRBNb = -1; 5333 riPartIdxRBNb = -1; 5334 } 5335 else 5336 { 5337 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 5338 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInCtuHeight() - 1 ) ) // is not at the last row of LCU 5339 { 5340 riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 5341 riLCUIdxRBNb = uiLCUIdx; 5342 } 5343 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 5344 { 5345 riPartIdxRBNb = -1; 5346 riLCUIdxRBNb = -1; 5347 } 5348 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInCtuHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 5349 { 5350 riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 5351 riLCUIdxRBNb = uiLCUIdx + 1; 5352 } 5353 else //is the right bottom corner of LCU 5354 { 5355 riPartIdxRBNb = -1; 5356 riLCUIdxRBNb = -1; 5357 } 5358 } 5359 } 5360 5361 5362 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ) 5363 { 5364 #if NH_3D_VSP // bug fix 5365 UInt uiCurrPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1); 5366 assert(m_pcPic->getNumPartitionsInCtu() ==m_pcPic->getNumPartInCtuWidth()*m_pcPic->getNumPartInCtuHeight()); 5367 5368 #else 5369 UInt uiCurrPartNumb = m_pcPic->getNumPartInCtuWidth() >> (uiDepth << 1); 5370 #endif 5371 for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 5372 { 5373 m_pDvInfo[uiAbsPartIdx + ui] = cDvInfo; 5374 } 5375 } 5376 #if NH_3D_VSP || NH_3D_DBBP 5377 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth ) 5378 { 5379 setSubPartT<DisInfo>( cDvInfo, m_pDvInfo, uiAbsPartIdx, uiDepth, uiPUIdx ); 5380 } 5381 #endif 5382 5383 Bool TComDataCU::xGetColDisMV( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx ) 5384 { 5385 5386 RefPicList eColRefPicList = REF_PIC_LIST_0; 5387 Int iColViewIdx, iColRefViewIdx; 5388 TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx); 5389 TComDataCU *pColCU = pColPic->getCtu( uiCUAddr ); 5390 iColViewIdx = pColCU->getSlice()->getViewIndex(); 5391 if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==NUMBER_OF_PART_SIZES||pColCU->isIntra(uiPartUnitIdx)) 5392 { 5393 return false; 5394 } 5395 for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++) 5396 { 5397 if(pColCU->getSlice()->isInterB()) 5398 { 5399 eColRefPicList = RefPicList(ilist); 5400 } 5401 5402 Int iColRefIdx = pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartUnitIdx); 5403 5404 if (iColRefIdx < 0) 5405 { 5406 continue; 5407 } 5408 5409 // The picture pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx) might not be in DPB anymore 5410 // So don't access it directly. 5411 iColRefViewIdx = pColCU->getSlice()->getVPS()->getViewOrderIdx( pColCU->getSlice()->getRefLayerId( eColRefPicList, iColRefIdx ) ); 5412 5413 5414 if ( iColViewIdx == iColRefViewIdx ) // temporal vector 5415 { 5416 continue; 5417 } 5418 else 5419 { 5420 if(getPic()->isTempIVRefValid(currCandPic, ilist, iColRefIdx)) 5421 { 5422 rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartUnitIdx); 5423 rcMv.setIDVFlag(0); 5424 iTargetViewIdx = iColRefViewIdx ; 5425 iStartViewIdx = iColViewIdx ; 5426 return true; 5427 } 5428 } 5429 } 5430 5431 return false; 5432 } 5433 #endif 5434 #if NH_3D_FAST_TEXTURE_ENCODING 5435 Void 5436 TComDataCU::getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD) 5437 { 5438 TComSlice* pcSlice = getSlice (); 5439 Int iViewIndex = pDInfo->m_aVIdxCan; 5440 //--- get base CU/PU and check prediction mode --- 5441 TComPic* pcBasePic = pcSlice->getIvPic( false, iViewIndex ); 5442 TComPicYuv* pcBaseRec = pcBasePic->getPicYuvRec (); 5443 5444 UInt uiPartAddr; 5445 Int iWidth; 5446 Int iHeight; 5447 getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); 5448 5449 Int iCurrPosX, iCurrPosY; 5450 pcBaseRec->getTopLeftSamplePos( this->getCtuRsAddr(), this->getZorderIdxInCtu() + uiPartAddr, iCurrPosX, iCurrPosY ); 5451 5452 iCurrPosX += ( ( iWidth - 1 ) >> 1 ); 5453 iCurrPosY += ( ( iHeight - 1 ) >> 1 ); 5454 5455 Bool depthRefineFlag = false; 5456 #if NH_3D_NBDV_REF 5457 depthRefineFlag = m_pcSlice->getDepthRefinementFlag( ); 5458 #endif // NH_3D_NBDV_REF 5459 5460 TComMv cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 5461 if( depthRefineFlag ) 5462 { 5463 cDv.setVer(0); 5464 } 5465 5466 Int iBasePosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 5467 Int iBasePosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCurrPosY + ( (cDv.getVer() + 2 ) >> 2 )); 5468 Int iBaseLPosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCurrPosX - (iWidth >> 1) + ( (cDv.getHor() + 2 ) >> 2 ) ); 5469 Int iBaseLPosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCurrPosY + ( (cDv.getVer() + 2 ) >> 2 )); 5470 Int iBaseRPosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCurrPosX + (iWidth >> 1) + 1 + ( (cDv.getHor() + 2 ) >> 2 ) ); 5471 Int iBaseRPosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCurrPosY + ( (cDv.getVer() + 2 ) >> 2 )); 5472 Int iBaseUPosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 5473 Int iBaseUPosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCurrPosY - (iHeight >> 1) + ( (cDv.getVer() + 2 ) >> 2 )); 5474 Int iBaseDPosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 5475 Int iBaseDPosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCurrPosY + (iHeight >> 1) + 1 + ( (cDv.getVer() + 2 ) >> 2 )); 5476 5477 Int iBaseCUAddr; 5478 Int iBaseAbsPartIdx; 5479 Int iBaseLCUAddr; 5480 Int iBaseLAbsPartIdx; 5481 Int iBaseRCUAddr; 5482 Int iBaseRAbsPartIdx; 5483 Int iBaseUCUAddr; 5484 Int iBaseUAbsPartIdx; 5485 Int iBaseDCUAddr; 5486 Int iBaseDAbsPartIdx; 5487 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx ); 5488 pcBaseRec->getCUAddrAndPartIdx( iBaseLPosX , iBaseLPosY , iBaseLCUAddr, iBaseLAbsPartIdx ); 5489 pcBaseRec->getCUAddrAndPartIdx( iBaseRPosX , iBaseRPosY , iBaseRCUAddr, iBaseRAbsPartIdx ); 5490 pcBaseRec->getCUAddrAndPartIdx( iBaseUPosX , iBaseUPosY , iBaseUCUAddr, iBaseUAbsPartIdx ); 5491 pcBaseRec->getCUAddrAndPartIdx( iBaseDPosX , iBaseDPosY , iBaseDCUAddr, iBaseDAbsPartIdx ); 5492 TComDataCU* pcBaseCU = pcBasePic->getCtu( iBaseCUAddr ); 5493 TComDataCU* pcBaseLCU = pcBasePic->getCtu( iBaseLCUAddr ); 5494 TComDataCU* pcBaseRCU = pcBasePic->getCtu( iBaseRCUAddr ); 5495 TComDataCU* pcBaseUCU = pcBasePic->getCtu( iBaseUCUAddr ); 5496 TComDataCU* pcBaseDCU = pcBasePic->getCtu( iBaseDCUAddr ); 5497 bIVFMerge = pcBaseLCU->getMergeFlag( iBaseLAbsPartIdx ) && pcBaseCU->getMergeFlag( iBaseAbsPartIdx ) && pcBaseRCU->getMergeFlag( iBaseRAbsPartIdx ) && pcBaseUCU->getMergeFlag( iBaseUAbsPartIdx ) && pcBaseDCU->getMergeFlag( iBaseDAbsPartIdx ); 5498 Int aiDepthL[5]; //depth level 5499 aiDepthL[0] = pcBaseCU->getDepth(iBaseAbsPartIdx); 5500 aiDepthL[1] = pcBaseLCU->getDepth(iBaseLAbsPartIdx); 5501 aiDepthL[2] = pcBaseRCU->getDepth(iBaseRAbsPartIdx); 5502 aiDepthL[3] = pcBaseUCU->getDepth(iBaseUAbsPartIdx); 5503 aiDepthL[4] = pcBaseDCU->getDepth(iBaseDAbsPartIdx); 5504 for (Int i = 0; i < 5; i++) 5505 { 5506 if (iIVFMaxD < aiDepthL[i]) 5507 iIVFMaxD = aiDepthL[i]; 5508 } 5509 } 5510 #endif 5511 5512 #if NH_3D_SPIVMP 5513 Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight) 5514 { 5515 Int iSubPUSize = ( getSlice()->getIsDepth() ? getSlice()->getMpiSubPbSize() : getSlice()->getSubPbSize() ); 5516 5517 iNumSPInOneLine = iPUWidth/iSubPUSize; 5518 Int iNumSPInOneColumn = iPUHeight/iSubPUSize; 5519 iNumSPInOneLine = (iPUHeight % iSubPUSize != 0 || iPUWidth % iSubPUSize != 0 ) ? 1 : iNumSPInOneLine; 5520 iNumSPInOneColumn = (iPUHeight % iSubPUSize != 0 || iPUWidth % iSubPUSize != 0 ) ? 1 : iNumSPInOneColumn; 5521 iNumSP = iNumSPInOneLine * iNumSPInOneColumn; 5522 5523 iSPWidth = iNumSPInOneLine == 1 ? iPUWidth: iSubPUSize; 5524 iSPHeight = iNumSPInOneColumn == 1 ? iPUHeight: iSubPUSize; 5525 } 5526 5527 Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ) 5528 { 5529 uiBaseAbsPartIdx += m_absZIdxInCtu; 5530 Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 5531 Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 5532 Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth; 5533 Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight; 5534 Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInCtuWidth() + iCurrPelX/getPic()->getMinCUWidth(); 5535 ruiPartAddr = g_auiRasterToZscan[iCurrRaster]; 5536 ruiPartAddr -= m_absZIdxInCtu; 5537 } 5538 5539 Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight ) 5540 { 5541 uiAbsPartIdx += getZorderIdxInCtu(); 5542 Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]]; 5543 Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]]; 5544 Int iEndPelX = iStartPelX + iWidth; 5545 Int iEndPelY = iStartPelY + iHeight; 5546 5547 Int iCurrRaster, uiPartAddr; 5548 5549 for (Int i=iStartPelY; i<iEndPelY; i+=getPic()->getMinCUHeight()) 5550 { 5551 for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth()) 5552 { 5553 iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInCtuWidth() + j/getPic()->getMinCUWidth(); 5554 uiPartAddr = g_auiRasterToZscan[iCurrRaster]; 5555 uiPartAddr -= getZorderIdxInCtu(); 5556 5557 m_puhInterDir[uiPartAddr] = uiDir; 5558 } 5559 } 5560 } 5561 #endif 5562 5563 #if NH_3D_IV_MERGE 5564 Bool 5565 TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc , Bool bIsDepth 5566 #if NH_3D_SPIVMP 5567 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP 5568 #endif 5569 , Bool bICFlag 5570 ) 5571 { 5572 TComSlice* pcSlice = getSlice (); 5573 Int iViewIndex = pDInfo->m_aVIdxCan; 5574 5575 //--- get base CU/PU and check prediction mode --- 5576 TComPic* pcBasePic = pcSlice->getIvPic( bIsDepth, iViewIndex ); 5577 TComPicYuv* pcBaseRec = pcBasePic->getPicYuvRec (); 5578 5579 UInt uiPartAddr; 5580 Int iWidth; 5581 Int iHeight; 5582 getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); 5583 5584 Int iCurrPosX, iCurrPosY; 5585 pcBaseRec->getTopLeftSamplePos( getCtuRsAddr(), getZorderIdxInCtu() + uiPartAddr, iCurrPosX, iCurrPosY ); 5586 5587 #if !NH_3D_SPIVMP 5588 iCurrPosX += ( iWidth >> 1 ); 5589 iCurrPosY += ( iHeight >> 1 ); 5590 #endif 5591 5592 Bool depthRefineFlag = false; 5593 #if NH_3D_NBDV_REF 5594 depthRefineFlag = m_pcSlice->getDepthRefinementFlag( ); 5595 #endif // NH_3D_NBDV_REF 5596 5597 TComMv cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 5598 if( depthRefineFlag ) 5599 { 5600 cDv.setVer(0); 5601 } 5602 5603 Bool abPdmAvailable[8] = {false, false, false, false, false, false, false, false}; 5604 #if NH_3D_NBDV 5605 for( Int i = 0; i < 8; i++) 5606 { 5607 pacPdmMv[i].setIDVFlag (false); 5608 } 5609 #endif 5610 5611 if(!bICFlag) 5612 { 5613 5614 #if NH_3D_SPIVMP 5615 //////////////////////////////// 5616 //////////sub-PU IvMC/////////// 5617 //////////////////////////////// 5618 if(!m_pcSlice->getIsDepth()) 5619 { 5620 #if NH_3D_DBBP 5621 if (!getDBBPFlag(0)) 5622 #else 5623 if (1) 5624 #endif 5625 { 5626 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 5627 getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 5628 5629 for (Int i=0; i<iNumSP; i++) 5630 { 5631 puhInterDirSP[i] = 0; 5632 pcMvFieldSP[2*i].getMv().set(0, 0); 5633 pcMvFieldSP[2*i+1].getMv().set(0,0); 5634 pcMvFieldSP[2*i].setRefIdx(-1); 5635 pcMvFieldSP[2*i+1].setRefIdx(-1); 5636 } 5637 5638 Int iBaseCUAddr; 5639 Int iBaseAbsPartIdx; 5640 TComDataCU* pcBaseCU; 5641 Int iPartition = 0; 5642 5643 Int iDelX = iSPWidth/2; 5644 Int iDelY = iSPHeight/2; 5645 5646 Int iCenterPosX = iCurrPosX + ( ( iWidth / iSPWidth ) >> 1 ) * iSPWidth + ( iSPWidth >> 1 ); 5647 Int iCenterPosY = iCurrPosY + ( ( iHeight / iSPHeight ) >> 1 ) * iSPHeight + (iSPHeight >> 1); 5648 Int iRefCenterCUAddr, iRefCenterAbsPartIdx; 5649 5650 if(iWidth == iSPWidth && iHeight == iSPHeight) 5651 { 5652 iCenterPosX = iCurrPosX + (iWidth >> 1); 5653 iCenterPosY = iCurrPosY + (iHeight >> 1); 5654 } 5655 5656 Int iRefCenterPosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCenterPosX + ( (cDv.getHor() + 2 ) >> 2 ) ); 5657 Int iRefCenterPosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCenterPosY + ( (cDv.getVer() + 2 ) >> 2 ) ); 5658 5659 pcBaseRec->getCUAddrAndPartIdx( iRefCenterPosX , iRefCenterPosY , iRefCenterCUAddr, iRefCenterAbsPartIdx ); 5660 TComDataCU* pcDefaultCU = pcBasePic->getCtu( iRefCenterCUAddr ); 5661 if(!( pcDefaultCU->getPredictionMode( iRefCenterAbsPartIdx ) == MODE_INTRA )) 5662 { 5663 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 5664 { 5665 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 5666 Bool stopLoop = false; 5667 for(Int iLoop = 0; iLoop < 2 && !stopLoop; ++iLoop) 5668 { 5669 RefPicList eDefaultRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 5670 TComMvField cDefaultMvField; 5671 pcDefaultCU->getMvField( pcDefaultCU, iRefCenterAbsPartIdx, eDefaultRefPicList, cDefaultMvField ); 5672 Int iDefaultRefIdx = cDefaultMvField.getRefIdx(); 5673 if (iDefaultRefIdx >= 0) 5674 { 5675 Int iDefaultRefPOC = pcDefaultCU->getSlice()->getRefPOC(eDefaultRefPicList, iDefaultRefIdx); 5676 if (iDefaultRefPOC != pcSlice->getPOC()) 5677 { 5678 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 5679 { 5680 if (iDefaultRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 5681 { 5682 abPdmAvailable[ uiCurrRefListId ] = true; 5683 TComMv cMv(cDefaultMvField.getHor(), cDefaultMvField.getVer()); 5684 #if NH_3D_NBDV 5685 #if NH_3D_IV_MERGE 5686 if( !bIsDepth ) 5687 { 5688 #endif 5689 cMv.setIDVFlag (true); 5690 cMv.setIDVHor (cDv.getHor()); 5691 cMv.setIDVVer (cDv.getVer()); 5692 cMv.setIDVVId (iViewIndex); 5693 #if NH_3D_IV_MERGE 5694 } 5695 #endif 5696 #endif 5697 paiPdmRefIdx [ uiCurrRefListId ] = iPdmRefIdx; 5698 pacPdmMv [ uiCurrRefListId ] = cMv; 5699 stopLoop = true; 5700 break; 5701 } 5702 } 5703 } 5704 } 5705 } 5706 } 5707 } 5708 availableMcDc[0] = ( abPdmAvailable[0]? 1 : 0) + (abPdmAvailable[1]? 2 : 0); 5709 5710 if(availableMcDc[0]) 5711 { 5712 5713 Int iBasePosX, iBasePosY; 5714 for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight) 5715 { 5716 for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth) 5717 { 5718 iBasePosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 )); 5719 iBasePosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 )); 5720 5721 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx ); 5722 pcBaseCU = pcBasePic->getCtu( iBaseCUAddr ); 5723 if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA )) 5724 { 5725 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 5726 { 5727 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 5728 Bool bLoopStop = false; 5729 for(Int iLoop = 0; iLoop < 2 && !bLoopStop; ++iLoop) 5730 { 5731 RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 5732 TComMvField cBaseMvField; 5733 pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField ); 5734 Int iBaseRefIdx = cBaseMvField.getRefIdx(); 5735 if (iBaseRefIdx >= 0) 5736 { 5737 Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx); 5738 if (iBaseRefPOC != pcSlice->getPOC()) 5739 { 5740 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 5741 { 5742 if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 5743 { 5744 abPdmAvailable[ uiCurrRefListId ] = true; 5745 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 5746 5747 if( !bIsDepth ) 5748 { 5749 cMv.setIDVFlag (true); 5750 cMv.setIDVHor (cDv.getHor()); 5751 cMv.setIDVVer (cDv.getVer()); 5752 cMv.setIDVVId (iViewIndex); 5753 } 5754 5755 bLoopStop = true; 5756 5757 pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx); 5758 break; 5759 } 5760 } 5761 } 5762 } 5763 } 5764 } 5765 } 5766 5767 puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0); 5768 if (puhInterDirSP[iPartition] == 0) 5769 { 5770 puhInterDirSP[iPartition] = availableMcDc[0]; 5771 pcMvFieldSP[2*iPartition].setMvField(pacPdmMv[0], paiPdmRefIdx[0]); 5772 pcMvFieldSP[2*iPartition + 1].setMvField(pacPdmMv[1], paiPdmRefIdx[1]); 5773 5774 } 5775 iPartition ++; 5776 } 5777 } 5778 } 5779 } 5780 5781 iCurrPosX += ( iWidth >> 1 ); 5782 iCurrPosY += ( iHeight >> 1 ); 5783 } 5784 #endif 5785 5786 //////////////////////////////// 5787 /////// IvMC + IvMCShift /////// 5788 //////////////////////////////// 5789 5790 #if NH_3D_SPIVMP 5791 if(m_pcSlice->getIsDepth()) 5792 { 5793 iCurrPosX += ( iWidth >> 1 ); 5794 iCurrPosY += ( iHeight >> 1 ); 5795 } 5796 #if NH_3D_DBBP 5797 for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 5798 #else 5799 for(Int iLoopCan = ( m_pcSlice->getIsDepth() ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 5800 #endif 5801 #else 5802 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 5803 #endif 5804 { 5805 // iLoopCan == 0 --> IvMC 5806 // iLoopCan == 1 --> IvMCShift 5807 5808 Int iBaseCUAddr; 5809 Int iBaseAbsPartIdx; 5810 5811 Int offsetW = (iLoopCan == 0) ? 0 : ( iWidth * 2); 5812 Int offsetH = (iLoopCan == 0) ? 0 : ( iHeight * 2); 5813 5814 Int iBasePosX = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) ); 5815 Int iBasePosY = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) ); 5816 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx ); 5817 5818 TComDataCU* pcBaseCU = pcBasePic->getCtu( iBaseCUAddr ); 5819 if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA )) 5820 { 5821 // Loop reference picture list of current slice (X in spec). 5822 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 5823 { 5824 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 5825 5826 Bool stopLoop = false; 5827 // Loop reference picture list of candidate slice (Y in spec) 5828 for(Int iLoop = 0; iLoop < 2 && !stopLoop; ++iLoop) 5829 { 5830 RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 5831 TComMvField cBaseMvField; 5832 pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField ); 5833 Int iBaseRefIdx = cBaseMvField.getRefIdx(); 5834 if (iBaseRefIdx >= 0) 5835 { 5836 Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx); 5837 if (iBaseRefPOC != pcSlice->getPOC()) 5838 { 5839 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 5840 { 5841 if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 5842 { 5843 abPdmAvailable[ (uiCurrRefListId + (iLoopCan<<2)) ] = true; 5844 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 5845 #if NH_3D_NBDV 5846 #if NH_3D_IV_MERGE 5847 if( !bIsDepth ) 5848 { 5849 #endif 5850 cMv.setIDVFlag (true); 5851 cMv.setIDVHor (cDv.getHor()); 5852 cMv.setIDVVer (cDv.getVer()); 5853 cMv.setIDVVId (iViewIndex); 5854 #if NH_3D_IV_MERGE 5855 } 5856 #endif 5857 #endif 5858 paiPdmRefIdx [ (uiCurrRefListId + (iLoopCan<<2)) ] = iPdmRefIdx; 5859 pacPdmMv [ (uiCurrRefListId + (iLoopCan<<2)) ] = cMv; 5860 stopLoop = true; 5861 break; 5862 } 5863 } 5864 } 5865 } 5866 } 5867 } 5868 } 5869 } 5870 #if NH_3D_SPIVMP 5871 #if NH_3D_DBBP 5872 for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 5873 #else 5874 for(Int iLoopCan = ( m_pcSlice->getIsDepth() ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 5875 #endif 5876 #else 5877 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 5878 #endif 5879 { 5880 availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0); 5881 } 5882 5883 } 5884 5885 //////////////////////////////// 5886 /////// IvDC + IvDCShift /////// 5887 //////////////////////////////// 5888 5889 if( !getSlice()->getIsDepth() ) 5890 { 5891 for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ ) 5892 { 5893 RefPicList eRefPicListDMV = RefPicList( iRefListId ); 5894 Int iNumRefPics = pcSlice->getNumRefIdx( eRefPicListDMV ); 5895 for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ ) 5896 { 5897 if(( pcSlice->getRefPOC( eRefPicListDMV, iPdmRefIdx ) == pcSlice->getPOC()) && (pcSlice->getRefPic( eRefPicListDMV, iPdmRefIdx )->getViewIndex() == pDInfo->m_aVIdxCan)) 5898 { 5899 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 5900 { 5901 Int ioffsetDV = (iLoopCan == 0) ? 0 : 4; 5902 abPdmAvailable[ iRefListId + 2 + (iLoopCan<<2) ] = true; 5903 paiPdmRefIdx [ iRefListId + 2 + (iLoopCan<<2) ] = iPdmRefIdx; 5904 #if NH_3D_NBDV_REF 5905 TComMv cMv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 5906 #endif 5907 cMv.setHor( cMv.getHor() + ioffsetDV ); 5908 #if NH_3D_IV_MERGE 5909 if( bIsDepth ) 5910 { 5911 cMv.setHor((cMv.getHor()+2)>>2); 5912 } 5913 #endif 5914 cMv.setVer( 0 ); 5915 pacPdmMv [iRefListId + 2 + (iLoopCan<<2)] = cMv; 5916 } 5917 break; 5918 } 5919 } 5920 } 5921 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 5922 { 5923 availableMcDc[1 + (iLoopCan << 1)] = ( abPdmAvailable[2 + (iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[3 + (iLoopCan<<2)] ? 2 : 0 ); 5924 } 5925 } 5926 return false; 5927 } 5928 #endif 5929 #if NH_3D_ARP 5930 Void TComDataCU::setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ) 5931 { 5932 setSubPart<UChar>( w, m_puhARPW, uiAbsPartIdx, uiDepth, 0 ); 5933 } 5934 #endif 5935 5936 #if NH_3D_IC 5937 Void TComDataCU::setICFlagSubParts( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 5938 { 5939 memset( m_pbICFlag + uiAbsPartIdx, bICFlag, (m_pcPic->getNumPartitionsInCtu() >> ( 2 * uiDepth ))*sizeof(Bool) ); 5940 } 5941 5942 Bool TComDataCU::isICFlagRequired( UInt uiAbsPartIdx ) 5943 { 5944 UInt uiPartAddr; 5945 UInt iNumbPart; 5946 5947 if( !( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ) 5948 { 5949 return false; 5950 } 5951 5952 if( getSlice()->getIcSkipParseFlag() ) 5953 { 5954 if( getMergeFlag( uiAbsPartIdx ) && getMergeIndex( uiAbsPartIdx ) == 0 ) 5955 { 5956 return false; 5957 } 5958 } 5959 5960 if( getMergeFlag( uiAbsPartIdx ) ) 5961 { 5962 return true; 5963 } 5964 5965 5966 Int iWidth, iHeight; 5967 5968 iNumbPart = ( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ? 1 : ( getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 ) ); 5969 5970 for(UInt i = 0; i < iNumbPart; i++) 5971 { 5972 getPartIndexAndSize( i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true ); 5973 uiPartAddr += uiAbsPartIdx; 5974 5975 for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) 5976 { 5977 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 5978 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); 5979 5980 if( ( getInterDir( uiPartAddr ) & ( uiRefIdx+1 ) ) && iBestRefIdx >= 0 && getSlice()->getViewIndex() != getSlice()->getRefPic( eRefList, iBestRefIdx )->getViewIndex() ) 5981 { 5982 return true; 5983 } 5984 } 5985 } 5986 5987 return false; 5988 } 5989 #endif 5990 #if NH_3D_DMM 5991 Void TComDataCU::setDmm1WedgeTabIdxSubParts( UInt tabIdx, UInt uiAbsPartIdx, UInt uiDepth ) 5992 { 5993 UInt uiCurrPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1); 5994 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm1WedgeTabIdx[uiAbsPartIdx+ui] = tabIdx; } 5995 } 5996 #endif 5997 5998 #if NH_3D_VSP 5999 Void TComDataCU::setMvFieldPUForVSP( TComDataCU* pcCU, UInt partAddr, Int width, Int height, RefPicList eRefPicList, Int iRefIdx, Int &vspSize ) 6000 { 6001 // Get depth reference 6002 Int depthRefViewIdx = pcCU->getDvInfo(partAddr).m_aVIdxCan; 6003 6004 #if H_3D_FCO 6005 TComPic* pRefPicBaseDepth = 0; 6006 Bool bIsCurrDepthCoded = false; 6007 pRefPicBaseDepth = pcCU->getSlice()->getIvPic( true, pcCU->getSlice()->getViewIndex() ); 6008 if ( pRefPicBaseDepth->getPicYuvRec() != NULL ) 6009 { 6010 bIsCurrDepthCoded = true; 6011 } 6012 else 6013 { 6014 pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx ); 6015 } 6016 #else 6017 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx ); 6018 #endif 6019 assert(pRefPicBaseDepth != NULL); 6020 TComPicYuv* pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 6021 assert(pcBaseViewDepthPicYuv != NULL); 6022 pcBaseViewDepthPicYuv->extendPicBorder(); 6023 6024 // Get texture reference 6025 assert(iRefIdx >= 0); 6026 TComPic* pRefPicBaseTxt = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx ); 6027 TComPicYuv* pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); 6028 assert(pcBaseViewTxtPicYuv != NULL); 6029 6030 // Initialize LUT according to the reference viewIdx 6031 Int txtRefViewIdx = pRefPicBaseTxt->getViewIndex(); 6032 Int* pShiftLUT = pcCU->getSlice()->getDepthToDisparityB( txtRefViewIdx ); 6033 assert( txtRefViewIdx < pcCU->getSlice()->getViewIndex() ); 6034 6035 // prepare Dv to access depth map or reference view 6036 TComMv cDv = pcCU->getDvInfo(partAddr).m_acNBDV; 6037 pcCU->clipMv(cDv); 6038 6039 #if H_3D_FCO 6040 if ( bIsCurrDepthCoded ) 6041 { 6042 cDv.setZero(); 6043 } 6044 #endif 6045 6046 // fetch virtual depth map & convert depth to motion vector, which are stored in the motion memory 6047 xSetMvFieldForVSP( pcCU, pcBaseViewDepthPicYuv, &cDv, partAddr, width, height, pShiftLUT, eRefPicList, iRefIdx, pcCU->getSlice()->getIsDepth(), vspSize ); 6048 } 6049 6050 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 ) 6051 { 6052 TComCUMvField *cuMvField = cu->getCUMvField( refPicList ); 6053 Int partAddrRasterSubPULine = g_auiZscanToRaster[ partAddr ]; 6054 Int numPartsLine = cu->getPic()->getNumPartInCtuWidth(); 6055 6056 Int nTxtPerMvInfoX = 4; // cu->getPic()->getMinCUWidth(); 6057 Int nTxtPerMvInfoY = 4; // cu->getPic()->getMinCUHeight(); 6058 6059 Int refDepStride = picRefDepth->getStride( COMPONENT_Y ); 6060 6061 TComMv tmpMv(0, 0); 6062 tmpMv.setIDVFlag(false); 6063 6064 Int refDepOffset = ( (dv->getHor()+2) >> 2 ) + ( (dv->getVer()+2) >> 2 ) * refDepStride; 6065 Pel *refDepth = picRefDepth->getAddr( COMPONENT_Y, cu->getCtuRsAddr(), cu->getZorderIdxInCtu() + partAddr ) + refDepOffset; 6066 6067 if ((height % 8)) 6068 { 6069 vspSize = 1; // 8x4 6070 } 6071 else if ((width % 8)) 6072 { 6073 vspSize = 0; // 4x8 6074 } 6075 else 6076 { 6077 Bool ULvsBR, URvsBL; 6078 ULvsBR = refDepth[0] < refDepth[refDepStride * (height-1) + width-1]; 6079 URvsBL = refDepth[width-1] < refDepth[refDepStride * (height-1)]; 6080 vspSize = ( ULvsBR ^ URvsBL ) ? 0 : 1; 6081 } 6082 6083 Int subBlockW, subBlockH; 6084 if (vspSize) 6085 { 6086 subBlockW = 8; 6087 subBlockH = 4; 6088 } 6089 else 6090 { 6091 subBlockW = 4; 6092 subBlockH = 8; 6093 } 6094 6095 Int numPartsInSubPUW = subBlockW / nTxtPerMvInfoX; 6096 Int numPartsInSubPUH = subBlockH / nTxtPerMvInfoY * numPartsLine; 6097 6098 for( Int y=0; y<height; y+=subBlockH, partAddrRasterSubPULine+=numPartsInSubPUH ) 6099 { 6100 Pel *refDepthTmp[4]; 6101 refDepthTmp[0] = refDepth + refDepStride * y; 6102 refDepthTmp[1] = refDepthTmp[0] + subBlockW - 1; 6103 refDepthTmp[2] = refDepthTmp[0] + refDepStride * (subBlockH - 1); 6104 refDepthTmp[3] = refDepthTmp[2] + subBlockW - 1; 6105 6106 Int partAddrRasterSubPU = partAddrRasterSubPULine; 6107 for( Int x=0; x<width; x+=subBlockW, partAddrRasterSubPU+=numPartsInSubPUW ) 6108 { 6109 Pel maxDepthVal; 6110 maxDepthVal = refDepthTmp[0][x]; 6111 maxDepthVal = std::max( maxDepthVal, refDepthTmp[1][x]); 6112 maxDepthVal = std::max( maxDepthVal, refDepthTmp[2][x]); 6113 maxDepthVal = std::max( maxDepthVal, refDepthTmp[3][x]); 6114 tmpMv.setHor( (Short) shiftLUT[ maxDepthVal ] ); 6115 6116 Int partAddrRasterPartLine = partAddrRasterSubPU; 6117 for( Int sY=0; sY<numPartsInSubPUH; sY+=numPartsLine, partAddrRasterPartLine += numPartsLine ) 6118 { 6119 Int partAddrRasterPart = partAddrRasterPartLine; 6120 for( Int sX=0; sX<numPartsInSubPUW; sX+=1, partAddrRasterPart++ ) 6121 { 6122 cuMvField->setMv ( g_auiRasterToZscan[ partAddrRasterPart ], tmpMv ); 6123 cuMvField->setRefIdx( g_auiRasterToZscan[ partAddrRasterPart ], refIdx ); 6124 } 6125 } 6126 } 6127 } 6128 6129 vspSize = (vspSize<<2)+1; 6130 6131 } 6132 #endif 3218 3219 3220 3221 3222 3223 6133 3224 6134 3225 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComDataCU.h
r1386 r1390 57 57 static const UInt NUM_MOST_PROBABLE_MODES=3; 58 58 59 #if NH_3D_DBBP60 typedef struct _DBBPTmpData61 {62 TComMv acMvd[2][2]; // for two segments and two lists63 TComMvField acMvField[2][2]; // for two segments and two lists64 Int aiMvpNum[2][2]; // for two segments and two lists65 Int aiMvpIdx[2][2]; // for two segments and two lists66 UChar auhInterDir[2]; // for two segments67 Bool abMergeFlag[2]; // for two segments68 UChar auhMergeIndex[2]; // for two segments69 PartSize eVirtualPartSize;70 UInt uiVirtualPartIndex;71 } DbbpTmpData;72 #endif73 59 74 60 … … 108 94 109 95 Bool* m_skipFlag; ///< array of skip flags 110 #if NH_3D_DIS111 Bool* m_bDISFlag;112 UChar* m_ucDISType;113 #endif114 96 SChar* m_pePartSize; ///< array of partition sizes 115 97 SChar* m_pePredMode; ///< array of prediction modes … … 159 141 SChar* m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors 160 142 Bool* m_pbIPCMFlag; ///< array of intra_pcm flags 161 #if NH_3D_NBDV162 DisInfo* m_pDvInfo;163 #endif164 #if NH_3D_VSP165 SChar* m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not ///< 0: non-VSP; 1: VSP166 #endif167 #if NH_3D_SPIVMP168 Bool* m_pbSPIVMPFlag; ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP ///< 0: non-SPIVMP; 1: SPIVMP169 #endif170 #if NH_3D_ARP171 UChar* m_puhARPW;172 #endif173 #if NH_3D_IC174 Bool* m_pbICFlag; ///< array of IC flags175 #endif176 #if NH_3D_DMM177 Pel* m_dmmDeltaDC[NUM_DMM][2];178 UInt* m_dmm1WedgeTabIdx;179 #endif180 #if NH_3D_SDC_INTRA181 Bool* m_pbSDCFlag;182 Pel* m_apSegmentDCOffset[2];183 #endif184 #if NH_3D_DBBP185 Bool* m_pbDBBPFlag; ///< array of DBBP flags186 DbbpTmpData m_sDBBPTmpData;187 #endif188 #if NH_3D_MLC189 Bool m_bAvailableFlagA1; ///< A1 available flag190 Bool m_bAvailableFlagB1; ///< B1 available flag191 Bool m_bAvailableFlagB0; ///< B0 available flag192 Bool m_bAvailableFlagA0; ///< A0 available flag193 Bool m_bAvailableFlagB2; ///< B2 available flag194 #endif195 143 196 144 … … 201 149 Bool m_bDecSubCu; ///< indicates decoder-mode 202 150 Double m_dTotalCost; ///< sum of partition RD costs 203 #if NH_3D_VSO204 Dist m_uiTotalDistortion; ///< sum of partition distortion205 #else206 151 Distortion m_uiTotalDistortion; ///< sum of partition distortion 207 #endif208 152 UInt m_uiTotalBits; ///< sum of partition bits 209 153 UInt m_uiTotalBins; ///< sum of partition bins 210 154 SChar m_codedQP; 211 #if NH_3D_MLC212 DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing213 TComMotionCand m_mergCands[MRG_IVSHIFT+1]; ///< Motion candidates for merge mode214 Int m_numSpatialCands;215 #endif216 155 217 156 UChar* m_explicitRdpcmMode[MAX_NUM_COMPONENT]; ///< Stores the explicit RDPCM mode for all TUs belonging to this CU … … 223 162 Bool xAddMVPCandWithScaling ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; 224 163 225 #if NH_3D_VSP226 Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);227 #endif228 #if NH_3D_IV_MERGE229 Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx );230 #endif231 164 232 165 Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const; 233 166 234 #if NH_3D_TMVP235 Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG = true ) const;236 #else237 167 Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const; 238 #endif239 168 240 169 /// compute scaling factor from POC difference 241 #if !NH_3D_ARP242 170 static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 243 #endif244 171 Void xDeriveCenterIdx ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const; 245 172 246 #if NH_3D_VSP247 Void xSetMvFieldForVSP ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );248 #endif249 173 250 174 public: 251 175 252 #if NH_3D_ARP253 static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );254 #endif255 176 256 177 TComDataCU(); … … 271 192 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); 272 193 Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); 273 #if NH_3D_NBDV274 Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);275 #endif276 194 277 195 Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx ); 278 #if NH_3D_NBDV279 Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, Bool bNBDV = false );280 #else281 196 Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); 282 #endif283 197 Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); 284 198 … … 304 218 305 219 Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); 306 #if NH_3D_VSO 307 Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) const; 308 #endif 309 310 #if NH_3D_ARP 311 Void setSlice ( TComSlice* pcSlice) { m_pcSlice = pcSlice; } 312 Void setPic ( TComDataCU* pcCU ) { m_pcPic = pcCU->getPic(); } 313 #endif 220 314 221 // ------------------------------------------------------------------------------------------------------------------- 315 222 // member functions for CU data … … 322 229 Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); 323 230 324 #if NH_3D_DBBP325 Pel* getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);326 #endif327 231 328 232 Bool* getSkipFlag () { return m_skipFlag; } … … 330 234 Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } 331 235 Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); 332 #if NH_3D_DIS333 Bool* getDISFlag () { return m_bDISFlag; }334 Bool getDISFlag ( UInt idx) { return m_bDISFlag[idx]; }335 Void setDISFlag ( UInt idx, Bool bDIS) { m_bDISFlag[idx] = bDIS; }336 Void setDISFlagSubParts ( Bool bDIS, UInt uiAbsPartIdx, UInt uiDepth );337 338 UChar* getDISType () { return m_ucDISType; }339 UChar getDISType ( UInt idx) { return m_ucDISType[idx]; }340 Void getDISType ( UInt idx, UChar ucDISType) { m_ucDISType[idx] = ucDISType; }341 Void setDISTypeSubParts ( UChar ucDISType, UInt uiAbsPartIdx, UInt uiDepth );342 #endif343 236 SChar* getPredictionMode ( ) { return m_pePredMode; } 344 237 PredMode getPredictionMode ( UInt uiIdx ) const { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } … … 346 239 Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); 347 240 348 #if NH_3D_DBBP349 Bool* getDBBPFlag () const { return m_pbDBBPFlag; }350 Bool getDBBPFlag ( UInt uiIdx ) const { return m_pbDBBPFlag[uiIdx]; }351 Void setDBBPFlag ( UInt uiIdx, Bool b ) { m_pbDBBPFlag[uiIdx] = b; }352 Void setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );353 DbbpTmpData* getDBBPTmpData () { return &m_sDBBPTmpData; }354 #endif355 241 356 242 SChar* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID]; } … … 448 334 template <typename T> 449 335 Void setSubPart ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); 450 #if H_3D_VSP || NH_3D_DBBP451 template<typename T>452 Void setSubPartT ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );453 #endif454 336 455 337 #if AMP_MRG … … 474 356 Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } 475 357 Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); 476 #if NH_3D_NBDV477 Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );478 #if H_3D_VSP || NH_3D_DBBP479 Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);480 #endif481 DisInfo* getDvInfo () { return m_pDvInfo; }482 DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; }483 #endif484 #if NH_3D_NBDV485 Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );486 Bool xCheckSpatialNBDV (const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,487 UInt uiMvpDvPos488 #if NH_3D_NBDV_REF489 , Bool bDepthRefine = false490 #endif491 );492 Bool xGetColDisMV ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );493 Void getDisMvpCandNBDV ( DisInfo* pDInfo494 #if NH_3D_NBDV_REF495 , Bool bDepthRefine = false496 #endif497 );498 499 #if NH_3D_IV_MERGE500 Void getDispforDepth ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);501 #endif502 503 #if NH_3D_NBDV_REF504 Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );505 Void estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred );506 #endif //NH_3D_NBDV_REF507 #endif508 #if NH_3D_DIS509 Bool getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index);510 #endif511 #if NH_3D_FAST_TEXTURE_ENCODING512 Void getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD);513 #endif514 #if NH_3D_SPIVMP515 Void getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);516 Void getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );517 Void setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );518 #endif519 #if NH_3D_IV_MERGE520 Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth521 522 #if NH_3D_SPIVMP523 , TComMvField* pcMFieldSP, UChar* puhInterDirSP524 #endif525 , Bool bICFlag526 );527 #endif528 #if NH_3D_ARP529 UChar* getARPW () const { return m_puhARPW; }530 UChar getARPW ( UInt uiIdx ) const { return m_puhARPW[uiIdx]; }531 Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; }532 Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );533 #endif534 #if NH_3D_IC535 Bool* getICFlag () { return m_pbICFlag; }536 Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; }537 Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; }538 Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );539 Bool isICFlagRequired ( UInt uiAbsPartIdx );540 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const;541 #elif NH_3D_VSP542 Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const;543 #else544 358 // ------------------------------------------------------------------------------------------------------------------- 545 359 // member functions for accessing partition information … … 547 361 548 362 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const; // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx 549 #endif550 363 UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 ) const; 551 364 Bool isFirstAbsZorderIdxInDepth ( UInt uiAbsPartIdx, UInt uiDepth ) const; 552 365 553 #if NH_3D_DMM554 Pel* getDmmDeltaDC ( DmmID dmmType, UInt segId ) { return m_dmmDeltaDC[dmmType][segId]; }555 Pel getDmmDeltaDC ( DmmID dmmType, UInt segId, UInt uiIdx ) { return m_dmmDeltaDC[dmmType][segId][uiIdx]; }556 Void setDmmDeltaDC ( DmmID dmmType, UInt segId, UInt uiIdx, Pel val ) { m_dmmDeltaDC[dmmType][segId][uiIdx] = val; }557 558 UInt* getDmm1WedgeTabIdx () { return m_dmm1WedgeTabIdx; }559 UInt getDmm1WedgeTabIdx ( UInt uiIdx ) { return m_dmm1WedgeTabIdx[uiIdx]; }560 Void setDmm1WedgeTabIdx ( UInt uiIdx, UInt tabIdx ) { m_dmm1WedgeTabIdx[uiIdx] = tabIdx; }561 Void setDmm1WedgeTabIdxSubParts ( UInt tabIdx, UInt uiAbsPartIdx, UInt uiDepth );562 #endif563 #if NH_3D_SDC_INTRA564 Bool* getSDCFlag () { return m_pbSDCFlag; }565 Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; }566 Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth );567 568 Bool getSDCAvailable ( UInt uiAbsPartIdx );569 570 Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; }571 Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }572 Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }573 #endif574 366 575 367 // ------------------------------------------------------------------------------------------------------------------- … … 602 394 Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv(); } 603 395 Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv(); } 604 #if NH_3D605 Void compressMV ( Int scale );606 Void printMV ( );607 #else608 396 Void compressMV (); 609 #endif610 397 // ------------------------------------------------------------------------------------------------------------------- 611 398 // utility functions for neighbouring information … … 650 437 Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const; 651 438 652 #if NH_3D653 Bool hasEqualMotion ( Int dirA, const TComMvField* mvFieldA, Int dirB, const TComMvField* mvFieldB );654 #endif655 439 Bool hasEqualMotion ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const; 656 440 657 #if NH_3D_MLC658 Bool getAvailableFlagA1() { return m_bAvailableFlagA1; }659 Bool getAvailableFlagB1() { return m_bAvailableFlagB1; }660 Bool getAvailableFlagB0() { return m_bAvailableFlagB0; }661 Bool getAvailableFlagA0() { return m_bAvailableFlagA0; }662 Bool getAvailableFlagB2() { return m_bAvailableFlagB2; }663 Void initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0; }664 Void buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours665 #if NH_3D_VSP666 , Int* vspFlag667 #endif668 #if NH_3D_SPIVMP669 , Bool* pbSPIVMPFlag670 #endif671 , Int& numValidMergeCand672 );673 Void xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours674 #if NH_3D_SPIVMP675 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP676 #endif677 , Int& numValidMergeCand, Int mrgCandIdx = -1 );678 #endif679 #if NH_3D680 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );681 #else682 441 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ) const; 683 #endif 684 685 #if NH_3D_VSP 686 #if NH_3D_SPIVMP 687 Bool* getSPIVMPFlag () const { return m_pbSPIVMPFlag; } 688 Bool getSPIVMPFlag ( UInt uiIdx ) const { 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 #endif 692 693 SChar* getVSPFlag () const { return m_piVSPFlag; } 694 SChar getVSPFlag ( UInt uiIdx ) const { return m_piVSPFlag[uiIdx]; } 695 Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; } 696 Void setVSPFlagSubParts( SChar 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 #endif 442 699 443 Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; 700 444 Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const; … … 726 470 UInt getCtxSkipFlag ( UInt uiAbsPartIdx ) const; 727 471 UInt getCtxInterDir ( UInt uiAbsPartIdx ) const; 728 #if NH_3D_ARP729 UInt getCTXARPWFlag ( UInt uiAbsPartIdx );730 #endif731 472 732 473 UInt& getTotalBins () { return m_uiTotalBins; } … … 736 477 737 478 Double& getTotalCost() { return m_dTotalCost; } 738 #if NH_3D_VSO739 Dist& getTotalDistortion() { return m_uiTotalDistortion; }740 #else741 479 Distortion& getTotalDistortion() { return m_uiTotalDistortion; } 742 #endif743 480 UInt& getTotalBits() { return m_uiTotalBits; } 744 481 UInt& getTotalNumPart() { return m_uiNumPartition; } -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComInterpolationFilter.cpp
r1386 r1390 75 75 }; 76 76 77 #if NH_3D_ARP78 const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] =79 {80 {64, 0},81 {48, 16},82 {32, 32},83 {16, 48}84 };85 const Short TComInterpolationFilter::m_chromaFilterARP[8][NTAPS_CHROMA_ARP] =86 {87 {64, 0},88 {56, 8},89 {48, 16},90 {40, 24},91 {32, 32},92 {24, 40},93 {16, 48},94 {8, 56}95 };96 #endif97 77 98 78 // ==================================================================================================================== … … 360 340 * \param bitDepth Bit depth 361 341 */ 362 #if NH_3D_ARP363 Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth, Bool filterType )364 #else365 342 Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth ) 366 #endif367 343 368 344 { … … 374 350 { 375 351 assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 376 #if NH_3D_ARP377 if(filterType)378 {379 filterHor<NTAPS_LUMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);380 }381 else382 {383 #endif384 352 filterHor<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]); 385 #if NH_3D_ARP386 }387 #endif388 353 389 354 } … … 392 357 const UInt csx = getComponentScaleX(compID, fmt); 393 358 assert(frac >=0 && csx<2 && (frac<<(1-csx)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 394 #if NH_3D_ARP395 if(filterType)396 {397 filterHor<NTAPS_CHROMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);398 }399 else400 {401 #endif402 359 filterHor<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac<<(1-csx)]); 403 #if NH_3D_ARP404 }405 #endif406 360 } 407 361 } … … 424 378 * \param bitDepth Bit depth 425 379 */ 426 #if NH_3D_ARP427 Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth, Bool filterType )428 #else429 380 Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth ) 430 #endif431 381 { 432 382 if ( frac == 0 ) … … 437 387 { 438 388 assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 439 #if NH_3D_ARP440 if(filterType)441 {442 filterVer<NTAPS_LUMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);443 }444 else445 {446 #endif447 389 filterVer<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]); 448 #if NH_3D_ARP449 }450 #endif451 390 452 391 } … … 455 394 const UInt csy = getComponentScaleY(compID, fmt); 456 395 assert(frac >=0 && csy<2 && (frac<<(1-csy)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS); 457 #if NH_3D_ARP458 if(filterType)459 {460 filterVer<NTAPS_CHROMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]);461 }462 else463 {464 #endif465 396 filterVer<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac<<(1-csy)]); 466 #if NH_3D_ARP467 }468 #endif469 397 } 470 398 } -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComInterpolationFilter.h
r1386 r1390 45 45 //! \{ 46 46 47 #if NH_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 TFilterCoeff m_lumaFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA]; ///< Luma filter taps 64 60 static const TFilterCoeff m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA]; ///< Chroma filter taps 65 #if NH_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 70 62 static Void filterCopy(Int bitDepth, const Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast); … … 82 74 ~TComInterpolationFilter() {} 83 75 84 #if NH_3D_ARP85 Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth , Bool filterType = false );86 #else87 76 Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth ); 88 #endif89 77 90 #if NH_3D_ARP91 Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth , Bool filterType = false );92 #else93 78 Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth ); 94 #endif95 79 }; 96 80 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComMotionInfo.cpp
r1386 r1390 40 40 #include "assert.h" 41 41 #include <stdlib.h> 42 #if NH_3D_SPIVMP43 #include "TComDataCU.h"44 #include "TComPic.h"45 #endif46 42 #if NH_MV 47 43 #include <iomanip> … … 330 326 } 331 327 332 #if NH_3D_SPIVMP333 Void TComCUMvField::setMvFieldSP( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight )334 {335 uiAbsPartIdx += pcCU->getZorderIdxInCtu();336 Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];337 Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];338 Int iEndPelX = iStartPelX + iWidth;339 Int iEndPelY = iStartPelY + iHeight;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 Int iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInCtuWidth() + j/pcCU->getPic()->getMinCUWidth();346 Int uiPartAddr = g_auiRasterToZscan[iCurrRaster];347 uiPartAddr -= pcCU->getZorderIdxInCtu();348 349 m_pcMv[uiPartAddr] = cMvField.getMv();350 m_piRefIdx[uiPartAddr] = cMvField.getRefIdx();351 }352 }353 }354 #endif355 328 356 329 /**Subsampling of the stored prediction mode, reference index and motion vector … … 405 378 } 406 379 407 #if NH_3D_MLC408 Void TComMotionCand::print( Int i )409 {410 if (i == 0 )411 {412 413 std::cout << std::setfill(' ') << std::setw( 15 )414 << "Num" << std::setw( 15 )415 << "Avai" << std::setw( 15 )416 << "Dir " << std::setw( 15 )417 << "L0 RefIdx" << std::setw( 15 )418 << "L0 Hor" << std::setw( 15 )419 << "L0 Ver" << std::setw( 15 )420 << "L1 RefIdx" << std::setw( 15 )421 << "L1 Hor" << std::setw( 15 )422 << "L1 Ver" << std::setw( 15 )423 << "VspFlag" << std::setw( 15 )424 << "SPIVMPFlag"425 << std::endl;426 }427 428 std::cout << std::setfill(' ') << std::setw( 15 )429 << i << std::setw( 15 )430 << m_bAvailable << std::setw( 15 )431 << (UInt) m_uDir << std::setw( 15 )432 << ((m_uDir & 1) ? m_cMvField[0].getRefIdx() : MIN_INT) << std::setw( 15 )433 << ((m_uDir & 1) ? m_cMvField[0].getMv().getHor() : MIN_INT) << std::setw( 15 )434 << ((m_uDir & 1) ? m_cMvField[0].getMv().getVer() : MIN_INT) << std::setw( 15 )435 << ((m_uDir & 2) ? m_cMvField[1].getRefIdx() : MIN_INT) << std::setw( 15 )436 << ((m_uDir & 2) ? m_cMvField[1].getMv().getHor() : MIN_INT) << std::setw( 15 )437 << ((m_uDir & 2) ? m_cMvField[1].getMv().getVer() : MIN_INT) << std::setw( 15 )438 << m_iVspFlag << std::setw( 15 )439 << m_bSPIVMPFlag << std::setw( 15 )440 << std::endl;441 }442 #endif443 380 #endif 444 381 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComMotionInfo.h
r1386 r1390 51 51 // ==================================================================================================================== 52 52 53 #if NH_3D_SPIVMP54 class TComDataCU;55 #endif56 53 /// parameters for AMVP 57 54 typedef struct _AMVPInfo … … 61 58 } AMVPInfo; 62 59 63 #if NH_3D_NBDV64 typedef struct _DisCand65 {66 TComMv m_acNBDV; // DV from NBDV67 #if NH_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 60 82 61 // ==================================================================================================================== … … 108 87 Int getHor () const { return m_acMv.getHor(); } 109 88 Int getVer () const { return m_acMv.getVer(); } 110 #if NH_3D_IV_MERGE111 Bool operator== ( const TComMvField& rcMv ) const112 {113 return (m_acMv.getHor()==rcMv.getHor() && m_acMv.getVer()==rcMv.getVer() && m_iRefIdx == rcMv.getRefIdx());114 }115 #endif116 89 }; 117 90 … … 168 141 Void setAllRefIdx ( Int iRefIdx, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 ); 169 142 Void setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 ); 170 #if NH_3D_SPIVMP171 Void setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight );172 #endif173 #if NH_3D_VSP174 Void setMv ( Int iIdx, TComMv const & rcMv ) { m_pcMv[iIdx] = rcMv; }175 Void setRefIdx ( Int iIdx, Int iRefIdx ) { m_piRefIdx[iIdx] = iRefIdx; }176 #endif177 143 178 144 Void setNumPartition( Int iNumPart ) … … 196 162 //! \} 197 163 198 #if NH_3D_MLC199 /// class for container of merge candidate200 class TComMotionCand201 {202 public:203 Bool m_bAvailable;204 TComMvField m_cMvField[2];205 UChar m_uDir;206 #if NH_3D_VSP207 Int m_iVspFlag;208 #endif209 #if NH_3D_SPIVMP210 Bool m_bSPIVMPFlag;211 #endif212 213 public:214 TComMotionCand()215 {216 m_bAvailable = false;217 m_uDir = 0;218 #if NH_3D_VSP219 m_iVspFlag = 0;220 #endif221 #if NH_3D_SPIVMP222 m_bSPIVMPFlag = false;223 #endif224 }225 226 ~TComMotionCand()227 {228 229 }230 231 Void init()232 {233 TComMv cZeroMv;234 235 m_bAvailable = false;236 m_uDir = 0;237 #if NH_3D_VSP238 m_iVspFlag = 0;239 #endif240 #if NH_3D_SPIVMP241 m_bSPIVMPFlag = false;242 #endif243 m_cMvField[0].setMvField(cZeroMv, NOT_VALID);244 m_cMvField[1].setMvField(cZeroMv, NOT_VALID);245 }246 247 Void setCand(TComMvField* pcMvFieldNeighbours, UChar uhInterDirNeighbours248 #if NH_3D_VSP249 , Int vspFlag250 #endif251 #if NH_3D_SPIVMP252 , Bool bSPIVMPFlag253 #endif254 )255 {256 m_bAvailable = true;257 m_cMvField[0] = pcMvFieldNeighbours[0];258 m_cMvField[1] = pcMvFieldNeighbours[1];259 m_uDir = uhInterDirNeighbours;260 #if NH_3D_VSP261 m_iVspFlag = vspFlag;262 #endif263 #if NH_3D_SPIVMP264 m_bSPIVMPFlag = bSPIVMPFlag;265 #endif266 }267 268 Void getCand(Int iCount, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours269 #if NH_3D_VSP270 , Int* vspFlag271 #endif272 #if NH_3D_SPIVMP273 , Bool* pbSPIVMPFlag274 #endif275 )276 {277 pcMvFieldNeighbours[iCount<<1] = m_cMvField[0];278 pcMvFieldNeighbours[(iCount<<1) + 1] = m_cMvField[1];279 puhInterDirNeighbours[iCount] = m_uDir;280 #if NH_3D_VSP281 vspFlag[iCount] = m_iVspFlag;282 #endif283 #if NH_3D_SPIVMP284 pbSPIVMPFlag[iCount] = m_bSPIVMPFlag;285 #endif286 }287 288 289 Void print( Int i );290 291 };292 293 294 #endif295 164 296 165 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComMv.h
r1386 r1390 40 40 41 41 #include "CommonDef.h" 42 #if NH_3D43 #include <cstdlib>44 #endif45 42 46 43 //! \ingroup TLibCommon … … 57 54 Short m_iHor; ///< horizontal component of motion vector 58 55 Short m_iVer; ///< vertical component of motion vector 59 #if NH_3D_NBDV60 Bool m_bIDV;61 Short m_iIDVHor;62 Short m_iIDVVer;63 Short m_iIDVVId; //view index of the IDV64 #endif65 56 public: 66 57 … … 72 63 m_iHor(0), 73 64 m_iVer(0) 74 #if NH_3D_NBDV75 , m_bIDV(false)76 , m_iIDVHor(0)77 , m_iIDVVer(0)78 , m_iIDVVId(0)79 #endif80 65 { 81 66 } … … 84 69 m_iHor(iHor), 85 70 m_iVer(iVer) 86 #if NH_3D_NBDV87 , m_bIDV(false)88 , m_iIDVHor(0)89 , m_iIDVVer(0)90 , m_iIDVVId(0)91 #endif92 71 { 93 72 } … … 100 79 Void setHor ( Short i ) { m_iHor = i; } 101 80 Void setVer ( Short i ) { m_iVer = i; } 102 #if NH_3D_NBDV103 Void setZero () { m_iHor = m_iVer = 0; m_bIDV = false; m_iIDVHor = m_iIDVVer = 0; m_iIDVVId = 0; }104 Void setIDVHor (Short i) {m_iIDVHor = i;}105 Void setIDVVer (Short i) {m_iIDVVer = i;}106 Void setIDVFlag (Bool b ) {m_bIDV = b;}107 Void setIDVVId (Short i) {m_iIDVVId = i;}108 #else109 81 Void setZero () { m_iHor = m_iVer = 0; } 110 #endif111 82 // ------------------------------------------------------------------------------------------------------------------ 112 83 // get … … 117 88 Int getAbsHor () const { return abs( m_iHor ); } 118 89 Int getAbsVer () const { return abs( m_iVer ); } 119 #if NH_3D_NBDV120 Short getIDVHor () const { return m_iIDVHor; }121 Short getIDVVer () const { return m_iIDVVer; }122 Bool getIDVFlag() const { return m_bIDV; }123 Short getIDVVId () const { return m_iIDVVId; }124 125 #endif126 90 // ------------------------------------------------------------------------------------------------------------------ 127 91 // operations … … 142 106 } 143 107 144 #if NH_3D145 #if ME_ENABLE_ROUNDING_OF_MVS146 147 const TComMv& operator>>= (const Int i)148 {149 m_iHor >>= i;150 m_iVer >>= i;151 return *this;152 }153 #endif154 #endif155 108 156 109 #if !ME_ENABLE_ROUNDING_OF_MVS -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComPattern.h
r1386 r1390 85 85 // TComPatternParam m_cPatternCb; 86 86 //TComPatternParam m_cPatternCr; 87 #if NH_3D_IC88 Bool m_bICFlag;89 #endif90 #if NH_3D_SDC_INTER91 Bool m_bSDCMRSADFlag;92 #endif93 87 94 88 … … 103 97 Int getBitDepthY() const { return m_cPatternY.m_bitDepth; } 104 98 105 #if NH_3D_IC106 Bool getICFlag() const { return m_bICFlag; }107 Void setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; }108 #endif109 #if NH_3D_SDC_INTER110 Bool getSDCMRSADFlag() const { return m_bSDCMRSADFlag; }111 Void setSDCMRSADFlag( Bool bSDCMRSADFlag ) { m_bSDCMRSADFlag = bSDCMRSADFlag; }112 #endif113 99 114 100 // ------------------------------------------------------------------------------------------------------------------- -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComPic.cpp
r1386 r1390 60 60 , m_viewId (0) 61 61 , m_bPicOutputFlag (false) 62 #if NH_3D_VSO63 , m_viewIndex (0)64 , m_isDepth (false)65 , m_aaiCodedScale (0)66 , m_aaiCodedOffset (0)67 62 #endif 68 #endif69 63 70 64 { … … 73 67 m_apcPicYuv[i] = NULL; 74 68 } 75 #if NH_3D_QTLPC76 m_bReduceBitsQTL = 0;77 #endif78 #if NH_3D_NBDV79 m_iNumDdvCandPics = 0;80 m_eRapRefList = REF_PIC_LIST_0;81 m_uiRapRefIdx = 0;82 #endif83 69 #if NH_MV 84 70 m_isPocResettingPic = false; … … 123 109 m_bUsedByCurr = false; 124 110 125 #if H_3D_FCO126 /* initialize the texture to depth reference status */127 for (int j=0; j<2; j++)128 {129 for (int i=0; i<MAX_NUM_REF; i++)130 {131 m_aiTexToDepRef[j][i] = -1;132 }133 }134 #endif135 111 136 112 } … … 152 128 deleteSEIs(m_SEIs); 153 129 } 154 #if NH_3D155 #if NH_3D_ARP156 Void TComPic::getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx )157 {158 Int iMaxCUWidth = (Int) ( getPicSym()->getSPS().getMaxCUWidth() );159 Int iMaxCuHeight = (Int) ( getPicSym()->getSPS().getMaxCUHeight() );160 161 UInt uiMaxTotalCUDepth = getPicSym()->getSPS().getMaxTotalCUDepth();162 Int iBaseUnitWidth = iMaxCUWidth >> uiMaxTotalCUDepth;163 Int iBaseUnitHeight = iMaxCUWidth >> uiMaxTotalCUDepth;164 165 Int iNumCuInWidth = getPicYuvRec()->getWidth(COMPONENT_Y) / iMaxCUWidth;166 iNumCuInWidth += ( getPicYuvRec()->getWidth(COMPONENT_Y) % iMaxCUWidth ) ? 1 : 0;167 168 169 Int iCuX = iX / iMaxCUWidth;170 Int iCuY = iY / iMaxCuHeight;171 Int iBaseX = ( iX - iCuX * iMaxCUWidth ) / iBaseUnitWidth;172 Int iBaseY = ( iY - iCuY * iMaxCuHeight ) / iBaseUnitHeight;173 Int iCuSizeInBases = iMaxCuHeight / iBaseUnitWidth;174 175 riCuAddr = iCuY * iNumCuInWidth + iCuX;176 Int iRastPartIdx = iBaseY * iCuSizeInBases + iBaseX;177 riAbsZorderIdx = g_auiRasterToZscan[ iRastPartIdx ];178 }179 #endif180 Void TComPic::compressMotion(Int scale)181 #else182 130 Void TComPic::compressMotion() 183 #endif184 131 { 185 132 TComPicSym* pPicSym = getPicSym(); … … 187 134 { 188 135 TComDataCU* pCtu = pPicSym->getCtu(uiCUAddr); 189 #if NH_3D190 pCtu->compressMV(scale);191 #else192 136 pCtu->compressMV(); 193 #endif194 137 195 138 } … … 327 270 } 328 271 329 #if NH_3D330 Void TComPic::printMotion()331 {332 TComPicSym* pPicSym = getPicSym();333 for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getNumberOfCtusInFrame(); uiCUAddr++ )334 {335 TComDataCU* pCtu = pPicSym->getCtu(uiCUAddr);336 std::cout << "CUAddr " << uiCUAddr << std::endl;337 pCtu->printMV();338 std::cout << std::endl;339 }340 }341 342 #if NH_3D_NBDV343 Int TComPic::getDisCandRefPictures(Int iColPOC)344 {345 UInt uiTempLayerCurr = 7;346 TComSlice* currSlice = getSlice(getCurrSliceIdx());347 UInt numDdvCandPics = 0;348 349 if(!currSlice->getEnableTMVPFlag())350 {351 return numDdvCandPics;352 }353 354 numDdvCandPics += 1;355 356 UInt pocCurr = currSlice->getPOC();357 UInt pocDiff = 255;358 359 for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr++)360 {361 Bool x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();362 363 for(UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)364 {365 if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex()366 && (x == currSlice->getColFromL0Flag() || currSlice->getRefPOC((RefPicList)x, i) != iColPOC) && numDdvCandPics != 2)367 {368 TComSlice* refSlice = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx());369 Bool bRAP = (refSlice->getViewIndex() && refSlice->isIRAP()) ? 1 : 0;370 UInt uiTempLayer = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer();371 372 if(bRAP)373 {374 this->setRapRefIdx(i);375 this->setRapRefList((RefPicList)x);376 numDdvCandPics = 2;377 378 return numDdvCandPics;379 }380 else if (uiTempLayerCurr > uiTempLayer)381 {382 uiTempLayerCurr = uiTempLayer;383 }384 }385 }386 }387 388 UInt z = -1; // GT: Added to make code compile needs to be checked!389 UInt idx = 0;390 391 for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2 : 1); lpNr++)392 {393 Bool x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();394 395 for(UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)396 {397 Int iTempPoc = currSlice->getRefPic((RefPicList)x, i)->getPOC();398 Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr) : (pocCurr - iTempPoc);399 400 if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() && (x == currSlice->getColFromL0Flag() || currSlice->getRefPOC((RefPicList)x, i) != iColPOC)401 && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)402 {403 pocDiff = iTempDiff;404 z = x;405 idx = i;406 }407 }408 }409 410 if(pocDiff < 255)411 {412 this->setRapRefIdx(idx);413 this->setRapRefList((RefPicList) z);414 numDdvCandPics = 2;415 }416 417 return numDdvCandPics;418 }419 420 Void TComPic::checkTemporalIVRef()421 {422 TComSlice* currSlice = getSlice(getCurrSliceIdx());423 const Int numCandPics = this->getNumDdvCandPics();424 425 for(Int curCandPic = 0; curCandPic < numCandPics; curCandPic++)426 {427 RefPicList eCurRefPicList = REF_PIC_LIST_0 ;428 Int curCandPicRefIdx = 0;429 if(curCandPic == 0)430 {431 eCurRefPicList = RefPicList(currSlice->isInterB() ? 1 - currSlice->getColFromL0Flag() : 0);432 curCandPicRefIdx = currSlice->getColRefIdx();433 }434 else435 {436 eCurRefPicList = this->getRapRefList();437 curCandPicRefIdx = this->getRapRefIdx();438 }439 440 TComPic* pcCandColPic = currSlice->getRefPic(eCurRefPicList, curCandPicRefIdx);441 TComSlice* pcCandColSlice = pcCandColPic->getSlice(0); // currently only support single slice442 443 if(!pcCandColSlice->isIntra())444 {445 for(Int iColRefDir = 0; iColRefDir < (pcCandColSlice->isInterB() ? 2 : 1); iColRefDir++)446 {447 for(Int iColRefIdx = 0; iColRefIdx < pcCandColSlice->getNumRefIdx((RefPicList)iColRefDir); iColRefIdx++)448 {449 m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = false;450 Int iColViewIdx = pcCandColSlice->getViewIndex();451 // The picture pcCandColSlice->getRefPic((RefPicList)iColRefDir, iColRefIdx) might not be in DPB anymore452 // So don't access it directly.453 Int iColRefViewIdx = pcCandColSlice->getVPS()->getViewOrderIdx( pcCandColSlice->getRefLayerId( (RefPicList)iColRefDir, iColRefIdx ) );454 if(iColViewIdx == iColRefViewIdx)455 {456 continue;457 }458 459 for(Int iCurrRefDir = 0; (iCurrRefDir < (currSlice->isInterB() ? 2 : 1)) && (m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] == false); iCurrRefDir++)460 {461 for(Int iCurrRefIdx = 0; iCurrRefIdx < currSlice->getNumRefIdx((RefPicList)iCurrRefDir); iCurrRefIdx++)462 {463 if(currSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iColRefViewIdx)464 {465 m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = true;466 break;467 }468 }469 }470 }471 }472 }473 }474 }475 476 Bool TComPic::isTempIVRefValid(Int currCandPic, Int iColRefDir, Int iColRefIdx)477 {478 return m_abTIVRINCurrRL[currCandPic][iColRefDir][iColRefIdx];479 }480 481 Void TComPic::checkTextureRef()482 {483 TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());484 TComPic* pcTextPic = pcCurrSlice->getIvPic(0, getViewIndex());485 #if H_3D_FCO486 if ( pcTextPic )487 {488 #endif489 TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice490 491 for(Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB() ? 2 :1) ) && !pcTextSlice->isIntra(); iTextRefDir++)492 {493 for(Int iTextRefIdx =0; iTextRefIdx < pcTextSlice->getNumRefIdx((RefPicList)iTextRefDir); iTextRefIdx++)494 {495 Int iTextRefPOC = pcTextSlice->getRefPOC((RefPicList)iTextRefDir, iTextRefIdx);496 Int iTextRefViewId = pcTextSlice->getRefPic((RefPicList)iTextRefDir, iTextRefIdx)->getViewIndex();497 m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;498 Int iCurrRefDir = iTextRefDir;499 500 for(Int iCurrRefIdx = 0; (iCurrRefIdx<pcCurrSlice->getNumRefIdx((RefPicList)iCurrRefDir)) && (m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0); iCurrRefIdx++)501 {502 if(pcCurrSlice->getRefPOC((RefPicList)iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&503 pcCurrSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId)504 {505 m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;506 }507 }508 }509 }510 #if H_3D_FCO511 }512 #endif513 }514 515 Int TComPic::isTextRefValid(Int iTextRefDir, Int iTextRefIdx)516 {517 return m_aiTexToDepRef[iTextRefDir][iTextRefIdx];518 }519 #endif520 #endif521 272 522 273 Void TComAu::setPicLatencyCount( Int picLatenyCount ) … … 989 740 } 990 741 991 #if NH_3D_VSO992 TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int auxId, Int poc, Bool recon )993 {994 Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag, auxId );995 return getPicYuv( layerIdInNuh, poc, recon );996 }997 998 TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int auxId, Int poc )999 {1000 return getPic ( m_vps->getLayerIdInNuh( viewIndex, depthFlag, auxId ), poc );1001 }1002 742 1003 743 #endif 1004 744 1005 #endif1006 1007 745 1008 746 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComPic.h
r1386 r1390 154 154 TComDecodedRps m_decodedRps; 155 155 #endif 156 #if NH_3D_VSO157 Int m_viewIndex;158 Bool m_isDepth;159 Int** m_aaiCodedScale;160 Int** m_aaiCodedOffset;161 #if NH_3D_QTLPC162 Bool m_bReduceBitsQTL;163 #endif164 #if NH_3D_NBDV165 UInt m_uiRapRefIdx;166 RefPicList m_eRapRefList;167 Int m_iNumDdvCandPics;168 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 lists169 Int m_aiTexToDepRef [2][MAX_NUM_REF];170 #endif171 #endif172 156 public: 173 157 TComPic(); … … 223 207 Bool getOutputMark () const { return m_bNeededForOutput; } 224 208 225 #if !NH_3D226 209 Void compressMotion(); 227 #endif228 210 UInt getCurrSliceIdx() const { return m_uiCurrSliceIdx; } 229 211 Void setCurrSliceIdx(UInt i) { m_uiCurrSliceIdx = i; } … … 311 293 Void print( Int outputLevel ); 312 294 313 #if NH_3D_VSO314 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; }315 Int getViewIndex () const { return m_viewIndex; }316 317 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }318 Bool getIsDepth () { return m_isDepth; }319 320 Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; }321 Int** getCodedScale () { return m_aaiCodedScale; }322 Int** getCodedOffset() { return m_aaiCodedOffset; }323 324 Void compressMotion(Int scale);325 Void printMotion( );326 #if NH_3D_ARP327 Void getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx );328 #endif329 #if NH_3D_QTLPC330 Bool getReduceBitsFlag () { return m_bReduceBitsQTL; }331 Void setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag; }332 #endif333 #if NH_3D_NBDV334 Int getNumDdvCandPics() { return m_iNumDdvCandPics; }335 Int getDisCandRefPictures(Int iColPOC);336 Void setRapRefIdx(UInt uiRapRefIdx) { m_uiRapRefIdx = uiRapRefIdx; }337 Void setRapRefList(RefPicList eRefPicList) { m_eRapRefList = eRefPicList; }338 Void setNumDdvCandPics (Int i) { m_iNumDdvCandPics = i; }339 UInt getRapRefIdx() { return m_uiRapRefIdx; }340 RefPicList getRapRefList() { return m_eRapRefList; }341 Void checkTemporalIVRef();342 Bool isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx);343 Void checkTextureRef( );344 Int isTextRefValid(Int iTextRefDir, Int iTextRefIdx);345 #endif346 #endif347 295 #endif 348 296 … … 404 352 TComList<TComSubDpb*> m_subDpbs; 405 353 Bool m_printPicOutput; 406 #if NH_3D_VSO407 const TComVPS* m_vps;408 #endif409 354 public: 410 355 TComPicLists() { m_printPicOutput = false; }; … … 448 393 Void print(); 449 394 450 #if NH_3D_VSO451 Void setVPS ( const TComVPS* vps ) { m_vps = vps; };452 TComPic* getPic ( Int viewIndex, Bool depthFlag, Int auxId, Int poc );453 TComPicYuv* getPicYuv ( Int viewIndex, Bool depthFlag, Int auxId, Int poc, Bool recon );454 #endif455 395 456 396 }; -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComPicYuv.cpp
r1386 r1390 90 90 m_picHeight = picHeight; 91 91 92 #if NH_3D_IV_MERGE93 m_iCuWidth = maxCUWidth;94 m_iCuHeight = maxCUHeight;95 96 m_iNumCuInWidth = picWidth / m_iCuWidth;97 m_iNumCuInWidth += ( picHeight % m_iCuWidth ) ? 1 : 0;98 // Check if m_iBaseUnitWidth and m_iBaseUnitHeight need to be derived here99 #endif100 92 101 93 m_chromaFormatIDC = chromaFormatIDC; … … 138 130 createWithoutCUInfo(picWidth, picHeight, chromaFormatIDC, bUseMargin, maxCUWidth, maxCUHeight); 139 131 140 #if NH_3D_IV_MERGE141 m_iBaseUnitWidth = maxCUWidth >> maxCUDepth;142 m_iBaseUnitHeight = maxCUHeight >> maxCUDepth;143 #endif144 132 145 133 … … 347 335 fclose(pFile); 348 336 } 349 #if NH_3D_IV_MERGE 350 Void 351 TComPicYuv::getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY ) 352 { 353 Int iRastPartIdx = g_auiZscanToRaster[iAbsZorderIdx]; 354 Int iCuSizeInBases = m_iCuWidth / m_iBaseUnitWidth; 355 Int iCuX = iCuAddr % m_iNumCuInWidth; 356 Int iCuY = iCuAddr / m_iNumCuInWidth; 357 Int iBaseX = iRastPartIdx % iCuSizeInBases; 358 Int iBaseY = iRastPartIdx / iCuSizeInBases; 359 riX = iCuX * m_iCuWidth + iBaseX * m_iBaseUnitWidth; 360 riY = iCuY * m_iCuHeight + iBaseY * m_iBaseUnitHeight; 361 } 362 363 Void 364 TComPicYuv::getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx ) 365 { 366 Int iCuX = iX / m_iCuWidth; 367 Int iCuY = iY / m_iCuHeight; 368 Int iBaseX = ( iX - iCuX * m_iCuWidth ) / m_iBaseUnitWidth; 369 Int iBaseY = ( iY - iCuY * m_iCuHeight ) / m_iBaseUnitHeight; 370 Int iCuSizeInBases = m_iCuWidth / m_iBaseUnitWidth; 371 riCuAddr = iCuY * m_iNumCuInWidth + iCuX; 372 Int iRastPartIdx = iBaseY * iCuSizeInBases + iBaseX; 373 riAbsZorderIdx = g_auiRasterToZscan[ iRastPartIdx ]; 374 } 375 376 #endif 377 378 #if NH_3D_VSO 379 Void TComPicYuv::setChromaTo( Pel pVal ) 380 { 381 xSetPels( getAddr( COMPONENT_Cb ), getStride( COMPONENT_Cb ), getWidth( COMPONENT_Cb), getHeight( COMPONENT_Cb ), pVal ); 382 xSetPels( getAddr( COMPONENT_Cr ), getStride( COMPONENT_Cr ), getWidth( COMPONENT_Cr), getHeight( COMPONENT_Cr ), pVal ); 383 } 384 385 Void TComPicYuv::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ) 386 { 387 for (Int iYPos = 0; iYPos < iHeight; iYPos++) 388 { 389 for (Int iXPos = 0; iXPos < iWidth; iXPos++) 390 { 391 piPelSource[iXPos] = iVal; 392 } 393 piPelSource += iSourceStride; 394 } 395 } 396 #endif 337 397 338 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComPicYuv.h
r1386 r1390 80 80 81 81 Bool m_bIsBorderExtended; 82 #if NH_3D_IV_MERGE83 Int m_iBaseUnitWidth; ///< Width of Base Unit (with maximum depth or minimum size, m_iCuWidth >> Max. Depth)84 Int m_iBaseUnitHeight; ///< Height of Base Unit (with maximum depth or minimum size, m_iCuHeight >> Max. Depth)85 Int m_iNumCuInWidth;86 Int m_iCuWidth; ///< Width of Coding Unit (CU)87 Int m_iCuHeight; ///< Height of Coding Unit (CU)88 #endif89 82 90 #if NH_3D_VSO91 Void xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );92 #endif93 83 94 84 public: … … 183 173 Bool getBorderExtension( ) { return m_bIsBorderExtended; } 184 174 #endif 185 #if NH_3D_VSO186 // Set Function187 Void setLumaTo ( Pel pVal );188 Void setChromaTo ( Pel pVal );189 #endif190 #if NH_3D191 #if NH_3D_IV_MERGE192 // sample to block and block to sample conversion193 Void getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY );194 Void getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx );195 #endif196 #endif197 175 198 176 };// END CLASS DEFINITION TComPicYuv -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComPrediction.cpp
r1386 r1390 82 82 } 83 83 } 84 #if NH_3D_VSP85 m_pDepthBlock = (Int*) malloc(MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH*sizeof(Int));86 if (m_pDepthBlock == NULL)87 {88 printf("ERROR: UKTGHU, No memory allocated.\n");89 }90 #endif91 84 92 85 } … … 94 87 TComPrediction::~TComPrediction() 95 88 { 96 #if NH_3D_VSP97 if (m_pDepthBlock != NULL)98 {99 free(m_pDepthBlock);100 }101 m_cYuvDepthOnVsp.destroy();102 #endif103 89 104 90 destroy(); … … 123 109 m_cYuvPredTemp.destroy(); 124 110 125 #if NH_3D_ARP126 m_acYuvPredBase[0].destroy();127 m_acYuvPredBase[1].destroy();128 #endif129 111 if( m_pLumaRecBuffer ) 130 112 { … … 182 164 183 165 m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC ); 184 #if NH_3D_ARP185 m_acYuvPredBase[0] .create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );186 m_acYuvPredBase[1] .create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );187 #endif188 #if NH_3D_VSP189 m_cYuvDepthOnVsp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );190 #endif191 166 192 167 } … … 201 176 } 202 177 } 203 #if NH_3D_IC204 m_uiaShift[0] = 0;205 for( Int i = 1; i < 64; i++ )206 {207 m_uiaShift[i] = ( (1 << 15) + i/2 ) / i;208 }209 #endif210 178 } 211 179 … … 508 476 } 509 477 510 #if NH_3D_DMM511 Void TComPrediction::predIntraLumaDmm( TComDataCU* pcCU, UInt uiAbsPartIdx, DmmID dmmType, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight )512 {513 assert( iWidth == iHeight );514 assert( iWidth >= DMM_MIN_SIZE && iWidth <= DMM_MAX_SIZE );515 #if NH_3D_SDC_INTRA516 assert( !pcCU->getSDCFlag( uiAbsPartIdx ) );517 #endif518 519 // get partition520 Bool* biSegPattern = new Bool[ (UInt)(iWidth*iHeight) ];521 UInt patternStride = (UInt)iWidth;522 switch( dmmType )523 {524 case( DMM1_IDX ): { (getWedgeListScaled( (UInt)iWidth )->at( pcCU->getDmm1WedgeTabIdx( uiAbsPartIdx ) )).getPatternScaledCopy( (UInt)iWidth, biSegPattern ); } break;525 case( DMM4_IDX ): { predContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, biSegPattern ); } break;526 default: assert(0);527 }528 529 // get predicted partition values530 Pel predDC1 = 0, predDC2 = 0;531 predBiSegDCs( pcCU, uiAbsPartIdx, iWidth, iHeight, biSegPattern, patternStride, predDC1, predDC2 );532 533 // set segment values with deltaDC offsets534 Pel segDC1 = 0, segDC2 = 0;535 Pel deltaDC1 = pcCU->getDmmDeltaDC( dmmType, 0, uiAbsPartIdx );536 Pel deltaDC2 = pcCU->getDmmDeltaDC( dmmType, 1, uiAbsPartIdx );537 #if NH_3D_DLT538 segDC1 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );539 segDC2 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );540 #else541 segDC1 = ClipBD( predDC1 + deltaDC1, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );542 segDC2 = ClipBD( predDC2 + deltaDC2, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );543 #endif544 545 // set prediction signal546 Pel* pDst = piPred;547 assignBiSegDCs( pDst, uiStride, biSegPattern, patternStride, segDC1, segDC2 );548 549 delete[] biSegPattern;550 }551 #endif552 478 553 479 /** Check for identical motion in both motion vector direction of a bi-directional predicted CU … … 565 491 Int layerIdL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getLayerId(); 566 492 Int layerIdL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getLayerId(); 567 #if NH_3D_ARP568 if(!pcCU->getARPW(PartAddr) && RefPOCL0 == RefPOCL1 && layerIdL0 == layerIdL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))569 #else570 493 if(RefPOCL0 == RefPOCL1 && layerIdL0 == layerIdL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr)) 571 #endif572 494 #else 573 495 if(RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr)) … … 581 503 } 582 504 583 #if NH_3D_SPIVMP 584 Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr ) 585 { 586 for (Int i = 0; i < iNumSP; i++) 587 { 588 uiMergedSPW[i] = iSPWidth; 589 uiMergedSPH[i] = iSPHeight; 590 pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]); 591 } 592 #if NH_3D_ARP 593 if( pcCU->getARPW( uiPartAddr ) != 0 ) 594 { 595 return; 596 } 597 #endif 598 599 // horizontal sub-PU merge 600 for (Int i=0; i<iNumSP; i++) 601 { 602 if (i % iNumSPInOneLine == iNumSPInOneLine - 1 || uiMergedSPW[i]==0 || uiMergedSPH[i]==0) 603 { 604 continue; 605 } 606 for (Int j=i+1; j<i+iNumSPInOneLine-i%iNumSPInOneLine; j++) 607 { 608 if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j])) 609 { 610 uiMergedSPW[i] += iSPWidth; 611 uiMergedSPW[j] = uiMergedSPH[j] = 0; 612 } 613 else 614 { 615 break; 616 } 617 } 618 } 619 //vertical sub-PU merge 620 for (Int i=0; i<iNumSP-iNumSPInOneLine; i++) 621 { 622 if (uiMergedSPW[i]==0 || uiMergedSPH[i]==0) 623 { 624 continue; 625 } 626 for (Int j=i+iNumSPInOneLine; j<iNumSP; j+=iNumSPInOneLine) 627 { 628 if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]) && uiMergedSPW[i]==uiMergedSPW[j]) 629 { 630 uiMergedSPH[i] += iSPHeight; 631 uiMergedSPH[j] = uiMergedSPW[j] = 0; 632 } 633 else 634 { 635 break; 636 } 637 } 638 } 639 } 640 641 Bool TComPrediction::xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 ) 642 { 643 if( pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr1)) 644 { 645 return false; 646 } 647 if( pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr1)) 648 { 649 return false; 650 } 651 652 if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) >= 0) 653 { 654 if (pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr1)) 655 { 656 return false; 657 } 658 } 659 660 if (pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) >= 0) 661 { 662 if (pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr1)) 663 { 664 return false; 665 } 666 } 667 return true; 668 } 669 #endif 670 671 #if NH_3D_DBBP 672 PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU) 673 { 674 const TComSPS* sps = pcCU->getSlice()->getSPS(); 675 UInt uiMaxCUWidth = sps->getMaxCUWidth(); 676 UInt uiMaxCUHeight = sps->getMaxCUHeight(); 677 678 // find virtual partitioning for this CU based on depth block 679 // segmentation of texture block --> mask IDs 680 Pel* pDepthBlockStart = pDepthPels; 681 682 // first compute average of depth block for thresholding 683 Int iSumDepth = 0; 684 Int iSubSample = 4; 685 Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth(COMPONENT_Y); 686 Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(COMPONENT_Y); 687 TComMv cDv = pcCU->getSlice()->getDepthRefinementFlag( ) ? pcCU->getDvInfo(0).m_acDoNBDV : pcCU->getDvInfo(0).m_acNBDV; 688 if( pcCU->getSlice()->getDepthRefinementFlag( ) ) 689 { 690 cDv.setVer(0); 691 } 692 Int iBlkX = ( pcCU->getCtuRsAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getHor()+2)>>2); 693 Int iBlkY = ( pcCU->getCtuRsAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getVer()+2)>>2); 694 695 UInt t=0; 696 697 for (Int y=0; y<uiSize; y+=iSubSample) 698 { 699 for (Int x=0; x<uiSize; x+=iSubSample) 700 { 701 if (iBlkX+x>iPictureWidth) 702 { 703 Int depthPel = pDepthPels[t]; 704 iSumDepth += depthPel; 705 } 706 else 707 { 708 Int depthPel = pDepthPels[x]; 709 t=x; 710 iSumDepth += depthPel; 711 } 712 } 713 714 // next row 715 if (!(iBlkY+y+4>iPictureHeight)) 716 { 717 pDepthPels += uiDepthStride*iSubSample; 718 } 719 } 720 721 Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample]; // respect sub-sampling factor 722 Int iMean = iSumDepth >> iSizeInBits*2; // iMean /= (uiSize*uiSize); 723 724 // start again for segmentation 725 pDepthPels = pDepthBlockStart; 726 727 // start mapping process 728 Int matchedPartSum[2][2] = {{0,0},{0,0}}; // counter for each part size and boolean option 729 PartSize virtualPartSizes[2] = { SIZE_Nx2N, SIZE_2NxN}; 730 731 UInt uiHalfSize = uiSize>>1; 732 for (Int y=0; y<uiSize; y+=iSubSample) 733 { 734 for (Int x=0; x<uiSize; x+=iSubSample) 735 { 736 Int depthPel = 0; 737 if (iBlkX+x>iPictureWidth) 738 { 739 depthPel = pDepthPels[t]; 740 } 741 else 742 { 743 depthPel = pDepthPels[x]; 744 t=x; 745 } 746 747 // decide which segment this pixel belongs to 748 Int ucSegment = (Int)(depthPel>iMean); 749 750 // Matched Filter to find optimal (conventional) partitioning 751 752 // SIZE_Nx2N 753 if(x<uiHalfSize) // left 754 { 755 matchedPartSum[0][ucSegment]++; 756 } 757 else // right 758 { 759 matchedPartSum[0][1-ucSegment]++; 760 } 761 762 // SIZE_2NxN 763 if(y<uiHalfSize) // top 764 { 765 matchedPartSum[1][ucSegment]++; 766 } 767 else // bottom 768 { 769 matchedPartSum[1][1-ucSegment]++; 770 } 771 } 772 773 // next row 774 if (!(iBlkY+y+4>iPictureHeight)) 775 { 776 pDepthPels += uiDepthStride*iSubSample; 777 } 778 } 779 780 PartSize matchedPartSize = NUMBER_OF_PART_SIZES; 781 782 Int iMaxMatchSum = 0; 783 for(Int p=0; p<2; p++) // loop over partition 784 { 785 for( Int b=0; b<=1; b++ ) // loop over boolean options 786 { 787 if(matchedPartSum[p][b] > iMaxMatchSum) 788 { 789 iMaxMatchSum = matchedPartSum[p][b]; 790 matchedPartSize = virtualPartSizes[p]; 791 } 792 } 793 } 794 795 AOF( matchedPartSize != NUMBER_OF_PART_SIZES ); 796 797 return matchedPartSize; 798 } 799 800 Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU) 801 { 802 const TComSPS* sps = pcCU->getSlice()->getSPS(); 803 UInt uiMaxCUWidth = sps->getMaxCUWidth(); 804 UInt uiMaxCUHeight = sps->getMaxCUHeight(); 805 806 // segmentation of texture block --> mask IDs 807 Pel* pDepthBlockStart = pDepthPels; 808 809 // first compute average of depth block for thresholding 810 Int iSumDepth = 0; 811 Int uiMinDepth = MAX_INT; 812 Int uiMaxDepth = 0; 813 uiMinDepth = pDepthPels[ 0 ]; 814 uiMaxDepth = pDepthPels[ 0 ]; 815 iSumDepth = pDepthPels[ 0 ]; 816 817 Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth(COMPONENT_Y); 818 Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(COMPONENT_Y); 819 TComMv cDv = pcCU->getSlice()->getDepthRefinementFlag( ) ? pcCU->getDvInfo(0).m_acDoNBDV : pcCU->getDvInfo(0).m_acNBDV; 820 if( pcCU->getSlice()->getDepthRefinementFlag( ) ) 821 { 822 cDv.setVer(0); 823 } 824 Int iBlkX = ( pcCU->getCtuRsAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getHor()+2)>>2); 825 Int iBlkY = ( pcCU->getCtuRsAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getVer()+2)>>2); 826 if (iBlkX>(Int)(iPictureWidth - uiWidth)) 827 { 828 iSumDepth += pDepthPels[ iPictureWidth - iBlkX - 1 ]; 829 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ iPictureWidth - iBlkX - 1 ]); 830 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ iPictureWidth - iBlkX - 1 ]); 831 } 832 else 833 { 834 iSumDepth += pDepthPels[ uiWidth - 1 ]; 835 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiWidth - 1 ]); 836 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiWidth - 1 ]); 837 } 838 if (iBlkY>(Int)(iPictureHeight - uiHeight)) 839 { 840 iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ]; 841 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ]); 842 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ]); 843 } 844 else 845 { 846 iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) ]; 847 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]); 848 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]); 849 } 850 if (iBlkY>(Int)(iPictureHeight - uiHeight) && iBlkX>(Int)(iPictureWidth - uiWidth)) 851 { 852 iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ]; 853 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ]); 854 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ]); 855 } 856 else if (iBlkY>(Int)(iPictureHeight - uiHeight)) 857 { 858 iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ]; 859 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ]); 860 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ]); 861 } 862 else if (iBlkX>(Int)(iPictureWidth - uiWidth)) 863 { 864 iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ]; 865 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ]); 866 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ]); 867 } 868 else 869 { 870 iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]; 871 uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]); 872 uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]); 873 } 874 875 // don't generate mask for blocks with small depth range (encoder decision) 876 if( uiMaxDepth - uiMinDepth < 10 ) 877 { 878 return false; 879 } 880 881 AOF(uiWidth==uiHeight); 882 Int iMean = iSumDepth >> 2; 883 884 // start again for segmentation 885 pDepthPels = pDepthBlockStart; 886 887 Bool bInvertMask = pDepthPels[0]>iMean; // top-left segment needs to be mapped to partIdx 0 888 889 // generate mask 890 UInt t=0; 891 UInt uiSumPix[2] = {0,0}; 892 for (Int y=0; y<uiHeight; y++) 893 { 894 for (Int x=0; x<uiHeight; x++) 895 { 896 Int depthPel = 0; 897 if (iBlkX+x>iPictureWidth) 898 { 899 depthPel = pDepthPels[t]; 900 } 901 else 902 { 903 depthPel = pDepthPels[x]; 904 t=x; 905 } 906 907 // decide which segment this pixel belongs to 908 Int ucSegment = (Int)(depthPel>iMean); 909 910 if( bInvertMask ) 911 { 912 ucSegment = 1-ucSegment; 913 } 914 915 // count pixels for each segment 916 uiSumPix[ucSegment]++; 917 918 // set mask value 919 pMask[x] = (Bool)ucSegment; 920 } 921 922 // next row 923 if (!(iBlkY+y+1>iPictureHeight)) 924 pDepthPels += uiDepthStride; 925 pMask += MAX_CU_SIZE; 926 } 927 928 // don't generate valid mask for tiny segments (encoder decision) 929 // each segment needs to cover at least 1/8th of block 930 UInt uiMinPixPerSegment = (uiWidth*uiHeight) >> 3; 931 if( !( uiSumPix[0] > uiMinPixPerSegment && uiSumPix[1] > uiMinPixPerSegment ) ) 932 { 933 return false; 934 } 935 936 // all good 937 return true; 938 } 939 940 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY ) 941 { 942 Pel* piSrc[2] = {pInYuv[0]->getAddr(COMPONENT_Y, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Y, uiPartAddr)}; 943 UInt uiSrcStride = pInYuv[0]->getStride(COMPONENT_Y); 944 Pel* piDst = pOutYuv->getAddr(COMPONENT_Y, uiPartAddr); 945 UInt uiDstStride = pOutYuv->getStride(COMPONENT_Y); 946 947 UInt uiMaskStride= MAX_CU_SIZE; 948 Pel* tmpTar = 0; 949 tmpTar = (Pel *)xMalloc(Pel, uiWidth*uiHeight); 950 951 // backup pointer 952 Bool* pMaskStart = pMask; 953 954 // combine luma first 955 for (Int y=0; y<uiHeight; y++) 956 { 957 for (Int x=0; x<uiWidth; x++) 958 { 959 UChar ucSegment = (UChar)pMask[x]; 960 AOF( ucSegment < 2 ); 961 962 // filtering 963 tmpTar[y*uiWidth+x] = piSrc[ucSegment][x]; 964 } 965 966 piSrc[0] += uiSrcStride; 967 piSrc[1] += uiSrcStride; 968 pMask += uiMaskStride; 969 } 970 971 if (partSize == SIZE_Nx2N) 972 { 973 for (Int y=0; y<uiHeight; y++) 974 { 975 for (Int x=0; x<uiWidth; x++) 976 { 977 Bool l = (x==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x-1]; 978 Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x+1]; 979 980 Pel left, right; 981 left = (x==0) ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x-1]; 982 right = (x==uiWidth-1) ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x+1]; 983 984 piDst[x] = (l!=r) ? ClipBD( Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 ), bitDepthY) : tmpTar[y*uiWidth+x]; 985 } 986 piDst += uiDstStride; 987 } 988 } 989 else // SIZE_2NxN 990 { 991 for (Int y=0; y<uiHeight; y++) 992 { 993 for (Int x=0; x<uiWidth; x++) 994 { 995 Bool t = (y==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x]; 996 Bool b = (y==uiHeight-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x]; 997 998 Pel top, bottom; 999 top = (y==0) ? tmpTar[y*uiWidth+x] : tmpTar[(y-1)*uiWidth+x]; 1000 bottom = (y==uiHeight-1) ? tmpTar[y*uiWidth+x] : tmpTar[(y+1)*uiWidth+x]; 1001 1002 piDst[x] = (t!=b) ? ClipBD( Pel(( top + (tmpTar[y*uiWidth+x] << 1) + bottom ) >> 2 ), bitDepthY) : tmpTar[y*uiWidth+x]; 1003 } 1004 piDst += uiDstStride; 1005 } 1006 } 1007 1008 if ( tmpTar ) 1009 { 1010 xFree(tmpTar); 1011 tmpTar = NULL; 1012 } 1013 1014 // now combine chroma 1015 Pel* piSrcU[2] = { pInYuv[0]->getAddr(COMPONENT_Cb, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Cb, uiPartAddr) }; 1016 Pel* piSrcV[2] = { pInYuv[0]->getAddr(COMPONENT_Cr, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Cr, uiPartAddr) }; 1017 UInt uiSrcStrideC = pInYuv[0]->getStride(COMPONENT_Cb); 1018 Pel* piDstU = pOutYuv->getAddr(COMPONENT_Cb, uiPartAddr); 1019 Pel* piDstV = pOutYuv->getAddr(COMPONENT_Cr, uiPartAddr); 1020 UInt uiDstStrideC = pOutYuv->getStride(COMPONENT_Cb); 1021 UInt uiWidthC = uiWidth >> 1; 1022 UInt uiHeightC = uiHeight >> 1; 1023 Pel filSrcU = 0, filSrcV = 0; 1024 Pel* tmpTarU = 0, *tmpTarV = 0; 1025 tmpTarU = (Pel *)xMalloc(Pel, uiWidthC*uiHeightC); 1026 tmpTarV = (Pel *)xMalloc(Pel, uiWidthC*uiHeightC); 1027 pMask = pMaskStart; 1028 1029 for (Int y=0; y<uiHeightC; y++) 1030 { 1031 for (Int x=0; x<uiWidthC; x++) 1032 { 1033 UChar ucSegment = (UChar)pMask[x*2]; 1034 AOF( ucSegment < 2 ); 1035 1036 // filtering 1037 tmpTarU[y*uiWidthC+x] = piSrcU[ucSegment][x]; 1038 tmpTarV[y*uiWidthC+x] = piSrcV[ucSegment][x]; 1039 } 1040 1041 piSrcU[0] += uiSrcStrideC; 1042 piSrcU[1] += uiSrcStrideC; 1043 piSrcV[0] += uiSrcStrideC; 1044 piSrcV[1] += uiSrcStrideC; 1045 pMask += 2*uiMaskStride; 1046 } 1047 1048 if (partSize == SIZE_Nx2N) 1049 { 1050 for (Int y=0; y<uiHeightC; y++) 1051 { 1052 for (Int x=0; x<uiWidthC; x++) 1053 { 1054 Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2]; 1055 Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2]; 1056 1057 Pel leftU, rightU; 1058 leftU = (x==0) ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x-1]; 1059 rightU = (x==uiWidthC-1) ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x+1]; 1060 Pel leftV, rightV; 1061 leftV = (x==0) ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x-1]; 1062 rightV = (x==uiWidthC-1) ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x+1]; 1063 1064 if (l!=r) 1065 { 1066 filSrcU = ClipBD( Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 ), bitDepthY); 1067 filSrcV = ClipBD( Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 ), bitDepthY); 1068 } 1069 else 1070 { 1071 filSrcU = tmpTarU[y*uiWidthC+x]; 1072 filSrcV = tmpTarV[y*uiWidthC+x]; 1073 } 1074 piDstU[x] = filSrcU; 1075 piDstV[x] = filSrcV; 1076 } 1077 piDstU += uiDstStrideC; 1078 piDstV += uiDstStrideC; 1079 } 1080 } 1081 else 1082 { 1083 for (Int y=0; y<uiHeightC; y++) 1084 { 1085 for (Int x=0; x<uiWidthC; x++) 1086 { 1087 Bool t = (y==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2]; 1088 Bool b = (y==uiHeightC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2]; 1089 1090 Pel topU, bottomU; 1091 topU = (y==0) ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y-1)*uiWidthC+x]; 1092 bottomU = (y==uiHeightC-1) ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y+1)*uiWidthC+x]; 1093 Pel topV, bottomV; 1094 topV = (y==0) ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y-1)*uiWidthC+x]; 1095 bottomV = (y==uiHeightC-1) ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y+1)*uiWidthC+x]; 1096 1097 if (t!=b) 1098 { 1099 filSrcU = ClipBD( Pel(( topU + (tmpTarU[y*uiWidthC+x] << 1) + bottomU ) >> 2 ), bitDepthY); 1100 filSrcV = ClipBD( Pel(( topV + (tmpTarV[y*uiWidthC+x] << 1) + bottomV ) >> 2 ), bitDepthY); 1101 } 1102 else 1103 { 1104 filSrcU = tmpTarU[y*uiWidthC+x]; 1105 filSrcV = tmpTarV[y*uiWidthC+x]; 1106 } 1107 piDstU[x] = filSrcU; 1108 piDstV[x] = filSrcV; 1109 } 1110 piDstU += uiDstStrideC; 1111 piDstV += uiDstStrideC; 1112 } 1113 } 1114 1115 if( tmpTarU ) 1116 { 1117 xFree(tmpTarU); 1118 tmpTarU = NULL; 1119 } 1120 if ( tmpTarV ) 1121 { 1122 xFree(tmpTarV); 1123 tmpTarV = NULL; 1124 } 1125 } 1126 #endif 505 1127 506 1128 507 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx ) … … 1138 517 { 1139 518 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1140 #if NH_3D_VSP1141 if ( pcCU->getVSPFlag(uiPartAddr) == 0)1142 {1143 #endif1144 519 if ( eRefPicList != REF_PIC_LIST_X ) 1145 520 { … … 1156 531 else 1157 532 { 1158 #if NH_3D_SPIVMP1159 if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0)1160 {1161 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;1162 1163 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);1164 1165 UInt uiW[256], uiH[256];1166 UInt uiSPAddr[256];1167 1168 xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);1169 1170 //MC1171 for (Int i = 0; i < iNumSP; i++)1172 {1173 if (uiW[i]==0 || uiH[i]==0)1174 {1175 continue;1176 }1177 if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))1178 {1179 xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );1180 }1181 else1182 {1183 xPredInterBi (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);1184 }1185 }1186 }1187 else1188 {1189 #endif1190 533 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1191 534 { … … 1196 539 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1197 540 } 1198 #if NH_3D_SPIVMP 1199 } 1200 #endif 1201 } 1202 #if NH_3D_VSP 1203 } 1204 else 1205 { 1206 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1207 { 1208 xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1209 } 1210 else 1211 { 1212 xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1213 } 1214 } 1215 #endif 541 } 1216 542 return; 1217 543 } … … 1221 547 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1222 548 1223 #if NH_3D_VSP1224 if ( pcCU->getVSPFlag(uiPartAddr) == 0 )1225 {1226 #endif1227 549 if ( eRefPicList != REF_PIC_LIST_X ) 1228 550 { … … 1239 561 else 1240 562 { 1241 #if NH_3D_SPIVMP1242 if (pcCU->getSPIVMPFlag(uiPartAddr)!=0)1243 {1244 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;1245 1246 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);1247 1248 UInt uiW[256], uiH[256];1249 UInt uiSPAddr[256];1250 1251 xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);1252 //MC1253 for (Int i = 0; i < iNumSP; i++)1254 {1255 if (uiW[i]==0 || uiH[i]==0)1256 {1257 continue;1258 }1259 if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))1260 {1261 xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );1262 }1263 else1264 {1265 xPredInterBi (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);1266 }1267 }1268 }1269 else1270 {1271 #endif1272 563 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1273 564 { … … 1278 569 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1279 570 } 1280 #if NH_3D_SPIVMP 1281 } 1282 #endif 1283 } 1284 #if NH_3D_VSP 1285 } 1286 else 1287 { 1288 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1289 { 1290 xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1291 } 1292 else 1293 { 1294 xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1295 } 1296 } 1297 #endif 571 } 1298 572 } 1299 573 return; … … 1319 593 pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx ); 1320 594 #endif 1321 #if NH_3D_ARP1322 if( pcCU->getARPW( uiPartAddr ) > 0 )1323 {1324 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC() )1325 {1326 xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , pcYuvPred , bi );1327 }1328 else1329 {1330 xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, bi );1331 }1332 }1333 else1334 {1335 #endif1336 595 1337 596 for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++) 1338 597 { 1339 598 const ComponentID compID=ComponentID(comp); 1340 #if NH_3D_IC1341 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() ) && ( isLuma(compID) || (iWidth > 8) );1342 xPredInterBlk(compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID))1343 #if NH_3D_ARP1344 , false1345 #endif1346 , bICFlag );1347 #else1348 599 xPredInterBlk (compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) ); 1349 #endif 1350 } 1351 #if NH_3D_ARP 1352 } 1353 #endif 1354 } 1355 1356 #if NH_3D_VSP 1357 Void TComPrediction::xPredInterUniVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi ) 1358 { 1359 Int vspSize = pcCU->getVSPFlag( uiPartAddr ) >> 1; 1360 1361 Int widthSubPU, heightSubPU; 1362 if (vspSize) 1363 { 1364 widthSubPU = 8; 1365 heightSubPU = 4; 1366 } 1367 else 1368 { 1369 widthSubPU = 4; 1370 heightSubPU = 8; 1371 } 1372 xPredInterUniSubPU( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi, widthSubPU, heightSubPU ); 1373 } 1374 1375 Void TComPrediction::xPredInterUniSubPU( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU, Int heightSubPU ) 1376 { 1377 UInt numPartsInLine = pcCU->getPic()->getNumPartInCtuWidth(); 1378 UInt horiNumPartsInSubPU = widthSubPU >> 2; 1379 UInt vertNumPartsInSubPU = (heightSubPU >> 2) * numPartsInLine; 1380 1381 UInt partAddrRasterLine = g_auiZscanToRaster[ uiPartAddr ]; 1382 1383 for( Int posY=0; posY<iHeight; posY+=heightSubPU, partAddrRasterLine+=vertNumPartsInSubPU ) 1384 { 1385 UInt partAddrRasterSubPU = partAddrRasterLine; 1386 for( Int posX=0; posX<iWidth; posX+=widthSubPU, partAddrRasterSubPU+=horiNumPartsInSubPU ) 1387 { 1388 UInt partAddrSubPU = g_auiRasterToZscan[ partAddrRasterSubPU ]; 1389 Int refIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( partAddrSubPU ); assert (refIdx >= 0); 1390 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( partAddrSubPU ); 1391 pcCU->clipMv(cMv); 1392 1393 xPredInterBlk( COMPONENT_Y, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 1394 xPredInterBlk( COMPONENT_Cb, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) ); 1395 xPredInterBlk( COMPONENT_Cr, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) ); 1396 } 1397 } 1398 } 1399 #endif 1400 1401 #if NH_3D_ARP 1402 //temporal ARP 1403 Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi ) 1404 { 1405 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 1406 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1407 Bool bTobeScaled = false; 1408 TComPic* pcPicYuvBaseCol = NULL; 1409 TComPic* pcPicYuvBaseRef = NULL; 1410 1411 #if NH_3D_NBDV 1412 DisInfo cDistparity; 1413 cDistparity.m_acNBDV = pcCU->getDvInfo(0).m_acNBDV; 1414 cDistparity.m_aVIdxCan = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan; 1415 #else 1416 assert(0); // ARP can be applied only when a DV is available 1417 #endif 1418 UChar dW = pcCU->getARPW ( uiPartAddr ); 1419 1420 Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList); 1421 if (arpRefIdx < 0 || !pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan)) 1422 { 1423 dW = 0; 1424 bTobeScaled = false; 1425 } 1426 else 1427 { 1428 if( arpRefIdx != iRefIdx ) 1429 { 1430 bTobeScaled = true; 1431 } 1432 pcPicYuvBaseCol = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(), cDistparity.m_aVIdxCan ); 1433 pcPicYuvBaseRef = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan ); 1434 } 1435 1436 if(bTobeScaled) 1437 { 1438 Int iCurrPOC = pcCU->getSlice()->getPOC(); 1439 Int iColRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx ); 1440 Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx ); 1441 Int iScale = pcCU->xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC); 1442 if ( iScale != 4096 ) 1443 { 1444 cMv = cMv.scaleMv( iScale ); 1445 } 1446 iRefIdx = arpRefIdx; 1447 } 1448 1449 pcCU->clipMv(cMv); 1450 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(); 1451 1452 for (UInt comp=COMPONENT_Y; comp< rpcYuvPred->getNumberValidComponents(); comp++) 1453 { 1454 const ComponentID compID=ComponentID(comp); 1455 xPredInterBlk ( compID, pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1456 } 1457 1458 if( dW > 0 ) 1459 { 1460 TComYuv * pYuvB0 = &m_acYuvPredBase[0]; 1461 TComYuv * pYuvB1 = &m_acYuvPredBase[1]; 1462 1463 TComMv cMVwithDisparity = cMv + cDistparity.m_acNBDV; 1464 pcCU->clipMv(cMVwithDisparity); 1465 if (iWidth <= 8) 1466 { 1467 pYuvB0->clear(); pYuvB1->clear(); 1468 } 1469 TComMv cNBDV = cDistparity.m_acNBDV; 1470 pcCU->clipMv( cNBDV ); 1471 1472 TComPicYuv* pcPicYuvBaseColRec = pcPicYuvBaseCol->getPicYuvRec(); 1473 TComPicYuv* pcPicYuvBaseRefRec = pcPicYuvBaseRef->getPicYuvRec(); 1474 1475 UInt uiCompNum = ( iWidth > 8 ) ? 3: 1; 1476 for (UInt comp=COMPONENT_Y; comp< uiCompNum; comp++) 1477 { 1478 const ComponentID compID=ComponentID(comp); 1479 xPredInterBlk ( compID, pcCU, pcPicYuvBaseColRec, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1480 xPredInterBlk ( compID, pcCU, pcPicYuvBaseRefRec, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1481 } 1482 1483 pYuvB0->subtractARP( pYuvB0 , pYuvB1 , uiPartAddr , iWidth , iHeight ); 1484 1485 if( 2 == dW ) 1486 { 1487 pYuvB0->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1488 } 1489 rpcYuvPred->addARP( rpcYuvPred , pYuvB0 , uiPartAddr , iWidth , iHeight , !bi, pcCU->getSlice()->getSPS()->getBitDepths() ); 1490 } 1491 } 1492 1493 Bool TComPrediction::xCheckBiInterviewARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc ) 1494 { 1495 Int iRefIdx = pcCU->getCUMvField( eBaseRefPicList )->getRefIdx( uiPartAddr ); 1496 TComMv cDMv = pcCU->getCUMvField( eBaseRefPicList )->getMv( uiPartAddr ); 1497 TComPic* pcPicYuvBaseCol = pcCU->getSlice()->getRefPic( eBaseRefPicList, iRefIdx ); 1498 Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2 + ((cDMv.getHor() + 2)>>2); 1499 Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2); 1500 1501 irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX); 1502 irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 1503 1504 Int uiLCUAddr,uiAbsPartAddr; 1505 pcPicYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1506 TComDataCU *pColCU = pcPicYuvBaseCol->getCtu( uiLCUAddr ); 1507 1508 TComPic* pcPicYuvBaseTRef = NULL; 1509 pcPicYuvCurrTRef = NULL; 1510 1511 //If there is available motion in base reference list, use it 1512 if(!pColCU->isIntra(uiAbsPartAddr)) 1513 { 1514 for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1); iList ++) 1515 { 1516 RefPicList eRefPicListCurr = RefPicList(iList); 1517 Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr); 1518 if( iRef != -1) 1519 { 1520 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 1521 Int iCurrPOC = pColCU->getSlice()->getPOC(); 1522 Int iCurrRefPOC = pcPicYuvBaseTRef->getPOC(); 1523 Int iCurrRef = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr); 1524 1525 if( iCurrRef >= 0 && iCurrPOC != iCurrRefPOC) 1526 { 1527 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 1528 Int iTargetPOC = pcPicYuvCurrTRef->getPOC(); 1529 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic(iTargetPOC, pcPicYuvBaseCol->getViewIndex() ); 1530 if(pcPicYuvBaseTRef) 1531 { 1532 cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr); 1533 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC); 1534 if ( iScale != 4096 ) 1535 { 1536 cBaseTMV = cBaseTMV.scaleMv( iScale ); 1537 } 1538 iCurrTRefPoc = iTargetPOC; 1539 return true; 1540 } 1541 } 1542 } 1543 } 1544 } 1545 1546 //If there is no available motion in base reference list, use ( 0, 0 ) 1547 if( pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) >= 0 ) 1548 { 1549 cBaseTMV.set( 0, 0 ); 1550 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic( eBaseRefPicList, pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) ); 1551 iCurrTRefPoc = pcPicYuvCurrTRef->getPOC(); 1552 return true; 1553 } 1554 1555 return false; 1556 } 1557 1558 //inter-view ARP 1559 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi ) 1560 { 1561 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 1562 TComMv cDMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1563 TComMv cTempDMv = cDMv; 1564 UChar dW = pcCU->getARPW ( uiPartAddr ); 1565 1566 TComPic* pcPicYuvBaseTRef = NULL; 1567 TComPic* pcPicYuvCurrTRef = NULL; 1568 TComPic* pcPicYuvBaseCol = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx ); 1569 TComPicYuv* pcYuvBaseCol = pcPicYuvBaseCol->getPicYuvRec(); 1570 Bool bTMVAvai = false; 1571 TComMv cBaseTMV; 1572 1573 pcCU->clipMv(cTempDMv); 1574 1575 Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2 + ((cDMv.getHor() + 2)>>2); 1576 Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2); 1577 1578 irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX); 1579 irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 1580 1581 Int uiLCUAddr,uiAbsPartAddr; 1582 pcPicYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1583 TComDataCU *pColCU = pcPicYuvBaseCol->getCtu( uiLCUAddr ); 1584 if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getIsDepth() ) 1585 { 1586 RefPicList eOtherRefList = ( eRefPicList == REF_PIC_LIST_0 ) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 1587 Int iOtherRefIdx = pcCU->getCUMvField( eOtherRefList )->getRefIdx( uiPartAddr ); 1588 //The other prediction direction is temporal ARP 1589 if( iOtherRefIdx >= 0 && pcCU->getSlice()->getViewIndex() == pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() ) 1590 { 1591 bTMVAvai = true; 1592 pcPicYuvBaseTRef = pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx ); 1593 Int iCurrPOC = pcCU->getSlice()->getPOC(); 1594 Int iCurrRefPOC = pcPicYuvBaseTRef->getPOC(); 1595 Int iCurrRef = pcCU->getSlice()->getFirstTRefIdx( eOtherRefList ); 1596 1597 if( iCurrRef >= 0 ) 1598 { 1599 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic( eOtherRefList,iCurrRef ); 1600 Int iTargetPOC = pcPicYuvCurrTRef->getPOC(); 1601 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iTargetPOC, pcPicYuvBaseCol->getViewIndex() ); 1602 if( pcPicYuvBaseTRef ) 1603 { 1604 cBaseTMV = pcCU->getCUMvField( eOtherRefList )->getMv( uiPartAddr ); 1605 Int iScale = pcCU-> xGetDistScaleFactor( iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC ); 1606 if ( iScale != 4096 ) 1607 { 1608 cBaseTMV = cBaseTMV.scaleMv( iScale ); 1609 } 1610 } 1611 else 1612 { 1613 dW = 0; 1614 } 1615 } 1616 else 1617 { 1618 dW = 0; 1619 } 1620 } 1621 1622 //Both prediction directions are inter-view ARP 1623 if ( iOtherRefIdx >= 0 && !bTMVAvai ) 1624 { 1625 RefPicList eBaseList = REF_PIC_LIST_0; 1626 Int iCurrTRefPoc; 1627 bTMVAvai = ( eBaseList != eRefPicList ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() ); 1628 1629 if ( bTMVAvai ) 1630 { 1631 if( xCheckBiInterviewARP( pcCU, uiPartAddr, iWidth, iHeight, eBaseList, pcPicYuvCurrTRef, cBaseTMV, iCurrTRefPoc ) ) 1632 { 1633 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iCurrTRefPoc, pcPicYuvBaseCol->getViewIndex() ); 1634 if ( pcPicYuvBaseTRef == NULL ) 1635 { 1636 dW = 0; 1637 } 1638 } 1639 else 1640 { 1641 dW = 0; 1642 } 1643 } 1644 } 1645 } 1646 1647 if( !pColCU->isIntra( uiAbsPartAddr ) && !bTMVAvai ) 1648 { 1649 TComMvField puMVField; 1650 for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1) && !bTMVAvai; iList ++) 1651 { 1652 RefPicList eRefPicListCurr = RefPicList(iList); 1653 Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr); 1654 if( iRef != -1 && pcCU->getSlice()->getArpRefPicAvailable( eRefPicListCurr, pcPicYuvBaseCol->getViewIndex())) 1655 { 1656 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 1657 Int iCurrPOC = pColCU->getSlice()->getPOC(); 1658 Int iCurrRefPOC = pcPicYuvBaseTRef->getPOC(); 1659 Int iCurrRef = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr); 1660 if (iCurrRef >= 0 && iCurrRefPOC != iCurrPOC) 1661 { 1662 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 1663 Int iTargetPOC = pcPicYuvCurrTRef->getPOC(); 1664 { 1665 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic(iTargetPOC, pcPicYuvBaseCol->getViewIndex() ); 1666 if(pcPicYuvBaseTRef) 1667 { 1668 cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr); 1669 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC); 1670 if ( iScale != 4096 ) 1671 cBaseTMV = cBaseTMV.scaleMv( iScale ); 1672 bTMVAvai = true; 1673 break; 1674 } 1675 } 1676 } 1677 } 1678 } 1679 } 1680 if (bTMVAvai == false) 1681 { 1682 bTMVAvai = true; 1683 cBaseTMV.set(0, 0); 1684 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicList, pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 1685 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic (eRefPicList, pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 1686 } 1687 1688 for (UInt comp=COMPONENT_Y; comp< rpcYuvPred->getNumberValidComponents(); comp++) 1689 { 1690 const ComponentID compID=ComponentID(comp); 1691 xPredInterBlk ( compID, pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ), pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), bTMVAvai ); 1692 } 1693 1694 if( dW > 0 ) 1695 { 1696 assert ( bTMVAvai ); 1697 TComYuv* pYuvCurrTRef = &m_acYuvPredBase[0]; 1698 TComYuv* pYuvBaseTRef = &m_acYuvPredBase[1]; 1699 TComPicYuv* pcYuvCurrTref = pcPicYuvCurrTRef->getPicYuvRec(); 1700 TComPicYuv* pcYuvBaseTref = pcPicYuvBaseTRef->getPicYuvRec(); 1701 TComMv cTempMv = cDMv + cBaseTMV; 1702 1703 pcCU->clipMv(cBaseTMV); 1704 pcCU->clipMv(cTempMv); 1705 1706 if (iWidth <= 8) 1707 { 1708 pYuvCurrTRef->clear(); pYuvBaseTRef->clear(); 1709 } 1710 1711 UInt uiCompNum = ( iWidth > 8 ) ? 3: 1; 1712 for (UInt comp=COMPONENT_Y; comp< uiCompNum; comp++) 1713 { 1714 const ComponentID compID=ComponentID(comp); 1715 xPredInterBlk ( compID, pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1716 xPredInterBlk ( compID, pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1717 } 1718 1719 pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); 1720 if(dW == 2) 1721 { 1722 pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1723 } 1724 rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi, pcCU->getSlice()->getSPS()->getBitDepths() ); 1725 } 1726 } 1727 #endif 600 } 601 } 602 603 1728 604 1729 605 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvPred ) … … 1777 653 } 1778 654 1779 #if NH_3D_VSP1780 Void TComPrediction::xPredInterBiVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred )1781 {1782 TComYuv* pcMbYuv;1783 Int iRefIdx[2] = {-1, -1};1784 Bool bi = (pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0);1785 1786 for ( Int iRefList = 0; iRefList < 2; iRefList++ )1787 {1788 RefPicList eRefPicList = RefPicList(iRefList);1789 iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );1790 1791 if ( iRefIdx[iRefList] < 0 )1792 {1793 continue;1794 }1795 assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );1796 1797 pcMbYuv = &m_acYuvPred[iRefList];1798 xPredInterUniVSP ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, bi );1799 }1800 1801 xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() );1802 }1803 #endif1804 655 1805 656 /** … … 1819 670 1820 671 1821 #if NH_3D1822 Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth1823 #if NH_3D_ARP1824 , Bool filterType1825 #endif1826 #if NH_3D_IC1827 , Bool bICFlag1828 #endif1829 )1830 #else1831 672 Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth ) 1832 #endif1833 673 { 1834 674 #if NH_MV … … 1849 689 Int yFrac = mv->getVer() & ((1<<shiftVer)-1); 1850 690 1851 #if NH_3D_INTEGER_MV_DEPTH1852 if( cu->getSlice()->getIsDepth() )1853 {1854 refOffset = mv->getHor() + mv->getVer() * refStride;1855 ref = refPic->getAddr(compID, cu->getCtuRsAddr(), cu->getZorderIdxInCtu() + partAddr ) + refOffset;1856 xFrac = 0;1857 yFrac = 0;1858 }1859 #endif1860 691 1861 692 UInt cxWidth = width >> refPic->getComponentScaleX(compID); … … 1866 697 if ( yFrac == 0 ) 1867 698 { 1868 #if NH_3D1869 m_if.filterHor(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, xFrac, !bi1870 #if NH_3D_IC1871 || bICFlag1872 #endif1873 , chFmt, bitDepth1874 #if NH_3D_ARP1875 , filterType1876 #endif1877 );1878 #else1879 699 m_if.filterHor(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth ); 1880 #endif1881 700 } 1882 701 else if ( xFrac == 0 ) 1883 702 { 1884 #if NH_3D1885 m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi1886 #if NH_3D_IC1887 || bICFlag1888 #endif1889 , chFmt, bitDepth1890 #if NH_3D_ARP1891 , filterType1892 #endif1893 );1894 #else1895 703 m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth ); 1896 704 1897 #endif1898 705 } 1899 706 else … … 1904 711 const Int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA; 1905 712 1906 #if NH_3D_ARP1907 m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false, chFmt, bitDepth, filterType );1908 #else1909 713 m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false, chFmt, bitDepth ); 1910 #endif 1911 1912 #if NH_3D 1913 m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight, yFrac, false, !bi 1914 #if NH_3D_IC 1915 || bICFlag 1916 #endif 1917 , chFmt, bitDepth 1918 #if NH_3D_ARP 1919 , filterType 1920 #endif 1921 ); 1922 #else 714 1923 715 m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight, yFrac, false, !bi, chFmt, bitDepth ); 1924 #endif 1925 } 1926 1927 #if NH_3D_IC 1928 if( bICFlag ) 1929 { 1930 Int a, b, i, j; 1931 const Int iShift = IC_CONST_SHIFT; 1932 Pel *dst2 = dst; 1933 1934 xGetLLSICPrediction( compID, cu, mv, refPic, a, b, bitDepth ); 1935 1936 for ( i = 0; i < cxHeight; i++ ) 1937 { 1938 for ( j = 0; j < cxWidth; j++ ) 1939 { 1940 dst[j] = Clip3( 0, ( 1 << bitDepth ) - 1, ( ( a*dst[j] ) >> iShift ) + b ); 1941 } 1942 dst += dstStride; 1943 } 1944 1945 if(bi) 1946 { 1947 Int shift = IF_INTERNAL_PREC - bitDepth; 1948 for (i = 0; i < cxHeight; i++) 1949 { 1950 for (j = 0; j < cxWidth; j++) 1951 { 1952 Pel val = dst2[j] << shift; 1953 dst2[j] = val - (Pel)IF_INTERNAL_OFFS; 1954 } 1955 dst2 += dstStride; 1956 } 1957 } 1958 } 1959 #endif 716 } 717 1960 718 1961 719 } … … 2104 862 (uiDirMode==HOR_IDX || uiDirMode==VER_IDX); 2105 863 } 2106 #if NH_3D_IC 2107 /** Function for deriving the position of first non-zero binary bit of a value 2108 * \param x input value 2109 * 2110 * This function derives the position of first non-zero binary bit of a value 2111 */ 2112 Int GetMSB( UInt x ) 2113 { 2114 Int iMSB = 0, bits = ( sizeof( Int ) << 3 ), y = 1; 2115 2116 while( x > 1 ) 2117 { 2118 bits >>= 1; 2119 y = x >> bits; 2120 2121 if( y ) 2122 { 2123 x = y; 2124 iMSB += bits; 2125 } 2126 } 2127 2128 iMSB+=y; 2129 2130 return iMSB; 2131 } 2132 2133 2134 /** Function for deriving LM illumination compensation. 2135 */ 2136 Void TComPrediction::xGetLLSICPrediction( const ComponentID compID, TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, const Int bitDepth ) 2137 { 2138 TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec(); 2139 Pel *pRec = NULL, *pRef = NULL; 2140 UInt uiWidth, uiHeight, uiTmpPartIdx; 2141 Int iRecStride = pRecPic->getStride(compID); 2142 Int iRefStride = pRefPic->getStride(compID); 2143 Int iRefOffset, iHor, iVer; 2144 iHor = pcCU->getSlice()->getIsDepth() ? pMv->getHor() : ( ( pMv->getHor() + 2 ) >> 2 ); 2145 iVer = pcCU->getSlice()->getIsDepth() ? pMv->getVer() : ( ( pMv->getVer() + 2 ) >> 2 ); 2146 if( !isLuma(compID) ) 2147 { 2148 iHor = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getHor() + 1 ) >> 1 ) : ( ( pMv->getHor() + 4 ) >> 3 ); 2149 iVer = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getVer() + 1 ) >> 1 ) : ( ( pMv->getVer() + 4 ) >> 3 ); 2150 } 2151 uiWidth = pcCU->getWidth( 0 ) >> pRefPic->getComponentScaleX(compID); 2152 uiHeight = pcCU->getHeight( 0 ) >> pRefPic->getComponentScaleY(compID); 2153 2154 Int i, j, iCountShift = 0; 2155 2156 // LLS parameters estimation 2157 2158 Int x = 0, y = 0, xx = 0, xy = 0; 2159 Int precShift = std::max(0, bitDepth - 12); 2160 2161 UInt partAddr = 0; 2162 if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCtu() ) ) 2163 { 2164 iRefOffset = iHor + iVer * iRefStride - iRefStride; 2165 pRef = pRefPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) + iRefOffset; 2166 pRec = pRecPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) - iRecStride; 2167 for( j = 0; j < uiWidth; j+=2 ) 2168 { 2169 x += pRef[j]; 2170 y += pRec[j]; 2171 if( isLuma(compID) ) 2172 { 2173 xx += (pRef[j] * pRef[j])>>precShift; 2174 xy += (pRef[j] * pRec[j])>>precShift; 2175 } 2176 } 2177 iCountShift += g_aucConvertToBit[ uiWidth ] + 1; 2178 } 2179 2180 if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCtu() ) ) 2181 { 2182 iRefOffset = iHor + iVer * iRefStride - 1; 2183 pRef = pRefPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) + iRefOffset; 2184 pRec = pRecPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) - 1; 2185 for( i = 0; i < uiHeight; i+=2 ) 2186 { 2187 x += pRef[0]; 2188 y += pRec[0]; 2189 if( isLuma(compID) ) 2190 { 2191 xx += (pRef[0] * pRef[0])>>precShift; 2192 xy += (pRef[0] * pRec[0])>>precShift; 2193 } 2194 pRef += iRefStride*2; 2195 pRec += iRecStride*2; 2196 } 2197 iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 1 ); 2198 } 2199 2200 if( iCountShift == 0 ) 2201 { 2202 a = ( 1 << IC_CONST_SHIFT ); 2203 b = 0; 2204 return; 2205 } 2206 2207 if( !isLuma(compID) ) 2208 { 2209 a = ( 1 << IC_CONST_SHIFT ); 2210 b = ( y - x + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 2211 } 2212 else 2213 { 2214 xy += xx >> IC_REG_COST_SHIFT; 2215 xx += xx >> IC_REG_COST_SHIFT; 2216 Int a1 = ( xy << iCountShift ) - ((y * x) >> precShift); 2217 Int a2 = ( xx << iCountShift ) - ((x * x) >> precShift); 2218 const Int iShift = IC_CONST_SHIFT; 2219 const Int iShiftA2 = 6; 2220 const Int iAccuracyShift = 15; 2221 2222 Int iScaleShiftA2 = 0; 2223 Int iScaleShiftA1 = 0; 2224 Int a1s; 2225 Int a2s; 2226 2227 a1 = Clip3(0, 2*a2, a1); 2228 iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 2229 iScaleShiftA1 = iScaleShiftA2 - IC_SHIFT_DIFF; 2230 2231 if( iScaleShiftA1 < 0 ) 2232 { 2233 iScaleShiftA1 = 0; 2234 } 2235 2236 if( iScaleShiftA2 < 0 ) 2237 { 2238 iScaleShiftA2 = 0; 2239 } 2240 2241 Int iScaleShiftA = iScaleShiftA2 + iAccuracyShift - iShift - iScaleShiftA1; 2242 2243 2244 a2s = a2 >> iScaleShiftA2; 2245 2246 a1s = a1 >> iScaleShiftA1; 2247 2248 a = a1s * m_uiaShift[ a2s ]; 2249 a = a >> iScaleShiftA; 2250 b = ( y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 2251 } 2252 } 2253 #endif 2254 2255 #if NH_3D_SDC_INTRA 2256 Void TComPrediction::predConstantSDC( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& predDC ) 2257 { 2258 Pel* pLeftTop = ptrSrc; 2259 Pel* pRightTop = ptrSrc + (uiSize-1); 2260 Pel* pLeftBottom = (ptrSrc+ (srcStride*(uiSize-1)) ); 2261 Pel* pRightBottom = (ptrSrc+ (srcStride*(uiSize-1)) + (uiSize-1)); 2262 predDC = (*pLeftTop + *pRightTop + *pLeftBottom + *pRightBottom + 2)>>2; 2263 } 2264 #endif // NH_3D_SDC_INTRA 2265 2266 #if NH_3D_DMM 2267 Void TComPrediction::predContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* segPattern ) 2268 { 2269 // get copy of co-located texture luma block 2270 TComYuv cTempYuv; 2271 cTempYuv.create( uiWidth, uiHeight, CHROMA_400 ); 2272 cTempYuv.clear(); 2273 Pel* piRefBlkY = cTempYuv.getAddr( COMPONENT_Y ); 2274 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getTexturePic()->getPicYuvRec(); 2275 assert( pcPicYuvRef != NULL ); 2276 Int iRefStride = pcPicYuvRef->getStride( COMPONENT_Y ); 2277 Pel* piRefY = pcPicYuvRef->getAddr ( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx ); 2278 2279 for( Int y = 0; y < uiHeight; y++ ) 2280 { 2281 ::memcpy(piRefBlkY, piRefY, sizeof(Pel)*uiWidth); 2282 piRefBlkY += uiWidth; 2283 piRefY += iRefStride; 2284 } 2285 2286 2287 // find contour for texture luma block 2288 piRefBlkY = cTempYuv.getAddr( COMPONENT_Y ); 2289 UInt iDC = 0; 2290 iDC = piRefBlkY[ 0 ]; 2291 iDC += piRefBlkY[ uiWidth - 1 ]; 2292 iDC += piRefBlkY[ uiWidth * (uiHeight - 1) ]; 2293 iDC += piRefBlkY[ uiWidth * (uiHeight - 1) + uiWidth - 1 ]; 2294 iDC = iDC >> 2; 2295 2296 piRefBlkY = cTempYuv.getAddr( COMPONENT_Y ); 2297 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 2298 { 2299 segPattern[k] = (piRefBlkY[k] > iDC) ? true : false; 2300 } 2301 2302 cTempYuv.destroy(); 2303 } 2304 2305 Void TComPrediction::predBiSegDCs( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 ) 2306 { 2307 assert( biSegPattern ); 2308 const Pel *piMask = getPredictorPtr( COMPONENT_Y, false ); 2309 assert( piMask ); 2310 Int srcStride = 2*uiWidth + 1; 2311 const Pel *ptrSrc = piMask+srcStride+1; 2312 2313 Int refDC1, refDC2; 2314 const Int iTR = ( patternStride - 1 ) - srcStride; 2315 const Int iTM = ( ( patternStride - 1 ) >> 1 ) - srcStride; 2316 const Int iLB = ( patternStride - 1 ) * srcStride - 1; 2317 const Int iLM = ( ( patternStride - 1 ) >> 1 ) * srcStride - 1; 2318 2319 Bool bL = ( biSegPattern[0] != biSegPattern[(patternStride-1)*patternStride] ); 2320 Bool bT = ( biSegPattern[0] != biSegPattern[(patternStride-1)] ); 2321 2322 if( bL == bT ) 2323 { 2324 const Int iTRR = ( patternStride * 2 - 1 ) - srcStride; 2325 const Int iLBB = ( patternStride * 2 - 1 ) * srcStride - 1; 2326 refDC1 = bL ? ( ptrSrc[iTR] + ptrSrc[iLB] )>>1 : (abs(ptrSrc[iTRR] - ptrSrc[-(Int)srcStride]) > abs(ptrSrc[iLBB] - ptrSrc[ -1]) ? ptrSrc[iTRR] : ptrSrc[iLBB]); 2327 refDC2 = ( ptrSrc[ -1] + ptrSrc[-(Int)srcStride] )>>1; 2328 } 2329 else 2330 { 2331 refDC1 = bL ? ptrSrc[iLB] : ptrSrc[iTR]; 2332 refDC2 = bL ? ptrSrc[iTM] : ptrSrc[iLM]; 2333 } 2334 2335 predDC1 = biSegPattern[0] ? refDC1 : refDC2; 2336 predDC2 = biSegPattern[0] ? refDC2 : refDC1; 2337 } 2338 2339 Void TComPrediction::assignBiSegDCs( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 ) 2340 { 2341 assert( biSegPattern ); 2342 if( dstStride == patternStride ) 2343 { 2344 for( UInt k = 0; k < (patternStride * patternStride); k++ ) 2345 { 2346 if( true == biSegPattern[k] ) { ptrDst[k] = valDC2; } 2347 else { ptrDst[k] = valDC1; } 2348 } 2349 } 2350 else 2351 { 2352 Pel* piTemp = ptrDst; 2353 for( UInt uiY = 0; uiY < patternStride; uiY++ ) 2354 { 2355 for( UInt uiX = 0; uiX < patternStride; uiX++ ) 2356 { 2357 if( true == biSegPattern[uiX] ) { piTemp[uiX] = valDC2; } 2358 else { piTemp[uiX] = valDC1; } 2359 } 2360 piTemp += dstStride; 2361 biSegPattern += patternStride; 2362 } 2363 } 2364 } 2365 #endif 864 865 2366 866 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComPrediction.h
r1386 r1390 45 45 #include "TComWeightPrediction.h" 46 46 47 #if NH_3D_ARP48 #include "TComPic.h"49 #endif50 47 // forward declaration 51 48 class TComMv; … … 80 77 TComYuv m_acYuvPred[NUM_REF_PIC_LIST_01]; 81 78 TComYuv m_cYuvPredTemp; 82 #if NH_3D_ARP83 TComYuv m_acYuvPredBase[2];84 #endif85 79 TComYuv m_filteredBlock[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS]; 86 80 TComYuv m_filteredBlockTmp[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS]; … … 90 84 Pel* m_pLumaRecBuffer; ///< array for downsampled reconstructed luma sample 91 85 Int m_iLumaRecStride; ///< stride of #m_pLumaRecBuffer array 92 #if NH_3D_IC93 UInt m_uiaShift[ 64 ]; // Table for multiplication to substitue of division operation94 #endif95 86 96 #if NH_3D_VSP97 Int* m_pDepthBlock; ///< Store a depth block, local variable, to prevent memory allocation every time98 TComYuv m_cYuvDepthOnVsp;99 #endif100 87 Void xPredIntraAng ( Int bitDepth, const Pel* pSrc, Int srcStride, Pel* pDst, Int dstStride, UInt width, UInt height, ChannelType channelType, UInt dirMode, const Bool bEnableEdgeFilters ); 101 88 Void xPredIntraPlanar ( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height ); 102 89 103 90 // motion compensation functions 104 #if NH_3D_ARP105 Void xPredInterUniARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );106 Void xPredInterUniARPviewRef ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );107 Bool xCheckBiInterviewARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc );108 #endif109 91 110 92 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false ); 111 93 Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvPred ); 112 #if NH_3D_VSP113 Void xPredInterUniVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false );114 Void xPredInterBiVSP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred );115 #endif116 94 117 #if NH_3D118 Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth119 #if NH_3D_ARP120 , Bool filterType = false121 #endif122 #if NH_3D_IC123 , Bool bICFlag = false124 #endif125 );126 #else127 95 Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth ); 128 #endif129 #if NH_3D_VSP130 Void xPredInterUniSubPU ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );131 #endif132 96 133 97 Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths ); 134 98 135 99 Void xGetLLSPrediction ( const Pel* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0, const ChromaFormat chFmt DEBUG_STRING_FN_DECLARE(sDebug) ); 136 #if NH_3D_IC137 Void xGetLLSICPrediction( const ComponentID compID, TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, const Int bitDepth);138 #endif139 100 Void xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType ); 140 101 Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); 141 #if NH_3D_SPIVMP142 Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );143 Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );144 #endif145 102 146 103 Void destroy(); … … 164 121 165 122 Pel predIntraGetPredValDC ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight); 166 #if NH_3D_DMM167 Void predIntraLumaDmm ( TComDataCU* pcCU, UInt uiAbsPartIdx, DmmID dmmType, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight );168 Void predContourFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* segPattern );169 Void predBiSegDCs ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 );170 Void assignBiSegDCs ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 );171 #endif172 #if NH_3D_SDC_INTRA173 Void predConstantSDC ( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& predDC );174 #endif175 123 176 #if NH_3D_DBBP177 PartSize getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU);178 Bool getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU);179 Void combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY );180 #endif181 #if NH_3D182 Pel predIntraGetPredValDC ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );183 #endif184 124 Pel* getPredictorPtr ( const ComponentID compID, const Bool bUseFilteredPredictions ) 185 125 { -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComRdCost.cpp
r1386 r1390 41 41 #include "TComRom.h" 42 42 #include "TComRdCost.h" 43 #if NH_3D_VSO44 #include "TComDataCU.h"45 #include "TComRectangle.h"46 #endif47 43 48 44 //! \ingroup TLibCommon 49 45 //! \{ 50 46 51 #if NH_3D_VSO52 // SAIT_VSO_EST_A003353 Double TComRdCost::m_dDisparityCoeff = 1.0;54 #endif55 47 TComRdCost::TComRdCost() 56 48 { … … 63 55 64 56 // Calculate RD functions 65 #if NH_3D_VSO66 Double TComRdCost::calcRdCost( Double numBits, Dist intDistortion, DFunc eDFunc )67 {68 Double distortion = (Double) intDistortion;69 #else70 57 Double TComRdCost::calcRdCost( Double numBits, Double distortion, DFunc eDFunc ) 71 58 { 72 #endif73 59 74 60 Double lambda = 1.0; … … 183 169 m_afpDistortFunc[DF_HADS16N] = TComRdCost::xGetHADs; 184 170 185 #if NH_3D_VSO186 // SAIT_VSO_EST_A0033187 m_afpDistortFunc[29] = TComRdCost::xGetVSD;188 m_afpDistortFunc[30] = TComRdCost::xGetVSD4;189 m_afpDistortFunc[31] = TComRdCost::xGetVSD8;190 m_afpDistortFunc[32] = TComRdCost::xGetVSD16;191 m_afpDistortFunc[33] = TComRdCost::xGetVSD32;192 m_afpDistortFunc[34] = TComRdCost::xGetVSD64;193 m_afpDistortFunc[35] = TComRdCost::xGetVSD16N;194 #endif195 171 196 172 m_costMode = COST_STANDARD_LOSSY; … … 199 175 m_iCostScale = 0; 200 176 201 #if NH_3D_VSO202 m_bUseVSO = false;203 m_uiVSOMode = 0;204 m_fpDistortFuncVSO = NULL;205 m_pcRenModel = NULL;206 207 // SAIT_VSO_EST_A0033208 m_bUseEstimatedVSD = false;209 #endif210 #if NH_3D_DBBP211 m_bUseMask = false;212 #endif213 177 214 178 } … … 237 201 rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 238 202 239 #if NH_3D_DBBP240 if( m_bUseMask )241 {242 if( eDFunc >= DF_SSE && eDFunc <= DF_SSE16N )243 {244 rcDistParam.DistFunc = TComRdCost::xGetMaskedSSE;245 }246 else if( eDFunc >= DF_SAD && eDFunc <= DF_SADS16N )247 {248 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;249 }250 else if( eDFunc >= DF_HADS && eDFunc <= DF_HADS16N )251 {252 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;253 }254 else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N )255 {256 rcDistParam.DistFunc = TComRdCost::xGetMaskedVSD;257 }258 else if( eDFunc >= DF_SAD12 && eDFunc <= DF_SADS48 )259 {260 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;261 }262 }263 #endif264 203 // initialize 265 204 rcDistParam.iSubShift = 0; … … 296 235 } 297 236 298 #if NH_3D_DBBP299 if( m_bUseMask )300 {301 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;302 }303 #endif304 237 // initialize 305 238 rcDistParam.iSubShift = 0; … … 347 280 } 348 281 349 #if NH_3D_DBBP350 if( m_bUseMask )351 {352 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;353 }354 #endif355 282 // initialize 356 283 rcDistParam.iSubShift = 0; … … 370 297 rcDP.DistFunc = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ]; 371 298 rcDP.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 372 #if NH_3D_DBBP373 if( m_bUseMask )374 {375 rcDP.DistFunc = TComRdCost::xGetMaskedSAD;376 }377 #endif378 299 } 379 300 … … 413 334 } 414 335 415 #if NH_3D_ENC_DEPTH416 UInt TComRdCost::calcVAR (Pel* pi0, Int stride, Int width, Int height, Int cuDepth, UInt maxCuWidth)417 {418 Int temp = 0;419 420 for (Int y = 0; y < height; y++)421 {422 for (Int x = 0; x < width; x++)423 {424 temp += pi0[ y * stride + x ];425 }426 }427 428 Int cuMaxLog2Size = g_aucConvertToBit[maxCuWidth]+2;429 430 if ( width == 4 )431 {432 cuDepth = cuMaxLog2Size - 2;433 }434 435 temp = temp >> (cuMaxLog2Size-cuDepth) * 2;436 437 UInt sum = 0;438 for (Int y = 0; y < height; y++)439 {440 for (Int x = 0; x < width; x++)441 {442 sum += (pi0[ y * stride + x ] - temp ) * (pi0[ y * stride + x ] - temp );443 }444 }445 return (sum >> (cuMaxLog2Size-cuDepth)*2);446 447 }448 #endif449 336 450 337 … … 463 350 cDtParam.bitDepth = bitDepth; 464 351 465 #if NH_3D_IC466 cDtParam.bUseIC = false;467 #endif468 #if NH_3D_SDC_INTER469 cDtParam.bUseSDCMRSAD = false;470 #endif471 352 472 353 if (isChroma(compID)) … … 479 360 } 480 361 } 481 #if NH_3D_VSO 482 // SAIT_VSO_EST_A0033 483 UInt TComRdCost::getDistPartVSD( TComDataCU* pcCU, UInt uiPartOffset, Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD, DFunc eDFunc ) 484 { 485 AOT( ( m_dDisparityCoeff <= 0 ) || ( m_dDisparityCoeff > 10 ) ); 486 487 Pel* piVirRec = m_pcVideoRecPicYuv->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr( ), pcCU->getZorderIdxInCtu()+uiPartOffset ); 488 Pel* piVirOrg = m_pcDepthPicYuv ->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr( ), pcCU->getZorderIdxInCtu()+uiPartOffset ); 489 Int iVirStride = m_pcVideoRecPicYuv->getStride( COMPONENT_Y ); 490 491 DistParam cDtParam; 492 setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); 493 cDtParam.pOrg = piOrg; 494 cDtParam.pCur = piCur; 495 cDtParam.pVirRec = piVirRec; 496 cDtParam.pVirOrg = piVirOrg; 497 cDtParam.iStrideVir = iVirStride; 498 cDtParam.iStrideOrg = iOrgStride; 499 cDtParam.iStrideCur = iCurStride; 500 cDtParam.iStep = 1; 501 502 cDtParam.bApplyWeight = false; 503 504 cDtParam.bitDepth = bitDepth; 505 #if NH_3D 506 cDtParam.bUseIC = false; 507 #endif 508 #if NH_3D_SDC_INTER 509 cDtParam.bUseSDCMRSAD = false; 510 #endif 511 512 Dist dist = cDtParam.DistFunc( &cDtParam ); 513 514 if ( m_bUseWVSO ) 515 { 516 Int iDWeight = m_iDWeight * m_iDWeight; 517 Int iVSOWeight = m_iVSDWeight * m_iVSDWeight; 518 Dist distDepth; 519 520 if ( !bHAD ) 521 { 522 distDepth = (Dist) getDistPart( bitDepth, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, COMPONENT_Y); 523 } 524 else 525 { 526 distDepth = (Dist) calcHAD( bitDepth, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight); 527 } 528 529 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight); 530 } 531 532 return (UInt) dist; 533 } 534 #endif 535 536 #if KWU_RC_MADPRED_E0227 537 UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ) 538 { 539 UInt SAD = 0; 540 Int shift = DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8); 541 for ( Int i=0; i<height; i++ ) 542 { 543 for( Int j=0; j<width; j++ ) 544 { 545 SAD += abs((pelCur[j] - pelOrg[j])) >> shift; 546 } 547 pelCur = pelCur + curStride; 548 pelOrg = pelOrg + orgStride; 549 } 550 return SAD; 551 } 552 #endif 362 553 363 554 364 // ==================================================================================================================== … … 556 366 // ==================================================================================================================== 557 367 558 #if NH_3D_DBBP559 // --------------------------------------------------------------------------------------------------------------------560 // Masked distortion functions561 // --------------------------------------------------------------------------------------------------------------------562 563 UInt TComRdCost::xGetMaskedSSE( DistParam* pcDtParam )564 {565 const Pel* piOrg = pcDtParam->pOrg;566 const Pel* piCur = pcDtParam->pCur;567 Int iRows = pcDtParam->iRows;568 Int iCols = pcDtParam->iCols;569 Int iStrideOrg = pcDtParam->iStrideOrg;570 Int iStrideCur = pcDtParam->iStrideCur;571 572 UInt uiSum = 0;573 574 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);575 576 Int iTemp;577 578 for( ; iRows != 0; iRows-- )579 {580 for (Int n = 0; n < iCols; n++ )581 {582 if( piOrg[n] != DBBP_INVALID_SHORT )583 {584 iTemp = piOrg[n ] - piCur[n ];585 uiSum += ( iTemp * iTemp ) >> uiShift;586 }587 }588 piOrg += iStrideOrg;589 piCur += iStrideCur;590 }591 592 return ( uiSum );593 }594 595 UInt TComRdCost::xGetMaskedSAD( DistParam* pcDtParam )596 {597 598 AOF(!pcDtParam->bApplyWeight);599 #if NH_3D_IC600 AOF(!pcDtParam->bUseIC);601 #endif602 603 const Pel* piOrg = pcDtParam->pOrg;604 const Pel* piCur = pcDtParam->pCur;605 Int iRows = pcDtParam->iRows;606 Int iCols = pcDtParam->iCols;607 Int iStrideCur = pcDtParam->iStrideCur;608 Int iStrideOrg = pcDtParam->iStrideOrg;609 610 UInt uiSum = 0;611 612 for( ; iRows != 0; iRows-- )613 {614 for (Int n = 0; n < iCols; n++ )615 {616 if( piOrg[n] != DBBP_INVALID_SHORT )617 {618 uiSum += abs( piOrg[n] - piCur[n] );619 }620 }621 piOrg += iStrideOrg;622 piCur += iStrideCur;623 }624 625 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);626 }627 628 629 UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam )630 {631 const Pel* piOrg = pcDtParam->pOrg;632 const Pel* piCur = pcDtParam->pCur;633 const Pel* piVirRec = pcDtParam->pVirRec;634 const Pel* piVirOrg = pcDtParam->pVirOrg;635 Int iRows = pcDtParam->iRows;636 Int iCols = pcDtParam->iCols;637 Int iStrideOrg = pcDtParam->iStrideOrg;638 Int iStrideCur = pcDtParam->iStrideCur;639 Int iStrideVir = pcDtParam->iStrideVir;640 641 UInt uiSum = 0;642 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;643 644 Int dDM;645 646 for ( Int y = 0 ; y < iRows ; y++ )647 {648 for (Int x = 0; x < iCols; x++ )649 {650 if( piOrg[x] != DBBP_INVALID_SHORT )651 {652 dDM = (Int) ( piOrg[x ] - piCur[x ] );653 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;654 }655 }656 piOrg += iStrideOrg;657 piCur += iStrideCur;658 }659 660 return ( uiSum );661 }662 #endif663 368 // -------------------------------------------------------------------------------------------------------------------- 664 369 // SAD … … 671 376 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 672 377 } 673 #if NH_3D_IC674 if( pcDtParam->bUseIC )675 {676 return xGetSADic( pcDtParam );677 }678 #endif679 #if NH_3D_SDC_INTER680 if( pcDtParam->bUseSDCMRSAD )681 {682 return xGetSADic( pcDtParam );683 }684 #endif685 378 686 379 const Pel* piOrg = pcDtParam->pOrg; … … 717 410 } 718 411 719 #if NH_3D_IC720 if( pcDtParam->bUseIC )721 {722 return xGetSAD4ic( pcDtParam );723 }724 #endif725 #if NH_3D_SDC_INTER726 if( pcDtParam->bUseSDCMRSAD )727 {728 return xGetSAD4ic( pcDtParam );729 }730 #endif731 412 732 413 const Pel* piOrg = pcDtParam->pOrg; … … 762 443 } 763 444 764 #if NH_3D_IC765 if( pcDtParam->bUseIC )766 {767 return xGetSAD8ic( pcDtParam );768 }769 #endif770 #if NH_3D_SDC_INTER771 if( pcDtParam->bUseSDCMRSAD )772 {773 return xGetSAD8ic( pcDtParam );774 }775 #endif776 445 777 446 const Pel* piOrg = pcDtParam->pOrg; … … 811 480 } 812 481 813 #if NH_3D_IC814 if( pcDtParam->bUseIC )815 {816 return xGetSAD16ic( pcDtParam );817 }818 #endif819 #if NH_3D_SDC_INTER820 if( pcDtParam->bUseSDCMRSAD )821 {822 return xGetSAD16ic( pcDtParam );823 }824 #endif825 482 826 483 const Pel* piOrg = pcDtParam->pOrg; … … 867 524 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 868 525 } 869 #if NH_3D_IC870 if( pcDtParam->bUseIC )871 {872 return xGetSAD12ic( pcDtParam );873 }874 #endif875 #if NH_3D_SDC_INTER876 if( pcDtParam->bUseSDCMRSAD )877 {878 return xGetSAD12ic( pcDtParam );879 }880 #endif881 526 882 527 const Pel* piOrg = pcDtParam->pOrg; … … 915 560 Distortion TComRdCost::xGetSAD16N( DistParam* pcDtParam ) 916 561 { 917 #if NH_3D_IC918 if( pcDtParam->bUseIC )919 {920 return xGetSAD16Nic( pcDtParam );921 }922 #endif923 #if NH_3D_SDC_INTER924 if( pcDtParam->bUseSDCMRSAD )925 {926 return xGetSAD16Nic( pcDtParam );927 }928 #endif929 562 930 563 const Pel* piOrg = pcDtParam->pOrg; … … 975 608 } 976 609 977 #if NH_3D_IC978 if( pcDtParam->bUseIC )979 {980 return xGetSAD32ic( pcDtParam );981 }982 #endif983 #if NH_3D_SDC_INTER984 if( pcDtParam->bUseSDCMRSAD )985 {986 return xGetSAD32ic( pcDtParam );987 }988 #endif989 610 990 611 const Pel* piOrg = pcDtParam->pOrg; … … 1048 669 } 1049 670 1050 #if NH_3D_IC1051 if( pcDtParam->bUseIC )1052 {1053 return xGetSAD24ic( pcDtParam );1054 }1055 #endif1056 #if NH_3D_SDC_INTER1057 if( pcDtParam->bUseSDCMRSAD )1058 {1059 return xGetSAD24ic( pcDtParam );1060 }1061 #endif1062 671 1063 672 const Pel* piOrg = pcDtParam->pOrg; … … 1113 722 } 1114 723 1115 #if NH_3D_IC1116 if( pcDtParam->bUseIC )1117 {1118 return xGetSAD64ic( pcDtParam );1119 }1120 #endif1121 #if NH_3D_SDC_INTER1122 if( pcDtParam->bUseSDCMRSAD )1123 {1124 return xGetSAD64ic( pcDtParam );1125 }1126 #endif1127 724 1128 725 const Pel* piOrg = pcDtParam->pOrg; … … 1217 814 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 1218 815 } 1219 #if NH_3D_IC1220 if( pcDtParam->bUseIC )1221 {1222 return xGetSAD48ic( pcDtParam );1223 }1224 #endif1225 #if NH_3D_SDC_INTER1226 if( pcDtParam->bUseSDCMRSAD )1227 {1228 return xGetSAD48ic( pcDtParam );1229 }1230 #endif1231 816 1232 817 const Pel* piOrg = pcDtParam->pOrg; … … 1300 885 1301 886 1302 #if NH_3D_IC || NH_3D_SDC_INTER1303 UInt TComRdCost::xGetSADic( DistParam* pcDtParam )1304 {1305 if ( pcDtParam->bApplyWeight )1306 {1307 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );1308 }1309 const Pel* piOrg = pcDtParam->pOrg;1310 const Pel* piCur = pcDtParam->pCur;1311 Int iRows = pcDtParam->iRows;1312 Int iCols = pcDtParam->iCols;1313 Int iStrideCur = pcDtParam->iStrideCur;1314 Int iStrideOrg = pcDtParam->iStrideOrg;1315 1316 UInt uiSum = 0;1317 1318 Int iOrigAvg = 0, iCurAvg = 0;1319 Int iDeltaC;1320 1321 for( ; iRows != 0; iRows-- )1322 {1323 for (Int n = 0; n < iCols; n++ )1324 {1325 iOrigAvg += piOrg[n];1326 iCurAvg += piCur[n];1327 }1328 piOrg += iStrideOrg;1329 piCur += iStrideCur;1330 }1331 1332 piOrg = pcDtParam->pOrg;1333 piCur = pcDtParam->pCur;1334 iRows = pcDtParam->iRows;1335 1336 iDeltaC = (iOrigAvg - iCurAvg)/iCols/iRows;1337 1338 for( ; iRows != 0; iRows-- )1339 {1340 for (Int n = 0; n < iCols; n++ )1341 {1342 uiSum += abs( piOrg[n] - piCur[n] - iDeltaC );1343 }1344 piOrg += iStrideOrg;1345 piCur += iStrideCur;1346 }1347 1348 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1349 }1350 1351 UInt TComRdCost::xGetSAD4ic( DistParam* pcDtParam )1352 {1353 if ( pcDtParam->bApplyWeight )1354 {1355 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );1356 }1357 const Pel* piOrg = pcDtParam->pOrg;1358 const Pel* piCur = pcDtParam->pCur;1359 Int iRows = pcDtParam->iRows;1360 Int iSubShift = pcDtParam->iSubShift;1361 Int iSubStep = ( 1 << iSubShift );1362 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1363 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1364 1365 UInt uiSum = 0;1366 1367 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1368 Int iDeltaC;1369 1370 for( ; iRows != 0; iRows-=iSubStep )1371 {1372 iOrigAvg += piOrg[0];1373 iOrigAvg += piOrg[1];1374 iOrigAvg += piOrg[2];1375 iOrigAvg += piOrg[3];1376 1377 iCurAvg += piCur[0];1378 iCurAvg += piCur[1];1379 iCurAvg += piCur[2];1380 iCurAvg += piCur[3];1381 1382 piOrg += iStrideOrg;1383 piCur += iStrideCur;1384 uiRowCnt++;1385 }1386 1387 piOrg = pcDtParam->pOrg;1388 piCur = pcDtParam->pCur;1389 iRows = pcDtParam->iRows;1390 1391 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/4) : 0;1392 1393 for( ; iRows != 0; iRows-=iSubStep )1394 {1395 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1396 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1397 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1398 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1399 1400 piOrg += iStrideOrg;1401 piCur += iStrideCur;1402 }1403 1404 uiSum <<= iSubShift;1405 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1406 }1407 1408 UInt TComRdCost::xGetSAD8ic( DistParam* pcDtParam )1409 {1410 if ( pcDtParam->bApplyWeight )1411 {1412 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );1413 }1414 const Pel* piOrg = pcDtParam->pOrg;1415 const Pel* piCur = pcDtParam->pCur;1416 Int iRows = pcDtParam->iRows;1417 Int iSubShift = pcDtParam->iSubShift;1418 Int iSubStep = ( 1 << iSubShift );1419 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1420 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1421 1422 UInt uiSum = 0;1423 1424 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1425 Int iDeltaC;1426 1427 for( ; iRows != 0; iRows-=iSubStep )1428 {1429 iOrigAvg += piOrg[0];1430 iOrigAvg += piOrg[1];1431 iOrigAvg += piOrg[2];1432 iOrigAvg += piOrg[3];1433 iOrigAvg += piOrg[4];1434 iOrigAvg += piOrg[5];1435 iOrigAvg += piOrg[6];1436 iOrigAvg += piOrg[7];1437 1438 iCurAvg += piCur[0];1439 iCurAvg += piCur[1];1440 iCurAvg += piCur[2];1441 iCurAvg += piCur[3];1442 iCurAvg += piCur[4];1443 iCurAvg += piCur[5];1444 iCurAvg += piCur[6];1445 iCurAvg += piCur[7];1446 1447 piOrg += iStrideOrg;1448 piCur += iStrideCur;1449 uiRowCnt++;1450 }1451 1452 piOrg = pcDtParam->pOrg;1453 piCur = pcDtParam->pCur;1454 iRows = pcDtParam->iRows;1455 1456 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/8) : 0;1457 1458 for( ; iRows != 0; iRows-=iSubStep )1459 {1460 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1461 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1462 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1463 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1464 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1465 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1466 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1467 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1468 1469 piOrg += iStrideOrg;1470 piCur += iStrideCur;1471 }1472 1473 uiSum <<= iSubShift;1474 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1475 }1476 1477 UInt TComRdCost::xGetSAD16ic( DistParam* pcDtParam )1478 {1479 if ( pcDtParam->bApplyWeight )1480 {1481 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );1482 }1483 const Pel* piOrg = pcDtParam->pOrg;1484 const Pel* piCur = pcDtParam->pCur;1485 Int iRows = pcDtParam->iRows;1486 Int iSubShift = pcDtParam->iSubShift;1487 Int iSubStep = ( 1 << iSubShift );1488 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1489 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1490 1491 UInt uiSum = 0;1492 1493 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1494 Int iDeltaC;1495 1496 for( ; iRows != 0; iRows-=iSubStep )1497 {1498 iOrigAvg += piOrg[0];1499 iOrigAvg += piOrg[1];1500 iOrigAvg += piOrg[2];1501 iOrigAvg += piOrg[3];1502 iOrigAvg += piOrg[4];1503 iOrigAvg += piOrg[5];1504 iOrigAvg += piOrg[6];1505 iOrigAvg += piOrg[7];1506 iOrigAvg += piOrg[8];1507 iOrigAvg += piOrg[9];1508 iOrigAvg += piOrg[10];1509 iOrigAvg += piOrg[11];1510 iOrigAvg += piOrg[12];1511 iOrigAvg += piOrg[13];1512 iOrigAvg += piOrg[14];1513 iOrigAvg += piOrg[15];1514 1515 iCurAvg += piCur[0];1516 iCurAvg += piCur[1];1517 iCurAvg += piCur[2];1518 iCurAvg += piCur[3];1519 iCurAvg += piCur[4];1520 iCurAvg += piCur[5];1521 iCurAvg += piCur[6];1522 iCurAvg += piCur[7];1523 iCurAvg += piCur[8];1524 iCurAvg += piCur[9];1525 iCurAvg += piCur[10];1526 iCurAvg += piCur[11];1527 iCurAvg += piCur[12];1528 iCurAvg += piCur[13];1529 iCurAvg += piCur[14];1530 iCurAvg += piCur[15];1531 1532 piOrg += iStrideOrg;1533 piCur += iStrideCur;1534 uiRowCnt++;1535 }1536 1537 piOrg = pcDtParam->pOrg;1538 piCur = pcDtParam->pCur;1539 iRows = pcDtParam->iRows;1540 1541 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/16) : 0;1542 1543 for( ; iRows != 0; iRows-=iSubStep )1544 {1545 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1546 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1547 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1548 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1549 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1550 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1551 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1552 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1553 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );1554 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );1555 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );1556 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );1557 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );1558 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );1559 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );1560 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );1561 1562 piOrg += iStrideOrg;1563 piCur += iStrideCur;1564 }1565 1566 uiSum <<= iSubShift;1567 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1568 }1569 1570 UInt TComRdCost::xGetSAD12ic( DistParam* pcDtParam )1571 {1572 if ( pcDtParam->bApplyWeight )1573 {1574 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );1575 }1576 const Pel* piOrg = pcDtParam->pOrg;1577 const Pel* piCur = pcDtParam->pCur;1578 Int iRows = pcDtParam->iRows;1579 Int iSubShift = pcDtParam->iSubShift;1580 Int iSubStep = ( 1 << iSubShift );1581 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1582 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1583 1584 UInt uiSum = 0;1585 1586 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1587 Int iDeltaC;1588 1589 for( ; iRows != 0; iRows-=iSubStep )1590 {1591 iOrigAvg += piOrg[0];1592 iOrigAvg += piOrg[1];1593 iOrigAvg += piOrg[2];1594 iOrigAvg += piOrg[3];1595 iOrigAvg += piOrg[4];1596 iOrigAvg += piOrg[5];1597 iOrigAvg += piOrg[6];1598 iOrigAvg += piOrg[7];1599 iOrigAvg += piOrg[8];1600 iOrigAvg += piOrg[9];1601 iOrigAvg += piOrg[10];1602 iOrigAvg += piOrg[11];1603 1604 iCurAvg += piCur[0];1605 iCurAvg += piCur[1];1606 iCurAvg += piCur[2];1607 iCurAvg += piCur[3];1608 iCurAvg += piCur[4];1609 iCurAvg += piCur[5];1610 iCurAvg += piCur[6];1611 iCurAvg += piCur[7];1612 iCurAvg += piCur[8];1613 iCurAvg += piCur[9];1614 iCurAvg += piCur[10];1615 iCurAvg += piCur[11];1616 1617 piOrg += iStrideOrg;1618 piCur += iStrideCur;1619 uiRowCnt++;1620 }1621 1622 piOrg = pcDtParam->pOrg;1623 piCur = pcDtParam->pCur;1624 iRows = pcDtParam->iRows;1625 1626 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/12) : 0;1627 1628 for( ; iRows != 0; iRows-=iSubStep )1629 {1630 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1631 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1632 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1633 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1634 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1635 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1636 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1637 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1638 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );1639 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );1640 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );1641 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );1642 1643 piOrg += iStrideOrg;1644 piCur += iStrideCur;1645 }1646 1647 uiSum <<= iSubShift;1648 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1649 }1650 1651 1652 UInt TComRdCost::xGetSAD16Nic( DistParam* pcDtParam )1653 {1654 const Pel* piOrg = pcDtParam->pOrg;1655 const Pel* piCur = pcDtParam->pCur;1656 Int iRows = pcDtParam->iRows;1657 Int iCols = pcDtParam->iCols;1658 Int iSubShift = pcDtParam->iSubShift;1659 Int iSubStep = ( 1 << iSubShift );1660 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1661 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1662 1663 UInt uiSum = 0;1664 1665 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0, uiColCnt = (iCols-1)/16 + 1;1666 Int iDeltaC;1667 1668 for( ; iRows != 0; iRows-=iSubStep )1669 {1670 for (Int n = 0; n < iCols; n+=16 )1671 {1672 iOrigAvg += piOrg[n + 0];1673 iOrigAvg += piOrg[n + 1];1674 iOrigAvg += piOrg[n + 2];1675 iOrigAvg += piOrg[n + 3];1676 iOrigAvg += piOrg[n + 4];1677 iOrigAvg += piOrg[n + 5];1678 iOrigAvg += piOrg[n + 6];1679 iOrigAvg += piOrg[n + 7];1680 iOrigAvg += piOrg[n + 8];1681 iOrigAvg += piOrg[n + 9];1682 iOrigAvg += piOrg[n + 10];1683 iOrigAvg += piOrg[n + 11];1684 iOrigAvg += piOrg[n + 12];1685 iOrigAvg += piOrg[n + 13];1686 iOrigAvg += piOrg[n + 14];1687 iOrigAvg += piOrg[n + 15];1688 1689 iCurAvg += piCur[n + 0];1690 iCurAvg += piCur[n + 1];1691 iCurAvg += piCur[n + 2];1692 iCurAvg += piCur[n + 3];1693 iCurAvg += piCur[n + 4];1694 iCurAvg += piCur[n + 5];1695 iCurAvg += piCur[n + 6];1696 iCurAvg += piCur[n + 7];1697 iCurAvg += piCur[n + 8];1698 iCurAvg += piCur[n + 9];1699 iCurAvg += piCur[n + 10];1700 iCurAvg += piCur[n + 11];1701 iCurAvg += piCur[n + 12];1702 iCurAvg += piCur[n + 13];1703 iCurAvg += piCur[n + 14];1704 iCurAvg += piCur[n + 15];1705 }1706 piOrg += iStrideOrg;1707 piCur += iStrideCur;1708 uiRowCnt++;1709 }1710 piOrg = pcDtParam->pOrg;1711 piCur = pcDtParam->pCur;1712 iRows = pcDtParam->iRows;1713 1714 iDeltaC = (uiRowCnt && uiColCnt) ? ((iOrigAvg - iCurAvg)/uiRowCnt/uiColCnt/16) : 0;1715 1716 for( ; iRows != 0; iRows-=iSubStep )1717 {1718 for (Int n = 0; n < iCols; n+=16 )1719 {1720 uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] - iDeltaC );1721 uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] - iDeltaC );1722 uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] - iDeltaC );1723 uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] - iDeltaC );1724 uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] - iDeltaC );1725 uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] - iDeltaC );1726 uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] - iDeltaC );1727 uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] - iDeltaC );1728 uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] - iDeltaC );1729 uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] - iDeltaC );1730 uiSum += abs( piOrg[n+10] - piCur[n+10] - iDeltaC );1731 uiSum += abs( piOrg[n+11] - piCur[n+11] - iDeltaC );1732 uiSum += abs( piOrg[n+12] - piCur[n+12] - iDeltaC );1733 uiSum += abs( piOrg[n+13] - piCur[n+13] - iDeltaC );1734 uiSum += abs( piOrg[n+14] - piCur[n+14] - iDeltaC );1735 uiSum += abs( piOrg[n+15] - piCur[n+15] - iDeltaC );1736 }1737 piOrg += iStrideOrg;1738 piCur += iStrideCur;1739 }1740 1741 uiSum <<= iSubShift;1742 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1743 }1744 1745 UInt TComRdCost::xGetSAD32ic( DistParam* pcDtParam )1746 {1747 if ( pcDtParam->bApplyWeight )1748 {1749 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );1750 }1751 const Pel* piOrg = pcDtParam->pOrg;1752 const Pel* piCur = pcDtParam->pCur;1753 Int iRows = pcDtParam->iRows;1754 Int iSubShift = pcDtParam->iSubShift;1755 Int iSubStep = ( 1 << iSubShift );1756 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1757 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1758 1759 UInt uiSum = 0;1760 1761 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1762 Int iDeltaC;1763 1764 for( ; iRows != 0; iRows-=iSubStep )1765 {1766 iOrigAvg += piOrg[0];1767 iOrigAvg += piOrg[1];1768 iOrigAvg += piOrg[2];1769 iOrigAvg += piOrg[3];1770 iOrigAvg += piOrg[4];1771 iOrigAvg += piOrg[5];1772 iOrigAvg += piOrg[6];1773 iOrigAvg += piOrg[7];1774 iOrigAvg += piOrg[8];1775 iOrigAvg += piOrg[9];1776 iOrigAvg += piOrg[10];1777 iOrigAvg += piOrg[11];1778 iOrigAvg += piOrg[12];1779 iOrigAvg += piOrg[13];1780 iOrigAvg += piOrg[14];1781 iOrigAvg += piOrg[15];1782 iOrigAvg += piOrg[16];1783 iOrigAvg += piOrg[17];1784 iOrigAvg += piOrg[18];1785 iOrigAvg += piOrg[19];1786 iOrigAvg += piOrg[20];1787 iOrigAvg += piOrg[21];1788 iOrigAvg += piOrg[22];1789 iOrigAvg += piOrg[23];1790 iOrigAvg += piOrg[24];1791 iOrigAvg += piOrg[25];1792 iOrigAvg += piOrg[26];1793 iOrigAvg += piOrg[27];1794 iOrigAvg += piOrg[28];1795 iOrigAvg += piOrg[29];1796 iOrigAvg += piOrg[30];1797 iOrigAvg += piOrg[31];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 iCurAvg += piCur[12];1812 iCurAvg += piCur[13];1813 iCurAvg += piCur[14];1814 iCurAvg += piCur[15];1815 iCurAvg += piCur[16];1816 iCurAvg += piCur[17];1817 iCurAvg += piCur[18];1818 iCurAvg += piCur[19];1819 iCurAvg += piCur[20];1820 iCurAvg += piCur[21];1821 iCurAvg += piCur[22];1822 iCurAvg += piCur[23];1823 iCurAvg += piCur[24];1824 iCurAvg += piCur[25];1825 iCurAvg += piCur[26];1826 iCurAvg += piCur[27];1827 iCurAvg += piCur[28];1828 iCurAvg += piCur[29];1829 iCurAvg += piCur[30];1830 iCurAvg += piCur[31];1831 1832 piOrg += iStrideOrg;1833 piCur += iStrideCur;1834 uiRowCnt++;1835 }1836 1837 piOrg = pcDtParam->pOrg;1838 piCur = pcDtParam->pCur;1839 iRows = pcDtParam->iRows;1840 1841 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/32) : 0;1842 1843 for( ; iRows != 0; iRows-=iSubStep )1844 {1845 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1846 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1847 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1848 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1849 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1850 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1851 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1852 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1853 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );1854 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );1855 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );1856 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );1857 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );1858 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );1859 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );1860 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );1861 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );1862 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );1863 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );1864 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );1865 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );1866 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );1867 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );1868 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );1869 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC );1870 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC );1871 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC );1872 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC );1873 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC );1874 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC );1875 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC );1876 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC );1877 1878 piOrg += iStrideOrg;1879 piCur += iStrideCur;1880 }1881 1882 uiSum <<= iSubShift;1883 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );1884 }1885 1886 1887 UInt TComRdCost::xGetSAD24ic( DistParam* pcDtParam )1888 {1889 if ( pcDtParam->bApplyWeight )1890 {1891 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );1892 }1893 const Pel* piOrg = pcDtParam->pOrg;1894 const Pel* piCur = pcDtParam->pCur;1895 Int iRows = pcDtParam->iRows;1896 Int iSubShift = pcDtParam->iSubShift;1897 Int iSubStep = ( 1 << iSubShift );1898 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;1899 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;1900 1901 UInt uiSum = 0;1902 1903 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;1904 Int iDeltaC;1905 1906 for( ; iRows != 0; iRows-=iSubStep )1907 {1908 iOrigAvg += piOrg[0];1909 iOrigAvg += piOrg[1];1910 iOrigAvg += piOrg[2];1911 iOrigAvg += piOrg[3];1912 iOrigAvg += piOrg[4];1913 iOrigAvg += piOrg[5];1914 iOrigAvg += piOrg[6];1915 iOrigAvg += piOrg[7];1916 iOrigAvg += piOrg[8];1917 iOrigAvg += piOrg[9];1918 iOrigAvg += piOrg[10];1919 iOrigAvg += piOrg[11];1920 iOrigAvg += piOrg[12];1921 iOrigAvg += piOrg[13];1922 iOrigAvg += piOrg[14];1923 iOrigAvg += piOrg[15];1924 iOrigAvg += piOrg[16];1925 iOrigAvg += piOrg[17];1926 iOrigAvg += piOrg[18];1927 iOrigAvg += piOrg[19];1928 iOrigAvg += piOrg[20];1929 iOrigAvg += piOrg[21];1930 iOrigAvg += piOrg[22];1931 iOrigAvg += piOrg[23];1932 1933 iCurAvg += piCur[0];1934 iCurAvg += piCur[1];1935 iCurAvg += piCur[2];1936 iCurAvg += piCur[3];1937 iCurAvg += piCur[4];1938 iCurAvg += piCur[5];1939 iCurAvg += piCur[6];1940 iCurAvg += piCur[7];1941 iCurAvg += piCur[8];1942 iCurAvg += piCur[9];1943 iCurAvg += piCur[10];1944 iCurAvg += piCur[11];1945 iCurAvg += piCur[12];1946 iCurAvg += piCur[13];1947 iCurAvg += piCur[14];1948 iCurAvg += piCur[15];1949 iCurAvg += piCur[16];1950 iCurAvg += piCur[17];1951 iCurAvg += piCur[18];1952 iCurAvg += piCur[19];1953 iCurAvg += piCur[20];1954 iCurAvg += piCur[21];1955 iCurAvg += piCur[22];1956 iCurAvg += piCur[23];1957 1958 piOrg += iStrideOrg;1959 piCur += iStrideCur;1960 uiRowCnt++;1961 }1962 1963 piOrg = pcDtParam->pOrg;1964 piCur = pcDtParam->pCur;1965 iRows = pcDtParam->iRows;1966 1967 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/24) : 0;1968 1969 for( ; iRows != 0; iRows-=iSubStep )1970 {1971 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );1972 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );1973 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );1974 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );1975 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );1976 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );1977 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );1978 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );1979 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );1980 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );1981 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );1982 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );1983 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );1984 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );1985 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );1986 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );1987 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );1988 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );1989 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );1990 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );1991 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );1992 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );1993 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );1994 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );1995 1996 piOrg += iStrideOrg;1997 piCur += iStrideCur;1998 }1999 2000 uiSum <<= iSubShift;2001 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );2002 }2003 2004 UInt TComRdCost::xGetSAD64ic( DistParam* pcDtParam )2005 {2006 if ( pcDtParam->bApplyWeight )2007 {2008 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );2009 }2010 const Pel* piOrg = pcDtParam->pOrg;2011 const Pel* piCur = pcDtParam->pCur;2012 Int iRows = pcDtParam->iRows;2013 Int iSubShift = pcDtParam->iSubShift;2014 Int iSubStep = ( 1 << iSubShift );2015 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;2016 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;2017 2018 UInt uiSum = 0;2019 2020 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;2021 Int iDeltaC;2022 2023 for( ; iRows != 0; iRows-=iSubStep )2024 {2025 iOrigAvg += piOrg[0] ;2026 iOrigAvg += piOrg[1] ;2027 iOrigAvg += piOrg[2] ;2028 iOrigAvg += piOrg[3] ;2029 iOrigAvg += piOrg[4] ;2030 iOrigAvg += piOrg[5] ;2031 iOrigAvg += piOrg[6] ;2032 iOrigAvg += piOrg[7] ;2033 iOrigAvg += piOrg[8] ;2034 iOrigAvg += piOrg[9] ;2035 iOrigAvg += piOrg[10] ;2036 iOrigAvg += piOrg[11] ;2037 iOrigAvg += piOrg[12] ;2038 iOrigAvg += piOrg[13] ;2039 iOrigAvg += piOrg[14] ;2040 iOrigAvg += piOrg[15] ;2041 iOrigAvg += piOrg[16] ;2042 iOrigAvg += piOrg[17] ;2043 iOrigAvg += piOrg[18] ;2044 iOrigAvg += piOrg[19] ;2045 iOrigAvg += piOrg[20] ;2046 iOrigAvg += piOrg[21] ;2047 iOrigAvg += piOrg[22] ;2048 iOrigAvg += piOrg[23] ;2049 iOrigAvg += piOrg[24] ;2050 iOrigAvg += piOrg[25] ;2051 iOrigAvg += piOrg[26] ;2052 iOrigAvg += piOrg[27] ;2053 iOrigAvg += piOrg[28] ;2054 iOrigAvg += piOrg[29] ;2055 iOrigAvg += piOrg[30] ;2056 iOrigAvg += piOrg[31] ;2057 iOrigAvg += piOrg[32] ;2058 iOrigAvg += piOrg[33] ;2059 iOrigAvg += piOrg[34] ;2060 iOrigAvg += piOrg[35] ;2061 iOrigAvg += piOrg[36] ;2062 iOrigAvg += piOrg[37] ;2063 iOrigAvg += piOrg[38] ;2064 iOrigAvg += piOrg[39] ;2065 iOrigAvg += piOrg[40] ;2066 iOrigAvg += piOrg[41] ;2067 iOrigAvg += piOrg[42] ;2068 iOrigAvg += piOrg[43] ;2069 iOrigAvg += piOrg[44] ;2070 iOrigAvg += piOrg[45] ;2071 iOrigAvg += piOrg[46] ;2072 iOrigAvg += piOrg[47] ;2073 iOrigAvg += piOrg[48] ;2074 iOrigAvg += piOrg[49] ;2075 iOrigAvg += piOrg[50] ;2076 iOrigAvg += piOrg[51] ;2077 iOrigAvg += piOrg[52] ;2078 iOrigAvg += piOrg[53] ;2079 iOrigAvg += piOrg[54] ;2080 iOrigAvg += piOrg[55] ;2081 iOrigAvg += piOrg[56] ;2082 iOrigAvg += piOrg[57] ;2083 iOrigAvg += piOrg[58] ;2084 iOrigAvg += piOrg[59] ;2085 iOrigAvg += piOrg[60] ;2086 iOrigAvg += piOrg[61] ;2087 iOrigAvg += piOrg[62] ;2088 iOrigAvg += piOrg[63] ;2089 2090 iCurAvg += piCur[0] ;2091 iCurAvg += piCur[1] ;2092 iCurAvg += piCur[2] ;2093 iCurAvg += piCur[3] ;2094 iCurAvg += piCur[4] ;2095 iCurAvg += piCur[5] ;2096 iCurAvg += piCur[6] ;2097 iCurAvg += piCur[7] ;2098 iCurAvg += piCur[8] ;2099 iCurAvg += piCur[9] ;2100 iCurAvg += piCur[10] ;2101 iCurAvg += piCur[11] ;2102 iCurAvg += piCur[12] ;2103 iCurAvg += piCur[13] ;2104 iCurAvg += piCur[14] ;2105 iCurAvg += piCur[15] ;2106 iCurAvg += piCur[16] ;2107 iCurAvg += piCur[17] ;2108 iCurAvg += piCur[18] ;2109 iCurAvg += piCur[19] ;2110 iCurAvg += piCur[20] ;2111 iCurAvg += piCur[21] ;2112 iCurAvg += piCur[22] ;2113 iCurAvg += piCur[23] ;2114 iCurAvg += piCur[24] ;2115 iCurAvg += piCur[25] ;2116 iCurAvg += piCur[26] ;2117 iCurAvg += piCur[27] ;2118 iCurAvg += piCur[28] ;2119 iCurAvg += piCur[29] ;2120 iCurAvg += piCur[30] ;2121 iCurAvg += piCur[31] ;2122 iCurAvg += piCur[32] ;2123 iCurAvg += piCur[33] ;2124 iCurAvg += piCur[34] ;2125 iCurAvg += piCur[35] ;2126 iCurAvg += piCur[36] ;2127 iCurAvg += piCur[37] ;2128 iCurAvg += piCur[38] ;2129 iCurAvg += piCur[39] ;2130 iCurAvg += piCur[40] ;2131 iCurAvg += piCur[41] ;2132 iCurAvg += piCur[42] ;2133 iCurAvg += piCur[43] ;2134 iCurAvg += piCur[44] ;2135 iCurAvg += piCur[45] ;2136 iCurAvg += piCur[46] ;2137 iCurAvg += piCur[47] ;2138 iCurAvg += piCur[48] ;2139 iCurAvg += piCur[49] ;2140 iCurAvg += piCur[50] ;2141 iCurAvg += piCur[51] ;2142 iCurAvg += piCur[52] ;2143 iCurAvg += piCur[53] ;2144 iCurAvg += piCur[54] ;2145 iCurAvg += piCur[55] ;2146 iCurAvg += piCur[56] ;2147 iCurAvg += piCur[57] ;2148 iCurAvg += piCur[58] ;2149 iCurAvg += piCur[59] ;2150 iCurAvg += piCur[60] ;2151 iCurAvg += piCur[61] ;2152 iCurAvg += piCur[62] ;2153 iCurAvg += piCur[63] ;2154 2155 piOrg += iStrideOrg;2156 piCur += iStrideCur;2157 uiRowCnt++;2158 }2159 2160 piOrg = pcDtParam->pOrg;2161 piCur = pcDtParam->pCur;2162 iRows = pcDtParam->iRows;2163 2164 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/64) : 0;2165 2166 for( ; iRows != 0; iRows-=iSubStep )2167 {2168 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );2169 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );2170 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );2171 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );2172 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );2173 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );2174 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );2175 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );2176 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );2177 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );2178 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );2179 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );2180 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );2181 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );2182 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );2183 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );2184 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );2185 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );2186 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );2187 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );2188 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );2189 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );2190 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );2191 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );2192 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC );2193 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC );2194 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC );2195 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC );2196 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC );2197 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC );2198 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC );2199 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC );2200 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC );2201 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC );2202 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC );2203 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC );2204 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC );2205 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC );2206 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC );2207 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC );2208 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC );2209 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC );2210 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC );2211 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC );2212 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC );2213 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC );2214 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC );2215 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC );2216 uiSum += abs( piOrg[48] - piCur[48] - iDeltaC );2217 uiSum += abs( piOrg[49] - piCur[49] - iDeltaC );2218 uiSum += abs( piOrg[50] - piCur[50] - iDeltaC );2219 uiSum += abs( piOrg[51] - piCur[51] - iDeltaC );2220 uiSum += abs( piOrg[52] - piCur[52] - iDeltaC );2221 uiSum += abs( piOrg[53] - piCur[53] - iDeltaC );2222 uiSum += abs( piOrg[54] - piCur[54] - iDeltaC );2223 uiSum += abs( piOrg[55] - piCur[55] - iDeltaC );2224 uiSum += abs( piOrg[56] - piCur[56] - iDeltaC );2225 uiSum += abs( piOrg[57] - piCur[57] - iDeltaC );2226 uiSum += abs( piOrg[58] - piCur[58] - iDeltaC );2227 uiSum += abs( piOrg[59] - piCur[59] - iDeltaC );2228 uiSum += abs( piOrg[60] - piCur[60] - iDeltaC );2229 uiSum += abs( piOrg[61] - piCur[61] - iDeltaC );2230 uiSum += abs( piOrg[62] - piCur[62] - iDeltaC );2231 uiSum += abs( piOrg[63] - piCur[63] - iDeltaC );2232 2233 piOrg += iStrideOrg;2234 piCur += iStrideCur;2235 }2236 2237 uiSum <<= iSubShift;2238 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );2239 }2240 2241 2242 UInt TComRdCost::xGetSAD48ic( DistParam* pcDtParam )2243 {2244 if ( pcDtParam->bApplyWeight )2245 {2246 return TComRdCostWeightPrediction::xGetSADw( pcDtParam );2247 }2248 2249 const Pel* piOrg = pcDtParam->pOrg;2250 const Pel* piCur = pcDtParam->pCur;2251 Int iRows = pcDtParam->iRows;2252 Int iSubShift = pcDtParam->iSubShift;2253 Int iSubStep = ( 1 << iSubShift );2254 Int iStrideCur = pcDtParam->iStrideCur*iSubStep;2255 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep;2256 2257 UInt uiSum = 0;2258 2259 Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0;2260 Int iDeltaC;2261 2262 for( ; iRows != 0; iRows-=iSubStep )2263 {2264 iOrigAvg += piOrg[0] ;2265 iOrigAvg += piOrg[1] ;2266 iOrigAvg += piOrg[2] ;2267 iOrigAvg += piOrg[3] ;2268 iOrigAvg += piOrg[4] ;2269 iOrigAvg += piOrg[5] ;2270 iOrigAvg += piOrg[6] ;2271 iOrigAvg += piOrg[7] ;2272 iOrigAvg += piOrg[8] ;2273 iOrigAvg += piOrg[9] ;2274 iOrigAvg += piOrg[10] ;2275 iOrigAvg += piOrg[11] ;2276 iOrigAvg += piOrg[12] ;2277 iOrigAvg += piOrg[13] ;2278 iOrigAvg += piOrg[14] ;2279 iOrigAvg += piOrg[15] ;2280 iOrigAvg += piOrg[16] ;2281 iOrigAvg += piOrg[17] ;2282 iOrigAvg += piOrg[18] ;2283 iOrigAvg += piOrg[19] ;2284 iOrigAvg += piOrg[20] ;2285 iOrigAvg += piOrg[21] ;2286 iOrigAvg += piOrg[22] ;2287 iOrigAvg += piOrg[23] ;2288 iOrigAvg += piOrg[24] ;2289 iOrigAvg += piOrg[25] ;2290 iOrigAvg += piOrg[26] ;2291 iOrigAvg += piOrg[27] ;2292 iOrigAvg += piOrg[28] ;2293 iOrigAvg += piOrg[29] ;2294 iOrigAvg += piOrg[30] ;2295 iOrigAvg += piOrg[31] ;2296 iOrigAvg += piOrg[32] ;2297 iOrigAvg += piOrg[33] ;2298 iOrigAvg += piOrg[34] ;2299 iOrigAvg += piOrg[35] ;2300 iOrigAvg += piOrg[36] ;2301 iOrigAvg += piOrg[37] ;2302 iOrigAvg += piOrg[38] ;2303 iOrigAvg += piOrg[39] ;2304 iOrigAvg += piOrg[40] ;2305 iOrigAvg += piOrg[41] ;2306 iOrigAvg += piOrg[42] ;2307 iOrigAvg += piOrg[43] ;2308 iOrigAvg += piOrg[44] ;2309 iOrigAvg += piOrg[45] ;2310 iOrigAvg += piOrg[46] ;2311 iOrigAvg += piOrg[47] ;2312 2313 iCurAvg += piCur[0] ;2314 iCurAvg += piCur[1] ;2315 iCurAvg += piCur[2] ;2316 iCurAvg += piCur[3] ;2317 iCurAvg += piCur[4] ;2318 iCurAvg += piCur[5] ;2319 iCurAvg += piCur[6] ;2320 iCurAvg += piCur[7] ;2321 iCurAvg += piCur[8] ;2322 iCurAvg += piCur[9] ;2323 iCurAvg += piCur[10] ;2324 iCurAvg += piCur[11] ;2325 iCurAvg += piCur[12] ;2326 iCurAvg += piCur[13] ;2327 iCurAvg += piCur[14] ;2328 iCurAvg += piCur[15] ;2329 iCurAvg += piCur[16] ;2330 iCurAvg += piCur[17] ;2331 iCurAvg += piCur[18] ;2332 iCurAvg += piCur[19] ;2333 iCurAvg += piCur[20] ;2334 iCurAvg += piCur[21] ;2335 iCurAvg += piCur[22] ;2336 iCurAvg += piCur[23] ;2337 iCurAvg += piCur[24] ;2338 iCurAvg += piCur[25] ;2339 iCurAvg += piCur[26] ;2340 iCurAvg += piCur[27] ;2341 iCurAvg += piCur[28] ;2342 iCurAvg += piCur[29] ;2343 iCurAvg += piCur[30] ;2344 iCurAvg += piCur[31] ;2345 iCurAvg += piCur[32] ;2346 iCurAvg += piCur[33] ;2347 iCurAvg += piCur[34] ;2348 iCurAvg += piCur[35] ;2349 iCurAvg += piCur[36] ;2350 iCurAvg += piCur[37] ;2351 iCurAvg += piCur[38] ;2352 iCurAvg += piCur[39] ;2353 iCurAvg += piCur[40] ;2354 iCurAvg += piCur[41] ;2355 iCurAvg += piCur[42] ;2356 iCurAvg += piCur[43] ;2357 iCurAvg += piCur[44] ;2358 iCurAvg += piCur[45] ;2359 iCurAvg += piCur[46] ;2360 iCurAvg += piCur[47] ;2361 2362 piOrg += iStrideOrg;2363 piCur += iStrideCur;2364 uiRowCnt++;2365 }2366 2367 piOrg = pcDtParam->pOrg;2368 piCur = pcDtParam->pCur;2369 iRows = pcDtParam->iRows;2370 2371 iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/48) : 0;2372 2373 for( ; iRows != 0; iRows-=iSubStep )2374 {2375 uiSum += abs( piOrg[0] - piCur[0] - iDeltaC );2376 uiSum += abs( piOrg[1] - piCur[1] - iDeltaC );2377 uiSum += abs( piOrg[2] - piCur[2] - iDeltaC );2378 uiSum += abs( piOrg[3] - piCur[3] - iDeltaC );2379 uiSum += abs( piOrg[4] - piCur[4] - iDeltaC );2380 uiSum += abs( piOrg[5] - piCur[5] - iDeltaC );2381 uiSum += abs( piOrg[6] - piCur[6] - iDeltaC );2382 uiSum += abs( piOrg[7] - piCur[7] - iDeltaC );2383 uiSum += abs( piOrg[8] - piCur[8] - iDeltaC );2384 uiSum += abs( piOrg[9] - piCur[9] - iDeltaC );2385 uiSum += abs( piOrg[10] - piCur[10] - iDeltaC );2386 uiSum += abs( piOrg[11] - piCur[11] - iDeltaC );2387 uiSum += abs( piOrg[12] - piCur[12] - iDeltaC );2388 uiSum += abs( piOrg[13] - piCur[13] - iDeltaC );2389 uiSum += abs( piOrg[14] - piCur[14] - iDeltaC );2390 uiSum += abs( piOrg[15] - piCur[15] - iDeltaC );2391 uiSum += abs( piOrg[16] - piCur[16] - iDeltaC );2392 uiSum += abs( piOrg[17] - piCur[17] - iDeltaC );2393 uiSum += abs( piOrg[18] - piCur[18] - iDeltaC );2394 uiSum += abs( piOrg[19] - piCur[19] - iDeltaC );2395 uiSum += abs( piOrg[20] - piCur[20] - iDeltaC );2396 uiSum += abs( piOrg[21] - piCur[21] - iDeltaC );2397 uiSum += abs( piOrg[22] - piCur[22] - iDeltaC );2398 uiSum += abs( piOrg[23] - piCur[23] - iDeltaC );2399 uiSum += abs( piOrg[24] - piCur[24] - iDeltaC );2400 uiSum += abs( piOrg[25] - piCur[25] - iDeltaC );2401 uiSum += abs( piOrg[26] - piCur[26] - iDeltaC );2402 uiSum += abs( piOrg[27] - piCur[27] - iDeltaC );2403 uiSum += abs( piOrg[28] - piCur[28] - iDeltaC );2404 uiSum += abs( piOrg[29] - piCur[29] - iDeltaC );2405 uiSum += abs( piOrg[30] - piCur[30] - iDeltaC );2406 uiSum += abs( piOrg[31] - piCur[31] - iDeltaC );2407 uiSum += abs( piOrg[32] - piCur[32] - iDeltaC );2408 uiSum += abs( piOrg[33] - piCur[33] - iDeltaC );2409 uiSum += abs( piOrg[34] - piCur[34] - iDeltaC );2410 uiSum += abs( piOrg[35] - piCur[35] - iDeltaC );2411 uiSum += abs( piOrg[36] - piCur[36] - iDeltaC );2412 uiSum += abs( piOrg[37] - piCur[37] - iDeltaC );2413 uiSum += abs( piOrg[38] - piCur[38] - iDeltaC );2414 uiSum += abs( piOrg[39] - piCur[39] - iDeltaC );2415 uiSum += abs( piOrg[40] - piCur[40] - iDeltaC );2416 uiSum += abs( piOrg[41] - piCur[41] - iDeltaC );2417 uiSum += abs( piOrg[42] - piCur[42] - iDeltaC );2418 uiSum += abs( piOrg[43] - piCur[43] - iDeltaC );2419 uiSum += abs( piOrg[44] - piCur[44] - iDeltaC );2420 uiSum += abs( piOrg[45] - piCur[45] - iDeltaC );2421 uiSum += abs( piOrg[46] - piCur[46] - iDeltaC );2422 uiSum += abs( piOrg[47] - piCur[47] - iDeltaC );2423 2424 piOrg += iStrideOrg;2425 piCur += iStrideCur;2426 }2427 2428 uiSum <<= iSubShift;2429 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );2430 }2431 #endif2432 887 // -------------------------------------------------------------------------------------------------------------------- 2433 888 // SSE … … 2781 1236 } 2782 1237 2783 #if NH_3D_VSO2784 //SAIT_VSO_EST_A00332785 UInt TComRdCost::getVSDEstimate( Int dDM, const Pel* pOrg, Int iOrgStride, const Pel* pVirRec, const Pel* pVirOrg, Int iVirStride, Int x, Int y )2786 {2787 // change to use bit depth from DistParam struct2788 Double dD = ( (Double) ( dDM >> ( ENC_INTERNAL_BIT_DEPTH - 8 ) ) ) * m_dDisparityCoeff;2789 2790 Double dDepthWeight = ( pOrg[x] >= ( (1<<(REN_BIT_DEPTH - 3)) + (1<<(REN_BIT_DEPTH - 2)) ) ? 4 : pOrg[x] > ((1<<REN_BIT_DEPTH) >> 4) ? (Float)(pOrg[x] - ((1<<REN_BIT_DEPTH) >> 4))/(Float)((1<<REN_BIT_DEPTH) >> 3) + 1 : 1.0 );2791 2792 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 ] ) ) );2793 Int iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));2794 2795 return (UInt) ( (iTemp*iTemp)>>1 );2796 }2797 2798 UInt TComRdCost::xGetVSD( DistParam* pcDtParam )2799 {2800 const Pel* piOrg = pcDtParam->pOrg;2801 const Pel* piCur = pcDtParam->pCur;2802 const Pel* piVirRec = pcDtParam->pVirRec;2803 const Pel* piVirOrg = pcDtParam->pVirOrg;2804 Int iRows = pcDtParam->iRows;2805 Int iCols = pcDtParam->iCols;2806 Int iStrideOrg = pcDtParam->iStrideOrg;2807 Int iStrideCur = pcDtParam->iStrideCur;2808 Int iStrideVir = pcDtParam->iStrideVir;2809 2810 UInt uiSum = 0;2811 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;2812 2813 Int dDM;2814 2815 for ( Int y = 0 ; y < iRows ; y++ )2816 {2817 for (Int x = 0; x < iCols; x++ )2818 {2819 dDM = (Int) ( piOrg[x ] - piCur[x ] );2820 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;2821 }2822 piOrg += iStrideOrg;2823 piCur += iStrideCur;2824 }2825 2826 return ( uiSum );2827 }2828 2829 UInt TComRdCost::xGetVSD4( DistParam* pcDtParam )2830 {2831 const Pel* piOrg = pcDtParam->pOrg;2832 const Pel* piCur = pcDtParam->pCur;2833 const Pel* piVirRec = pcDtParam->pVirRec;2834 const Pel* piVirOrg = pcDtParam->pVirOrg;2835 Int iRows = pcDtParam->iRows;2836 Int iStrideOrg = pcDtParam->iStrideOrg;2837 Int iStrideCur = pcDtParam->iStrideCur;2838 Int iStrideVir = pcDtParam->iStrideVir;2839 2840 UInt uiSum = 0;2841 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;2842 2843 Int dDM;2844 2845 for ( Int y = 0 ; y < iRows ; y++ )2846 {2847 dDM = (Int) ( piOrg[0] - piCur[0] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 0, y ) ) >> uiShift;2848 dDM = (Int) ( piOrg[1] - piCur[1] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 1, y ) ) >> uiShift;2849 dDM = (Int) ( piOrg[2] - piCur[2] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 2, y ) ) >> uiShift;2850 dDM = (Int) ( piOrg[3] - piCur[3] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 3, y ) ) >> uiShift;2851 2852 piOrg += iStrideOrg;2853 piCur += iStrideCur;2854 }2855 2856 return ( uiSum );2857 }2858 2859 UInt TComRdCost::xGetVSD8( DistParam* pcDtParam )2860 {2861 const Pel* piOrg = pcDtParam->pOrg;2862 const Pel* piCur = pcDtParam->pCur;2863 const Pel* piVirRec = pcDtParam->pVirRec;2864 const Pel* piVirOrg = pcDtParam->pVirOrg;2865 Int iRows = pcDtParam->iRows;2866 Int iStrideOrg = pcDtParam->iStrideOrg;2867 Int iStrideCur = pcDtParam->iStrideCur;2868 Int iStrideVir = pcDtParam->iStrideVir;2869 2870 UInt uiSum = 0;2871 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;2872 2873 Int dDM;2874 2875 for ( Int y = 0 ; y < iRows ; y++ )2876 {2877 for (Int x = 0; x < 8; x++ )2878 {2879 dDM = (Int) ( piOrg[x] - piCur[x] );2880 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;2881 }2882 piOrg += iStrideOrg;2883 piCur += iStrideCur;2884 }2885 2886 return ( uiSum );2887 }2888 2889 UInt TComRdCost::xGetVSD16( DistParam* pcDtParam )2890 {2891 const Pel* piOrg = pcDtParam->pOrg;2892 const Pel* piCur = pcDtParam->pCur;2893 const Pel* piVirRec = pcDtParam->pVirRec;2894 const Pel* piVirOrg = pcDtParam->pVirOrg;2895 Int iRows = pcDtParam->iRows;2896 Int iStrideOrg = pcDtParam->iStrideOrg;2897 Int iStrideCur = pcDtParam->iStrideCur;2898 Int iStrideVir = pcDtParam->iStrideVir;2899 2900 UInt uiSum = 0;2901 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;2902 2903 Int dDM;2904 2905 for ( Int y = 0 ; y < iRows ; y++ )2906 {2907 for (Int x = 0; x < 16; x++ )2908 {2909 dDM = (Int) ( piOrg[x] - piCur[x] );2910 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;2911 }2912 piOrg += iStrideOrg;2913 piCur += iStrideCur;2914 }2915 2916 return ( uiSum );2917 }2918 2919 UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam )2920 {2921 const Pel* piOrg = pcDtParam->pOrg;2922 const Pel* piCur = pcDtParam->pCur;2923 const Pel* piVirRec = pcDtParam->pVirRec;2924 const Pel* piVirOrg = pcDtParam->pVirOrg;2925 Int iRows = pcDtParam->iRows;2926 Int iCols = pcDtParam->iCols;2927 Int iStrideOrg = pcDtParam->iStrideOrg;2928 Int iStrideCur = pcDtParam->iStrideCur;2929 Int iStrideVir = pcDtParam->iStrideVir;2930 2931 UInt uiSum = 0;2932 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;2933 2934 Int dDM;2935 2936 for ( Int y = 0 ; y < iRows ; y++ )2937 {2938 for (Int x = 0; x < iCols; x+=16 )2939 {2940 for ( Int k = 0 ; k < 16 ; k++ )2941 {2942 dDM = (Int) ( piOrg[x+k] - piCur[x+k] );2943 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x+k, y ) >> uiShift;2944 }2945 }2946 piOrg += iStrideOrg;2947 piCur += iStrideCur;2948 }2949 2950 return ( uiSum );2951 }2952 2953 UInt TComRdCost::xGetVSD32( DistParam* pcDtParam )2954 {2955 const Pel* piOrg = pcDtParam->pOrg;2956 const Pel* piCur = pcDtParam->pCur;2957 const Pel* piVirRec = pcDtParam->pVirRec;2958 const Pel* piVirOrg = pcDtParam->pVirOrg;2959 Int iRows = pcDtParam->iRows;2960 Int iStrideOrg = pcDtParam->iStrideOrg;2961 Int iStrideCur = pcDtParam->iStrideCur;2962 Int iStrideVir = pcDtParam->iStrideVir;2963 2964 UInt uiSum = 0;2965 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;2966 2967 Int dDM;2968 2969 for ( Int y = 0 ; y < iRows ; y++ )2970 {2971 for (Int x = 0; x < 32 ; x++ )2972 {2973 dDM = (Int) ( piOrg[x] - piCur[x] );2974 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;2975 }2976 piOrg += iStrideOrg;2977 piCur += iStrideCur;2978 }2979 2980 return ( uiSum );2981 }2982 2983 UInt TComRdCost::xGetVSD64( DistParam* pcDtParam )2984 {2985 const Pel* piOrg = pcDtParam->pOrg;2986 const Pel* piCur = pcDtParam->pCur;2987 const Pel* piVirRec = pcDtParam->pVirRec;2988 const Pel* piVirOrg = pcDtParam->pVirOrg;2989 Int iRows = pcDtParam->iRows;2990 Int iStrideOrg = pcDtParam->iStrideOrg;2991 Int iStrideCur = pcDtParam->iStrideCur;2992 Int iStrideVir = pcDtParam->iStrideVir;2993 2994 UInt uiSum = 0;2995 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;2996 2997 Int dDM;2998 2999 for ( Int y = 0 ; y < iRows ; y++ )3000 {3001 for (Int x = 0; x < 64; x++ )3002 {3003 dDM = (Int) ( piOrg[x] - piCur[x] );3004 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;3005 }3006 piOrg += iStrideOrg;3007 piCur += iStrideCur;3008 }3009 3010 return ( uiSum );3011 }3012 3013 #endif3014 1238 3015 1239 // -------------------------------------------------------------------------------------------------------------------- … … 3239 1463 return TComRdCostWeightPrediction::xGetHADsw( pcDtParam ); 3240 1464 } 3241 #if NH_3D_IC3242 if( pcDtParam->bUseIC )3243 {3244 return xGetHADsic( pcDtParam );3245 }3246 #endif3247 #if NH_3D_SDC_INTER3248 if( pcDtParam->bUseSDCMRSAD )3249 {3250 return xGetHADsic( pcDtParam );3251 }3252 #endif3253 1465 3254 1466 const Pel* piOrg = pcDtParam->pOrg; … … 3315 1527 } 3316 1528 3317 #if NH_3D_IC || NH_3D_SDC_INTER3318 UInt TComRdCost::xGetHADsic( DistParam* pcDtParam )3319 {3320 if ( pcDtParam->bApplyWeight )3321 {3322 return TComRdCostWeightPrediction::xGetHADsw( pcDtParam );3323 }3324 const Pel* piOrg = pcDtParam->pOrg;3325 const Pel* piCur = pcDtParam->pCur;3326 3327 Int iRows = pcDtParam->iRows;3328 Int iCols = pcDtParam->iCols;3329 Int iStrideCur = pcDtParam->iStrideCur;3330 Int iStrideOrg = pcDtParam->iStrideOrg;3331 Int iStep = pcDtParam->iStep;3332 3333 Int x, y;3334 3335 UInt uiSum = 0;3336 3337 Int iOrigAvg = 0, iCurAvg = 0;3338 Int iDeltaC;3339 3340 for ( y=0; y<iRows; y++ )3341 {3342 for ( x=0; x<iCols; x++ )3343 {3344 iOrigAvg += piOrg[x];3345 iCurAvg += piCur[x];3346 }3347 piOrg += iStrideOrg;3348 piCur += iStrideCur;3349 }3350 3351 piOrg = pcDtParam->pOrg;3352 piCur = pcDtParam->pCur;3353 3354 iDeltaC = (iOrigAvg - iCurAvg)/iRows/iCols;3355 3356 const Int orgMaxSize = MAX_CU_SIZE*MAX_CU_SIZE;3357 assert( iRows * iCols <= orgMaxSize );3358 3359 Pel orgMinusDeltaDc[ orgMaxSize ];3360 Pel* tempOrgMinusDeltaDc = orgMinusDeltaDc;3361 3362 for ( y=0; y<iRows; y++ )3363 {3364 for ( x=0; x<iCols; x++ )3365 {3366 tempOrgMinusDeltaDc[x] = (piOrg[x] - iDeltaC);3367 }3368 piOrg += iStrideOrg;3369 tempOrgMinusDeltaDc += iStrideOrg;3370 }3371 3372 tempOrgMinusDeltaDc = orgMinusDeltaDc;3373 3374 piOrg = pcDtParam->pOrg;3375 3376 #if NS_HAD3377 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) )3378 #else3379 if( ( iRows % 8 == 0) && (iCols % 8 == 0) )3380 #endif3381 {3382 Int iOffsetOrg = iStrideOrg<<3;3383 Int iOffsetCur = iStrideCur<<3;3384 for ( y=0; y<iRows; y+= 8 )3385 {3386 for ( x=0; x<iCols; x+= 8 )3387 {3388 uiSum += xCalcHADs8x8( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3389 }3390 tempOrgMinusDeltaDc += iOffsetOrg;3391 piCur += iOffsetCur;3392 }3393 }3394 #if NS_HAD3395 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD )3396 {3397 Int iOffsetOrg = iStrideOrg<<2;3398 Int iOffsetCur = iStrideCur<<2;3399 for ( y=0; y<iRows; y+= 4 )3400 {3401 for ( x=0; x<iCols; x+= 16 )3402 {3403 uiSum += xCalcHADs16x4( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3404 }3405 tempOrgMinusDeltaDc += iOffsetOrg;3406 piCur += iOffsetCur;3407 }3408 }3409 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD )3410 {3411 Int iOffsetOrg = iStrideOrg<<4;3412 Int iOffsetCur = iStrideCur<<4;3413 for ( y=0; y<iRows; y+= 16 )3414 {3415 for ( x=0; x<iCols; x+= 4 )3416 {3417 uiSum += xCalcHADs4x16( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3418 }3419 tempOrgMinusDeltaDc += iOffsetOrg;3420 piCur += iOffsetCur;3421 }3422 }3423 #endif3424 else if( ( iRows % 4 == 0) && (iCols % 4 == 0) )3425 {3426 Int iOffsetOrg = iStrideOrg<<2;3427 Int iOffsetCur = iStrideCur<<2;3428 3429 for ( y=0; y<iRows; y+= 4 )3430 {3431 for ( x=0; x<iCols; x+= 4 )3432 {3433 uiSum += xCalcHADs4x4( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3434 }3435 tempOrgMinusDeltaDc += iOffsetOrg;3436 piCur += iOffsetCur;3437 }3438 }3439 else if( ( iRows % 2 == 0) && (iCols % 2 == 0) )3440 {3441 Int iOffsetOrg = iStrideOrg<<1;3442 Int iOffsetCur = iStrideCur<<1;3443 for ( y=0; y<iRows; y+=2 )3444 {3445 for ( x=0; x<iCols; x+=2 )3446 {3447 uiSum += xCalcHADs2x2( &tempOrgMinusDeltaDc[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );3448 }3449 tempOrgMinusDeltaDc += iOffsetOrg;3450 piCur += iOffsetCur;3451 }3452 }3453 else3454 {3455 assert(false);3456 }3457 3458 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT( pcDtParam->bitDepth - 8 ) );3459 }3460 #endif3461 #if NH_3D_VSO3462 Void TComRdCost::setLambdaVSO( Double dLambdaVSO )3463 {3464 m_dLambdaVSO = dLambdaVSO;3465 m_dSqrtLambdaVSO = sqrt(m_dLambdaVSO);3466 m_uiLambdaMotionSADVSO = (UInt)floor(65536.0 * m_dSqrtLambdaVSO);3467 m_uiLambdaMotionSSEVSO = (UInt)floor(65536.0 * m_dLambdaVSO );3468 }3469 #endif3470 #if NH_3D_VSO3471 Dist TComRdCost::xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD )3472 {3473 AOT(bSAD);3474 #if H_3D_VSO_EARLY_SKIP3475 RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride);3476 #else3477 RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur );3478 #endif3479 3480 RMDist iDistMin = (RMDist) RDO_DIST_MIN;3481 iDistMin = m_bAllowNegDist ? RDO_DIST_MIN : 0;3482 3483 iDist = std::min( iDist, (RMDist) RDO_DIST_MAX);3484 iDist = std::max( iDist, iDistMin);3485 return (Dist) iDist;3486 }3487 3488 3489 Dist TComRdCost::getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD )3490 {3491 assert( m_bUseVSO );3492 assert( this->m_fpDistortFuncVSO != 0 );3493 3494 Int iPosX;3495 Int iPosY;3496 3497 pcCU->getPosInPic( uiAbsPartIndex, iPosX, iPosY );3498 3499 Dist dist = (this->*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bHAD );3500 3501 if ( m_bUseWVSO )3502 {3503 Int iDWeight = m_iDWeight * m_iDWeight ;3504 Int iVSOWeight = m_iVSOWeight * m_iVSOWeight;3505 Dist distDepth;3506 3507 if ( !bHAD )3508 {3509 distDepth = (Dist) getDistPart( bitDepth, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, COMPONENT_Y);3510 }3511 else3512 {3513 distDepth = (Dist) calcHAD ( bitDepth, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight);3514 }3515 3516 dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight);3517 }3518 return dist;3519 };3520 3521 3522 Void TComRdCost::setVSOMode( UInt uiIn )3523 {3524 m_uiVSOMode = uiIn;3525 switch (m_uiVSOMode )3526 {3527 case 4:3528 m_fpDistortFuncVSO = &TComRdCost::xGetDistVSOMode4;3529 break;3530 default:3531 assert(0);3532 break;3533 }3534 }3535 3536 3537 Double TComRdCost::calcRdCostVSO( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc )3538 {3539 assert( m_bUseLambdaScaleVSO );3540 3541 Double dRdCost = 0.0;3542 Double dLambda = 0.0;3543 3544 switch ( eDFunc )3545 {3546 case DF_SSE:3547 assert(0);3548 break;3549 case DF_SAD:3550 dLambda = (Double)m_uiLambdaMotionSADVSO;3551 break;3552 case DF_DEFAULT:3553 dLambda = m_dLambdaVSO;3554 break;3555 case DF_SSE_FRAME:3556 dLambda = m_dFrameLambdaVSO;3557 break;3558 default:3559 assert (0);3560 break;3561 }3562 3563 if (bFlag)3564 {3565 // Intra8x8, Intra4x4 Block only...3566 #if SEQUENCE_LEVEL_LOSSLESS3567 dRdCost = (Double)(uiBits);3568 #else3569 dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda));3570 #endif3571 }3572 else3573 {3574 if (eDFunc == DF_SAD)3575 {3576 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16));3577 dRdCost = (Double)(Dist)floor(dRdCost);3578 }3579 else3580 {3581 #if SEQUENCE_LEVEL_LOSSLESS3582 dRdCost = (Double)(uiBits);3583 #else3584 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)));3585 dRdCost = (Double)(Dist)floor(dRdCost);3586 #endif3587 }3588 }3589 3590 #if NH_MV3591 D_PRINT_INDENT( g_traceRDCost, "VSO Dist: " + n2s(uiDistortion) + " Bits: " + n2s(uiBits) + " RD Cost: " + n2s(dRdCost));3592 #endif3593 3594 return dRdCost;3595 }3596 3597 Void TComRdCost::setRenModelData( const TComDataCU* pcCU, UInt uiAbsPartIndex, const TComYuv* pcYuv, const TComTURecurse* tuRecurseWithPU )3598 {3599 const TComRectangle &puRect=tuRecurseWithPU->getRect(COMPONENT_Y);3600 const UInt uiCompWidth = puRect.width;3601 const UInt uiCompHeight = puRect.height;3602 3603 const Pel* piSrc = pcYuv->getAddr( COMPONENT_Y, uiAbsPartIndex );3604 const UInt uiSrcStride = pcYuv->getStride( COMPONENT_Y);3605 setRenModelData( pcCU, uiAbsPartIndex, piSrc, uiSrcStride, uiCompWidth, uiCompHeight );3606 }3607 3608 Void TComRdCost::setRenModelData( const TComDataCU* pcCU, UInt uiAbsPartIndex, const Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight )3609 {3610 UInt iBlkX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]];3611 UInt iBlkY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]];3612 3613 Int iStartPosX = iBlkX + pcCU->getCUPelX();3614 Int iStartPosY = iBlkY + pcCU->getCUPelY();3615 3616 m_pcRenModel->setData( iStartPosX, iStartPosY, iBlkWidth, iBlkHeight, iStride, piData );3617 }3618 3619 Void TComRdCost::setAllowNegDist( Bool bAllowNegDist )3620 {3621 m_bAllowNegDist = bAllowNegDist;3622 }3623 #endif3624 1529 3625 1530 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComRdCost.h
r1386 r1390 46 46 #include "TComSlice.h" 47 47 #include "TComRdCostWeightPrediction.h" 48 #if NH_3D_VSO49 #include "../TLibRenderer/TRenModel.h"50 #include "TComYuv.h"51 #include "TComTU.h"52 #endif53 48 54 49 //! \ingroup TLibCommon … … 57 52 class DistParam; 58 53 class TComPattern; 59 #if NH_3D_VSO60 class TComRdCost;61 #endif62 54 63 55 // ==================================================================================================================== … … 69 61 70 62 71 #if NH_3D_VSO72 typedef Dist (TComRdCost::*FpDistFuncVSO) ( Int, Int, Pel*, Int, Pel*, Int, UInt, UInt, Bool );73 #endif74 63 // ==================================================================================================================== 75 64 // Class definition … … 84 73 Int iStrideOrg; 85 74 Int iStrideCur; 86 #if NH_3D_VSO87 // SAIT_VSO_EST_A003388 Pel* pVirRec;89 Pel* pVirOrg;90 Int iStrideVir;91 #endif92 #if NH_3D_IC93 Bool bUseIC;94 #endif95 #if NH_3D_SDC_INTER96 Bool bUseSDCMRSAD;97 #endif98 75 Int iRows; 99 76 Int iCols; … … 130 107 iSubShift(0) 131 108 { 132 #if NH_3D_VSO133 // SAIT_VSO_EST_A0033134 pVirRec = NULL;135 pVirOrg = NULL;136 iStrideVir = 0;137 #endif138 #if NH_3D_SDC_INTER139 bUseSDCMRSAD = false;140 #endif141 109 } 142 110 }; … … 156 124 Double m_dLambdaMotionSSE[2 /* 0=standard, 1=for transquant bypass when mixed-lossless cost evaluation enabled*/]; 157 125 Double m_dFrameLambda; 158 #if NH_3D_VSO159 // SAIT_VSO_EST_A0033160 static Double m_dDisparityCoeff;161 #endif162 126 163 127 // for motion cost … … 165 129 Double m_motionLambda; 166 130 Int m_iCostScale; 167 #if NH_3D_DBBP168 Bool m_bUseMask;169 #endif170 131 171 132 public: 172 133 TComRdCost(); 173 134 virtual ~TComRdCost(); 174 #if NH_3D_VSO175 Double calcRdCost64( UInt64 uiBits , Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );176 Double calcRdCost( Double numBits, Dist intDistortion, DFunc eDFunc = DF_DEFAULT );177 #else178 135 Double calcRdCost( Double numBits, Double distortion, DFunc eDFunc = DF_DEFAULT ); 179 #endif180 136 181 137 … … 185 141 186 142 Double getSqrtLambda () { return m_sqrtLambda; } 187 #if NH_3D_VSO188 // SAIT_VSO_EST_A0033189 Void setDisparityCoeff( Double dDisparityCoeff ) { m_dDisparityCoeff = dDisparityCoeff; }190 Double getDisparityCoeff() { return m_dDisparityCoeff; }191 #endif192 143 193 144 Double getLambda() { return m_dLambda; } … … 204 155 Void setDistParam( DistParam& rcDP, Int bitDepth, const Pel* p1, Int iStride1, const Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false ); 205 156 206 #if NH_3D_DBBP207 Void setUseMask(Bool b) { m_bUseMask = b; }208 #endif209 157 210 158 Distortion calcHAD(Int bitDepth, const Pel* pi0, Int iStride0, const Pel* pi1, Int iStride1, Int iWidth, Int iHeight ); 211 159 212 #if NH_3D_ENC_DEPTH213 UInt calcVAR(Pel* pi0, Int stride, Int width, Int height, Int cuDepth, UInt maxCuWidth );214 #endif215 160 216 161 // for motion cost … … 242 187 static Distortion xGetSSE64 ( DistParam* pcDtParam ); 243 188 static Distortion xGetSSE16N ( DistParam* pcDtParam ); 244 #if NH_3D_IC || NH_3D_SDC_INTER245 static UInt xGetSADic ( DistParam* pcDtParam );246 static UInt xGetSAD4ic ( DistParam* pcDtParam );247 static UInt xGetSAD8ic ( DistParam* pcDtParam );248 static UInt xGetSAD16ic ( DistParam* pcDtParam );249 static UInt xGetSAD32ic ( DistParam* pcDtParam );250 static UInt xGetSAD64ic ( DistParam* pcDtParam );251 static UInt xGetSAD16Nic ( DistParam* pcDtParam );252 #endif253 189 254 190 static Distortion xGetSAD ( DistParam* pcDtParam ); … … 259 195 static Distortion xGetSAD64 ( DistParam* pcDtParam ); 260 196 static Distortion xGetSAD16N ( DistParam* pcDtParam ); 261 #if NH_3D_VSO 262 static UInt xGetVSD ( DistParam* pcDtParam ); 263 static UInt xGetVSD4 ( DistParam* pcDtParam ); 264 static UInt xGetVSD8 ( DistParam* pcDtParam ); 265 static UInt xGetVSD16 ( DistParam* pcDtParam ); 266 static UInt xGetVSD32 ( DistParam* pcDtParam ); 267 static UInt xGetVSD64 ( DistParam* pcDtParam ); 268 static UInt xGetVSD16N ( DistParam* pcDtParam ); 269 #endif 270 271 #if NH_3D_IC || NH_3D_SDC_INTER 272 static UInt xGetSAD12ic ( DistParam* pcDtParam ); 273 static UInt xGetSAD24ic ( DistParam* pcDtParam ); 274 static UInt xGetSAD48ic ( DistParam* pcDtParam ); 275 #endif 197 276 198 277 199 static Distortion xGetSAD12 ( DistParam* pcDtParam ); … … 280 202 281 203 282 #if NH_3D_IC || NH_3D_SDC_INTER283 static UInt xGetHADsic ( DistParam* pcDtParam );284 #endif285 204 286 205 static Distortion xGetHADs ( DistParam* pcDtParam ); … … 288 207 static Distortion xCalcHADs4x4 ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 289 208 static Distortion xCalcHADs8x8 ( const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 290 #if NH_3D_DBBP291 static UInt xGetMaskedSSE ( DistParam* pcDtParam );292 static UInt xGetMaskedSAD ( DistParam* pcDtParam );293 static UInt xGetMaskedVSD ( DistParam* pcDtParam );294 #endif295 209 296 210 … … 299 213 Distortion getDistPart(Int bitDepth, const Pel* piCur, Int iCurStride, const Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc = DF_SSE ); 300 214 301 #if KWU_RC_MADPRED_E0227 302 UInt getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ); 303 #endif 304 305 #if NH_3D_VSO 306 // SAIT_VSO_EST_A0033 307 UInt getDistPartVSD( TComDataCU* pcCu, UInt uiPartOffset, Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHad, DFunc eDFunc = DF_VSD); 308 static UInt getVSDEstimate( Int dDM, const Pel* pOrg, Int iOrgStride, const Pel* pVirRec, const Pel* pVirOrg, Int iVirStride, Int x, Int y ); 309 310 private: 311 Double m_dLambdaVSO; 312 Double m_dSqrtLambdaVSO; 313 UInt m_uiLambdaMotionSADVSO; 314 UInt m_uiLambdaMotionSSEVSO; 315 Double m_dFrameLambdaVSO; 316 Bool m_bAllowNegDist; 317 Bool m_bUseVSO; 318 Bool m_bUseLambdaScaleVSO; 319 UInt m_uiVSOMode; 320 321 FpDistFuncVSO m_fpDistortFuncVSO; 322 TRenModel* m_pcRenModel; 323 324 325 // SAIT_VSO_EST_A0033 326 TComPicYuv * m_pcVideoRecPicYuv; 327 TComPicYuv * m_pcDepthPicYuv; 328 Bool m_bUseEstimatedVSD; 329 330 // LGE_WVSO_A0119 331 Int m_iDWeight; 332 Int m_iVSOWeight; 333 Int m_iVSDWeight; 334 Bool m_bUseWVSO; 335 336 public: 337 338 Void setRenModel ( TRenModel* pcRenModel ) { m_pcRenModel = pcRenModel; } 339 TRenModel* getRenModel ( ) { return m_pcRenModel; } 340 Void setRenModelData ( const TComDataCU* pcCU, UInt uiAbsPartIndex, const TComYuv* pcYuv, const TComTURecurse* tuRecurseWithPU ); 341 Void setRenModelData ( const TComDataCU* pcCU, UInt uiAbsPartIndex, const Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ); 342 343 Void setLambdaVSO ( Double dLambda ); 344 Void setFrameLambdaVSO ( Double dLambda ) { m_dFrameLambdaVSO = dLambda; }; 345 346 347 Void setUseVSO ( Bool bIn ) { m_bUseVSO = bIn; }; 348 Bool getUseVSO ( ) { return m_bUseVSO;}; 349 350 Bool getUseRenModel ( ) { return (m_bUseVSO && m_uiVSOMode == 4); }; 351 Void setUseLambdaScaleVSO(Bool bIn) { m_bUseLambdaScaleVSO = bIn; }; 352 Bool getUseLambdaScaleVSO( ) { return m_bUseLambdaScaleVSO; }; 353 354 Void setVSOMode( UInt uiIn); 355 UInt getVSOMode( ) { return m_uiVSOMode; } 356 Void setAllowNegDist ( Bool bAllowNegDist ); 357 358 Double getSqrtLambdaVSO () { return m_dSqrtLambdaVSO; } 359 Double getLambdaVSO () { return m_dLambdaVSO; } 360 361 Dist getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Int bitdDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 362 Double calcRdCostVSO ( UInt uiBits, Dist uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT ); 363 364 // SAIT_VSO_EST_A0033 365 Bool getUseEstimatedVSD( ) { return m_bUseEstimatedVSD; }; 366 Void setUseEstimatedVSD( Bool bIn ) { m_bUseEstimatedVSD = bIn; }; 367 368 TComPicYuv* getVideoRecPicYuv () { return m_pcVideoRecPicYuv; }; 369 Void setVideoRecPicYuv ( TComPicYuv* pcVideoRecPicYuv ) { m_pcVideoRecPicYuv = pcVideoRecPicYuv; }; 370 TComPicYuv* getDepthPicYuv () { return m_pcDepthPicYuv; }; 371 Void setDepthPicYuv ( TComPicYuv* pcDepthPicYuv ) { m_pcDepthPicYuv = pcDepthPicYuv; }; 372 373 // LGE_WVSO_A0119 374 Void setUseWVSO ( Bool bIn ) { m_bUseWVSO = bIn; }; 375 Bool getUseWVSO ( ) { return m_bUseWVSO;}; 376 Void setDWeight ( Int iDWeight ) { m_iDWeight = iDWeight; }; 377 Int getDWeight () { return m_iDWeight; }; 378 Void setVSOWeight ( Int iVSOWeight ) { m_iVSOWeight = iVSOWeight; }; 379 Int getVSOWeight () { return m_iVSOWeight; }; 380 Void setVSDWeight ( Int iVSDWeight ) { m_iVSDWeight = iVSDWeight; }; 381 Int getVSDWeight () { return m_iVSDWeight; }; 382 383 private: 384 Dist xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ); 385 386 #endif // NH_3D_VSO 215 387 216 388 217 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComRom.cpp
r1386 r1390 253 253 } 254 254 } 255 #if NH_3D_DMM256 if( !g_dmmWedgeLists.empty() )257 {258 for( UInt ui = 0; ui < g_dmmWedgeLists.size(); ui++ ) { g_dmmWedgeLists[ui].clear(); }259 g_dmmWedgeLists.clear();260 }261 if( !g_dmmWedgeNodeLists.empty() )262 {263 for( UInt ui = 0; ui < g_dmmWedgeNodeLists.size(); ui++ ) { g_dmmWedgeNodeLists[ui].clear(); }264 g_dmmWedgeNodeLists.clear();265 }266 #endif267 255 } 268 256 // ==================================================================================================================== … … 509 497 //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, DM 510 498 { 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31, DM_CHROMA_IDX}; 511 #if NH_3D_DMM512 // ====================================================================================================================513 // Depth coding modes514 // ====================================================================================================================515 const WedgeResolution g_dmmWedgeResolution[6] =516 {517 HALF_PEL, // 4x4518 HALF_PEL, // 8x8519 FULL_PEL, // 16x16520 FULL_PEL, // 32x32521 FULL_PEL, // 64x64522 FULL_PEL // 128x128523 };524 const UChar g_dmm1TabIdxBits[6] =525 { //2x2 4x4 8x8 16x16 32x32 64x64526 0, 7, 10, 9, 9, 13 };527 Bool g_wedgePattern[32*32];528 extern std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists;529 extern std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;530 #endif531 499 // ==================================================================================================================== 532 500 // Misc. … … 790 758 #endif 791 759 #endif 792 #if NH_3D_DMM793 std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists;794 std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;795 Void initWedgeLists( Bool initNodeList )796 {797 if( !g_dmmWedgeLists.empty() ) return;798 for( UInt ui = g_aucConvertToBit[DMM_MIN_SIZE]; ui < (g_aucConvertToBit[DMM_MAX_SIZE]); ui++ )799 {800 UInt uiWedgeBlockSize = ((UInt)DMM_MIN_SIZE)<<ui;801 std::vector<TComWedgelet> acWedgeList;802 std::vector<TComWedgeRef> acWedgeRefList;803 createWedgeList( uiWedgeBlockSize, uiWedgeBlockSize, acWedgeList, acWedgeRefList, g_dmmWedgeResolution[ui] );804 g_dmmWedgeLists.push_back( acWedgeList );805 if( initNodeList )806 {807 // create WedgeNodeList808 std::vector<TComWedgeNode> acWedgeNodeList;809 for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ )810 {811 if( acWedgeList[uiPos].getIsCoarse() )812 {813 TComWedgeNode cWedgeNode;814 cWedgeNode.setPatternIdx( uiPos );815 UInt uiRefPos = 0;816 for( Int iOffS = -1; iOffS <= 1; iOffS++ )817 {818 for( Int iOffE = -1; iOffE <= 1; iOffE++ )819 {820 if( iOffS == 0 && iOffE == 0 ) { continue; }821 Int iSx = (Int)acWedgeList[uiPos].getStartX();822 Int iSy = (Int)acWedgeList[uiPos].getStartY();823 Int iEx = (Int)acWedgeList[uiPos].getEndX();824 Int iEy = (Int)acWedgeList[uiPos].getEndY();825 switch( acWedgeList[uiPos].getOri() )826 {827 case( 0 ): { iSx += iOffS; iEy += iOffE; } break;828 case( 1 ): { iSy += iOffS; iEx -= iOffE; } break;829 case( 2 ): { iSx -= iOffS; iEy -= iOffE; } break;830 case( 3 ): { iSy -= iOffS; iEx += iOffE; } break;831 case( 4 ): { iSx += iOffS; iEx += iOffE; } break;832 case( 5 ): { iSy += iOffS; iEy += iOffE; } break;833 default: assert( 0 );834 }835 for( UInt k = 0; k < acWedgeRefList.size(); k++ )836 {837 if( iSx == (Int)acWedgeRefList[k].getStartX() &&838 iSy == (Int)acWedgeRefList[k].getStartY() &&839 iEx == (Int)acWedgeRefList[k].getEndX() &&840 iEy == (Int)acWedgeRefList[k].getEndY() )841 {842 if( acWedgeRefList[k].getRefIdx() != cWedgeNode.getPatternIdx() )843 {844 Bool bNew = true;845 for( UInt m = 0; m < uiRefPos; m++ ) { if( acWedgeRefList[k].getRefIdx() == cWedgeNode.getRefineIdx( m ) ) { bNew = false; break; } }846 if( bNew )847 {848 cWedgeNode.setRefineIdx( acWedgeRefList[k].getRefIdx(), uiRefPos );849 uiRefPos++;850 break;851 }852 }853 }854 }855 }856 }857 acWedgeNodeList.push_back( cWedgeNode );858 }859 }860 g_dmmWedgeNodeLists.push_back( acWedgeNodeList );861 }862 }863 }864 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes )865 {866 assert( uiWidth == uiHeight );867 Int posStart = 0, posEnd = 0;868 UInt uiBlockSize = 0;869 switch( eWedgeRes )870 {871 case( FULL_PEL ): { uiBlockSize = uiWidth; break; }872 case( HALF_PEL ): { uiBlockSize = (uiWidth<<1); break; }873 }874 TComWedgelet cTempWedgelet( uiWidth, uiHeight );875 for( UInt uiOri = 0; uiOri < 6; uiOri++ )876 {877 posEnd = (Int) racWedgeList.size();878 if (uiOri == 0 || uiOri == 4)879 {880 for( Int iK = 0; iK < uiBlockSize; iK += (uiWidth>=16 ?2:1))881 {882 for( Int iL = 0; iL < uiBlockSize; iL += ((uiWidth>=16 && uiOri<4)?2:1) )883 {884 Int xS = iK;885 Int yS = 0;886 Int xE = (uiOri == 0) ? 0 : iL;887 Int yE = (uiOri == 0) ? iL : uiBlockSize - 1;888 cTempWedgelet.setWedgelet( xS, yS, xE, yE, uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) );889 addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList );890 }891 }892 }893 else894 {895 for (Int pos = posStart; pos < posEnd; pos++)896 {897 cTempWedgelet.generateWedgePatternByRotate(racWedgeList[pos], uiOri);898 addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList );899 }900 }901 posStart = posEnd;902 }903 }904 Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList )905 {906 Bool bValid = cWedgelet.checkNotPlain();907 if( bValid )908 {909 for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ )910 {911 if( cWedgelet.checkIdentical( racWedgeList[uiPos].getPattern() ) )912 {913 TComWedgeRef cWedgeRef;914 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos );915 racWedgeRefList.push_back( cWedgeRef );916 bValid = false;917 return;918 }919 }920 }921 if( bValid )922 {923 for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ )924 {925 if( cWedgelet.checkInvIdentical( racWedgeList[uiPos].getPattern() ) )926 {927 TComWedgeRef cWedgeRef;928 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos );929 racWedgeRefList.push_back( cWedgeRef );930 bValid = false;931 return;932 }933 }934 }935 if( bValid )936 {937 racWedgeList.push_back( cWedgelet );938 TComWedgeRef cWedgeRef;939 cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), (UInt)(racWedgeList.size()-1) );940 racWedgeRefList.push_back( cWedgeRef );941 }942 }943 WedgeList* getWedgeListScaled( UInt blkSize )944 {945 return &g_dmmWedgeLists[ g_aucConvertToBit[( 16 >= blkSize ) ? blkSize : 16] ];946 }947 WedgeNodeList* getWedgeNodeListScaled( UInt blkSize )948 {949 return &g_dmmWedgeNodeLists[ g_aucConvertToBit[( 16 >= blkSize ) ? blkSize : 16] ];950 }951 #endif //NH_3D_DMM952 760 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComRom.h
r1386 r1390 39 39 #include<stdio.h> 40 40 #include<iostream> 41 #if NH_3D_DMM42 #include "TComWedgelet.h"43 #endif44 41 //! \ingroup TLibCommon 45 42 //! \{ … … 91 88 extern const UChar g_aucIntraModeNumFast_NotUseMPM[MAX_CU_DEPTH]; 92 89 extern const UChar g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE]; 93 #if NH_3D_DMM94 // ====================================================================================================================95 // Depth coding modes96 // ====================================================================================================================97 extern const WedgeResolution g_dmmWedgeResolution [6];98 extern const UChar g_dmm1TabIdxBits [6];99 extern Bool g_wedgePattern[32*32];100 extern std::vector< std::vector<TComWedgelet> > g_dmmWedgeLists;101 extern std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;102 Void initWedgeLists( Bool initNodeList = false );103 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes );104 Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList );105 WedgeList* getWedgeListScaled ( UInt blkSize );106 WedgeNodeList* getWedgeNodeListScaled( UInt blkSize );107 __inline Void mapDmmToIntraDir( UInt& intraMode ) { if( isDmmMode( intraMode ) ) intraMode = DC_IDX; }108 __inline Void mapDmmToIntraDir( Int& intraMode ) { if( isDmmMode( intraMode ) ) intraMode = DC_IDX; }109 #endif110 90 // ==================================================================================================================== 111 91 // Mode-Dependent DST Matrices -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComSlice.cpp
r1386 r1390 118 118 , m_viewId (0) 119 119 , m_viewIndex (0) 120 #if NH_3D_VSO121 , m_isDepth (false)122 #endif123 120 #if NH_MV 124 121 , m_pocResetFlag (false) … … 139 136 , m_pocMsbValRequiredFlag (false) 140 137 #endif 141 #if NH_3D_IC142 , m_bApplyIC (false)143 , m_icSkipParseFlag (false)144 #endif145 #if NH_3D146 , m_inCmpPredFlag (false)147 , m_numViews (0)148 , m_depthToDisparityB (NULL)149 , m_depthToDisparityF (NULL)150 #endif151 #if NH_3D_DIS152 , m_bApplyDIS (false)153 #endif154 138 #endif 155 139 { … … 210 194 } 211 195 #endif 212 #if NH_3D213 m_iDefaultRefViewIdx = -1;214 m_bDefaultRefViewIdxAvailableFlag = false;215 m_ivMvPredFlag = false;216 m_ivMvScalingFlag = false;217 m_ivResPredFlag = false;218 m_depthRefinementFlag = false;219 m_viewSynthesisPredFlag = false;220 m_depthBasedBlkPartFlag = false;221 m_mpiFlag = false;222 m_intraContourFlag = false;223 m_intraSdcWedgeFlag = false;224 m_qtPredFlag = false;225 m_interSdcFlag = false;226 m_depthIntraSkipFlag = false;227 m_subPbSize = 1 << 6;228 m_mpiSubPbSize = 1 << 6;229 230 m_aaiCodedOffset.resize(2);231 m_aaiCodedScale .resize(2);232 for (Int i = 0; i < 2; i++)233 {234 m_aaiCodedOffset[i].resize(MAX_NUM_LAYERS);235 m_aaiCodedScale [i].resize(MAX_NUM_LAYERS);236 }237 238 #endif239 196 240 197 } … … 242 199 TComSlice::~TComSlice() 243 200 { 244 #if NH_3D245 for( UInt i = 0; i < m_numViews; i++ )246 {247 if ( m_depthToDisparityB && m_depthToDisparityB[ i ] )248 {249 delete[] m_depthToDisparityB [ i ];250 }251 252 if ( m_depthToDisparityF && m_depthToDisparityF[ i ] )253 {254 delete[] m_depthToDisparityF [ i ];255 }256 }257 258 if ( m_depthToDisparityF )259 {260 delete[] m_depthToDisparityF;261 }262 263 m_depthToDisparityF = NULL;264 265 if ( m_depthToDisparityB )266 delete[] m_depthToDisparityB;267 268 m_depthToDisparityB = NULL;269 #endif270 201 271 202 } … … 289 220 m_iSliceChromaQpDelta[component] = 0; 290 221 } 291 #if NH_3D_IV_MERGE292 m_maxNumMergeCand = MRG_MAX_NUM_CANDS_MEM;293 #else294 222 m_maxNumMergeCand = MRG_MAX_NUM_CANDS; 295 #endif296 223 297 224 m_bFinalized=false; … … 300 227 m_cabacInitFlag = false; 301 228 m_enableTMVPFlag = true; 302 #if NH_3D_TMVP303 m_aiAlterRefIdx[0] = -1;304 m_aiAlterRefIdx[1] = -1;305 #endif306 229 } 307 230 … … 619 542 UInt NumPocLtCurr = 0; 620 543 Int i; 621 #if NH_3D622 m_pocsInCurrRPSs.clear();623 #endif624 544 for(i=0; i < m_pRPS->getNumberOfNegativePictures(); i++) 625 545 { … … 632 552 NumPocStCurr0++; 633 553 pcRefPic->setCheckLTMSBPresent(false); 634 #if NH_3D635 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() );636 #endif637 554 } 638 555 } … … 648 565 NumPocStCurr1++; 649 566 pcRefPic->setCheckLTMSBPresent(false); 650 #if NH_3D651 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() );652 #endif653 567 } 654 568 } … … 663 577 RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; 664 578 NumPocLtCurr++; 665 #if NH_3D666 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() );667 #endif668 579 } 669 580 if(pcRefPic==NULL) … … 675 586 676 587 Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 677 #if NH_3D678 assert( numPocInterCurr == (Int) m_pocsInCurrRPSs.size() );679 #endif680 588 numPocTotalCurr = numPocInterCurr + getNumActiveRefLayerPics( ); 681 589 assert( numPocTotalCurr == getNumRpsCurrTempList() ); … … 827 735 } 828 736 } 829 #if NH_3D 830 #if NH_3D_TMVP 831 Void TComSlice::generateAlterRefforTMVP() 832 { 833 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 834 { 835 if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0) 836 { 837 continue; 838 } 839 Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm(); 840 for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ ) 841 { 842 if ( ( bZeroIdxLtFlag && !this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) || 843 (!bZeroIdxLtFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) ) 844 { 845 this->setAlterRefIdx(RefPicList(uiRefListIdx),i); 846 break; 847 } 848 } 849 } 850 } 851 #endif 852 #endif 853 854 #if NH_3D 855 Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset ) 856 { 857 Int voiInVps = m_pcVPS->getVoiInVps(getViewIndex() ); 858 if( m_pcVPS->getNumCp( voiInVps ) > 0 ) 859 { 860 if( m_pcVPS->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 861 { 862 for( Int m = 0; m < m_pcVPS->getNumCp( voiInVps ); m++ ) 863 { 864 Int j = m_pcVPS->getCpRefVoi( voiInVps, m ); 865 Int jInVps = m_pcVPS->getVoiInVps( j ); 866 867 setCpScale ( jInVps , aaiScale [ jInVps ][ voiInVps ]); 868 setCpInvScale( jInVps , aaiScale [ voiInVps ][ jInVps ]); 869 setCpOff ( jInVps , aaiOffset[ jInVps ][ voiInVps ]); 870 setCpInvOff ( jInVps , aaiOffset[ voiInVps ][ jInVps ]); 871 } 872 } 873 } 874 } 875 #endif 737 876 738 877 739 Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) … … 1169 1031 } 1170 1032 #endif 1171 #if NH_3D_DIS1172 m_bApplyDIS = pSrc->m_bApplyDIS;1173 #endif1174 #if NH_3D_IC1175 m_bApplyIC = pSrc->m_bApplyIC;1176 m_icSkipParseFlag = pSrc->m_icSkipParseFlag;1177 #endif1178 1033 1179 1034 } … … 1923 1778 for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++) 1924 1779 { 1925 #if !NH_3D_FIX_TICKET_1071926 1780 m_layerSetIdxForOlsMinus1[i] = -1; 1927 #endif1928 1781 for ( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++) 1929 1782 { … … 1972 1825 m_layerIdInNuh [i] = ( i == 0 ) ? 0 : -1; 1973 1826 m_numDirectRefLayers[i] = 0; 1974 #if NH_3D1975 m_numRefListLayers[i] = 0;1976 #endif1977 1827 m_vpsRepFormatIdx [i] = 0; 1978 1828 m_pocLsbNotPresentFlag[i] = 0; 1979 1829 m_viewIdVal [i] = 0; 1980 1830 1981 #if NH_3D1982 m_viewIndex [i] = -1;1983 #endif1984 1831 1985 1832 for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) … … 1989 1836 m_dependencyFlag [i][j] = false; 1990 1837 m_idDirectRefLayer[i][j] = -1; 1991 #if NH_3D1992 m_idRefListLayer[i][j] = -1;1993 #endif1994 1838 m_idPredictedLayer[i][j] = -1; 1995 1839 m_idRefLayer [i][j] = -1; … … 2001 1845 m_dimensionId[i][j] = 0; 2002 1846 } 2003 #if NH_3D_ARP2004 #endif2005 1847 } 2006 1848 #endif … … 2078 1920 Int iNuhLId = getLayerIdInNuh( i ); 2079 1921 Int d = 0; 2080 #if NH_3D2081 Int l = 0;2082 #endif2083 1922 Int r = 0; 2084 1923 Int p = 0; … … 2091 1930 m_idDirectRefLayer[iNuhLId][d++] = jNuhLid; 2092 1931 } 2093 #if NH_3D2094 if( getDirectDependencyFlag( i , j ) && ( getDepthId( iNuhLId ) == getDepthId( jNuhLid ) ))2095 {2096 m_idRefListLayer [iNuhLId][l++] = jNuhLid;2097 }2098 #endif2099 1932 2100 1933 if( getDependencyFlag( i , j ) ) … … 2108 1941 } 2109 1942 m_numDirectRefLayers[ iNuhLId ] = d; 2110 #if NH_3D2111 m_numRefListLayers[ iNuhLId ] = l;2112 #endif2113 1943 2114 1944 m_numRefLayers [ iNuhLId ] = r; … … 2149 1979 { 2150 1980 m_numViews = 1; 2151 #if NH_3D2152 AOF( m_viewOIdxList.size() == 0 );2153 m_viewOIdxList.push_back( 0 );2154 #endif2155 1981 2156 1982 for( Int i = 0; i <= getMaxLayersMinus1(); i++ ) … … 2170 1996 { 2171 1997 m_numViews++; 2172 #if NH_3D2173 m_viewOIdxList.push_back( getViewOrderIdx( lId ) );2174 #endif2175 1998 } 2176 1999 } … … 2184 2007 } 2185 2008 2186 #if NH_3D_VSO2187 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag, Int auxId ) const2188 {2189 Int foundLayerIdinNuh = -1;2190 2191 for (Int layerIdInVps = 0 ; layerIdInVps <= getMaxLayersMinus1(); layerIdInVps++ )2192 {2193 Int layerIdInNuh = getLayerIdInNuh( layerIdInVps );2194 #if !NH_3D2195 if( ( getViewIndex( layerIdInNuh ) == viewIndex ) && ( getAuxId( layerIdInNuh ) == ( depthFlag ? 2 : 0 ) ) )2196 #else2197 if( ( getViewIndex( layerIdInNuh ) == viewIndex ) && ( getDepthId( layerIdInNuh ) == ( depthFlag ? 1 : 0 ) ) )2198 #endif2199 {2200 foundLayerIdinNuh = layerIdInNuh;2201 break;2202 }2203 }2204 return foundLayerIdinNuh;2205 }2206 #endif2207 #if NH_3D2208 Void TComVPS::createCamPars(Int iNumViews)2209 {2210 m_numCp .resize( iNumViews );2211 m_cpRefVoi .resize( iNumViews );2212 m_cpInSliceSegmentHeaderFlag.resize( iNumViews );2213 m_cpPresentFlag .resize( iNumViews );2214 m_aaaiCodedScale .resize( iNumViews );2215 m_aaaiCodedOffset .resize( iNumViews );2216 2217 for ( Int i = 0; i < iNumViews ; i++ )2218 {2219 m_numCp [i] = 0;2220 m_cpRefVoi [i].resize( iNumViews );2221 m_cpInSliceSegmentHeaderFlag[i] = false;2222 m_aaaiCodedScale [i].resize( 2 );2223 m_aaaiCodedOffset [i].resize( 2 );2224 m_cpPresentFlag [i].resize( iNumViews );2225 2226 for ( Int j = 0; j < iNumViews; j++)2227 {2228 m_cpRefVoi [i][j] = 0;2229 m_cpPresentFlag [i][j] = false;2230 }2231 2232 for ( Int j = 0; j < 2; j++ )2233 {2234 m_aaaiCodedScale [i][j].resize( MAX_NUM_LAYERS );2235 m_aaaiCodedOffset [i][j].resize( MAX_NUM_LAYERS );2236 2237 for ( Int k = 0; k < MAX_NUM_LAYERS; k++ )2238 {2239 m_aaaiCodedScale [i][j][k] = 0;2240 m_aaaiCodedOffset[i][j][k] = 0;2241 }2242 }2243 }2244 }2245 #endif // NH_3D2246 2009 2247 2010 … … 2496 2259 vector<Int> range; 2497 2260 2498 #if NH_3D2499 vector<Int> depthId;2500 #endif2501 2261 2502 2262 vector<Int> viewOrderIndex; … … 2512 2272 auxId .push_back( getAuxId ( i ) ); 2513 2273 viewId .push_back( getViewId ( getLayerIdInNuh( i ) ) ); 2514 #if NH_3D2515 depthId.push_back( getDepthId( i ) );2516 #endif2517 2274 } 2518 2275 std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Layer Dependencies" << std::endl; … … 2523 2280 xPrintArray( "IdRefLayer" , getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefLayers, m_idRefLayer, true ); 2524 2281 xPrintArray( "IdDirectRefLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numDirectRefLayers, m_idDirectRefLayer, true ); 2525 #if NH_3D2526 xPrintArray( "IdRefListLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefListLayers, m_idRefListLayer, true );2527 #endif2528 2282 2529 2283 std::cout << std::endl; … … 2619 2373 } 2620 2374 2621 #if NH_3D2622 Void TComVPS::initViewCompLayer()2623 {2624 assert( m_viewCompLayerId.size() == 0 && m_viewCompLayerPresentFlag.size() == 0 );2625 for( Int i = 0; i < getNumViews(); i++ )2626 {2627 m_viewCompLayerId .push_back( std::vector<Int>(0) );2628 m_viewCompLayerPresentFlag.push_back( std::vector<Bool>(0) );2629 2630 for( Int depFlag = 0; depFlag <= 1; depFlag++ )2631 {2632 Int iViewOIdx = getViewOIdxList( i );2633 Int layerId = -1;2634 for( Int j = 0; j <= getMaxLayersMinus1(); j++ )2635 {2636 Int jNuhLId = getLayerIdInNuh( j );2637 if( getVpsDepthFlag( jNuhLId ) == ( (Bool) depFlag ) && getViewOrderIdx( jNuhLId ) == iViewOIdx2638 && getDependencyId( jNuhLId ) == 0 && getAuxId( jNuhLId ) == 0 )2639 {2640 layerId = jNuhLId;2641 }2642 }2643 m_viewCompLayerPresentFlag[ i ].push_back( layerId != -1 );2644 m_viewCompLayerId [ i ].push_back( layerId );2645 }2646 }2647 }2648 2649 Int TComVPS::getVoiInVps(Int viewOIdx) const2650 {2651 for ( Int i = 0; i < m_viewOIdxList.size(); i++ )2652 {2653 if ( m_viewOIdxList[ i ] == viewOIdx )2654 {2655 return i;2656 }2657 }2658 assert( 0 );2659 return -1;2660 }2661 2662 Void TComVPS::deriveCpPresentFlag()2663 {2664 for( Int nInVps = 0; nInVps < getNumViews(); nInVps++ )2665 {2666 for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ )2667 {2668 m_cpPresentFlag[nInVps][mInVps] = 0;2669 }2670 }2671 2672 for( Int n = 1; n < getNumViews(); n++ )2673 {2674 Int iInVps = getVoiInVps( getViewOIdxList( n ) );2675 for( Int m = 0; m < getNumCp( iInVps ); m++ )2676 {2677 m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1;2678 }2679 }2680 }2681 2682 #endif2683 2375 #endif // NH_MV 2684 2376 … … 2845 2537 , m_pocResetInfoPresentFlag (false) 2846 2538 #endif 2847 #if NH_3D_DLT2848 , m_cDLT ()2849 #endif2850 2539 { 2851 2540 #if NH_MV … … 2862 2551 } 2863 2552 2864 #if NH_3D_DLT2865 TComDLT::TComDLT()2866 : m_bDltPresentFlag(false)2867 , m_iNumDepthViews(0)2868 , m_uiDepthViewBitDepth(8)2869 {2870 for( Int i = 0; i < MAX_NUM_LAYERS; i++ )2871 {2872 m_bUseDLTFlag [i] = false;2873 m_bInterViewDltPredEnableFlag [i] = false;2874 m_bDltBitMapRepFlag [i] = false;2875 2876 // allocate some memory and initialize with default mapping2877 m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1;2878 m_iDepthValue2Idx[i] = std::vector<Int>(m_iNumDepthmapValues[i]);2879 m_iIdx2DepthValue[i] = std::vector<Int>(m_iNumDepthmapValues[i]);2880 2881 m_iDepthIdxToLayerId[i] = i;2882 2883 //default mapping2884 for (Int d=0; d<m_iNumDepthmapValues[i]; d++)2885 {2886 m_iDepthValue2Idx[i][d] = d;2887 m_iIdx2DepthValue[i][d] = d;2888 }2889 }2890 }2891 2892 TComDLT::~TComDLT()2893 {2894 2895 }2896 2897 Void TComDLT::setDepthLUTs(Int layerIdInVps, std::vector<Int> idxToDepthValueTable, Int iNumDepthValues)2898 {2899 if( iNumDepthValues == 0 ) // default mapping only2900 return;2901 2902 // copy idx2DepthValue to internal array2903 m_iIdx2DepthValue[layerIdInVps] = idxToDepthValueTable;2904 2905 UInt uiMaxDepthValue = ((1 << m_uiDepthViewBitDepth)-1);2906 for(Int p=0; p<=uiMaxDepthValue; p++)2907 {2908 Int iIdxDown = 0;2909 Int iIdxUp = iNumDepthValues-1;2910 Bool bFound = false;2911 2912 // iterate over indices to find lower closest depth2913 Int i = 1;2914 while(!bFound && i<iNumDepthValues)2915 {2916 if( m_iIdx2DepthValue[layerIdInVps][i] > p )2917 {2918 iIdxDown = i-1;2919 bFound = true;2920 }2921 2922 i++;2923 }2924 iIdxUp = bFound ? iIdxDown + 1 : iNumDepthValues-1;2925 2926 // assign closer depth value/idx2927 if( abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxDown]) < abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxUp]) )2928 {2929 m_iDepthValue2Idx[layerIdInVps][p] = iIdxDown;2930 }2931 else2932 {2933 m_iDepthValue2Idx[layerIdInVps][p] = iIdxUp;2934 }2935 2936 }2937 2938 // update DLT variables2939 m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues;2940 }2941 2942 Void TComDLT::getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt&ruiDeltaDLTOutNum ) const2943 {2944 Bool abBM0[ 256 ];2945 Bool abBM1[ 256 ];2946 2947 memset( abBM0, 0, sizeof( abBM0 ));2948 memset( abBM1, 0, sizeof( abBM1 ));2949 2950 // convert reference DLT to bit string2951 for( Int i = 0; i < uiDLTInRefNum; i++ )2952 {2953 abBM0[ piDLTInRef[ i ] ] = true;2954 }2955 // convert internal DLT to bit string2956 for( Int i = 0; i < m_iNumDepthmapValues[ layerIdInVps ]; i++ )2957 {2958 abBM1[ m_iIdx2DepthValue[ layerIdInVps ][ i ] ] = true;2959 }2960 2961 ruiDeltaDLTOutNum = 0;2962 for( Int i = 0; i < 256; i++ )2963 {2964 if( abBM0[ i ] ^ abBM1[ i ] )2965 {2966 riDeltaDLTOut[ ruiDeltaDLTOutNum++ ] = i;2967 }2968 }2969 }2970 2971 Void TComDLT::setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum )2972 {2973 Bool abBM0[ 256 ];2974 Bool abBM1[ 256 ];2975 2976 memset( abBM0, 0, sizeof( abBM0 ));2977 memset( abBM1, 0, sizeof( abBM1 ));2978 2979 // convert reference DLT to bit string2980 for( Int i = 0; i < uiDLTInRefNum; i++ )2981 {2982 abBM0[ piDLTInRef[ i ] ] = true;2983 }2984 // convert delta DLT to bit string2985 for( Int i = 0; i < uiDeltaDLTInNum; i++ )2986 {2987 abBM1[ piDeltaDLTIn[ i ] ] = true;2988 }2989 2990 std::vector<Int> aiIdx2DepthValue(256, 0);2991 UInt uiNumDepthValues = 0;2992 std::fill(aiIdx2DepthValue.begin(), aiIdx2DepthValue.end(), 0);2993 2994 for( Int i = 0; i < 256; i++ )2995 {2996 if( abBM0[ i ] ^ abBM1[ i ] )2997 {2998 aiIdx2DepthValue[ uiNumDepthValues++ ] = i;2999 }3000 }3001 3002 // update internal tables3003 setDepthLUTs(layerIdInVps, aiIdx2DepthValue, uiNumDepthValues);3004 }3005 3006 #endif3007 2553 3008 2554 #if NH_MV … … 3512 3058 { 3513 3059 const TComVPS* vps = getVPS(); 3514 #if NH_3D3515 Int refLayerIdx = vps->getLayerIdInVps( vps->getIdRefListLayer( getLayerId(), i ) );3516 #else3517 3060 Int refLayerIdx = vps->getLayerIdInVps( vps->getIdDirectRefLayer( getLayerId(), i ) ); 3518 #endif3519 3061 3520 3062 Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >= getTLayer() && ( getTLayer() == 0 || … … 3527 3069 Int refLayerPicIdc = -1; 3528 3070 Int curj = 0; 3529 #if NH_3D3530 for( Int i = 0; i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ )3531 #else3532 3071 for( Int i = 0; i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ ) 3533 #endif3534 3072 { 3535 3073 if( getRefLayerPicFlag( i ) ) … … 3552 3090 { 3553 3091 Int numRefLayerPics = 0; 3554 #if NH_3D3555 for( Int i = 0; i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ )3556 #else3557 3092 for( Int i = 0; i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ ) 3558 #endif3559 3093 { 3560 3094 numRefLayerPics += getRefLayerPicFlag( i ); … … 3581 3115 numActiveRefLayerPics = 0; 3582 3116 } 3583 #if NH_3D3584 else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumRefListLayers( getLayerId() ) == 1 )3585 #else3586 3117 else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 ) 3587 #endif3588 3118 { 3589 3119 numActiveRefLayerPics = 1; … … 3598 3128 Int TComSlice::getRefPicLayerId( Int i ) const 3599 3129 { 3600 #if NH_3D3601 return getVPS()->getIdRefListLayer( getLayerId(), getInterLayerPredLayerIdc( i ) );3602 #else3603 3130 return getVPS()->getIdDirectRefLayer( getLayerId(), getInterLayerPredLayerIdc( i ) ); 3604 #endif 3605 } 3606 #endif 3607 #if NH_3D_NBDV 3608 Void TComSlice::setDefaultRefView() 3609 { 3610 setDefaultRefViewIdx(-1); 3611 setDefaultRefViewIdxAvailableFlag(false); 3612 3613 Int valid = 0; 3614 Int DefaultRefViewIdx = -1; 3615 3616 for(UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++) 3617 { 3618 for(Int iRefListId = 0; (iRefListId < (isInterB() ? 2 : 1)) && !isIntra() && valid == 0; iRefListId++) 3619 { 3620 RefPicList eRefPicList = RefPicList(iRefListId); 3621 Int iNumRefPics = getNumRefIdx(eRefPicList); 3622 3623 for(Int i = 0; i < iNumRefPics; i++) 3624 { 3625 if(getPOC() == getRefPic(eRefPicList, i)->getPOC() && curViewIdx == getRefPic(eRefPicList, i)->getViewIndex()) 3626 { 3627 valid = 1; 3628 DefaultRefViewIdx = curViewIdx; 3629 break; 3630 } 3631 } 3632 } 3633 } 3634 3635 if(valid) 3636 { 3637 setDefaultRefViewIdx(DefaultRefViewIdx); 3638 setDefaultRefViewIdxAvailableFlag(true); 3639 } 3640 } 3641 #endif 3642 3643 #if NH_3D_ARP 3644 Void TComSlice::setARPStepNum( TComPicLists*ivPicLists ) 3645 { 3646 Bool tempRefPicInListsFlag = false; 3647 if( !getIvResPredFlag() || this->isIRAP()) 3648 { 3649 m_nARPStepNum = 0; 3650 } 3651 else 3652 { 3653 setFirstTRefIdx (REF_PIC_LIST_0, -1); 3654 setFirstTRefIdx (REF_PIC_LIST_1, -1); 3655 for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) 3656 { 3657 Int diffPOC=MAX_INT; 3658 Int idx=-1; 3659 for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ ) 3660 { 3661 if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() ) 3662 { 3663 if( abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()) < diffPOC) 3664 { 3665 diffPOC=abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()); 3666 idx=i; 3667 } 3668 } 3669 if(idx>=0) 3670 { 3671 setFirstTRefIdx (RefPicList(refListIdx), idx); 3672 } 3673 } 3674 } 3675 tempRefPicInListsFlag = (getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0) && getDefaultRefViewIdxAvailableFlag(); 3676 m_nARPStepNum = tempRefPicInListsFlag ? 3 : 0; 3677 } 3678 3679 if (tempRefPicInListsFlag) 3680 { 3681 for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) 3682 { 3683 RefPicList eRefPicList = RefPicList( refListIdx ); 3684 Int prevPOC = getRefPic(eRefPicList, getFirstTRefIdx(eRefPicList) )->getPOC(); 3685 for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) 3686 { 3687 Int layerIdInNuh = getRefPicLayerId( i ); 3688 3689 TComPic* picV = getIvPic( getIsDepth(), getVPS()->getViewIndex( layerIdInNuh ) ); 3690 assert( picV != NULL ); 3691 IntAry1d pocsInCurrRPSsPicV = picV->getSlice(0)->getPocsInCurrRPSs(); 3692 Bool refRpRefAvailFlag = false; 3693 for (Int idx = 0; idx < pocsInCurrRPSsPicV.size(); idx++) 3694 { 3695 if ( pocsInCurrRPSsPicV[idx] == prevPOC ) 3696 { 3697 refRpRefAvailFlag = true; 3698 break; 3699 } 3700 } 3701 3702 if (getFirstTRefIdx(eRefPicList) >= 0 && refRpRefAvailFlag ) 3703 { 3704 m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true; 3705 } 3706 else 3707 { 3708 m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = false; 3709 } 3710 } 3711 } 3712 } 3713 if( m_nARPStepNum > 1) 3714 { 3715 for(Int i = 0; i < getNumActiveRefLayerPics(); i ++ ) 3716 { 3717 Int iLayerId = getRefPicLayerId( i ); 3718 Int iViewIdx = getVPS()->getViewIndex(iLayerId); 3719 Bool bIsDepth = ( getVPS()->getDepthId ( iLayerId ) == 1 ); 3720 if( iViewIdx<getViewIndex() && !bIsDepth ) 3721 { 3722 setBaseViewRefPicList( ivPicLists->getSubDpb( iLayerId, false ), iViewIdx ); 3723 } 3724 } 3725 } 3726 } 3727 #endif 3728 3729 #if NH_3D_IC 3730 // This is an encoder only function and should be moved to TEncSlice or TEncSearch!! 3731 Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc) 3732 { 3733 if(bUseLowLatencyICEnc) 3734 { 3735 Bool existInterViewRef=false; 3736 TComPic* pcCurrPic = getPic(); 3737 TComPic* pcRefPic = NULL; 3738 for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_0 )) && !existInterViewRef; i++ ) 3739 { 3740 pcRefPic = getRefPic( REF_PIC_LIST_0, i ); 3741 if ( pcRefPic != NULL ) 3742 { 3743 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 3744 { 3745 existInterViewRef = true; 3746 } 3747 } 3748 } 3749 3750 for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_1 )) && !existInterViewRef; i++ ) 3751 { 3752 pcRefPic = getRefPic( REF_PIC_LIST_1, i ); 3753 if ( pcRefPic != NULL ) 3754 { 3755 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 3756 { 3757 existInterViewRef = true; 3758 } 3759 } 3760 } 3761 3762 if(!existInterViewRef) 3763 { 3764 m_bApplyIC = false; 3765 } 3766 else 3767 { 3768 Int curLayer=getDepth(); 3769 if( curLayer>9) curLayer=9; // Max layer is 10 3770 3771 m_bApplyIC = true; 3772 Int refLayer = curLayer-1; 3773 3774 Int ICEnableCandidate = getICEnableCandidate(refLayer); 3775 Int ICEnableNum = getICEnableNum(refLayer); 3776 if( (refLayer>=0) && (ICEnableCandidate>0) ) 3777 { 3778 Double ratio=Double(ICEnableNum/Double(ICEnableCandidate)); 3779 3780 if( ratio > IC_LOW_LATENCY_ENCODING_THRESHOLD) 3781 { 3782 m_bApplyIC=true; 3783 } 3784 else 3785 { 3786 m_bApplyIC=false; 3787 } 3788 } 3789 setICEnableCandidate(curLayer, 0); 3790 setICEnableNum(curLayer, 0); 3791 } 3792 } 3793 else 3794 { 3795 TComPic* pcCurrPic = getPic(); 3796 TComPicYuv* pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); 3797 3798 // Get InterView Reference picture 3799 // !!!!! Assume only one Interview Reference Picture in L0 3800 // GT: Is this assumption correct? 3801 3802 TComPicYuv* pcRefPicYuvOrg = NULL; 3803 for ( Int i = 0; i < getNumRefIdx( REF_PIC_LIST_0 ); i++ ) 3804 { 3805 TComPic* pcRefPic = getRefPic( REF_PIC_LIST_0, i ); 3806 if ( pcRefPic != NULL ) 3807 { 3808 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 3809 { 3810 pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); 3811 } 3812 } 3813 } 3814 3815 if ( pcRefPicYuvOrg != NULL ) 3816 { 3817 // Histogram building - luminance 3818 Int iMaxPelValue = ( 1 << getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3819 Int *aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); 3820 Int *aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); 3821 memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); 3822 memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); 3823 3824 Int iWidth = pcCurrPicYuv->getWidth(COMPONENT_Y); 3825 Int iHeight = pcCurrPicYuv->getHeight(COMPONENT_Y); 3826 Pel* pCurrY = pcCurrPicYuv->getAddr(COMPONENT_Y); 3827 Pel* pRefOrgY = pcRefPicYuvOrg->getAddr(COMPONENT_Y); 3828 Int iCurrStride = pcCurrPicYuv->getStride(COMPONENT_Y); 3829 Int iRefStride = pcRefPicYuvOrg->getStride(COMPONENT_Y); 3830 for ( Int y = 0; y < iHeight; y++ ) 3831 { 3832 for ( Int x = 0; x < iWidth; x++ ) 3833 { 3834 aiCurrHist[pCurrY[x]]++; 3835 aiRefOrgHist[pRefOrgY[x]]++; 3836 } 3837 pCurrY += iCurrStride; 3838 pRefOrgY += iRefStride; 3839 } 3840 3841 // Histogram SAD 3842 Int iSumOrgSAD = 0; 3843 for ( Int i = 0; i < iMaxPelValue; i++ ) 3844 { 3845 iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] ); 3846 } 3847 3848 // Setting 3849 Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; 3850 3851 if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) ) 3852 { 3853 m_bApplyIC = true; 3854 } 3855 else 3856 { 3857 m_bApplyIC = false; 3858 } 3859 3860 xFree( aiCurrHist ); 3861 xFree( aiRefOrgHist ); 3862 } 3863 }//if(bUseLowLatencyICEnc) 3864 } 3865 #endif 3866 #if NH_3D_QTL 3867 Void TComSlice::setIvPicLists( TComPicLists* m_ivPicLists ) 3868 { 3869 for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) 3870 { 3871 for ( Int depthId = 0; depthId < 2; depthId++ ) 3872 { 3873 m_ivPicsCurrPoc[ depthId ][ i ] = ( i <= m_viewIndex ) ? m_ivPicLists->getPic( i, ( depthId == 1) , 0, getPOC() ) : NULL; 3874 } 3875 } 3876 } 3877 #endif 3878 #if NH_3D 3879 Void TComSlice::setDepthToDisparityLUTs() 3880 { 3881 Bool setupLUT = false; 3882 3883 setupLUT = setupLUT || getViewSynthesisPredFlag( ); 3884 3885 #if NH_3D_NBDV_REF 3886 setupLUT = setupLUT || getDepthRefinementFlag( ); 3887 #endif 3888 3889 #if NH_3D_IV_MERGE 3890 setupLUT = setupLUT || ( getIvMvPredFlag() && getIsDepth() ); 3891 #endif 3892 3893 Int bitDepthY = getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 3894 3895 if( !setupLUT ) 3896 { 3897 return; 3898 } 3899 3900 m_numViews = getVPS()->getNumViews(); 3901 /// GT: Allocation should be moved to a better place later; 3902 if ( m_depthToDisparityB == NULL ) 3903 { 3904 m_depthToDisparityB = new Int*[ m_numViews ]; 3905 for ( Int i = 0; i < getVPS()->getNumViews(); i++ ) 3906 { 3907 m_depthToDisparityB[ i ] = new Int[ Int(1 << bitDepthY) ]; 3908 } 3909 } 3910 3911 3912 if ( m_depthToDisparityF == NULL ) 3913 { 3914 m_depthToDisparityF = new Int*[ m_numViews ]; 3915 for ( Int i = 0; i < m_numViews; i++ ) 3916 { 3917 m_depthToDisparityF[ i ] = new Int[ Int(1 << bitDepthY) ]; 3918 } 3919 } 3920 3921 assert( m_depthToDisparityB != NULL ); 3922 assert( m_depthToDisparityF != NULL ); 3923 3924 const TComVPS* vps = getVPS(); 3925 3926 Int log2Div = bitDepthY - 1 + vps->getCpPrecision(); 3927 Int voiInVps = vps->getVoiInVps( getViewIndex() ); 3928 Bool camParaSH = vps->getCpInSliceSegmentHeaderFlag( voiInVps ); 3929 3930 const IntAry1d codScale = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale ( voiInVps ); 3931 const IntAry1d codOffset = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset ( voiInVps ); 3932 const IntAry1d invCodScale = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( voiInVps ); 3933 const IntAry1d invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( voiInVps ); 3934 3935 3936 for (Int i = 0; i < voiInVps; i++) 3937 { 3938 Int iInVoi = vps->getVoiInVps( i ); 3939 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 3940 if ( g_traceCameraParameters ) 3941 { 3942 std::cout << "Cp: " << codScale [ iInVoi ] << " " << codOffset[ iInVoi ] << " " 3943 << invCodScale[ iInVoi ] << " " << invCodOffset[ iInVoi ] << " " << log2Div << std::endl ; 3944 } 3945 #endif 3946 for ( Int d = 0; d <= ( ( 1 << bitDepthY ) - 1 ); d++ ) 3947 { 3948 Int offset = ( codOffset [ iInVoi ] << bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); 3949 m_depthToDisparityB[ iInVoi ][ d ] = ( codScale [ iInVoi ] * d + offset ) >> log2Div; 3950 3951 Int invOffset = ( invCodOffset[ iInVoi ] << bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); 3952 m_depthToDisparityF[ iInVoi ][ d ] = ( invCodScale[ iInVoi ] * d + invOffset ) >> log2Div; 3953 } 3954 } 3955 } 3956 #endif 3131 } 3132 #endif 3133 3134 3957 3135 3958 3136 … … 4311 3489 4312 3490 4313 #if NH_3D4314 Void TComSlice::init3dToolParameters()4315 {4316 Bool depthFlag = getIsDepth();4317 4318 Bool nRLLG0 = ( getVPS()->getNumRefListLayers( getLayerId() ) > 0 );4319 4320 const TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();4321 4322 m_ivMvPredFlag = sps3dExt->getIvDiMcEnabledFlag ( depthFlag ) && nRLLG0 ;4323 m_ivMvScalingFlag = sps3dExt->getIvMvScalEnabledFlag ( depthFlag ) ;4324 m_ivResPredFlag = sps3dExt->getIvResPredEnabledFlag ( depthFlag ) && nRLLG0 ;4325 m_depthRefinementFlag = sps3dExt->getDepthRefEnabledFlag ( depthFlag ) && getInCompPredFlag() && m_cpAvailableFlag;4326 m_viewSynthesisPredFlag = sps3dExt->getVspMcEnabledFlag ( depthFlag ) && nRLLG0 && getInCompPredFlag() && m_cpAvailableFlag;4327 m_depthBasedBlkPartFlag = sps3dExt->getDbbpEnabledFlag ( depthFlag ) && getInCompPredFlag();4328 m_mpiFlag = sps3dExt->getTexMcEnabledFlag ( depthFlag ) && getInCompPredFlag();4329 m_intraContourFlag = sps3dExt->getIntraContourEnabledFlag ( depthFlag ) && getInCompPredFlag();4330 m_intraSdcWedgeFlag = sps3dExt->getIntraDcOnlyWedgeEnabledFlag( depthFlag ) ;4331 m_qtPredFlag = sps3dExt->getCqtCuPartPredEnabledFlag ( depthFlag ) && getInCompPredFlag();4332 m_interSdcFlag = sps3dExt->getInterDcOnlyEnabledFlag ( depthFlag ) ;4333 m_depthIntraSkipFlag = sps3dExt->getSkipIntraEnabledFlag ( depthFlag ) ;4334 4335 m_subPbSize = 1 << ( sps3dExt->getLog2IvmcSubPbSizeMinus3 ( depthFlag ) + 3 );4336 m_mpiSubPbSize = 1 << ( sps3dExt->getLog2TexmcSubPbSizeMinus3( depthFlag ) + 3 );4337 4338 4339 #if NH_3D_OUTPUT_ACTIVE_TOOLS4340 std::cout << "Layer: :" << getLayerId() << std::endl;4341 std::cout << "DepthFlag: :" << getIsDepth() << std::endl;4342 std::cout << "ViewOrderIdx: :" << getViewIndex() << std::endl;4343 std::cout << "InterCmpPredAvailableFlag:" << getInCmpPredAvailFlag() << std::endl;4344 std::cout << "InterCompPredFlag :" << getInCompPredFlag() << std::endl;4345 4346 std::cout << "ivMvPredFlag :" << m_ivMvPredFlag << std::endl;4347 std::cout << "ivMvScalingFlag :" << m_ivMvScalingFlag << std::endl;4348 std::cout << "ivResPredFlag :" << m_ivResPredFlag << std::endl;4349 std::cout << "depthRefinementFlag :" << m_depthRefinementFlag << std::endl;4350 std::cout << "viewSynthesisPredFlag :" << m_viewSynthesisPredFlag << std::endl;4351 std::cout << "depthBasedBlkPartFlag :" << m_depthBasedBlkPartFlag << std::endl;4352 std::cout << "mpiFlag :" << m_mpiFlag << std::endl;4353 std::cout << "intraContourFlag :" << m_intraContourFlag << std::endl;4354 std::cout << "intraSdcWedgeFlag :" << m_intraSdcWedgeFlag << std::endl;4355 std::cout << "qtPredFlag :" << m_qtPredFlag << std::endl;4356 std::cout << "interSdcFlag :" << m_interSdcFlag << std::endl;4357 std::cout << "depthIntraSkipFlag :" << m_depthIntraSkipFlag << std::endl;4358 std::cout << "subPbSize :" << m_subPbSize << std::endl;4359 std::cout << "mpiSubPbSize :" << m_mpiSubPbSize << std::endl;4360 #endif4361 }4362 4363 Void TComSlice::deriveInCmpPredAndCpAvailFlag( )4364 {4365 Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics();4366 std::vector<Int> curCmpLIds;4367 if ( getIsDepth() )4368 {4369 curCmpLIds.push_back( getLayerId() );4370 }4371 else4372 {4373 for (Int i = 0; i < numCurCmpLIds; i++)4374 {4375 curCmpLIds.push_back( getRefPicLayerId( i ) );4376 }4377 }4378 4379 m_cpAvailableFlag = true;4380 m_inCmpRefViewIdcs.clear();4381 Bool allRefCmpLayersAvailFlag = true;4382 4383 for( Int i = 0; i <= numCurCmpLIds - 1; i++ )4384 {4385 m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] ));4386 if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ), getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) )4387 {4388 m_cpAvailableFlag = false;4389 }4390 Bool refCmpCurLIdAvailFlag = false;4391 if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) )4392 {4393 Int j = getVPS()->getLayerIdInVps( getVPS()->getViewCompLayerId( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) );4394 if ( getVPS()->getDirectDependencyFlag( getVPS()->getLayerIdInVps( getLayerId() ) , j ) &&4395 getVPS()->getSubLayersVpsMaxMinus1( j ) >= getTemporalId() &&4396 ( getTemporalId() == 0 || getVPS()->getMaxTidIlRefPicsPlus1( j , getVPS()->getLayerIdInVps( getLayerId() ) ) > getTemporalId() )4397 )4398 {4399 refCmpCurLIdAvailFlag = true;4400 }4401 }4402 if( !refCmpCurLIdAvailFlag )4403 {4404 allRefCmpLayersAvailFlag = false;4405 }4406 }4407 4408 if( !allRefCmpLayersAvailFlag )4409 {4410 m_inCmpPredAvailFlag = false;4411 }4412 else4413 {4414 const TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();4415 if( !getIsDepth() )4416 {4417 m_inCmpPredAvailFlag = sps3dExt->getVspMcEnabledFlag( getIsDepth() ) ||4418 sps3dExt->getDbbpEnabledFlag( getIsDepth() ) ||4419 sps3dExt->getDepthRefEnabledFlag ( getIsDepth() );4420 }4421 else4422 {4423 m_inCmpPredAvailFlag = sps3dExt->getIntraContourEnabledFlag( getIsDepth() ) ||4424 sps3dExt->getCqtCuPartPredEnabledFlag( getIsDepth() ) ||4425 sps3dExt->getTexMcEnabledFlag( getIsDepth() );4426 }4427 }4428 }4429 4430 Void TComSlice::checkInCompPredRefLayers()4431 {4432 if ( getInCompPredFlag() )4433 {4434 for (Int i = 0; i < getNumCurCmpLIds(); i++ )4435 {4436 assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL );4437 // It is a requirement of bitstream conformance that there4438 // is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture,4439 // and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ].4440 }4441 }4442 }4443 4444 Void TComSlice::setPocsInCurrRPSs()4445 {4446 // Currently only needed at decoder side;4447 m_pocsInCurrRPSs.clear();4448 std::vector<TComPic*>** rpsCurr = getPic()->getDecodedRps()->m_refPicSetsCurr;4449 for (Int i = 0 ; i < 3; i++ )4450 {4451 for( Int j = 0; j < rpsCurr[i]->size(); j++ )4452 {4453 m_pocsInCurrRPSs.push_back( (*rpsCurr[i])[j]->getPOC() );4454 }4455 }4456 }4457 4458 #endif4459 3491 4460 3492 /** get scaling matrix from RefMatrixID -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComSlice.h
r1386 r1390 1030 1030 Int m_numDirectRefLayers [MAX_NUM_LAYERS]; 1031 1031 Int m_idDirectRefLayer [MAX_NUM_LAYERS][MAX_NUM_LAYERS]; 1032 #if NH_3D1033 Int m_numRefListLayers [MAX_NUM_LAYERS];1034 Int m_idRefListLayer [MAX_NUM_LAYERS][MAX_NUM_LAYERS];1035 #endif1036 1032 1037 1033 … … 1059 1055 1060 1056 // VPS EXTENSION 2 SYNTAX ELEMENTS 1061 #if NH_3D1062 IntAry1d m_numCp;1063 IntAry2d m_cpRefVoi;1064 BoolAry2d m_cpPresentFlag;1065 Int m_cpPrecision;1066 BoolAry1d m_cpInSliceSegmentHeaderFlag;1067 IntAry3d m_aaaiCodedScale ;1068 IntAry3d m_aaaiCodedOffset;1069 1070 IntAry1d m_viewOIdxList;1071 BoolAry2d m_viewCompLayerPresentFlag;1072 IntAry2d m_viewCompLayerId;1073 #endif1074 1057 1075 1058 #endif … … 1307 1290 Int getNumViews() const { return m_numViews; } 1308 1291 Void initNumViews(); 1309 #if NH_3D1310 Void initViewCompLayer( );1311 Int getViewOIdxList( Int i ) const { return m_viewOIdxList[i]; }1312 std::vector<Int> getViewOIdxList( ) const { return m_viewOIdxList; }1313 1314 Int getVoiInVps( Int viewOIdx ) const;1315 1316 Bool getViewCompLayerPresentFlag (Int i, Bool d ) const { return m_viewCompLayerPresentFlag[ getVoiInVps(i) ][d]; }1317 Bool getViewCompLayerId (Int i, Bool d ) const { return m_viewCompLayerId [ getVoiInVps(i) ][d]; }1318 #endif1319 1292 Bool getDependencyFlag( Int i, Int j ) const { return m_dependencyFlag[i][j]; } 1320 1293 Int getNumDirectRefLayers( Int layerIdInNuh ) const { return m_numDirectRefLayers[ layerIdInNuh ]; }; 1321 #if NH_3D1322 Int getNumRefListLayers( Int layerIdInNuh ) const { return m_numRefListLayers[ layerIdInNuh ]; };1323 #endif1324 1294 1325 1295 Int getNumRefLayers ( Int i ) const { return m_numRefLayers[i]; } … … 1329 1299 Int getIdPredictedLayer ( Int i, Int j ) const { assert( j >= 0 && j < getNumPredictedLayers( i )); return m_idPredictedLayer[i][j]; } 1330 1300 Int getIdDirectRefLayer ( Int i, Int j ) const { assert( j >= 0 && j < getNumDirectRefLayers( i )); return m_idDirectRefLayer[i][j]; } 1331 #if NH_3D1332 Int getIdRefListLayer ( Int i, Int j ) const { assert( j >= 0 && j < getNumRefListLayers ( i )); return m_idRefListLayer[i][j]; }1333 #endif1334 1301 Int getNumIndependentLayers ( ) const { return m_numIndependentLayers; } 1335 1302 Int getNumLayersInTreePartition( Int i ) const { return m_numLayersInTreePartition[i]; } … … 1384 1351 /// VPS EXTENSION 2 SYNTAX ELEMENTS 1385 1352 Int getDepthId ( Int layerIdInNuh) const { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); } 1386 #if NH_3D_VSO1387 Bool getVpsDepthFlag ( Int layerIdInNuh) const { return (getDepthId( layerIdInNuh ) > 0); }1388 Int getLayerIdInNuh ( Int viewIndex, Bool depthFlag, Int auxId ) const;1389 #endif1390 #if NH_3D1391 Void createCamPars ( Int iNumViews );1392 Void initCamParaVPS ( Int vOIdxInVps, Int numCp, Bool cpInSliceSegmentHeaderFlag, Int* cpRefVoi, Int** aaiScale, Int** aaiOffset );1393 1394 Void setCpPrecision ( Int val ) { m_cpPrecision = val; }1395 Int getCpPrecision ( ) const { return m_cpPrecision; }1396 1397 Void setNumCp ( Int i, Int val ) { m_numCp[i] = val; }1398 Int getNumCp ( Int i ) const { return m_numCp[i]; }1399 1400 Void setCpRefVoi ( Int i, Int m, Int val ) { m_cpRefVoi[i][m] = val; }1401 Int getCpRefVoi ( Int i, Int m ) const { return m_cpRefVoi[i][m]; }1402 1403 Void setCpInSliceSegmentHeaderFlag( Int i, Bool flag ) { m_cpInSliceSegmentHeaderFlag[i] = flag; }1404 Bool getCpInSliceSegmentHeaderFlag( Int i ) const { return m_cpInSliceSegmentHeaderFlag[i]; }1405 1406 Void setVpsCpScale ( Int i, Int j, Int val ) { m_aaaiCodedScale [i][0][j] = val; }1407 Int getVpsCpScale ( Int i, Int j ) const { return m_aaaiCodedScale[i][0][j]; }1408 1409 Void setVpsCpOff ( Int i, Int j, Int val ) { m_aaaiCodedOffset[i][0][j] = val; }1410 Int getVpsCpOff ( Int i, Int j ) const { return m_aaaiCodedOffset[i][0][j]; }1411 1412 Void setVpsCpInvScale ( Int i, Int j, Int val ) { m_aaaiCodedScale[i][1][j] = val; }1413 Int getVpsCpInvScale ( Int i, Int j ) const { return m_aaaiCodedScale[i][1][j]; }1414 1415 Void setVpsCpInvOff ( Int i, Int j, Int val ) { m_aaaiCodedOffset[i][1][j] = val; }1416 Int getVpsCpInvOff ( Int i, Int j ) const { return m_aaaiCodedOffset[i][1][j]; }1417 1418 // Derived1419 Void deriveCpPresentFlag ( );1420 Void setCpPresentFlag ( Int i, Int m, Bool flag ) { m_cpPresentFlag[i][m] = flag; }1421 Bool getCpPresentFlag ( Int i, Int m ) const { return m_cpPresentFlag[i][m]; }1422 1423 const IntAry1d& getCodedScale ( Int viewIndex ) const { return m_aaaiCodedScale [viewIndex][0]; }1424 const IntAry1d& getCodedOffset ( Int viewIndex ) const { return m_aaaiCodedOffset[viewIndex][0]; }1425 const IntAry1d& getInvCodedScale ( Int viewIndex ) const { return m_aaaiCodedScale [viewIndex][1]; }1426 const IntAry1d& getInvCodedOffset ( Int viewIndex ) const { return m_aaaiCodedOffset[viewIndex][1]; }1427 #endif1428 1353 1429 1354 template <typename T, typename S, typename U> Void xPrintArray( const TChar* name, Int numElemDim1, U idx, S numElemDim2, T vec, Bool printNumber, Bool printIdx = true ) const … … 1471 1396 }; 1472 1397 1473 #if NH_3D_DLT1474 class TComDLT1475 {1476 private:1477 Bool m_bDltPresentFlag;1478 Bool m_bUseDLTFlag [ MAX_NUM_LAYERS ];1479 Bool m_bInterViewDltPredEnableFlag [ MAX_NUM_LAYERS ];1480 Bool m_bDltBitMapRepFlag [ MAX_NUM_LAYERS ];1481 1482 Int m_iNumDepthmapValues [ MAX_NUM_LAYERS ];1483 std::vector<Int> m_iDepthValue2Idx [ MAX_NUM_LAYERS ];1484 std::vector<Int> m_iIdx2DepthValue [ MAX_NUM_LAYERS ];1485 1486 Int m_iNumDepthViews;1487 UInt m_uiDepthViewBitDepth;1488 1489 // mapping1490 Int m_iDepthIdxToLayerId [ MAX_NUM_LAYERS ];1491 1492 public:1493 TComDLT();1494 ~TComDLT();1495 1496 Int getDepthIdxToLayerId(Int depthIdx) const { return m_iDepthIdxToLayerId[depthIdx]; }1497 Void setDepthIdxToLayerId(Int depthIdx, Int layerId) { m_iDepthIdxToLayerId[depthIdx] = layerId; }1498 1499 Bool getDltPresentFlag () const { return m_bDltPresentFlag; }1500 Void setDltPresentFlag ( Bool b ) { m_bDltPresentFlag = b; }1501 1502 Bool getUseDLTFlag ( Int layerIdInVps ) const { return m_bUseDLTFlag[ layerIdInVps ]; }1503 Void setUseDLTFlag ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ] = b; }1504 1505 Bool getInterViewDltPredEnableFlag( Int layerIdInVps ) const { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }1506 Void setInterViewDltPredEnableFlag( Int layerIdInVps, Bool b ) { m_bInterViewDltPredEnableFlag[ layerIdInVps ] = b; }1507 1508 Bool getUseBitmapRep ( Int layerIdInVps ) const { return m_bDltBitMapRepFlag[ layerIdInVps ]; }1509 Void setUseBitmapRep ( Int layerIdInVps, Bool b ) { m_bDltBitMapRepFlag[ layerIdInVps ] = b; }1510 1511 Void setNumDepthViews ( Int n ) { m_iNumDepthViews = n; }1512 Int getNumDepthViews () const { return m_iNumDepthViews; }1513 1514 Void setDepthViewBitDepth( UInt n ) { m_uiDepthViewBitDepth = n; }1515 UInt getDepthViewBitDepth() const { return m_uiDepthViewBitDepth; }1516 1517 Int getNumDepthValues( Int layerIdInVps ) const { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:(1 << m_uiDepthViewBitDepth); }1518 Int depthValue2idx( Int layerIdInVps, Pel value ) const { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }1519 Pel idx2DepthValue( Int layerIdInVps, UInt uiIdx ) const { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipBD(uiIdx,m_uiDepthViewBitDepth)]:uiIdx; }1520 Void setDepthLUTs( Int layerIdInVps, std::vector<Int> idx2DepthValue, Int iNumDepthValues = 0 );1521 std::vector<Int> idx2DepthValue( Int layerIdInVps ) const { return m_iIdx2DepthValue[layerIdInVps]; }1522 Void getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt& ruiDeltaDLTOutNum ) const;1523 Void setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum );1524 };1525 #endif1526 1398 1527 1399 … … 1803 1675 1804 1676 1805 #if NH_3D1806 class TComSps3dExtension1807 {1808 public:1809 TComSps3dExtension()1810 {1811 for (Int d = 0; d < 2; d++)1812 {1813 m_ivDiMcEnabledFlag [d] = false;1814 m_ivMvScalEnabledFlag [d] = false;1815 m_log2IvmcSubPbSizeMinus3 [d] = 3;1816 m_ivResPredEnabledFlag [d] = false;1817 m_depthRefEnabledFlag [d] = false;1818 m_vspMcEnabledFlag [d] = false;1819 m_dbbpEnabledFlag [d] = false;1820 m_texMcEnabledFlag [d] = false;1821 m_log2TexmcSubPbSizeMinus3[d] = 3;1822 m_intraContourEnabledFlag [d] = false;1823 m_intraDcOnlyWedgeEnabledFlag [d] = false;1824 m_cqtCuPartPredEnabledFlag [d] = false;1825 m_interDcOnlyEnabledFlag [d] = false;1826 m_skipIntraEnabledFlag [d] = false;1827 }1828 }1829 1830 Void setIvDiMcEnabledFlag( Int d, Bool flag ) { m_ivDiMcEnabledFlag[d] = flag; }1831 Bool getIvDiMcEnabledFlag( Int d ) const { return m_ivDiMcEnabledFlag[d]; }1832 1833 Void setIvMvScalEnabledFlag( Int d, Bool flag ) { m_ivMvScalEnabledFlag[d] = flag; }1834 Bool getIvMvScalEnabledFlag( Int d ) const { return m_ivMvScalEnabledFlag[d]; }1835 1836 Void setLog2IvmcSubPbSizeMinus3( Int d, Int val ) { m_log2IvmcSubPbSizeMinus3[d] = val; }1837 Int getLog2IvmcSubPbSizeMinus3( Int d ) const { return m_log2IvmcSubPbSizeMinus3[d]; }1838 1839 Void setIvResPredEnabledFlag( Int d, Bool flag ) { m_ivResPredEnabledFlag[d] = flag; }1840 Bool getIvResPredEnabledFlag( Int d ) const { return m_ivResPredEnabledFlag[d]; }1841 1842 Void setDepthRefEnabledFlag( Int d, Bool flag ) { m_depthRefEnabledFlag[d] = flag; }1843 Bool getDepthRefEnabledFlag( Int d ) const { return m_depthRefEnabledFlag[d]; }1844 1845 Void setVspMcEnabledFlag( Int d, Bool flag ) { m_vspMcEnabledFlag[d] = flag; }1846 Bool getVspMcEnabledFlag( Int d ) const { return m_vspMcEnabledFlag[d]; }1847 1848 Void setDbbpEnabledFlag( Int d, Bool flag ) { m_dbbpEnabledFlag[d] = flag; }1849 Bool getDbbpEnabledFlag( Int d ) const { return m_dbbpEnabledFlag[d]; }1850 1851 Void setTexMcEnabledFlag( Int d, Bool flag ) { m_texMcEnabledFlag[d] = flag; }1852 Bool getTexMcEnabledFlag( Int d ) const { return m_texMcEnabledFlag[d]; }1853 1854 Void setLog2TexmcSubPbSizeMinus3( Int d, Int val ) { m_log2TexmcSubPbSizeMinus3[d] = val; }1855 Int getLog2TexmcSubPbSizeMinus3( Int d ) const { return m_log2TexmcSubPbSizeMinus3[d]; }1856 1857 Void setIntraContourEnabledFlag( Int d, Bool flag ) { m_intraContourEnabledFlag[d] = flag; }1858 Bool getIntraContourEnabledFlag( Int d ) const { return m_intraContourEnabledFlag[d]; }1859 1860 Void setIntraDcOnlyWedgeEnabledFlag( Int d, Bool flag ) { m_intraDcOnlyWedgeEnabledFlag[d] = flag; }1861 Bool getIntraDcOnlyWedgeEnabledFlag( Int d ) const { return m_intraDcOnlyWedgeEnabledFlag[d]; }1862 1863 Void setCqtCuPartPredEnabledFlag( Int d, Bool flag ) { m_cqtCuPartPredEnabledFlag[d] = flag; }1864 Bool getCqtCuPartPredEnabledFlag( Int d ) const { return m_cqtCuPartPredEnabledFlag[d]; }1865 1866 Void setInterDcOnlyEnabledFlag( Int d, Bool flag ) { m_interDcOnlyEnabledFlag[d] = flag; }1867 Bool getInterDcOnlyEnabledFlag( Int d ) const { return m_interDcOnlyEnabledFlag[d]; }1868 1869 Void setSkipIntraEnabledFlag( Int d, Bool flag ) { m_skipIntraEnabledFlag[d] = flag; }1870 Bool getSkipIntraEnabledFlag( Int d ) const { return m_skipIntraEnabledFlag[d]; }1871 private:1872 1873 Bool m_ivDiMcEnabledFlag [2];1874 Bool m_ivMvScalEnabledFlag [2];1875 Int m_log2IvmcSubPbSizeMinus3 [2];1876 Bool m_ivResPredEnabledFlag [2];1877 Bool m_depthRefEnabledFlag [2];1878 Bool m_vspMcEnabledFlag [2];1879 Bool m_dbbpEnabledFlag [2];1880 Bool m_texMcEnabledFlag [2];1881 Int m_log2TexmcSubPbSizeMinus3 [2];1882 Bool m_intraContourEnabledFlag [2];1883 Bool m_intraDcOnlyWedgeEnabledFlag[2];1884 Bool m_cqtCuPartPredEnabledFlag [2];1885 Bool m_interDcOnlyEnabledFlag [2];1886 Bool m_skipIntraEnabledFlag [2];1887 };1888 1889 #endif1890 1677 1891 1678 … … 1994 1781 Bool m_interViewMvVertConstraintFlag; 1995 1782 #endif 1996 #if NH_3D1997 TComSps3dExtension m_sps3dExtension;1998 Int m_aaiCodedScale [2][MAX_NUM_LAYERS];1999 Int m_aaiCodedOffset[2][MAX_NUM_LAYERS];2000 #endif2001 1783 #if NH_MV 2002 1784 Int m_layerId; … … 2212 1994 Bool getInterViewMvVertConstraintFlag() const { return m_interViewMvVertConstraintFlag; } 2213 1995 2214 #if NH_3D2215 Void setSps3dExtension ( TComSps3dExtension& sps3dExtension ) { m_sps3dExtension = sps3dExtension; }2216 const TComSps3dExtension* getSps3dExtension ( ) const { return &m_sps3dExtension; }2217 #endif2218 1996 2219 1997 // Inference … … 2403 2181 #endif 2404 2182 2405 #if NH_3D_DLT2406 TComDLT m_cDLT;2407 #endif2408 2183 2409 2184 public: … … 2428 2203 UInt getMaxCuDQPDepth() const { return m_uiMaxCuDQPDepth; } 2429 2204 2430 #if NH_3D_DLT2431 Void setDLT( TComDLT cDLT ) { m_cDLT = cDLT; }2432 const TComDLT* getDLT() const { return &m_cDLT; }2433 TComDLT* getDLT() { return &m_cDLT; }2434 #endif2435 2205 2436 2206 … … 2701 2471 Int m_viewId; 2702 2472 Int m_viewIndex; 2703 #if NH_3D_VSO2704 Bool m_isDepth;2705 #endif2706 2473 2707 2474 // Additional slice header syntax elements … … 2727 2494 Bool m_pocMsbValRequiredFlag; 2728 2495 2729 #if NH_3D2730 IntAry2d m_aaiCodedScale ;2731 IntAry2d m_aaiCodedOffset;2732 #endif2733 #if NH_3D_TMVP2734 Int m_aiAlterRefIdx [2];2735 #endif2736 #if NH_3D_ARP2737 Bool m_arpRefPicAvailable[2][MAX_NUM_LAYERS];2738 TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS];2739 UInt m_nARPStepNum;2740 Int m_aiFirstTRefIdx [2];2741 #endif2742 #if NH_3D2743 std::vector<Int> m_pocsInCurrRPSs;2744 #endif2745 #if NH_3D_IC2746 Bool m_bApplyIC;2747 Bool m_icSkipParseFlag;2748 #endif2749 #if NH_3D2750 std::vector<Int> m_inCmpRefViewIdcs;2751 Bool m_inCmpPredAvailFlag;2752 Bool m_inCmpPredFlag;2753 Bool m_cpAvailableFlag;2754 Int m_numViews;2755 #endif2756 #if NH_3D_QTL2757 TComPic* m_ivPicsCurrPoc [2][MAX_NUM_LAYERS];2758 #endif2759 #if NH_3D2760 Int** m_depthToDisparityB;2761 Int** m_depthToDisparityF;2762 Bool m_bApplyDIS;2763 #endif2764 #endif2765 #if NH_3D_IC2766 Int* m_aICEnableCandidate;2767 Int* m_aICEnableNum;2768 #endif2769 #if NH_3D2770 Int m_iDefaultRefViewIdx;2771 Bool m_bDefaultRefViewIdxAvailableFlag;2772 2773 Bool m_ivMvPredFlag ;2774 Bool m_ivMvScalingFlag ;2775 Bool m_ivResPredFlag ;2776 Bool m_depthRefinementFlag ;2777 Bool m_viewSynthesisPredFlag;2778 Bool m_depthBasedBlkPartFlag;2779 Bool m_mpiFlag ;2780 Bool m_intraContourFlag ;2781 Bool m_intraSdcWedgeFlag ;2782 Bool m_qtPredFlag ;2783 Bool m_interSdcFlag ;2784 Bool m_depthIntraSkipFlag ;2785 Int m_mpiSubPbSize ;2786 Int m_subPbSize ;2787 2496 #endif 2788 2497 public: … … 2847 2556 const TComPic* getRefPic( RefPicList e, Int iRefIdx) const { return m_apcRefPicList[e][iRefIdx]; } 2848 2557 Int getRefPOC( RefPicList e, Int iRefIdx) const { return m_aiRefPOCList[e][iRefIdx]; } 2849 #if NH_3D2850 Bool getInCmpPredAvailFlag( ) const { return m_inCmpPredAvailFlag; }2851 Bool getCpAvailableFlag( ) const { return m_cpAvailableFlag; }2852 Bool getInCompPredFlag( ) const { return m_inCmpPredFlag; }2853 Void setInCompPredFlag( Bool b ) { m_inCmpPredFlag = b; }2854 Int getInCmpRefViewIdcs( Int i ) const { return m_inCmpRefViewIdcs [i]; }2855 Int getNumCurCmpLIds( ) const { return (Int) m_inCmpRefViewIdcs.size(); }2856 TComPic* getIvPic( Bool depthFlag, Int viewIndex) const { return m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ]; }2857 #endif2858 #if NH_3D_QTL2859 TComPic* getTexturePic () { return m_ivPicsCurrPoc[0][ m_viewIndex ]; }2860 2861 #endif2862 #if NH_3D_IC2863 Void setApplyIC( Bool b ) { m_bApplyIC = b; }2864 Bool getApplyIC() { return m_bApplyIC; }2865 Void xSetApplyIC();2866 Void xSetApplyIC(Bool bUseLowLatencyICEnc);2867 Void setIcSkipParseFlag( Bool b ) { m_icSkipParseFlag = b; }2868 Bool getIcSkipParseFlag() { return m_icSkipParseFlag; }2869 #endif2870 #if NH_3D_ARP2871 Void setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx ) { m_pBaseViewRefPicList[iViewIdx] = pListPic; }2872 Void setARPStepNum( TComPicLists*ivPicLists );2873 Void setPocsInCurrRPSs( );2874 2875 TComPic* getBaseViewRefPic ( UInt uiPOC , Int iViewIdx ) { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }2876 UInt getARPStepNum( ) { return m_nARPStepNum; }2877 #endif2878 2558 Int getDepth() const { return m_iDepth; } 2879 2559 Bool getColFromL0Flag() const { return m_colFromL0Flag; } … … 3154 2834 3155 2835 3156 #if NH_3D3157 #if NH_3D_TMVP3158 Void generateAlterRefforTMVP ();3159 Void setAlterRefIdx ( RefPicList e, Int i ) { m_aiAlterRefIdx[e] = i; }3160 Int getAlterRefIdx ( RefPicList e ) { return m_aiAlterRefIdx[e]; }3161 #endif3162 #if NH_3D_ARP3163 Int getFirstTRefIdx ( RefPicList e ) { return m_aiFirstTRefIdx[e]; }3164 Void setFirstTRefIdx ( RefPicList e, Int i ) { m_aiFirstTRefIdx[e] = i; }3165 3166 Bool getArpRefPicAvailable ( RefPicList e, Int viewIdx) { return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, false, 0 )]; }3167 IntAry1d getPocsInCurrRPSs() { return m_pocsInCurrRPSs; }3168 #endif3169 #endif3170 #if NH_3D_VSO3171 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }3172 Bool getIsDepth () const { return m_isDepth; }3173 #endif3174 #if NH_3D3175 Void setCamparaSlice ( Int** aaiScale = 0, Int** aaiOffset = 0 );3176 3177 IntAry1d getCodedScale () const { return m_aaiCodedScale [0]; }3178 IntAry1d getCodedOffset () const { return m_aaiCodedOffset[0]; }3179 IntAry1d getInvCodedScale () const { return m_aaiCodedScale [1]; }3180 IntAry1d getInvCodedOffset () const { return m_aaiCodedOffset[1]; }3181 3182 Void setCpScale( Int j, Int val ) { m_aaiCodedScale[0][j] = val; }3183 Int getCpScale( Int j ) { return m_aaiCodedScale[0][j]; }3184 3185 Void setCpOff( Int j, Int val ) { m_aaiCodedOffset[0][j] = val; }3186 Int getCpOff( Int j ) { return m_aaiCodedOffset[0][j]; }3187 3188 Void setCpInvScale( Int j, Int val ) { m_aaiCodedScale[1][j] = val; }3189 Int getCpInvScale( Int j ) { return m_aaiCodedScale[1][j]; }3190 3191 Void setCpInvOff( Int j, Int val ) { m_aaiCodedOffset[1][j] = val; }3192 Int getCpInvOff( Int j ) { return m_aaiCodedOffset[1][j]; }3193 3194 #endif3195 #if NH_3D_QTL3196 Void setIvPicLists( TComPicLists* m_ivPicLists );3197 #endif3198 #if NH_3D3199 Void setDepthToDisparityLUTs();3200 3201 Int* getDepthToDisparityB( Int refViewIdx ) { return m_depthToDisparityB[ getVPS()->getVoiInVps( refViewIdx) ];}3202 Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ getVPS()->getVoiInVps( refViewIdx) ];}3203 #if NH_3D_IC3204 Void setICEnableCandidate( Int* icEnableCandidate) { m_aICEnableCandidate = icEnableCandidate; }3205 Void setICEnableNum( Int* icEnableNum) { m_aICEnableNum = icEnableNum; }3206 Void setICEnableCandidate( UInt layer, Int value) { m_aICEnableCandidate[ layer ] = value; }3207 Void setICEnableNum( UInt layer, Int value) { m_aICEnableNum[ layer ] = value; ; }3208 3209 Int getICEnableCandidate( Int layer) { return m_aICEnableCandidate[ layer ]; }3210 Int getICEnableNum( Int layer) { return m_aICEnableNum[ layer ]; }3211 #endif3212 #endif3213 2836 // Additional slice header syntax elements 3214 2837 … … 3292 2915 3293 2916 // Additional variables derived in slice header semantics 3294 #if NH_3D3295 Int getNumInterLayerRefPicsMinus1Len( ) const { return gCeilLog2( getVPS()->getNumRefListLayers( getLayerId() )); }3296 Int getInterLayerPredLayerIdcLen ( ) const { return gCeilLog2( getVPS()->getNumRefListLayers( getLayerId() )); }3297 #else3298 2917 Int getNumInterLayerRefPicsMinus1Len( ) const { return gCeilLog2( getVPS()->getNumDirectRefLayers( getLayerId() )); } 3299 2918 Int getInterLayerPredLayerIdcLen ( ) const { return gCeilLog2( getVPS()->getNumDirectRefLayers( getLayerId() )); } 3300 #endif3301 2919 3302 2920 Int getRefLayerPicFlag( Int i ) const; … … 3314 2932 TComPic* getPicFromRefPicSetInterLayer ( Int setIdc, Int layerId ) const ; 3315 2933 3316 #if NH_3D3317 // 3D-HEVC tool parameters3318 Void deriveInCmpPredAndCpAvailFlag( );3319 Void init3dToolParameters();3320 Void checkInCompPredRefLayers();3321 3322 Bool getIvMvPredFlag ( ) { return m_ivMvPredFlag ; };3323 Bool getIvMvScalingFlag ( ) { return m_ivMvScalingFlag ; };3324 Bool getIvResPredFlag ( ) { return m_ivResPredFlag ; };3325 Bool getDepthRefinementFlag ( ) { return m_depthRefinementFlag ; };3326 Bool getViewSynthesisPredFlag ( ) { return m_viewSynthesisPredFlag ; };3327 Bool getDepthBasedBlkPartFlag ( ) { return m_depthBasedBlkPartFlag ; };3328 Bool getMpiFlag ( ) { return m_mpiFlag ; };3329 Bool getIntraContourFlag ( ) { return m_intraContourFlag ; };3330 Bool getIntraSdcWedgeFlag ( ) { return m_intraSdcWedgeFlag ; };3331 Bool getQtPredFlag ( ) { return m_qtPredFlag ; };3332 Bool getInterSdcFlag ( ) { return m_interSdcFlag ; };3333 Bool getDepthIntraSkipFlag ( ) { return m_depthIntraSkipFlag ; };3334 3335 Int getMpiSubPbSize ( ) { return m_mpiSubPbSize ; };3336 Int getSubPbSize ( ) { return m_subPbSize ; };3337 #if NH_3D_NBDV3338 Int getDefaultRefViewIdx() { return m_iDefaultRefViewIdx; }3339 Void setDefaultRefViewIdx(Int iViewIdx) { m_iDefaultRefViewIdx = iViewIdx; }3340 3341 Bool getDefaultRefViewIdxAvailableFlag() { return m_bDefaultRefViewIdxAvailableFlag; }3342 Void setDefaultRefViewIdxAvailableFlag(Bool bViewIdx) { m_bDefaultRefViewIdxAvailableFlag = bViewIdx; }3343 Void setDefaultRefView( );3344 #endif3345 #endif3346 2934 #if NH_MV 3347 2935 TComPic* getRefPicSetInterLayer( Int setIdc, Int i ) const; -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComWedgelet.cpp
r1313 r1390 45 45 using namespace std; 46 46 47 #if NH_3D_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_uiWidth ( rcWedge.m_uiWidth ),67 m_uiHeight ( rcWedge.m_uiHeight ),68 m_pbPattern( (Bool*)xMalloc( Bool, (m_uiWidth * m_uiHeight) ) ),69 m_pbScaledPattern( g_wedgePattern )70 {71 ::memcpy( m_pbPattern, rcWedge.m_pbPattern, sizeof(Bool) * (m_uiWidth * m_uiHeight));72 }73 74 TComWedgelet::~TComWedgelet(void)75 {76 destroy();77 }78 79 Void TComWedgelet::create( UInt uiWidth, UInt uiHeight )80 {81 assert( uiWidth > 0 && uiHeight > 0 );82 83 m_uiWidth = uiWidth;84 m_uiHeight = uiHeight;85 86 m_pbPattern = (Bool*)xMalloc( Bool, (m_uiWidth * m_uiHeight) );87 m_pbScaledPattern = g_wedgePattern;88 }89 90 Void TComWedgelet::destroy()91 {92 if( m_pbPattern ) { xFree( m_pbPattern ); m_pbPattern = NULL; }93 }94 95 Void TComWedgelet::clear()96 {97 ::memset( m_pbPattern, 0, (m_uiWidth * m_uiHeight) * sizeof(Bool) );98 }99 100 Void TComWedgelet::setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse )101 {102 m_uhXs = uhXs;103 m_uhYs = uhYs;104 m_uhXe = uhXe;105 m_uhYe = uhYe;106 m_uhOri = uhOri;107 m_eWedgeRes = eWedgeRes;108 m_bIsCoarse = bIsCoarse;109 110 xGenerateWedgePattern();111 }112 113 Bool TComWedgelet::checkNotPlain()114 {115 for( UInt k = 1; k < (m_uiWidth * m_uiHeight); k++ )116 {117 if( m_pbPattern[0] != m_pbPattern[k] )118 {119 return true;120 }121 }122 return false;123 }124 125 Bool TComWedgelet::checkIdentical( Bool* pbRefPattern )126 {127 for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ )128 {129 if( m_pbPattern[k] != pbRefPattern[k] )130 {131 return false;132 }133 }134 return true;135 }136 137 Bool TComWedgelet::checkInvIdentical( Bool* pbRefPattern )138 {139 for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ )140 {141 if( m_pbPattern[k] == pbRefPattern[k] )142 {143 return false;144 }145 }146 return true;147 }148 149 Void TComWedgelet::generateWedgePatternByRotate(const TComWedgelet &rcWedge, Int rotate)150 {151 Int stride = m_uiWidth;152 Int sinc, offsetI, offsetJ;153 154 sinc = 1;155 offsetI = ( sinc) < 0 ? stride-1 : 0; // 0156 offsetJ = (-sinc) < 0 ? stride-1 : 0; // stride - 1157 158 for (Int y = 0; y < stride; y++)159 {160 for (Int x = 0; x < stride; x++)161 {162 Int i = offsetI + sinc * y; // y163 Int j = offsetJ - sinc * x; // stride - 1 - x164 m_pbPattern[(y * stride) + x] = !rcWedge.m_pbPattern[(j * stride) + i];165 }166 }167 Int blocksize = rcWedge.m_uiWidth * (rcWedge.m_eWedgeRes == HALF_PEL ? 2 : 1);168 Int offsetX = (-sinc) < 0 ? blocksize - 1 : 0;169 Int offsetY = ( sinc) < 0 ? blocksize - 1 : 0;170 m_uhXs = offsetX - sinc * rcWedge.m_uhYs;171 m_uhYs = offsetY + sinc * rcWedge.m_uhXs;172 m_uhXe = offsetX - sinc * rcWedge.m_uhYe;173 m_uhYe = offsetY + sinc * rcWedge.m_uhXe;174 m_uhOri = rotate;175 m_eWedgeRes = rcWedge.m_eWedgeRes;176 m_bIsCoarse = rcWedge.m_bIsCoarse;177 m_uiWidth = rcWedge.m_uiWidth;178 m_uiHeight = rcWedge.m_uiHeight;179 }180 181 Void TComWedgelet::xGenerateWedgePattern()182 {183 UInt uiTempBlockSize = 0;184 UChar uhXs = 0, uhYs = 0, uhXe = 0, uhYe = 0;185 switch( m_eWedgeRes )186 {187 case( FULL_PEL ): { uiTempBlockSize = m_uiWidth; uhXs = m_uhXs; uhYs = m_uhYs; uhXe = m_uhXe; uhYe = m_uhYe; } break;188 case( HALF_PEL ): { uiTempBlockSize = (m_uiWidth<<1); uhXs = m_uhXs; uhYs = m_uhYs; uhXe = m_uhXe; uhYe = m_uhYe; } break;189 }190 191 Bool* pbTempPattern = new Bool[ (uiTempBlockSize * uiTempBlockSize) ];192 ::memset( pbTempPattern, 0, (uiTempBlockSize * uiTempBlockSize) * sizeof(Bool) );193 Int iTempStride = uiTempBlockSize;194 195 xDrawEdgeLine( uhXs, uhYs, uhXe, uhYe, pbTempPattern, iTempStride );196 197 Int shift = (m_eWedgeRes == HALF_PEL) ? 1 : 0;198 Int endPos = uhYe>>shift;199 for (Int y = 0; y <= endPos; y++)200 {201 for (Int x = 0; x < m_uiWidth && pbTempPattern[(y * m_uiWidth) + x] == 0; x++)202 {203 pbTempPattern[(y * m_uiWidth) + x] = true;204 }205 }206 for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ )207 {208 m_pbPattern[k] = pbTempPattern[k];209 };210 211 if( pbTempPattern )212 {213 delete [] pbTempPattern;214 pbTempPattern = NULL;215 }216 }217 218 Void TComWedgelet::xDrawEdgeLine( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, Bool* pbPattern, Int iPatternStride )219 {220 Int x0 = (Int)uhXs;221 Int y0 = (Int)uhYs;222 Int x1 = (Int)uhXe;223 Int y1 = (Int)uhYe;224 225 // direction independent Bresenham line226 bool steep = (abs(y1 - y0) > abs(x1 - x0));227 if( steep )228 {229 std::swap( x0, y0 );230 std::swap( x1, y1 );231 }232 233 bool backward = ( x0 > x1 );234 if( backward )235 {236 std::swap( x0, x1 );237 std::swap( y0, y1 );238 }239 240 Int deltax = x1 - x0;241 Int deltay = abs(y1 - y0);242 Int error = 0;243 Int deltaerr = (deltay<<1);244 245 Int ystep;246 Int y = y0;247 if( y0 < y1 ) ystep = 1;248 else ystep = -1;249 250 for( Int x = x0; x <= x1; x++ )251 {252 Int shift = (m_eWedgeRes == HALF_PEL) ? 1 : 0;253 Int stride = iPatternStride >> shift;254 if( steep ) { pbPattern[((x>>shift) * stride) + (y>>shift)] = true; }255 else { pbPattern[((y>>shift) * stride) + (x>>shift)] = true; }256 257 error += deltaerr;258 if( error >= deltax )259 {260 y += ystep;261 error = error - (deltax<<1);262 }263 }264 }265 266 Bool* TComWedgelet::getPatternScaled( UInt dstSize )267 {268 Bool *pbSrcPat = this->getPattern();269 UInt uiSrcSize = this->getStride();270 271 if( 16 >= dstSize )272 {273 assert( dstSize == uiSrcSize );274 return pbSrcPat;275 }276 else277 {278 Int scale = (g_aucConvertToBit[dstSize] - g_aucConvertToBit[uiSrcSize]);279 assert(scale>=0);280 for (Int y=0; y<dstSize; y++)281 {282 for (Int x=0; x<dstSize; x++)283 {284 Int srcX = x>>scale;285 Int srcY = y>>scale;286 m_pbScaledPattern[y*dstSize + x] = pbSrcPat[ srcY*uiSrcSize + srcX ];287 }288 }289 return m_pbScaledPattern;290 }291 }292 293 Void TComWedgelet::getPatternScaledCopy( UInt dstSize, Bool* dstBuf )294 {295 Bool *pbSrcPat = this->getPattern();296 UInt uiSrcSize = this->getStride();297 298 if( 16 >= dstSize )299 {300 assert( dstSize == uiSrcSize );301 memcpy( dstBuf, pbSrcPat, (dstSize*dstSize) );302 }303 else304 {305 Int scale = (g_aucConvertToBit[dstSize] - g_aucConvertToBit[uiSrcSize]);306 assert(scale>=0);307 for (Int y=0; y<dstSize; y++)308 {309 for (Int x=0; x<dstSize; x++)310 {311 Int srcX = x>>scale;312 Int srcY = y>>scale;313 dstBuf[y*dstSize + x] = pbSrcPat[ srcY*uiSrcSize + srcX ];314 }315 }316 }317 }318 319 320 TComWedgeNode::TComWedgeNode()321 {322 m_uiPatternIdx = DMM_NO_WEDGE_IDX;323 for( UInt uiPos = 0; uiPos < DMM_NUM_WEDGE_REFINES; uiPos++ )324 {325 m_uiRefineIdx[uiPos] = DMM_NO_WEDGE_IDX;326 }327 }328 329 UInt TComWedgeNode::getPatternIdx()330 {331 return m_uiPatternIdx;332 }333 UInt TComWedgeNode::getRefineIdx( UInt uiPos )334 {335 assert( uiPos < DMM_NUM_WEDGE_REFINES );336 return m_uiRefineIdx[uiPos];337 }338 Void TComWedgeNode::setPatternIdx( UInt uiIdx )339 {340 m_uiPatternIdx = uiIdx;341 }342 Void TComWedgeNode::setRefineIdx( UInt uiIdx, UInt uiPos )343 {344 assert( uiPos < DMM_NUM_WEDGE_REFINES );345 m_uiRefineIdx[uiPos] = uiIdx;346 }347 #endif //NH_3D_DMM -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComWedgelet.h
r1313 r1390 43 43 #include <vector> 44 44 45 #if NH_3D_DMM46 #define DMM_OFFSET (NUM_INTRA_MODE+1) // offset for DMM and RBC mode numbers47 #define DMM_MIN_SIZE 4 // min. block size for DMM and RBC modes48 #define DMM_MAX_SIZE 32 // max. block size for DMM and RBC modes49 50 enum DmmID51 {52 DMM1_IDX = 0,53 DMM4_IDX = 1,54 NUM_DMM = 2,55 DMM_NO_IDX = MAX_UINT56 };57 58 __inline DmmID getDmmType( Int intraMode )59 {60 Int dmmType = intraMode-DMM_OFFSET;61 return (dmmType >= 0 && dmmType < NUM_DMM) ? (DmmID)dmmType : DMM_NO_IDX;62 }63 __inline Bool isDmmMode( Int intraMode ) { return ((UInt)getDmmType( intraMode ) < NUM_DMM); }64 65 66 // Wedgelets67 #define DMM_NO_WEDGE_IDX MAX_UINT68 #define DMM_NUM_WEDGE_REFINES 869 70 enum WedgeResolution71 {72 FULL_PEL,73 HALF_PEL74 };75 76 77 // ====================================================================================================================78 // Class definition TComWedgelet79 // ====================================================================================================================80 class TComWedgelet81 {82 private:83 UChar m_uhXs; // line start X pos84 UChar m_uhYs; // line start Y pos85 UChar m_uhXe; // line end X pos86 UChar m_uhYe; // line end Y pos87 UChar m_uhOri; // orientation index88 WedgeResolution m_eWedgeRes; // start/end pos resolution89 Bool m_bIsCoarse;90 91 UInt m_uiWidth;92 UInt m_uiHeight;93 94 Bool* m_pbPattern;95 Bool* m_pbScaledPattern;96 97 Void xGenerateWedgePattern();98 Void xDrawEdgeLine( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, Bool* pbPattern, Int iPatternStride );99 100 public:101 TComWedgelet( UInt uiWidth, UInt uiHeight );102 TComWedgelet( const TComWedgelet &rcWedge );103 virtual ~TComWedgelet();104 105 Void create ( UInt iWidth, UInt iHeight ); ///< create wedgelet pattern106 Void destroy(); ///< destroy wedgelet pattern107 Void clear (); ///< clear wedgelet pattern108 109 UInt getWidth () { return m_uiWidth; }110 UInt getStride () { return m_uiWidth; }111 UInt getHeight () { return m_uiHeight; }112 WedgeResolution getWedgeRes() { return m_eWedgeRes; }113 Bool* getPattern () { return m_pbPattern; }114 UChar getStartX () { return m_uhXs; }115 UChar getStartY () { return m_uhYs; }116 UChar getEndX () { return m_uhXe; }117 UChar getEndY () { return m_uhYe; }118 UChar getOri () { return m_uhOri; }119 Bool getIsCoarse() { return m_bIsCoarse; }120 121 Void generateWedgePatternByRotate(const TComWedgelet &rcWedge, Int rotate);122 Void setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse = false );123 124 Bool checkNotPlain();125 Bool checkIdentical( Bool* pbRefPattern );126 Bool checkInvIdentical( Bool* pbRefPattern );127 128 Bool* getPatternScaled ( UInt dstSize );129 Void getPatternScaledCopy( UInt dstSize, Bool* dstBuf );130 131 }; // END CLASS DEFINITION TComWedgelet132 133 // type definition wedgelet pattern list134 typedef std::vector<TComWedgelet> WedgeList;135 136 // ====================================================================================================================137 // Class definition TComWedgeRef138 // ====================================================================================================================139 class TComWedgeRef140 {141 private:142 UChar m_uhXs; // line start X pos143 UChar m_uhYs; // line start Y pos144 UChar m_uhXe; // line end X pos145 UChar m_uhYe; // line end Y pos146 UInt m_uiRefIdx; // index of corresponding pattern of TComWedgelet object in wedge list147 148 public:149 TComWedgeRef() {}150 virtual ~TComWedgeRef() {}151 152 UChar getStartX () { return m_uhXs; }153 UChar getStartY () { return m_uhYs; }154 UChar getEndX () { return m_uhXe; }155 UChar getEndY () { return m_uhYe; }156 UInt getRefIdx () { return m_uiRefIdx; }157 158 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; }159 }; // END CLASS DEFINITION TComWedgeRef160 161 162 // ====================================================================================================================163 // Class definition TComWedgeNode164 // ====================================================================================================================165 class TComWedgeNode166 {167 private:168 UInt m_uiPatternIdx;169 UInt m_uiRefineIdx[DMM_NUM_WEDGE_REFINES];170 171 public:172 TComWedgeNode();173 virtual ~TComWedgeNode() {}174 175 UInt getPatternIdx();176 UInt getRefineIdx ( UInt uiPos );177 178 Void setPatternIdx( UInt uiIdx );179 Void setRefineIdx ( UInt uiIdx, UInt uiPos );180 }; // END CLASS DEFINITION TComWedgeNode181 182 // type definition wedgelet node list183 typedef std::vector<TComWedgeNode> WedgeNodeList;184 #endif //NH_3D_DMM185 45 186 46 #endif // __TCOMWEDGELET__ -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComYuv.cpp
r1386 r1390 464 464 } 465 465 466 #if NH_3D_VSO467 Void TComYuv::addClipPartLuma( Int bitDepth, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )468 {469 Int x, y;470 471 Pel* pSrc0 = pcYuvSrc0->getAddr( COMPONENT_Y, uiTrUnitIdx);472 Pel* pSrc1 = pcYuvSrc1->getAddr( COMPONENT_Y, uiTrUnitIdx);473 Pel* pDst = getAddr( COMPONENT_Y, uiTrUnitIdx);474 475 UInt iSrc0Stride = pcYuvSrc0->getStride( COMPONENT_Y );476 UInt iSrc1Stride = pcYuvSrc1->getStride( COMPONENT_Y );477 UInt iDstStride = getStride( COMPONENT_Y );478 for ( y = uiPartSize-1; y >= 0; y-- )479 {480 for ( x = uiPartSize-1; x >= 0; x-- )481 {482 pDst[x] = ClipBD( pSrc0[x] + pSrc1[x], bitDepth );483 }484 pSrc0 += iSrc0Stride;485 pSrc1 += iSrc1Stride;486 pDst += iDstStride;487 }488 }489 490 #if NH_3D_ARP491 Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths )492 {493 addARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight , bClip , clipBitDepths);494 addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip , clipBitDepths);495 }496 497 Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths )498 {499 Int x, y;500 501 Pel* pSrc0 = pcYuvSrc0->getAddr( COMPONENT_Y, uiAbsPartIdx );502 Pel* pSrc1 = pcYuvSrc1->getAddr( COMPONENT_Y, uiAbsPartIdx );503 Pel* pDst = getAddr( COMPONENT_Y, uiAbsPartIdx );504 505 UInt iSrc0Stride = pcYuvSrc0->getStride(COMPONENT_Y);506 UInt iSrc1Stride = pcYuvSrc1->getStride(COMPONENT_Y);507 UInt iDstStride = getStride(COMPONENT_Y);508 const Int clipbd = clipBitDepths.recon[CHANNEL_TYPE_LUMA];509 Int iIFshift = IF_INTERNAL_PREC - clipbd;510 Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;511 for ( y = uiHeight-1; y >= 0; y-- )512 {513 for ( x = uiWidth-1; x >= 0; x-- )514 {515 pDst[x] = pSrc0[x] + pSrc1[x];516 if( bClip )517 {518 pDst[x] = Pel(ClipBD<Int>(Int( ( pDst[x] + iOffSet ) >> iIFshift ), clipbd));519 }520 }521 pSrc0 += iSrc0Stride;522 pSrc1 += iSrc1Stride;523 pDst += iDstStride;524 }525 }526 527 Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths )528 {529 Int x, y;530 531 Pel* pSrcU0 = pcYuvSrc0->getAddr( COMPONENT_Cb, uiAbsPartIdx );532 Pel* pSrcU1 = pcYuvSrc1->getAddr( COMPONENT_Cb, uiAbsPartIdx );533 Pel* pSrcV0 = pcYuvSrc0->getAddr( COMPONENT_Cr, uiAbsPartIdx );534 Pel* pSrcV1 = pcYuvSrc1->getAddr( COMPONENT_Cr, uiAbsPartIdx );535 Pel* pDstU = getAddr( COMPONENT_Cb, uiAbsPartIdx );536 Pel* pDstV = getAddr( COMPONENT_Cr, uiAbsPartIdx );537 538 UInt iSrc0StrideCb = pcYuvSrc0->getStride(COMPONENT_Cb);539 UInt iSrc1StrideCb = pcYuvSrc1->getStride(COMPONENT_Cb);540 UInt iDstStrideCb = getStride(COMPONENT_Cb);541 542 UInt iSrc0StrideCr = pcYuvSrc0->getStride(COMPONENT_Cr);543 UInt iSrc1StrideCr = pcYuvSrc1->getStride(COMPONENT_Cr);544 UInt iDstStrideCr = getStride(COMPONENT_Cr);545 546 const Int clipbd = clipBitDepths.recon[CHANNEL_TYPE_CHROMA];547 Int iIFshift = IF_INTERNAL_PREC - clipbd;548 Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;549 550 for ( y = uiHeight-1; y >= 0; y-- )551 {552 for ( x = uiWidth-1; x >= 0; x-- )553 {554 pDstU[x] = pSrcU0[x] + pSrcU1[x];555 pDstV[x] = pSrcV0[x] + pSrcV1[x];556 if( bClip )557 {558 pDstU[x] = Pel(ClipBD<Int>( Int( ( pDstU[x] + iOffSet ) >> iIFshift ), clipbd));559 pDstV[x] = Pel(ClipBD<Int>( Int( ( pDstV[x] + iOffSet ) >> iIFshift ), clipbd));560 }561 }562 563 pSrcU0 += iSrc0StrideCb;564 pSrcU1 += iSrc1StrideCb;565 pSrcV0 += iSrc0StrideCr;566 pSrcV1 += iSrc1StrideCr;567 pDstU += iDstStrideCb;568 pDstV += iDstStrideCr;569 }570 }571 572 Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )573 {574 subtractARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight );575 576 if (uiWidth > 8 && pcYuvSrc1->getNumberValidComponents() > 1)577 {578 subtractARPChroma( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );579 }580 }581 582 Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )583 {584 Int x, y;585 586 Pel* pSrc0 = pcYuvSrc0->getAddr(COMPONENT_Y, uiAbsPartIdx );587 Pel* pSrc1 = pcYuvSrc1->getAddr(COMPONENT_Y, uiAbsPartIdx );588 Pel* pDst = getAddr (COMPONENT_Y, uiAbsPartIdx );589 590 Int iSrc0Stride = pcYuvSrc0->getStride(COMPONENT_Y);591 Int iSrc1Stride = pcYuvSrc1->getStride(COMPONENT_Y);592 Int iDstStride = getStride(COMPONENT_Y);593 for ( y = uiHeight-1; y >= 0; y-- )594 {595 for ( x = uiWidth-1; x >= 0; x-- )596 {597 pDst[x] = pSrc0[x] - pSrc1[x];598 }599 pSrc0 += iSrc0Stride;600 pSrc1 += iSrc1Stride;601 pDst += iDstStride;602 }603 }604 605 Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )606 {607 Int x, y;608 609 Pel* pSrcU0 = pcYuvSrc0->getAddr(COMPONENT_Cb, uiAbsPartIdx );610 Pel* pSrcU1 = pcYuvSrc1->getAddr(COMPONENT_Cb, uiAbsPartIdx );611 Pel* pSrcV0 = pcYuvSrc0->getAddr(COMPONENT_Cr, uiAbsPartIdx );612 Pel* pSrcV1 = pcYuvSrc1->getAddr(COMPONENT_Cr, uiAbsPartIdx );613 Pel* pDstU = getAddr(COMPONENT_Cb, uiAbsPartIdx );614 Pel* pDstV = getAddr(COMPONENT_Cr, uiAbsPartIdx );615 616 Int iSrc0Stride = pcYuvSrc0->getStride(COMPONENT_Cb);617 Int iSrc1Stride = pcYuvSrc1->getStride(COMPONENT_Cb);618 Int iDstStride = getStride( COMPONENT_Cb );619 for ( y = uiHeight-1; y >= 0; y-- )620 {621 for ( x = uiWidth-1; x >= 0; x-- )622 {623 pDstU[x] = pSrcU0[x] - pSrcU1[x];624 pDstV[x] = pSrcV0[x] - pSrcV1[x];625 }626 pSrcU0 += iSrc0Stride;627 pSrcU1 += iSrc1Stride;628 pSrcV0 += iSrc0Stride;629 pSrcV1 += iSrc1Stride;630 pDstU += iDstStride;631 pDstV += iDstStride;632 }633 }634 635 Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )636 {637 multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );638 639 if ( uiWidth > 8 && getNumberValidComponents() > 1 )640 {641 multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );642 }643 }644 645 Void TComYuv::xxMultiplyLine( Pel* pSrcDst , UInt uiWidth , UChar dW )646 {647 assert( dW == 2 );648 for( UInt x = 0 ; x < uiWidth ; x++ )649 pSrcDst[x] = pSrcDst[x] >> 1;650 }651 652 Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )653 {654 Pel* pDst = getAddr(COMPONENT_Y, uiAbsPartIdx );655 Int iDstStride = getStride(COMPONENT_Y);656 for ( Int y = uiHeight-1; y >= 0; y-- )657 {658 xxMultiplyLine( pDst , uiWidth , dW );659 pDst += iDstStride;660 }661 }662 663 Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )664 {665 Pel* pDstU = getAddr( COMPONENT_Cb, uiAbsPartIdx );666 Pel* pDstV = getAddr( COMPONENT_Cr, uiAbsPartIdx );667 668 Int iDstStride = getStride( COMPONENT_Cb );669 for ( Int y = uiHeight-1; y >= 0; y-- )670 {671 xxMultiplyLine( pDstU , uiWidth , dW );672 xxMultiplyLine( pDstV , uiWidth , dW );673 pDstU += iDstStride;674 pDstV += iDstStride;675 }676 }677 #endif678 #endif679 466 680 467 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TComYuv.h
r1386 r1390 204 204 UInt getComponentScaleX (const ComponentID id) const { return ::getComponentScaleX(id, m_chromaFormatIDC); } 205 205 UInt getComponentScaleY (const ComponentID id) const { return ::getComponentScaleY(id, m_chromaFormatIDC); } 206 #if NH_3D_VSO207 Void addClipPartLuma( Int bitDepth, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );208 #endif209 #if NH_3D210 #if NH_3D_ARP211 Void addARP ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip, const BitDepths &clipBitDepths );212 Void addARPLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip, const BitDepths &clipBitDepths );213 Void addARPChroma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip, const BitDepths &clipBitDepths );214 Void subtractARP ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );215 Void subtractARPLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );216 Void subtractARPChroma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );217 Void multiplyARP ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );218 Void multiplyARPLuma ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );219 Void multiplyARPChroma ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );220 private:221 Void xxMultiplyLine ( Pel * pSrcDst , UInt uiWidth , UChar dW );222 #endif223 #endif224 206 225 207 };// END CLASS DEFINITION TComYuv -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibCommon/TypeDef.h
r1386 r1390 49 49 make -> HEVC_EXT not defined 50 50 make HEVC_EXT=0 -> NH_MV=0 H_3D=0 --> plain HM 51 make HEVC_EXT=1 -> NH_MV=1 H_3D=0 --> MV only 52 make HEVC_EXT=2 -> NH_MV=1 H_3D=1 --> full 3D 51 make HEVC_EXT=1 -> NH_MV=1 H_3D=0 --> MV 53 52 */ 54 53 #ifndef HEVC_EXT 55 #define HEVC_EXT 256 #endif 57 #if ( HEVC_EXT < 0 )||( HEVC_EXT > 2)58 #error HEVC_EXT must be in the range of 0 to 2, inclusive.54 #define HEVC_EXT 1 55 #endif 56 #if ( HEVC_EXT < 0 )||( HEVC_EXT > 1 ) 57 #error HEVC_EXT must be in the range of 0 to 1, inclusive. 59 58 #endif 60 59 #define NH_MV ( HEVC_EXT != 0) 61 #define NH_3D ( HEVC_EXT == 2)62 60 ///////////////////////////////////////////////////////////////////////////////////////// 63 61 /////////////////////////////////// FIXES AND INTEGRATIONS //////////////////////// … … 65 63 #if NH_MV 66 64 // Recent bug fixes 67 #define NH_3D_FIX_TICKET_107 1 // Clean up.68 #define NH_3D_FIX_TICKET_91 1 // NBDV availability in case of tiles.69 65 // Things that needs to be fixed also in the Specification ... 70 66 #define NH_MV_FIX_NO_REF_PICS_CHECK 1 // !!SPEC!! … … 72 68 #define NH_MV_FIX_NUM_POC_TOTAL_CUR 1 // Derivation of NumPocTotalCur for IDR pictures. !!SPEC!! 73 69 // To be done 74 #define NH_MV_HLS_PTL_LIMITS 070 #define NH_MV_HLS_PTL_LIMITS 0 75 71 #define NH_MV_SEI_TBD 0 76 72 #endif … … 80 76 #if NH_MV 81 77 #define NH_MV_ENC_DEC_TRAC 1 //< CU/PU level tracking 82 #if NH_3D83 #define NH_3D_INTEGER_MV_DEPTH 184 #define NH_3D_ENC_DEPTH 1 // Encoder optimizations for depth, incl.85 // HHI_DEPTH_INTRA_SEARCH_RAU_C016086 // LG_ZEROINTRADEPTHRESI_A008787 // HHI_DMM4_ENC_I006688 // H_3D_FAST_DEPTH_INTRA89 #define NH_3D_FAST_TEXTURE_ENCODING 1 // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E017390 #define NH_3D_ARP 1 // Advanced residual prediction (ARP), JCT3V-D017791 // QC_MTK_INTERVIEW_ARP_F0123_F0108 JCT3V-F0123; JCT3V-F010892 // SHARP_ARP_REF_CHECK_F0105 ARP reference picture selection and DPB check93 // LGE_ARP_CTX_F0161 JCT3V-F016194 // MTK_ARP_FLAG_CABAC_SIMP_G0061 Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G006195 // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G005396 // 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-H008597 // QC_I0051_ARP_SIMP98 // SHARP_ARP_CHROMA_I010499 // MTK_I0072_IVARP_SCALING_FIX100 // SEC_ARP_VIEW_REF_CHECK_J0037 Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1101 // SEC_ARP_REM_ENC_RESTRICT_K0035 Removal of encoder restriction of ARP, JCT3V-K0035102 #define NH_3D_QTL 1103 #define NH_3D_QTLPC 1 // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068104 // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units105 // MTK_TEX_DEP_PAR_G0055 Texture-partition-dependent depth partition. JCT3V-G0055106 #define NH_3D_VSO 1 // VSO, View synthesis optimization, includes:107 // HHI_VSO108 // HHI_VSO_LS_TABLE_M23714 enable table base Lagrange multiplier optimization109 // SAIT_VSO_EST_A0033, JCT3V-A0033 modification 3110 // LGE_WVSO_A0119111 // SCU_HS_VSD_BUGFIX_IMPROV_G0163112 #define NH_3D_NBDV 1 // Neighboring block disparity derivation113 // QC_JCT3V-A0097114 // LGE_DVMCP_A0126115 // LGE_DVMCP_MEM_REDUCTION_B0135116 // QC_SIMPLE_NBDV_B0047117 // FIX_LGE_DVMCP_B0133118 // QC_NBDV_LDB_FIX_C0055119 // MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097120 // MTK_SIMPLIFY_DVTC_C0135121 // QC_CU_NBDV_D0181122 // SEC_DEFAULT_DV_D0112123 // MTK_DVMCP_FIX_E0172 fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172124 // SEC_SIMPLIFIED_NBDV_E0142 Simplified NBDV, JCT3V-E0142 and JCT3V-E0190125 // MTK_NBDV_TN_FIX_E0172 fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172126 // MTK_TEXTURE_MRGCAND_BUGFIX_E0182 Bug fix for TEXTURE MERGING CANDIDATE , JCT3V-E0182127 // LGE_SIMP_DISP_AVAIL_J0041 // Use 2 status for disparity availability - DISP_AVAILABLE and DISP_NONE128 #define NH_3D_IC 1 // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060129 // Unifying rounding offset, for IC part, JCT3V-D0135130 // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC131 // SHARP_ILLUCOMP_REFINE_E0046132 // MTK_CLIPPING_ALIGN_IC_E0168 // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168133 // LGE_IC_CTX_F0160 //JCT3V-F0160134 // SEC_ONLY_TEXTURE_IC_F0151135 // MTK_IC_FLAG_CABAC_SIMP_G0061136 // SEC_IC_ARP_SIG_G0072, Disabling IC when ARP is enabled, option 1 in JCT3V-G0072, part 2 in JCT3V-G0121137 // MTK_LOW_LATENCY_IC_ENCODING_H0086 Low-latency IC encoding in JCT3V-H0086138 // MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX 1 // Remove the global variables used in JCT3V-H0086139 // SEC_IC_NEIGHBOR_CLIP_I0080 // Clipping of neighboring sample position, JCT3V-I0080140 // LGE_CHROMA_IC_J0050_J0034141 #if NH_3D_NBDV142 #define NH_3D_NBDV_REF 1 // Depth oriented neighboring block disparity derivation143 // MTK_D0156144 // MERL_D0166: Reference view selection in NBDV & Bi-VSP145 // MERL_C0152: Basic VSP146 // NBDV_DEFAULT_VIEWIDX_BUGFIX Bug fix for invalid default view index for NBDV147 // NTT_DoNBDV_VECTOR_CLIP_E0141 disparity vector clipping in DoNBDV, JCT3V-E0141 and JCT3V-E0209148 // SEC_VER_DONBDV_H0103 Vertical DV Restriction for DoNBDV149 #endif150 #define NH_3D_VSP 1 // View synthesis prediction151 // MERL_C0152: Basic VSP152 // MERL_D0166: Reference view selection in NBDV & Bi-VSP153 // MTK_D0105, LG_D0139: No VSP for depth154 // QC_D0191: Clean up155 // LG_D0092: Multiple VSP candidate allowed156 // MTK_VSP_FIX_ALIGN_WD_E0172157 // NTT_VSP_ADAPTIVE_SPLIT_E0207 adaptive sub-PU partitioning in VSP, JCT3V-E0207158 // NTT_VSP_DC_BUGFIX_E0208 bugfix for sub-PU based DC in VSP, JCT3V-E0208159 // NTT_VSP_COMMON_E0207_E0208 common part of JCT3V-E0207 and JCT3V-E0208160 // MTK_F0109_LG_F0120_VSP_BLOCK MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120161 // SHARP_VSP_BLOCK_IN_AMP_F0102 VSP partitioning for AMP162 // MTK_VSP_SIMPLIFICATION_F0111 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss163 // LGE_SHARP_VSP_INHERIT_F0104164 // NTT_STORE_SPDV_VSP_G0148 Storing Sub-PU based DV for VSP165 // Restricted bi-prediction for VSP166 // MTK_MRG_LIST_SIZE_CLEANUP_J0059 1 // Include VSP for deriving merge candidate list size, JCT3V-J0059167 // SEC_A1_BASED_VSP_J0039 1 // Removal of redundant VSP in Merge list168 #define NH_3D_MLC 1169 #define NH_3D_IV_MERGE 1 // Inter-view motion merge candidate170 // HHI_INTER_VIEW_MOTION_PRED171 // SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction172 // QC_MRG_CANS_B0048 , JCT3V-B0048, B0086, B0069173 // OL_DISMV_POS_B0069 , different pos for disparity MV candidate, B0069174 // MTK_INTERVIEW_MERGE_A0049 , second part175 // QC_AMVP_MRG_UNIFY_IVCAN_C0051176 // QC_INRIA_MTK_MRG_E0126177 // ETRIKHU_MERGE_REUSE_F0093 QC_DEPTH_IV_MRG_F0125, JCT3V-F0125: Depth oriented Inter-view MV candidate178 // MTK_NBDV_IVREF_FIX_G0067 , Disable IvMC, VSP when IVREF is not available, JCT3V-G0067179 // SEC_DEPTH_DV_DERIVAITON_G0074, Simplification of DV derivation for depth, JCT3V-G0074180 // QC_DEPTH_MERGE_SIMP_G0127 Remove DV candidate and shifting candidate for depth coding181 // QC_IV_PRED_CONSTRAINT_H0137 Constraint on inter-view (motion) prediction tools182 // ETRIKHU_BUGFIX_H0083 bug-fix for DV candidate pruning183 // ETRIKHU_CLEANUP_H0083 cleaned-up source code for constructing merging candidate list184 // ETRIKHU_CLEANUP_H0083_MISSING missing guard macros added by GT185 // SHARP_SIMPLE_MERGE_H0062 Restrict 3D-HEVC merge cand in small PUs186 // MTK_DIS_SPBIP8X4_H0205 Disable bi-prediction for 8x4 and 4x8 sub PU and remove the SPIVMP 2Nx2N restriction187 // SEC_ADAPT_DISABLE_IVMP Disabling IVMP merge candidates when IC is enabled, JCT3V-H0070188 // SEC_SIMP_SHIFTED_DV_I0086 Simplification of Shifted DV candidate, JCT3V-I0086189 // SEC_SHIFTED_IVMC_POS_K0036 Position Derivation for Shifted-IVMC, JCT3V-K0036190 #define NH_3D_TEXT_MERGE 1191 // TEXTURE MERGING CANDIDATE , JCT3V-C0137192 // EC_MPI_ENABLING_MERGE_F0150, MPI flag in VPS and enabling in Merge mode193 #define NH_3D_TMVP 1 // QC_TMVP_C0047194 // Sony_M23639195 // H_3D_TMVP_SCALING_FIX_K0053 1 // QC/CY for K0053196 #define NH_3D_DMM 1 // Depth modeling modes197 // HHI_DMM_PRED_TEX198 // HHI_DMM_WEDGE_INTRA199 // FIX_WEDGE_NOFLOAT_D0036200 // LGE_EDGE_INTRA_A0070201 // LGE_DMM3_SIMP_C0044202 // QC_DC_PREDICTOR_D0183203 // LGE_CONCATENATE_D0141204 // PKU_QC_DEPTH_INTRA_UNI_D0195205 // SEC_DMM2_E0146_HHIFIX Removal of DMM2 from DMMs206 // ZJU_DEPTH_INTRA_MODE_E0204 Simplified Binarization for depth_intra_mode207 // SCU_HS_DMM4_REMOVE_DIV_E0242 DMM4 Division Removal208 // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1 Removal of overlap between DMM3 and DMM1209 // SEC_DMM3_RBC_F0147 Removal of DMM3 and RBC from DMMs210 // HHI_DIM_PREDSAMP_FIX_F0171211 // QC_DIM_DELTADC_UNIFY_F0132 Unify delta DC coding in depth intra modes212 // LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135 Use only one context for CABAC of dim_not_present_flag213 // QC_SIMP_DELTADC_CODING_H0131 Simplify detaDC entropy coding214 // MTK_DMM_SIMP_CODE_H0092 Remove CABAC context for DMM1 mode coding215 // 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-H0113216 // HS_DMM_SIGNALLING_I0120217 // SHARP_DMM1_I0110 LUT size reduction for DMM1 proposed in JCT3V-I0110218 // MTK_DMM_SIM_J0035219 // SHARP_DMM_CLEAN_K0042 1 // Generate DMM pattern with rotation220 #define NH_3D_DLT 1 // Depth Lookup Table221 // HHI_DELTADC_DLT_D0035222 // LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 JCT3V-F0159223 // SEC_NO_RESI_DLT_H0105224 // MTK_DLT_CODING_FIX_H0091225 // H_3D_DELTA_DLT226 // RWTH_DLT_CLIP_I0057227 // SHARP_DLT_SIMP_J0029 DLT(DepthValue2Idx[]) table derivation cleanup228 #define NH_3D_SDC_INTRA 1 // Segment-wise DC Coding method for INTRA229 #define NH_3D_SDC_INTER 1 // Segment-wise DC Coding method for INTER230 // RWTH_SDC_DLT_B0036231 // INTEL_SDC64_D0193232 // RWTH_SDC_CTX_SIMPL_D0032233 // FIX_SDC_ENC_RD_WVSO_D0163234 // MTK_SAMPLE_BASED_SDC_D0110235 // KWU_SDC_SIMPLE_DC_E0117 Simplified DC calculation for SDC236 // LGE_SDC_REMOVE_DC_E0158 Removal of DC mode from SDC237 // Unify intra SDC and inter SDC238 // QC_GENERIC_SDC_G0122 Generalize SDC to all depth intra modes239 // SCU_HS_DEPTH_DC_PRED_G0143240 // HS_TSINGHUA_SDC_SPLIT_G0111241 // QC_PKU_SDC_SPLIT_G0123 Intra SDC Split242 // HS_DMM_SDC_PREDICTOR_UNIFY_H0108 Unification of DMM and SDC predictor derivation243 // MTK_SDC_FLAG_FIX_H0095 Remove conditional check of PCM flag based on SDC flag, JCTVC-H0095244 // FAST_SDC_OFFSET_DECISION_I0084245 // SEPARATE_FLAG_I0085246 // MTK_J0033247 // LGE_INTER_SDC_E0156 Enable inter SDC for depth coding248 // SEC_INTER_SDC_G0101 Improved inter SDC with multiple DC candidates249 #define NH_3D_SPIVMP 1 // H_3D_SPIVMP JCT3V-F0110: Sub-PU level inter-view motion prediction250 // SEC_SPIVMP_MCP_SIZE_G0077, Apply SPIVMP only to 2Nx2N partition, JCT3V-G0077251 // QC_SPIVMP_MPI_G0119 Sub-PU level MPI merge candidate252 // Simplification on Sub-PU level temporal interview motion prediction253 // MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133254 #define NH_3D_DBBP 1 // DBBP: Depth-based Block Partitioning and Merging255 // MTK_DBBP_AMP_REM_H0072256 // RWTH_DBBP_NO_SPU_H0057257 // SEC_DBBP_FILTERING_H0104258 // MTK_DBBP_SIGNALING_H0094259 // 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.260 // SEC_DBBP_EXPLICIT_SIG_I0077 Remove the partition derivation and signal dbbp_flag only when the partition mode is 2NxN/Nx2N, JCT3V-I0077261 // Disallow DBBP in 8x8 CU, JCT3V-I0078262 // SHARP_DBBP_SIMPLE_FLTER_I0109 Simple condition and one dimensional filter for DBBP263 // SEC_DBBP_DMM4_THRESHOLD_I0076 Simplification of threshold derivation for DBBP and DMM4, JCT3V-I0076264 // SEC_DBBP_VIEW_REF_CHECK_J0037 Signaling dbbp_flag when the current slice has view reference picture(s), JCT3V-J0037 item4265 // RWTH_DBBP_NO_SATD_K0028266 // HS_DBBP_CLEAN_K0048267 #define NH_3D_DIS 1 // Depth intra skip268 // SEC_DEPTH_INTRA_SKIP_MODE_K0033 Depth intra skip mode269 #define H_3D_FCO 0 // Flexible coding order for 3D270 // OTHERS271 // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170272 // MTK_FAST_TEXTURE_ENCODING_E0173273 //HLS274 // HHI_DEPENDENCY_SIGNALLING_I1_J0107275 // HHI_TOOL_PARAMETERS_I2_J0107276 // HHI_VPS_3D_EXTENSION_I3_J0107277 // HHI_INTER_COMP_PRED_K0052278 // HHI_RES_PRED_K0052279 // HHI_CAM_PARA_K0052280 // H_3D_DIRECT_DEP_TYPE281 #endif // NH_3D282 #if NH_MV283 78 //////////////////////// 284 79 /// Consider Removal 285 80 //////////////////////// 286 // Rate Control287 #define KWU_FIX_URQ 0288 #define KWU_RC_VIEWRC_E0227 0 ///< JCT3V-E0227, view-wise target bitrate allocation289 #define KWU_RC_MADPRED_E0227 0 ///< JCT3V-E0227, inter-view MAD prediction290 81 #define NH_MV_HLS_PTL_LIMITS 0 291 #if NH_3D292 // Unclear Fix293 #define H_3D_PPS_FIX_DEPTH 0294 #endif295 #endif296 /////////////////////////////////////////////////////////////////////////////////////////297 /////////////////////////////////// DERIVED DEFINES ///////////////////////////////////298 /////////////////////////////////////////////////////////////////////////////////////////299 #if NH_3D300 #define NH_3D_OUTPUT_ACTIVE_TOOLS 0301 #define NH_3D_REN_MAX_DEV_OUT 0302 #endif303 ///// ***** VIEW SYNTHESIS OPTIMIZAION *********304 #if NH_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 #endif311 //// ****** NEIGHBOURING BLOCK-BASED DISPARITY VECTOR *********312 #if NH_3D_NBDV313 #define DVFROM_LEFT 0314 #define DVFROM_ABOVE 1315 #define IDV_CANDS 2316 #endif317 /////////////////////////////////////////////////////////////////////////////////////318 /// GT: Move values which are not flags to CommonDef.h and convert to static int !!319 ///////////////////////////////////////////////////////////////////////////////////320 ///// ***** ILLUMATION COMPENSATION *********321 #if NH_3D_IC322 #define IC_REG_COST_SHIFT 7323 #define IC_CONST_SHIFT 5324 #define IC_SHIFT_DIFF 12325 #define IC_LOW_LATENCY_ENCODING_THRESHOLD 0.1 // Threshold for low-latency IC encoding in JCT3V-H0086326 #endif327 ///// ***** DEPTH BASED BLOCK PARTITIONING *********328 #if NH_3D_DBBP329 #define DBBP_INVALID_SHORT (-4)330 #endif331 /////////////////////////////////////////////////////////////////////////////////////////332 /////////////////////////////////// HM RELATED DEFINES ////////////////////////////////333 /////////////////////////////////////////////////////////////////////////////////////////334 82 #endif 335 83 // ==================================================================================================================== … … 493 241 typedef std::vector< BoolAry3d > BoolAry4d; 494 242 typedef std::vector< BoolAry4d > BoolAry5d; 495 #endif496 #if NH_3D_VSO497 // ====================================================================================================================498 // Define Distortion Types499 // ====================================================================================================================500 typedef Int64 RMDist; ///< renderer model distortion501 #if H_3D_VSO_DIST_INT502 typedef Int64 Dist; ///< RDO distortion503 typedef Int64 Dist64;504 #define RDO_DIST_MIN MIN_INT505 #define RDO_DIST_MAX MAX_INT506 #else507 typedef UInt Dist; ///< RDO distortion508 typedef UInt64 Dist;509 #define RDO_DIST_MIN 0510 #define RDO_DIST_MAX MAX_UINT511 #endif512 243 #endif 513 244 // ==================================================================================================================== … … 645 376 DF_HADS64 = 27, ///< 64xM HAD with step 646 377 DF_HADS16N = 28, ///< 16NxM HAD with step 647 #if NH_3D_VSO648 DF_VSD = 29, ///< general size VSD649 DF_VSD4 = 30, ///< 4xM VSD650 DF_VSD8 = 31, ///< 8xM VSD651 DF_VSD16 = 32, ///< 16xM VSD652 DF_VSD32 = 33, ///< 32xM VSD653 DF_VSD64 = 34, ///< 64xM VSD654 DF_VSD16N = 35, ///< 16NxM VSD655 #endif656 378 DF_SAD12 = 43, 657 379 DF_SAD24 = 44, … … 683 405 MD_ABOVE_LEFT ///< MVP of above left block 684 406 }; 685 #if NH_3D_MLC686 enum DefaultMergCandOrder687 {688 MRG_T = 0, ///< MPI689 MRG_D, ///< DDD690 MRG_IVMC, ///< Temporal inter-view691 MRG_A1, ///< Left692 MRG_B1, ///< Above693 MRG_VSP, ///< VSP694 MRG_B0, ///< Above right695 MRG_IVDC, ///< Disparity inter-view696 MRG_A0, ///< Left bottom697 MRG_B2, ///< Above left698 MRG_IVSHIFT, ///< Shifted IVMC or Shifted IVDC. (These are mutually exclusive)699 MRG_COL ///< Temporal co-located700 };701 #endif702 407 enum StoredResidualType 703 408 { … … 835 540 #if NH_MV 836 541 ,MULTIVIEWMAIN = 6, 837 #if NH_3D838 MAIN3D = 8,839 #endif840 542 #endif 841 543 }; … … 990 692 }; 991 693 #endif 992 #if NH_3D_VSO993 // Renderer994 enum BlenMod995 {996 BLEND_NONE = -1,997 BLEND_AVRG = 0,998 BLEND_LEFT = 1,999 BLEND_RIGHT = 2,1000 BLEND_GEN = 31001 };1002 enum1003 {1004 VIEWPOS_INVALID = -1,1005 VIEWPOS_LEFT = 0,1006 VIEWPOS_RIGHT = 1,1007 VIEWPOS_MERGED = 21008 };1009 #endif1010 694 // ==================================================================================================================== 1011 695 // Type definition -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/SEIread.cpp
r1386 r1390 381 381 xParseSEIMultiviewViewPosition((SEIMultiviewViewPosition&) *sei, payloadSize, pDecodedMessageOutputStream ); 382 382 break; 383 #if NH_3D384 case SEI::ALTERNATIVE_DEPTH_INFO:385 sei = new SEIAlternativeDepthInfo;386 xParseSEIAlternativeDepthInfo((SEIAlternativeDepthInfo&) *sei, payloadSize, pDecodedMessageOutputStream );387 break;388 #endif389 383 #endif 390 384 default: … … 1740 1734 }; 1741 1735 1742 #if NH_3D1743 Void SEIReader::xParseSEIAlternativeDepthInfo(SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)1744 {1745 UInt code;1746 Int scode;1747 output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);1748 1749 sei.resizeArrays( );1750 sei_read_flag( pDecodedMessageOutputStream, code, "alternative_depth_info_cancel_flag" ); sei.m_alternativeDepthInfoCancelFlag = (code == 1);1751 if( sei.m_alternativeDepthInfoCancelFlag == 0 )1752 {1753 sei_read_code( pDecodedMessageOutputStream, 2, code, "depth_type" ); sei.m_depthType = code;1754 if( sei.m_depthType == 0 )1755 {1756 sei_read_uvlc( pDecodedMessageOutputStream, code, "num_constituent_views_gvd_minus1" ); sei.m_numConstituentViewsGvdMinus1 = code;1757 sei_read_flag( pDecodedMessageOutputStream, code, "depth_present_gvd_flag" ); sei.m_depthPresentGvdFlag = (code == 1);1758 sei_read_flag( pDecodedMessageOutputStream, code, "z_gvd_flag" ); sei.m_zGvdFlag = (code == 1);1759 sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_param_gvd_flag" ); sei.m_intrinsicParamGvdFlag = (code == 1);1760 sei_read_flag( pDecodedMessageOutputStream, code, "rotation_gvd_flag" ); sei.m_rotationGvdFlag = (code == 1);1761 sei_read_flag( pDecodedMessageOutputStream, code, "translation_gvd_flag" ); sei.m_translationGvdFlag = (code == 1);1762 if( sei.m_zGvdFlag )1763 {1764 for( Int i = 0, j = 0; j <= sei.m_numConstituentViewsGvdMinus1 + 1; j++ )1765 {1766 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_near_flag" ); sei.m_signGvdZNearFlag[i][j] = (code == 1);1767 sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_near" ); sei.m_expGvdZNear[i][j] = code;1768 sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_near_minus1" ); sei.m_manLenGvdZNearMinus1[i][j] = code;1769 sei_read_code( pDecodedMessageOutputStream, sei.m_manLenGvdZNearMinus1[i][j]+1, code, "man_gvd_z_near" ); sei.m_manGvdZNear[i][j] = code;1770 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_far_flag" ); sei.m_signGvdZFarFlag[i][j] = (code == 1);1771 sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_far" ); sei.m_expGvdZFar[i][j] = code;1772 sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_far_minus1" ); sei.m_manLenGvdZFarMinus1[i][j] = code;1773 sei_read_code( pDecodedMessageOutputStream, sei.m_manLenGvdZFarMinus1[i][j]+1, code, "man_gvd_z_far" ); sei.m_manGvdZFar[i][j] = code;1774 }1775 }1776 if( sei.m_intrinsicParamGvdFlag )1777 {1778 sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_focal_length" ); sei.m_precGvdFocalLength = code;1779 sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_principal_point" ); sei.m_precGvdPrincipalPoint = code;1780 }1781 if( sei.m_rotationGvdFlag )1782 {1783 sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_rotation_param" ); sei.m_precGvdRotationParam = code;1784 }1785 if( sei.m_translationGvdFlag )1786 {1787 sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_translation_param" ); sei.m_precGvdTranslationParam = code;1788 }1789 for( Int i = 0, j = 0; j <= sei.m_numConstituentViewsGvdMinus1 + 1; j++ )1790 {1791 if( sei.m_intrinsicParamGvdFlag )1792 {1793 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_x" ); sei.m_signGvdFocalLengthX[i][j] = (code == 1);1794 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_x" ); sei.m_expGvdFocalLengthX[i][j] = code;1795 sei_read_code( pDecodedMessageOutputStream, sei.getManGvdFocalLengthXLen(i,j), code, "man_gvd_focal_length_x" ); sei.m_manGvdFocalLengthX[i][j] = code;1796 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_y" ); sei.m_signGvdFocalLengthY[i][j] = (code == 1);1797 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_y" ); sei.m_expGvdFocalLengthY[i][j] = code;1798 sei_read_code( pDecodedMessageOutputStream, sei.getManGvdFocalLengthYLen(i,j), code, "man_gvd_focal_length_y" ); sei.m_manGvdFocalLengthY[i][j] = code;1799 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_x" ); sei.m_signGvdPrincipalPointX[i][j] = (code == 1);1800 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_x" ); sei.m_expGvdPrincipalPointX[i][j] = code;1801 sei_read_code( pDecodedMessageOutputStream, sei.getManGvdPrincipalPointXLen(i,j), code, "man_gvd_principal_point_x" ); sei.m_manGvdPrincipalPointX[i][j] = code;1802 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_y" ); sei.m_signGvdPrincipalPointY[i][j] = (code == 1);1803 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_y" ); sei.m_expGvdPrincipalPointY[i][j] = code;1804 sei_read_code( pDecodedMessageOutputStream, sei.getManGvdPrincipalPointYLen(i,j), code, "man_gvd_principal_point_y" ); sei.m_manGvdPrincipalPointY[i][j] = code;1805 }1806 if( sei.m_rotationGvdFlag )1807 {1808 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r00" ); sei.m_signGvdR00[i][j] = (code == 1);1809 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r00" ); sei.m_expGvdR00[i][j] = code;1810 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r00" ); sei.m_manGvdR00[i][j] = code;1811 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r01" ); sei.m_signGvdR01[i][j] = (code == 1);1812 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r01" ); sei.m_expGvdR01[i][j] = code;1813 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r01" ); sei.m_manGvdR01[i][j] = code;1814 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r02" ); sei.m_signGvdR02[i][j] = (code == 1);1815 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r02" ); sei.m_expGvdR02[i][j] = code;1816 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r02" ); sei.m_manGvdR02[i][j] = code;1817 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r10" ); sei.m_signGvdR10[i][j] = (code == 1);1818 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r10" ); sei.m_expGvdR10[i][j] = code;1819 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r10" ); sei.m_manGvdR10[i][j] = code;1820 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r11" ); sei.m_signGvdR11[i][j] = (code == 1);1821 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r11" ); sei.m_expGvdR11[i][j] = code;1822 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r11" ); sei.m_manGvdR11[i][j] = code;1823 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r12" ); sei.m_signGvdR12[i][j] = (code == 1);1824 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r12" ); sei.m_expGvdR12[i][j] = code;1825 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r12" ); sei.m_manGvdR12[i][j] = code;1826 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r20" ); sei.m_signGvdR20[i][j] = (code == 1);1827 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r20" ); sei.m_expGvdR20[i][j] = code;1828 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r20" ); sei.m_manGvdR20[i][j] = code;1829 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r21" ); sei.m_signGvdR21[i][j] = (code == 1);1830 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r21" ); sei.m_expGvdR21[i][j] = code;1831 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r21" ); sei.m_manGvdR21[i][j] = code;1832 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r22" ); sei.m_signGvdR22[i][j] = (code == 1);1833 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r22" ); sei.m_expGvdR22[i][j] = code;1834 sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r22" ); sei.m_manGvdR22[i][j] = code;1835 //sei_read_code( pDecodedMessageOutputStream, sei.getManGvdRLen(i,j,k), code, "man_gvd_r" ); sei.m_manGvdR[i][j] = code;1836 }1837 if( sei.m_translationGvdFlag )1838 {1839 sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_t_x" ); sei.m_signGvdTX[i][j] = (code == 1);1840 sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_t_x" ); sei.m_expGvdTX[i][j] = code;1841 sei_read_code( pDecodedMessageOutputStream, sei.getManGvdTXLen(i,j), code, "man_gvd_t_x" ); sei.m_manGvdTX[i][j] = code;1842 }1843 }1844 }1845 1846 if( sei.m_depthType == 1 )1847 {1848 sei_read_svlc( pDecodedMessageOutputStream, scode, "min_offset_x_int" ); sei.m_minOffsetXInt = scode;1849 sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_x_frac" ); sei.m_minOffsetXFrac = code;1850 sei_read_svlc( pDecodedMessageOutputStream, scode, "max_offset_x_int" ); sei.m_maxOffsetXInt = scode;1851 sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_x_frac" ); sei.m_maxOffsetXFrac = code;1852 sei_read_flag( pDecodedMessageOutputStream, code, "offset_y_present_flag" ); sei.m_offsetYPresentFlag = (code == 1);1853 if( sei.m_offsetYPresentFlag )1854 {1855 sei_read_svlc( pDecodedMessageOutputStream, scode, "min_offset_y_int" ); sei.m_minOffsetYInt = scode;1856 sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_y_frac" ); sei.m_minOffsetYFrac = code;1857 sei_read_svlc( pDecodedMessageOutputStream, scode, "max_offset_y_int" ); sei.m_maxOffsetYInt = scode;1858 sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_y_frac" ); sei.m_maxOffsetYFrac = code;1859 }1860 sei_read_flag( pDecodedMessageOutputStream, code, "warp_map_size_present_flag" ); sei.m_warpMapSizePresentFlag = (code == 1);1861 if( sei.m_warpMapSizePresentFlag )1862 {1863 sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_width_minus2" ); sei.m_warpMapWidthMinus2 = code;1864 sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_height_minus2" ); sei.m_warpMapHeightMinus2 = code;1865 }1866 }1867 }1868 };1869 1736 #endif 1870 #endif1871 1737 1872 1738 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/SEIread.h
r1386 r1390 115 115 Void xParseSEIMultiviewAcquisitionInfo (SEIMultiviewAcquisitionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 116 116 Void xParseSEIMultiviewViewPosition (SEIMultiviewViewPosition& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 117 #if NH_3D118 Void xParseSEIAlternativeDepthInfo (SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);119 #endif120 117 #endif 121 118 Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName); -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1386 r1390 436 436 if ( pcPPS->getPps3dExtensionFlag() ) 437 437 { 438 #if NH_3D 439 parsePps3dExtension( pcPPS ); 440 #endif 441 } 442 #if NH_3D 443 if ( pcPPS->getPpsExtension5bits() ) 444 #else 438 } 445 439 if ( pcPPS->getPpsExtension5bits() || pcPPS->getPps3dExtensionFlag() ) 446 #endif447 440 { 448 441 while ( xMoreRbspData() ) … … 543 536 } 544 537 545 #if NH_3D546 Void TDecCavlc::parsePps3dExtension( TComPPS* pcPPS )547 {548 #if NH_3D_DLT549 UInt uiCode = 0;550 //551 TComDLT* pcDLT = pcPPS->getDLT();552 553 READ_FLAG(uiCode, "dlts_present_flag");554 pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false );555 556 if ( pcDLT->getDltPresentFlag() )557 {558 READ_CODE(6, uiCode, "pps_depth_layers_minus1");559 pcDLT->setNumDepthViews( uiCode+1 );560 561 READ_CODE(4, uiCode, "pps_bit_depth_for_depth_layers_minus8");562 pcDLT->setDepthViewBitDepth( (uiCode+8) );563 564 for( Int i = 0; i <= pcDLT->getNumDepthViews()-1; i++ )565 {566 Int layerId = pcDLT->getDepthIdxToLayerId(i);567 568 READ_FLAG(uiCode, "dlt_flag[i]");569 pcDLT->setUseDLTFlag(layerId, (uiCode == 1) ? true : false);570 571 if ( pcDLT->getUseDLTFlag( layerId ) )572 {573 Bool bDltBitMapRepFlag = false;574 UInt uiMaxDiff = MAX_INT;575 UInt uiMinDiff = 0;576 UInt uiCodeLength = 0;577 578 READ_FLAG(uiCode, "dlt_pred_flag[i]");579 580 if( uiCode )581 {582 assert( pcDLT->getUseDLTFlag( 1 ));583 }584 pcDLT->setInterViewDltPredEnableFlag( layerId, (uiCode == 1) ? true : false );585 586 if ( pcDLT->getInterViewDltPredEnableFlag( layerId ) == false )587 {588 READ_FLAG(uiCode, "dlt_val_flags_present_flag[i]");589 bDltBitMapRepFlag = (uiCode == 1) ? true : false;590 }591 else592 {593 bDltBitMapRepFlag = false;594 }595 596 UInt uiNumDepthValues = 0;597 std::vector<Int> aiIdx2DepthValue(256, 0);598 599 // Bit map600 if ( bDltBitMapRepFlag )601 {602 for (UInt d=0; d<256; d++)603 {604 READ_FLAG(uiCode, "dlt_value_flag[i][j]");605 if (uiCode == 1)606 {607 aiIdx2DepthValue[uiNumDepthValues] = d;608 uiNumDepthValues++;609 }610 }611 }612 // Diff Coding613 else614 {615 READ_CODE(8, uiNumDepthValues, "num_val_delta_dlt"); // num_entry616 617 {618 // 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.619 620 if (uiNumDepthValues > 1)621 {622 READ_CODE(8, uiCode, "max_diff");623 uiMaxDiff = uiCode;624 }625 else626 {627 uiMaxDiff = 0; // when there is only one value in DLT628 }629 630 if (uiNumDepthValues > 2)631 {632 uiCodeLength = (UInt) gCeilLog2(uiMaxDiff + 1);633 READ_CODE(uiCodeLength, uiCode, "min_diff_minus1");634 uiMinDiff = uiCode + 1;635 }636 else637 {638 uiMinDiff = uiMaxDiff; // when there are only one or two values in DLT639 }640 641 READ_CODE(8, uiCode, "delta_dlt_val0"); // entry0642 aiIdx2DepthValue[0] = uiCode;643 644 if (uiMaxDiff == uiMinDiff)645 {646 for (UInt d=1; d<uiNumDepthValues; d++)647 {648 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0;649 }650 }651 else652 {653 uiCodeLength = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);654 for (UInt d=1; d<uiNumDepthValues; d++)655 {656 READ_CODE(uiCodeLength, uiCode, "delta_val_diff_minus_min[k]");657 aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode;658 }659 }660 661 }662 }663 664 if( pcDLT->getInterViewDltPredEnableFlag( layerId ) )665 {666 // interpret decoded values as delta DLT667 AOF( layerId > 1 );668 // assumes ref layer id to be 1669 std::vector<Int> viRefDLT = pcDLT->idx2DepthValue( 1 );670 UInt uiRefNum = pcDLT->getNumDepthValues( 1 );671 pcDLT->setDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);672 }673 else674 {675 // store final DLT676 pcDLT->setDepthLUTs(layerId, aiIdx2DepthValue, uiNumDepthValues);677 }678 }679 }680 }681 #endif682 }683 #endif684 538 685 539 … … 1184 1038 if ( pcSPS->getSps3dExtensionFlag() ) 1185 1039 { 1186 #if NH_3D 1187 parseSps3dExtension( pcSPS ); 1188 #endif 1189 } 1190 1191 #if NH_3D 1192 if ( pcSPS->getSpsExtension5bits() ) 1193 #else 1040 } 1041 1194 1042 if ( pcSPS->getSpsExtension5bits() || pcSPS->getSps3dExtensionFlag() ) 1195 #endif1196 1043 { 1197 1044 while ( xMoreRbspData() ) … … 1270 1117 } 1271 1118 1272 #if NH_3D1273 Void TDecCavlc::parseSps3dExtension( TComSPS* pcSPS )1274 {1275 TComSps3dExtension sps3dExt;1276 UInt uiCode;1277 for( Int d = 0; d <= 1; d++ )1278 {1279 READ_FLAG( uiCode, "iv_di_mc_enabled_flag" ); sps3dExt.setIvDiMcEnabledFlag( d, uiCode == 1 );1280 READ_FLAG( uiCode, "iv_mv_scal_enabled_flag" ); sps3dExt.setIvMvScalEnabledFlag( d, uiCode == 1 );1281 if( d == 0 )1282 {1283 READ_UVLC( uiCode, "log2_sub_pb_size_minus3" ); sps3dExt.setLog2IvmcSubPbSizeMinus3( d, uiCode );1284 READ_FLAG( uiCode, "iv_res_pred_enabled_flag" ); sps3dExt.setIvResPredEnabledFlag( d, uiCode == 1 );1285 READ_FLAG( uiCode, "depth_ref_enabled_flag" ); sps3dExt.setDepthRefEnabledFlag( d, uiCode == 1 );1286 READ_FLAG( uiCode, "vsp_mc_enabled_flag" ); sps3dExt.setVspMcEnabledFlag( d, uiCode == 1 );1287 READ_FLAG( uiCode, "dbbp_enabled_flag" ); sps3dExt.setDbbpEnabledFlag( d, uiCode == 1 );1288 }1289 else1290 {1291 READ_FLAG( uiCode, "tex_mc_enabled_flag" ); sps3dExt.setTexMcEnabledFlag( d, uiCode == 1 );1292 READ_UVLC( uiCode, "log2_texmc_sub_pb_size_minus3" ); sps3dExt.setLog2TexmcSubPbSizeMinus3( d, uiCode );1293 READ_FLAG( uiCode, "intra_contour_enabled_flag" ); sps3dExt.setIntraContourEnabledFlag( d, uiCode == 1 );1294 READ_FLAG( uiCode, "intra_dc_only_wedge_enabled_flag" ); sps3dExt.setIntraDcOnlyWedgeEnabledFlag( d, uiCode == 1 );1295 READ_FLAG( uiCode, "cqt_cu_part_pred_enabled_flag" ); sps3dExt.setCqtCuPartPredEnabledFlag( d, uiCode == 1 );1296 READ_FLAG( uiCode, "inter_dc_only_enabled_flag" ); sps3dExt.setInterDcOnlyEnabledFlag( d, uiCode == 1 );1297 READ_FLAG( uiCode, "skip_intra_enabled_flag" ); sps3dExt.setSkipIntraEnabledFlag( d, uiCode == 1 );1298 }1299 }1300 pcSPS->setSps3dExtension( sps3dExt );1301 }1302 #endif1303 1119 1304 1120 Void TDecCavlc::parsePpsMultilayerExtension(TComPPS* pcPPS) … … 1482 1298 if (uiCode) 1483 1299 { 1484 #if NH_3D1485 READ_FLAG( uiCode, "vps_3d_extension_flag" );1486 if ( uiCode )1487 {1488 m_pcBitstream->readOutTrailingBits();1489 pcVPS->createCamPars(pcVPS->getNumViews());1490 parseVps3dExtension( pcVPS );1491 }1492 READ_FLAG( uiCode, "vps_extension3_flag" );1493 if (uiCode)1494 {1495 #endif1496 1300 #endif 1497 1301 while ( xMoreRbspData() ) … … 1500 1304 } 1501 1305 #if NH_MV 1502 #if NH_3D1503 }1504 #endif1505 1306 } 1506 1307 #endif … … 1587 1388 } 1588 1389 1589 #if NH_3D1590 pcVPS->initViewCompLayer( );1591 #endif1592 1390 1593 1391 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) … … 2178 1976 } 2179 1977 2180 #if NH_3D2181 Void TDecCavlc::parseVps3dExtension( TComVPS* pcVPS )2182 {2183 UInt uiCode;2184 READ_UVLC( uiCode, "cp_precision"); pcVPS->setCpPrecision( uiCode ) ;2185 2186 for (Int n = 1; n < pcVPS->getNumViews(); n++)2187 {2188 Int i = pcVPS->getViewOIdxList( n );2189 Int iInVps = pcVPS->getVoiInVps( i );2190 READ_CODE( 6, uiCode, "num_cp" ); pcVPS->setNumCp( iInVps, uiCode );2191 2192 if( pcVPS->getNumCp( iInVps ) > 0 )2193 {2194 READ_FLAG( uiCode, "cp_in_slice_segment_header_flag" ); pcVPS->setCpInSliceSegmentHeaderFlag( iInVps, uiCode == 1 );2195 for( Int m = 0; m < pcVPS->getNumCp( iInVps ); m++ )2196 {2197 READ_UVLC( uiCode, "cp_ref_voi" ); pcVPS->setCpRefVoi( iInVps, m, uiCode );2198 if( !pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) )2199 {2200 Int j = pcVPS->getCpRefVoi( iInVps, m );2201 Int jInVps = pcVPS->getVoiInVps( j );2202 Int iCode;2203 READ_SVLC( iCode, "vps_cp_scale" ); pcVPS->setVpsCpScale ( iInVps, jInVps, iCode );2204 READ_SVLC( iCode, "vps_cp_off" ); pcVPS->setVpsCpOff ( iInVps, jInVps, iCode );2205 READ_SVLC( iCode, "vps_cp_inv_scale_plus_scale" ); pcVPS->setVpsCpInvScale( iInVps, jInVps, iCode - pcVPS->getVpsCpScale( iInVps, jInVps ) );2206 READ_SVLC( iCode, "vps_cp_inv_off_plus_off" ); pcVPS->setVpsCpInvOff ( iInVps, jInVps, iCode - pcVPS->getVpsCpOff ( iInVps, jInVps ) );2207 }2208 }2209 }2210 }2211 pcVPS->deriveCpPresentFlag();2212 }2213 #endif2214 1978 #endif 2215 1979 … … 2304 2068 pcSlice->setViewId ( vps->getViewId ( pcSlice->getLayerId() ) ); 2305 2069 pcSlice->setViewIndex( vps->getViewIndex( pcSlice->getLayerId() ) ); 2306 #if NH_3D2307 pcSlice->setIsDepth ( vps->getDepthId ( pcSlice->getLayerId() ) == 1 );2308 #endif2309 2070 #endif 2310 2071 … … 2622 2383 Bool interLayerPredLayerIdcPresentFlag = false; 2623 2384 Int layerId = pcSlice->getLayerId(); 2624 #if NH_3D2625 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 )2626 #else2627 2385 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) 2628 #endif2629 2386 { 2630 2387 READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); pcSlice->setInterLayerPredEnabledFlag( uiCode == 1 ); 2631 #if NH_3D2632 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 )2633 #else2634 2388 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 ) 2635 #endif2636 2389 { 2637 2390 if( !vps->getMaxOneActiveRefLayerFlag()) … … 2639 2392 READ_CODE( pcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); pcSlice->setNumInterLayerRefPicsMinus1( uiCode ); 2640 2393 } 2641 #if NH_3D2642 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) )2643 #else2644 2394 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) ) 2645 #endif2646 2395 { 2647 2396 interLayerPredLayerIdcPresentFlag = true; … … 2660 2409 } 2661 2410 } 2662 #if NH_3D2663 if ( getDecTop()->decProcAnnexI() )2664 {2665 pcSlice->deriveInCmpPredAndCpAvailFlag( );2666 if ( pcSlice->getInCmpPredAvailFlag() )2667 {2668 READ_FLAG(uiCode, "in_comp_pred_flag"); pcSlice->setInCompPredFlag((Bool)uiCode);2669 }2670 pcSlice->init3dToolParameters();2671 }2672 #endif2673 2411 #endif 2674 2412 if(sps->getUseSAO()) … … 2877 2615 } 2878 2616 2879 #if NH_3D_IC2880 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE )2881 && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 02882 && getDecTop()->decProcAnnexI()2883 )2884 {2885 UInt uiCodeTmp = 0;2886 2887 READ_FLAG ( uiCodeTmp, "slice_ic_enable_flag" );2888 pcSlice->setApplyIC( uiCodeTmp );2889 2890 if ( uiCodeTmp )2891 {2892 READ_FLAG ( uiCodeTmp, "slice_ic_disabled_merge_zero_idx_flag" );2893 pcSlice->setIcSkipParseFlag( uiCodeTmp );2894 }2895 }2896 #endif2897 2617 2898 2618 if (!pcSlice->isIntra()) 2899 2619 { 2900 2620 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 2901 #if NH_3D_IV_MERGE2902 pcSlice->setMaxNumMergeCand(( ( pcSlice->getMpiFlag() || pcSlice->getIvMvPredFlag() || pcSlice->getViewSynthesisPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);2903 #else2904 2621 pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 2905 #endif2906 2622 } 2907 2623 … … 2994 2710 pcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); 2995 2711 2996 #if NH_3D2997 if ( getDecTop()->decProcAnnexI() )2998 {2999 Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() );3000 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )3001 {3002 for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ )3003 {3004 Int jInVps = vps->getVoiInVps( vps->getCpRefVoi( voiInVps, m ));3005 READ_SVLC( iCode, "cp_scale" ); pcSlice->setCpScale ( jInVps, iCode );3006 READ_SVLC( iCode, "cp_off" ); pcSlice->setCpOff ( jInVps, iCode );3007 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); pcSlice->setCpInvScale( jInVps, iCode - pcSlice->getCpScale ( jInVps ));3008 READ_SVLC( iCode, "cp_inv_off_plus_off" ); pcSlice->setCpInvOff ( jInVps, iCode - pcSlice->getCpOff ( jInVps ));3009 }3010 }3011 }3012 #endif3013 2712 3014 2713 } … … 3351 3050 } 3352 3051 3353 #if NH_3D_DIS3354 Void TDecCavlc::parseDIS( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )3355 {3356 assert(0);3357 }3358 #endif3359 3052 3360 3053 Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) … … 3493 3186 } 3494 3187 3495 #if NH_3D_ARP3496 Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3497 {3498 assert(0);3499 }3500 #endif3501 #if NH_3D_IC3502 Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3503 {3504 assert(0);3505 }3506 #endif3507 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER3508 Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3509 {3510 assert(0);3511 }3512 3513 #endif3514 #if NH_3D_DBBP3515 Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )3516 {3517 assert(0);3518 }3519 #endif3520 3188 // ==================================================================================================================== 3521 3189 // Protected member functions -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecCAVLC.h
r1321 r1390 94 94 Void setDecTop ( TDecTop* decTop ) { m_decTop = decTop; }; 95 95 #endif 96 #if NH_3D97 Void parseVps3dExtension ( TComVPS* pcVPS );98 Void parseSps3dExtension ( TComSPS* pcSPS );99 Void parsePps3dExtension ( TComPPS* pcPPS );100 #endif101 96 102 97 Void parseSPS ( TComSPS* pcSPS ); … … 121 116 122 117 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 123 #if NH_3D_DIS124 Void parseDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );125 #endif126 118 Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 127 119 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 128 120 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ); 129 #if NH_3D_ARP130 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );131 #endif132 #if NH_3D_IC133 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );134 #endif135 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER136 Void parseDeltaDC ( TComDataCU* /*pcCU*/, UInt /*absPartIdx*/, UInt /*depth*/ ) { assert(0); };137 #endif138 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER139 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );140 #endif141 #if NH_3D_DBBP142 Void parseDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );143 #endif144 121 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 145 122 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecCu.cpp
r1386 r1390 52 52 m_ppcYuvReco = NULL; 53 53 m_ppcCU = NULL; 54 #if NH_3D_DBBP55 m_ppcYuvRecoDBBP = NULL;56 #endif57 54 } 58 55 … … 81 78 m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; 82 79 m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; 83 #if NH_3D_DBBP84 m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1];85 #endif86 80 87 81 for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ ) … … 102 96 m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight, chromaFormatIDC ); 103 97 m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( chromaFormatIDC, uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); 104 #if NH_3D_DBBP105 m_ppcYuvRecoDBBP[ui] = new TComYuv; m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight, chromaFormatIDC );106 #endif107 98 } 108 99 … … 126 117 m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; 127 118 m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; 128 #if NH_3D_DBBP129 m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL;130 #endif131 119 } 132 120 … … 134 122 delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; 135 123 delete [] m_ppcCU ; m_ppcCU = NULL; 136 #if NH_3D_DBBP137 delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL;138 #endif139 124 } 140 125 … … 170 155 Void TDecCu::decompressCtu( TComDataCU* pCtu ) 171 156 { 172 #if !NH_3D_IV_MERGE173 157 xDecompressCU( pCtu, 0, 0 ); 174 #endif175 158 } 176 159 … … 290 273 pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP 291 274 } 292 #if NH_3D_NBDV293 DisInfo DvInfo;294 DvInfo.m_acNBDV.setZero();295 DvInfo.m_aVIdxCan = 0;296 #if NH_3D_NBDV_REF297 DvInfo.m_acDoNBDV.setZero();298 #endif299 300 if(!pcCU->getSlice()->isIntra())301 {302 #if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP303 if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )304 #else305 #if NH_3D_IV_MERGE && NH_3D_VSP306 if( pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )307 #else308 #if NH_3D_ARP && NH_3D_VSP309 if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )310 #else311 #if NH_3D_VSP312 if( pcCU->getSlice()->getViewSynthesisPredFlag() )313 #else314 #if H_3D_ARP315 if( pcCU->getSlice()->getIvResPredFlag( ) )316 #else317 #if H_3D_IV_MERGE318 if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) )319 #else320 #if NH_3D_DBBP321 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() )322 #else323 if (0)324 #endif325 #endif326 #endif327 #endif328 #endif329 #endif330 #endif331 {332 m_ppcCU[uiDepth]->copyInterPredInfoFrom(pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true);333 m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);334 PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);335 UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0);336 UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0);337 m_ppcCU[uiDepth]->setWidth (0, pcCU->getSlice()->getSPS()->getMaxCUWidth () / (1 << uiDepth));338 m_ppcCU[uiDepth]->setHeight(0, pcCU->getSlice()->getSPS()->getMaxCUHeight() / (1 << uiDepth));339 m_ppcCU[uiDepth]->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth);340 #if NH_3D_IV_MERGE341 if( pcCU->getSlice()->getIsDepth())342 {343 m_ppcCU[uiDepth]->getDispforDepth(0, 0, &DvInfo);344 }345 else346 {347 #endif348 #if NH_3D_NBDV_REF349 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() ) //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.350 {351 m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);352 }353 else354 #endif355 {356 m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);357 }358 #if NH_3D_IV_MERGE359 }360 #endif361 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC362 if ( g_decTraceDispDer )363 {364 DTRACE_CU( "RefViewIdx", DvInfo.m_aVIdxCan );365 DTRACE_CU( "MvDisp[x]", DvInfo.m_acNBDV.getHor() );366 DTRACE_CU( "MvDisp[y]", DvInfo.m_acNBDV.getVer() );367 DTRACE_CU( "MvRefinedDisp[x]", DvInfo.m_acDoNBDV.getHor() );368 DTRACE_CU( "MvRefinedDisp[y]", DvInfo.m_acDoNBDV.getVer() );369 }370 #endif371 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);372 m_ppcCU[uiDepth]->setPartSizeSubParts(ePartTemp, 0, uiDepth);373 m_ppcCU[uiDepth]->setWidth(0, cWidTemp);374 m_ppcCU[uiDepth]->setHeight(0, cHeightTemp);375 }376 }377 #endif378 275 379 276 if( uiDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth() && pcCU->getSlice()->getUseChromaQpAdj() ) … … 403 300 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 404 301 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 405 #if NH_3D_IV_MERGE406 m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);407 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists408 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];409 #else410 #if NH_3D_MLC411 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists412 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];413 #else414 302 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 415 303 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 416 #endif417 #endif418 304 Int numValidMergeCand = 0; 419 305 for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui ) … … 423 309 m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth ); 424 310 UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); 425 #if NH_3D_ARP 426 m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth ); 427 #endif 428 #if NH_3D_IC 429 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 430 #endif 431 432 433 #if NH_3D_VSP 434 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 435 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 436 #endif 437 #if NH_3D_SPIVMP 438 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 439 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 440 TComMvField* pcMvFieldSP; 441 UChar* puhInterDirSP; 442 pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2]; 443 puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()]; 444 #endif 445 446 #if NH_3D_MLC 447 m_ppcCU[uiDepth]->initAvailableFlags(); 448 #endif 311 312 313 449 314 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 450 #if NH_3D_MLC451 m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours452 #if NH_3D_SPIVMP453 , pcMvFieldSP, puhInterDirSP454 #endif455 , numValidMergeCand, uiMergeIndex );456 457 m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours458 #if NH_3D_VSP459 , vspFlag460 #endif461 #if NH_3D_SPIVMP462 , bSPIVMPFlag463 #endif464 , numValidMergeCand );465 #endif466 #if NH_3D_VSP467 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );468 #endif469 315 470 316 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); … … 479 325 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 480 326 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 481 #if NH_3D_VSP482 if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 )483 {484 if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )485 {486 UInt dummy;487 Int vspSize;488 Int width, height;489 m_ppcCU[uiDepth]->getPartIndexAndSize( uiAbsPartIdx, dummy, width, height );490 m_ppcCU[uiDepth]->setMvFieldPUForVSP( pcCU, uiAbsPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );491 pcCU->setVSPFlag( uiAbsPartIdx, vspSize );492 }493 }494 #endif495 327 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 496 328 if ( g_decTraceMvFromMerge ) … … 512 344 } 513 345 } 514 #if NH_3D_SPIVMP515 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );516 if (bSPIVMPFlag[uiMergeIndex])517 {518 UInt uiSPAddr;519 Int iWidth = pcCU->getWidth(uiAbsPartIdx);520 Int iHeight = pcCU->getHeight(uiAbsPartIdx);521 522 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;523 524 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);525 526 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)527 {528 pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);529 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);530 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);531 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);532 }533 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC534 if ( g_traceSubPBMotion )535 {536 std::cout << std::setfill(' ') << std::setw( 15 )537 << "Num" << std::setw( 15 )538 << "Dir " << std::setw( 15 )539 << "L0 RefIdx" << std::setw( 15 )540 << "L0 Hor" << std::setw( 15 )541 << "L0 Ver" << std::setw( 15 )542 << "L1 RefIdx" << std::setw( 15 )543 << "L1 Hor" << std::setw( 15 )544 << "L1 Ver" << std::setw( 15 )545 << std::endl;546 547 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)548 {549 UChar dir = puhInterDirSP[iPartitionIdx];550 TComMvField& mv0 = pcMvFieldSP [2*iPartitionIdx];551 TComMvField& mv1 = pcMvFieldSP [2*iPartitionIdx+1];552 553 std::cout << std::setfill(' ') << std::setw( 15 )554 << iPartitionIdx << std::setw( 15 )555 << (UInt) dir << std::setw( 15 )556 << ((dir & 1) ? mv0.getRefIdx() : MIN_INT) << std::setw( 15 )557 << ((dir & 1) ? mv0.getMv().getHor() : MIN_INT) << std::setw( 15 )558 << ((dir & 1) ? mv0.getMv().getVer() : MIN_INT) << std::setw( 15 )559 << ((dir & 2) ? mv1.getRefIdx() : MIN_INT) << std::setw( 15 )560 << ((dir & 2) ? mv1.getMv().getHor() : MIN_INT) << std::setw( 15 )561 << ((dir & 2) ? mv1.getMv().getVer() : MIN_INT) << std::setw( 15 )562 << std::endl;563 }564 }565 #endif566 }567 delete[] pcMvFieldSP;568 delete[] puhInterDirSP;569 #endif570 346 571 347 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); 572 #if NH_3D_IV_MERGE573 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );574 #endif575 348 576 349 return; 577 350 } 578 #if NH_3D_DIS579 m_pcEntropyDecoder->decodeDIS( pcCU, uiAbsPartIdx, uiDepth );580 if(!pcCU->getDISFlag(uiAbsPartIdx))581 {582 #endif583 351 584 352 m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); … … 591 359 if(pcCU->getIPCMFlag(uiAbsPartIdx)) 592 360 { 593 #if NH_3D_SDC_INTRA594 m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );595 #endif596 361 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); 597 #if NH_3D_IV_MERGE598 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );599 #endif600 362 return; 601 363 } … … 611 373 setIsChromaQpAdjCoded( isChromaQpAdjCoded ); 612 374 setdQPFlag( bCodeDQP ); 613 #if NH_3D_DIS614 }615 #endif616 375 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment ); 617 #if NH_3D_IV_MERGE618 xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );619 #endif620 376 } 621 377 … … 638 394 { 639 395 TComPic* pcPic = pCtu->getPic(); 640 #if !NH_3D_IV_MERGE641 396 TComSlice * pcSlice = pCtu->getSlice(); 642 397 const TComSPS &sps=*(pcSlice->getSPS()); … … 672 427 return; 673 428 } 674 #endif675 429 // Residual reconstruction 676 430 m_ppcYuvResi[uiDepth]->clear(); … … 681 435 { 682 436 case MODE_INTER: 683 #if NH_3D_DBBP684 if( m_ppcCU[uiDepth]->getDBBPFlag(0) )685 {686 xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );687 }688 else689 {690 #endif691 #if NH_3D_SDC_INTER692 if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) )693 {694 xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );695 }696 else697 {698 #endif699 437 xReconInter( m_ppcCU[uiDepth], uiDepth ); 700 #if NH_3D_SDC_INTER701 }702 #endif703 #if NH_3D_DBBP704 }705 #endif706 438 break; 707 439 case MODE_INTRA: 708 #if NH_3D709 #if NH_3D_DIS710 if( m_ppcCU[uiDepth]->getDISFlag(0) )711 {712 xReconDIS( m_ppcCU[uiDepth], 0, uiDepth );713 }714 #else715 if(false )716 {717 // xReconDIS( m_ppcCU[uiDepth], 0, uiDepth );718 }719 #endif720 #if NH_3D_SDC_INTRA721 else if( m_ppcCU[uiDepth]->getSDCFlag(0) )722 {723 xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );724 }725 #endif726 else727 #endif728 440 xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); 729 441 break; … … 794 506 } 795 507 796 #if NH_3D_DIS 797 Void TDecCu::xReconDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 798 { 799 UInt uiWidth = pcCU->getWidth ( 0 ); 800 UInt uiHeight = pcCU->getHeight ( 0 ); 801 802 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; 803 804 UInt uiStride = pcRecoYuv->getStride (COMPONENT_Y); 805 Pel* piReco = pcRecoYuv->getAddr( COMPONENT_Y, uiAbsPartIdx ); 806 807 808 AOF( uiWidth == uiHeight ); 809 AOF( uiAbsPartIdx == 0 ); 810 811 TComTURecurse rTu(pcCU, 0); 812 const ChromaFormat chFmt = rTu.GetChromaFormat(); 813 814 DEBUG_STRING_NEW(sTemp) 815 if ( pcCU->getDISType(uiAbsPartIdx) == 0 ) 816 { 817 const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, VER_IDX, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag()); 818 m_pcPrediction->initIntraPatternChType( rTu, COMPONENT_Y, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) ); 819 m_pcPrediction->predIntraAng( COMPONENT_Y, VER_IDX, 0 /* Decoder does not have an original image */, 0, piReco, uiStride, rTu, bUseFilteredPredictions ); 820 } 821 else if ( pcCU->getDISType(uiAbsPartIdx) == 1 ) 822 { 823 const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, HOR_IDX, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag()); 824 m_pcPrediction->initIntraPatternChType( rTu, COMPONENT_Y, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) ); 825 m_pcPrediction->predIntraAng( COMPONENT_Y, HOR_IDX, 0 /* Decoder does not have an original image */, 0, piReco, uiStride, rTu, bUseFilteredPredictions ); 826 } 827 else if ( pcCU->getDISType(uiAbsPartIdx) == 2 ) 828 { 829 Pel pSingleDepth = 1 << ( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 ); 830 pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 0 ); 831 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 832 { 833 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 834 { 835 piReco[ uiX ] = pSingleDepth; 836 } 837 piReco+= uiStride; 838 } 839 } 840 else if ( pcCU->getDISType(uiAbsPartIdx) == 3 ) 841 { 842 Pel pSingleDepth = 1 << ( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 ); 843 pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 1 ); 844 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 845 { 846 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 847 { 848 piReco[ uiX ] = pSingleDepth; 849 } 850 piReco+= uiStride; 851 } 852 } 853 854 // clear UV 855 UInt uiStrideC = pcRecoYuv->getStride(COMPONENT_Cb); 856 Pel *pRecCb = pcRecoYuv->getAddr(COMPONENT_Cb); 857 Pel *pRecCr = pcRecoYuv->getAddr(COMPONENT_Cr); 858 859 for (Int y=0; y<uiHeight/2; y++) 860 { 861 for (Int x=0; x<uiWidth/2; x++) 862 { 863 pRecCb[x] = 1<<(pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-1); 864 pRecCr[x] = 1<<(pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-1); 865 } 866 867 pRecCb += uiStrideC; 868 pRecCr += uiStrideC; 869 } 870 } 871 #endif 872 #if NH_3D_SDC_INTER 873 Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 874 { 875 // inter prediction 876 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); 877 878 UInt uiWidth = pcCU->getWidth ( 0 ); 879 UInt uiHeight = pcCU->getHeight( 0 ); 880 881 Pel *pResi; 882 UInt uiPelX, uiPelY; 883 UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride( COMPONENT_Y ); 884 Int bitDepthC = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA); 885 886 pResi = m_ppcYuvResi[uiDepth]->getAddr( COMPONENT_Y ); 887 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) 888 { 889 for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ ) 890 { 891 pResi[ uiPelX ] = pcCU->getSDCSegmentDCOffset( 0, 0 ); 892 } 893 pResi += uiResiStride; 894 } 895 896 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() ); 897 898 // clear UV 899 UInt uiStrideC = m_ppcYuvReco[uiDepth]->getStride( COMPONENT_Cb ); 900 Pel *pRecCb = m_ppcYuvReco[uiDepth]->getAddr( COMPONENT_Cb ); 901 Pel *pRecCr = m_ppcYuvReco[uiDepth]->getAddr( COMPONENT_Cr ); 902 903 for (Int y = 0; y < uiHeight/2; y++) 904 { 905 for (Int x = 0; x < uiWidth/2; x++) 906 { 907 pRecCb[x] = (Pel)( 1 << ( bitDepthC - 1 ) ); 908 pRecCr[x] = (Pel)( 1 << ( bitDepthC - 1 ) ); 909 } 910 911 pRecCb += uiStrideC; 912 pRecCr += uiStrideC; 913 } 914 } 915 #endif 916 917 #if NH_3D_DBBP 918 Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 919 { 920 AOF(!pcCU->getSlice()->getIsDepth()); 921 AOF(!pcCU->getSlice()->isIntra()); 922 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 923 924 Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 925 926 // get collocated depth block 927 UInt uiDepthStride = 0; 928 #if H_3D_FCO 929 Pel* pDepthPels = pcCU->getVirtualDepthBlock(pcCU->getZorderIdxInCU(), pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); 930 #else 931 Pel* pDepthPels = pcCU->getVirtualDepthBlock(0, pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride); 932 #endif 933 AOF( pDepthPels != NULL ); 934 AOF( uiDepthStride != 0 ); 935 936 // compute mask by segmenting depth block 937 Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE]; 938 Bool bValidMask = m_pcPrediction->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(0), pcCU->getHeight(0), pMask, pcCU); 939 AOF(bValidMask); 940 941 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 942 TComYuv* apSegPredYuv[2] = { m_ppcYuvReco[uiDepth], m_ppcYuvRecoDBBP[uiDepth] }; 943 944 // first, extract the two sets of motion parameters 945 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4; 946 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 947 { 948 UInt uiPartAddr = uiSegment*uiPUOffset; 949 950 pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr); 951 assert( pDBBPTmpData->auhInterDir[uiSegment] == 1 || pDBBPTmpData->auhInterDir[uiSegment] == 2 ); // only uni-prediction allowed 952 953 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 954 { 955 RefPicList eRefList = (RefPicList)uiRefListIdx; 956 pcCU->getMvField(pcCU, uiPartAddr, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]); 957 } 958 959 #if NH_3D 960 AOF( pcCU->getARPW(uiPartAddr) == 0 ); 961 AOF( pcCU->getICFlag(uiPartAddr) == false ); 962 AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false ); 963 AOF( pcCU->getVSPFlag(uiPartAddr) == 0 ); 964 #endif 965 } 966 967 // do motion compensation for each segment as 2Nx2N 968 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 969 pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); 970 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 971 { 972 pcCU->setInterDirSubParts( pDBBPTmpData->auhInterDir[uiSegment], 0, 0, uiDepth ); 973 974 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 975 { 976 RefPicList eRefList = (RefPicList)uiRefListIdx; 977 978 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], SIZE_2Nx2N, 0, 0 ); 979 } 980 981 // inter prediction 982 m_pcPrediction->motionCompensation( pcCU, apSegPredYuv[uiSegment] ); 983 } 984 985 // restore motion information in both segments again 986 pcCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); 987 pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth ); 988 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 989 { 990 UInt uiPartAddr = uiSegment*uiPUOffset; 991 992 pcCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uiDepth); 993 pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uiDepth); // interprets depth relative to LCU level 994 995 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 996 { 997 RefPicList eRefList = (RefPicList)uiRefListIdx; 998 999 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], ePartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level 1000 } 1001 } 1002 1003 // reconstruct final prediction signal by combining both segments 1004 m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize, bitDepthY); 1005 1006 // inter recon 1007 xDecodeInterTexture( pcCU, uiDepth ); 1008 1009 // clip for only non-zero cbp case 1010 if ( ( pcCU->getCbf( 0, COMPONENT_Y ) ) || ( pcCU->getCbf( 0, COMPONENT_Cb ) ) || ( pcCU->getCbf(0, COMPONENT_Cr ) ) ) 1011 { 1012 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() ); 1013 } 1014 else 1015 { 1016 m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); 1017 } 1018 } 1019 #endif 508 1020 509 1021 510 … … 1081 570 1082 571 //===== get prediction signal ===== 1083 #if NH_3D_DMM1084 if( bIsLuma && isDmmMode( uiChFinalMode ) )1085 {1086 m_pcPrediction->predIntraLumaDmm( pcCU, uiAbsPartIdx, getDmmType( uiChFinalMode ), piPred, uiStride, uiWidth, uiHeight );1087 }1088 else1089 {1090 #endif1091 572 m_pcPrediction->predIntraAng( compID, uiChFinalMode, 0 /* Decoder does not have an original image */, 0, piPred, uiStride, rTu, bUseFilteredPredictions ); 1092 #if NH_3D_DMM1093 }1094 #endif1095 573 1096 574 #if DEBUG_STRING … … 1110 588 std::string *psDebug=(DebugOptionList::DebugString_InvTran.getInt()&debugPredModeMask) ? &sDebug : 0; 1111 589 #endif 1112 #if H_3D1113 Bool useDltFlag = (isDmmMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps());1114 1115 if ( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) || useDltFlag )1116 #else1117 590 if (pcCU->getCbf(uiAbsPartIdx, compID, rTu.GetTransformDepthRel()) != 0) 1118 #endif1119 591 { 1120 592 m_pcTrQuant->invTransformNxN( rTu, compID, piResi, uiStride, pcCoeff, cQP DEBUG_STRING_PASS_INTO(psDebug) ); … … 1255 727 } 1256 728 1257 #if NH_3D_SDC_INTRA1258 Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )1259 {1260 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth];1261 TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth];1262 TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth];1263 1264 UInt uiWidth = pcCU->getWidth ( 0 );1265 UInt uiHeight = pcCU->getHeight( 0 );1266 UInt uiLumaPredMode = pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx );1267 const Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);1268 const TComSPS &sps = *(pcCU->getSlice()->getSPS());1269 const ChromaFormat chFmt = pcCU->getPic()->getChromaFormat();1270 1271 UInt sdcDepth = 0;1272 UInt uiStride;1273 Pel* piReco;1274 Pel* piPred;1275 Pel* piResi;1276 1277 Pel* piRecIPred;1278 UInt uiRecIPredStride;1279 1280 Pel apDCPredValues[2];1281 UInt uiNumSegments;1282 1283 Bool* pbMask = NULL;1284 UInt uiMaskStride = 0;1285 1286 #if NH_3D_DMM1287 if( isDmmMode( uiLumaPredMode ) )1288 {1289 assert( uiWidth == uiHeight );1290 assert( uiWidth >= DMM_MIN_SIZE && uiWidth <= DMM_MAX_SIZE );1291 assert( !((uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()) > 1) );1292 1293 uiNumSegments = 2;1294 1295 uiStride = pcRecoYuv->getStride( COMPONENT_Y );1296 piReco = pcRecoYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );1297 piPred = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );1298 piResi = pcResiYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );1299 1300 piRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr ( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx );1301 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride( COMPONENT_Y );1302 1303 //===== init availability pattern =====1304 TComTURecurse tuRecurseCU(pcCU, 0);1305 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, TComTU::DONT_SPLIT);1306 1307 DEBUG_STRING_NEW(sTemp)1308 m_pcPrediction->initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, false DEBUG_STRING_PASS_INTO(sTemp) );1309 1310 // get partition1311 pbMask = new Bool[ uiWidth*uiHeight ];1312 uiMaskStride = uiWidth;1313 switch( getDmmType( uiLumaPredMode ) )1314 {1315 case( DMM1_IDX ): { (getWedgeListScaled( uiWidth )->at( pcCU->getDmm1WedgeTabIdx( uiAbsPartIdx ) )).getPatternScaledCopy( uiWidth, pbMask ); } break;1316 case( DMM4_IDX ): { m_pcPrediction->predContourFromTex( pcCU, uiAbsPartIdx, uiWidth, uiHeight, pbMask ); } break;1317 default: assert(0);1318 }1319 1320 // get predicted partition values1321 Pel predDC1 = 0, predDC2 = 0;1322 m_pcPrediction->predBiSegDCs( pcCU, uiAbsPartIdx, uiWidth, uiHeight, pbMask, uiMaskStride, predDC1, predDC2 );1323 1324 // set prediction signal1325 Pel* pDst = piPred;1326 m_pcPrediction->assignBiSegDCs( pDst, uiStride, pbMask, uiMaskStride, predDC1, predDC2 );1327 apDCPredValues[0] = predDC1;1328 apDCPredValues[1] = predDC2;1329 }1330 else // regular HEVC intra modes1331 {1332 #endif1333 uiNumSegments = 1;1334 1335 if( ( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1 )1336 {1337 sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();1338 }1339 1340 //===== loop over partitions =====1341 TComTURecurse tuRecurseCU(pcCU, 0);1342 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, (sdcDepth==0)?TComTU::DONT_SPLIT:TComTU::QUAD_SPLIT);1343 1344 do1345 {1346 const TComRectangle &puRect = tuRecurseWithPU.getRect(COMPONENT_Y);1347 const UInt uiAbsPartIdxTU = tuRecurseWithPU.GetAbsPartIdxTU();1348 1349 Pel* piPredTU = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdxTU );1350 UInt uiStrideTU = pcPredYuv->getStride( COMPONENT_Y );1351 1352 Pel* piRecIPredTU = pcCU->getPic()->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdxTU );1353 UInt uiRecIPredStrideTU = pcCU->getPic()->getPicYuvRec()->getStride(COMPONENT_Y);1354 1355 const Bool bUseFilter = TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiLumaPredMode, puRect.width, puRect.height, chFmt, sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag());1356 1357 //===== init pattern for luma prediction =====1358 DEBUG_STRING_NEW(sTemp)1359 m_pcPrediction->initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, bUseFilter DEBUG_STRING_PASS_INTO(sTemp) );1360 1361 m_pcPrediction->predIntraAng( COMPONENT_Y, uiLumaPredMode, NULL, uiStrideTU, piPredTU, uiStrideTU, tuRecurseWithPU, bUseFilter );1362 1363 // copy for prediction of next part1364 for( UInt uiY = 0; uiY < puRect.height; uiY++ )1365 {1366 for( UInt uiX = 0; uiX < puRect.width; uiX++ )1367 {1368 piPredTU [ uiX ] = ClipBD( piPredTU[ uiX ], bitDepthY );1369 piRecIPredTU [ uiX ] = piPredTU[ uiX ];1370 }1371 piPredTU += uiStrideTU;1372 piRecIPredTU += uiRecIPredStrideTU;1373 }1374 1375 1376 } while (tuRecurseWithPU.nextSection(tuRecurseCU));1377 1378 // reset to full block1379 uiWidth = pcCU->getWidth( 0 );1380 uiHeight = pcCU->getHeight( 0 );1381 1382 uiStride = pcRecoYuv->getStride( COMPONENT_Y );1383 piReco = pcRecoYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );1384 piPred = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );1385 piResi = pcResiYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );1386 1387 piRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr ( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx );1388 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride( COMPONENT_Y );1389 1390 m_pcPrediction->predConstantSDC( piPred, uiStride, uiWidth, apDCPredValues[0] ); apDCPredValues[1] = 0;1391 #if NH_3D_DMM1392 }1393 #endif1394 1395 // reconstruct residual based on mask + DC residuals1396 Pel apDCResiValues[2];1397 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )1398 {1399 #if NH_3D_DLT1400 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );1401 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);1402 Pel pRecoValue = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );1403 1404 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment];1405 #else1406 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);1407 #endif1408 }1409 1410 //===== reconstruction =====1411 Bool*pMask = pbMask;1412 Pel* pPred = piPred;1413 Pel* pResi = piResi;1414 Pel* pReco = piReco;1415 Pel* pRecIPred = piRecIPred;1416 1417 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1418 {1419 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1420 {1421 UChar ucSegment = pMask?(UChar)pMask[uiX]:0;1422 assert( ucSegment < uiNumSegments );1423 1424 Pel pResiDC = apDCResiValues[ucSegment];1425 1426 pReco [ uiX ] = ClipBD( pPred[ uiX ] + pResiDC, bitDepthY );1427 pRecIPred[ uiX ] = pReco[ uiX ];1428 }1429 pPred += uiStride;1430 pResi += uiStride;1431 pReco += uiStride;1432 pRecIPred += uiRecIPredStride;1433 pMask += uiMaskStride;1434 }1435 1436 // clear chroma1437 UInt uiStrideC = pcPredYuv->getStride( COMPONENT_Cb );1438 Pel *pRecCb = pcPredYuv->getAddr ( COMPONENT_Cb, uiAbsPartIdx );1439 Pel *pRecCr = pcPredYuv->getAddr ( COMPONENT_Cr, uiAbsPartIdx );1440 1441 for (Int y=0; y<uiHeight/2; y++)1442 {1443 for (Int x=0; x<uiWidth/2; x++)1444 {1445 pRecCb[x] = 128;1446 pRecCr[x] = 128;1447 }1448 1449 pRecCb += uiStrideC;1450 pRecCr += uiStrideC;1451 }1452 #if NH_3D_DMM1453 if( pbMask ) { delete[] pbMask; }1454 #endif1455 }1456 #endif1457 729 1458 730 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecCu.h
r1313 r1390 62 62 TComDataCU** m_ppcCU; ///< CU data array 63 63 64 #if NH_3D_DBBP65 TComYuv** m_ppcYuvRecoDBBP;66 #endif67 64 68 65 // access channel … … 102 99 Void xReconInter ( TComDataCU* pcCU, UInt uiDepth ); 103 100 104 #if NH_3D_DBBP105 Void xReconInterDBBP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );106 #endif107 101 108 102 Void xReconIntraQT ( TComDataCU* pcCU, UInt uiDepth ); … … 124 118 Void xFillPCMBuffer (TComDataCU* pCU, UInt depth); 125 119 126 #if NH_3D_DIS127 Void xReconDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );128 #endif129 #if NH_3D_SDC_INTRA130 Void xReconIntraSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );131 #endif132 #if NH_3D_SDC_INTER133 Void xReconInterSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );134 #endif135 120 136 121 }; -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecEntropy.cpp
r1386 r1390 60 60 m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); 61 61 } 62 #if NH_3D_DIS63 Void TDecEntropy::decodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )64 {65 if( !pcCU->getSlice()->getDepthIntraSkipFlag() )66 {67 return;68 }69 m_pcEntropyDecoderIf->parseDIS( pcCU, uiAbsPartIdx, uiDepth );70 }71 #endif72 62 73 63 Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) … … 104 94 } 105 95 106 #if NH_3D_ARP 107 Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 108 { 109 if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) 110 { 111 return; 112 } 113 114 if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) 115 { 116 pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); 117 } 118 else 119 { 120 m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); 121 } 122 } 123 #endif 124 125 #if NH_3D_IC 126 Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 127 { 128 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); 129 130 #if NH_3D_ARP 131 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 ) 132 #else 133 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() ) 134 #endif 135 { 136 return; 137 } 138 139 if( !pcCU->getSlice()->getApplyIC() ) 140 return; 141 142 if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) 143 m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); 144 } 145 #endif 96 146 97 147 98 Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) … … 165 116 { 166 117 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 167 #if NH_3D_SDC_INTRA168 decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth );169 #endif170 118 if (pcCU->getPic()->getChromaFormat()!=CHROMA_400) 171 119 { … … 239 187 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4; 240 188 241 #if NH_3D_MLC242 //#if H_3D_IV_MERGE243 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists244 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];245 #else246 189 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 247 190 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 248 #endif249 #if NH_3D_SPIVMP250 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];251 TComMvField* pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];252 UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];253 #endif254 #if NH_3D_IV_MERGE255 pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);256 #endif257 191 for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) 258 192 { … … 264 198 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 265 199 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 266 #if NH_3D267 200 for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) 268 201 { … … 273 206 //DTRACE_PU("x1", uiTPelY) 274 207 #endif 275 276 ////// Parse PUs syntax277 208 decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); 278 209 if ( pcCU->getMergeFlag( uiSubPartIdx ) ) 279 210 { 280 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); 281 } 282 else 283 { 284 decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); 285 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 286 { 287 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 288 { 289 decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 290 decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 291 decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 292 } 293 } 294 } 295 } 296 297 ////// Parse CUs extension syntax 298 #if NH_3D_DBBP 299 decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth ); 300 #endif 301 #if NH_3D_SDC_INTER 302 decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); 303 #endif 304 #if NH_3D_ARP 305 decodeARPW ( pcCU, uiAbsPartIdx, uiDepth ); 306 #endif 307 #if NH_3D_IC 308 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 309 #endif 310 311 ////// Decode motion vectors 312 for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) 313 { 314 if ( pcCU->getMergeFlag( uiSubPartIdx ) ) 315 { 316 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 211 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); 317 212 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 318 213 if (bDebugPredEnabled) … … 323 218 #endif 324 219 325 #if NH_3D_DBBP 326 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false ) 327 #else 328 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 329 #endif 220 const UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 221 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 330 222 { 331 223 if ( !hasMergedCandList ) … … 333 225 pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set. 334 226 335 #if NH_3D_MLC336 #if NH_3D_VSP337 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];338 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);339 #endif340 #if NH_3D_SPIVMP341 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);342 #endif343 pcSubCU->initAvailableFlags();344 #endif345 227 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 346 #if NH_3D_MLC347 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours348 #if NH_3D_SPIVMP349 , pcMvFieldSP, puhInterDirSP350 #endif351 , numValidMergeCand );352 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours353 #if NH_3D_VSP354 , vspFlag355 #endif356 #if NH_3D_SPIVMP357 , bSPIVMPFlag358 #endif359 , numValidMergeCand );360 #if NH_3D_VSP361 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );362 #endif363 #endif364 228 pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore. 365 229 hasMergedCandList = true; … … 368 232 else 369 233 { 370 #if NH_3D_MLC 371 #if NH_3D_VSP 372 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 373 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 374 #endif 375 #if NH_3D_SPIVMP 376 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 377 #endif 378 pcSubCU->initAvailableFlags(); 379 #endif 234 380 235 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 381 #if NH_3D_MLC 382 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours 383 #if NH_3D_SPIVMP 384 , pcMvFieldSP, puhInterDirSP 385 #endif 386 ,numValidMergeCand, uiMergeIndex ); 387 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours 388 #if NH_3D_VSP 389 , vspFlag 390 #endif 391 #if NH_3D_SPIVMP 392 , bSPIVMPFlag 393 #endif 394 ,numValidMergeCand ); 395 #if NH_3D_VSP 396 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 397 #endif 398 #endif 399 } 236 } 237 400 238 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 401 239 … … 409 247 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 410 248 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 411 #if NH_3D_VSP412 #if NH_3D_DBBP413 if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )414 #else415 if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )416 #endif417 {418 if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )419 {420 UInt dummy;421 Int vspSize;422 Int width, height;423 pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );424 pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );425 pcCU->setVSPFlag( uiSubPartIdx, vspSize );426 }427 }428 #endif429 249 } 430 250 } 431 #if NH_3D_SPIVMP432 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );433 if (bSPIVMPFlag[uiMergeIndex] != 0)434 {435 Int iWidth, iHeight;436 UInt uiIdx;437 pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );438 439 UInt uiSPAddr;440 441 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;442 443 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);444 445 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)446 {447 pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);448 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);449 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);450 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);451 }452 }453 #endif454 251 } 455 252 else 456 253 { 254 decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); 457 255 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 458 { 256 { 459 257 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 460 258 { 461 decodeMvsAMVP ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 259 decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 260 decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 261 decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); 462 262 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 463 263 if (bDebugPredEnabled) … … 471 271 #endif 472 272 } 473 } 273 } 474 274 } 475 275 … … 481 281 } 482 282 } 483 #else484 for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )485 {486 #if NH_MV_ENC_DEC_TRAC487 DTRACE_PU_S("=========== prediction_unit ===========\n")488 // ToDo:489 //DTRACE_PU("x0", uiLPelX)490 //DTRACE_PU("x1", uiTPelY)491 #endif492 decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );493 if ( pcCU->getMergeFlag( uiSubPartIdx ) )494 {495 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );496 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST497 if (bDebugPredEnabled)498 {499 std::cout << "Coded merge flag, CU absPartIdx: " << uiAbsPartIdx << " PU(" << uiPartIdx << ") absPartIdx: " << uiSubPartIdx;500 std::cout << " merge index: " << (UInt)pcCU->getMergeIndex(uiSubPartIdx) << std::endl;501 }502 #endif503 #if NH_3D_IC504 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );505 #endif506 507 const UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);508 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )509 {510 if ( !hasMergedCandList )511 {512 pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.513 514 #if NH_3D_MLC515 #if NH_3D_VSP516 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];517 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);518 #endif519 #if NH_3D_SPIVMP520 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);521 #endif522 pcSubCU->initAvailableFlags();523 #endif524 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );525 #if NH_3D_MLC526 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours527 #if NH_3D_SPIVMP528 , pcMvFieldSP, puhInterDirSP529 #endif530 , numValidMergeCand );531 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours532 #if NH_3D_VSP533 , vspFlag534 #endif535 #if NH_3D_SPIVMP536 , bSPIVMPFlag537 #endif538 , numValidMergeCand );539 #if NH_3D_VSP540 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );541 #endif542 #endif543 pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.544 hasMergedCandList = true;545 }546 }547 else548 {549 550 #if NH_3D_MLC551 #if NH_3D_VSP552 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];553 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);554 #endif555 #if NH_3D_SPIVMP556 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);557 #endif558 pcSubCU->initAvailableFlags();559 #endif560 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );561 #if NH_3D_MLC562 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours563 #if NH_3D_SPIVMP564 , pcMvFieldSP, puhInterDirSP565 #endif566 ,numValidMergeCand, uiMergeIndex );567 pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours568 #if NH_3D_VSP569 , vspFlag570 #endif571 #if NH_3D_SPIVMP572 , bSPIVMPFlag573 #endif574 ,numValidMergeCand );575 #if NH_3D_VSP576 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );577 #endif578 #endif579 }580 581 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );582 583 TComMv cTmpMv( 0, 0 );584 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )585 {586 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )587 {588 pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth);589 pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth);590 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );591 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );592 #if NH_3D_VSP593 if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )594 {595 if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )596 {597 UInt dummy;598 Int vspSize;599 Int width, height;600 pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );601 pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );602 pcCU->setVSPFlag( uiSubPartIdx, vspSize );603 }604 }605 #endif606 }607 }608 #if NH_3D_SPIVMP609 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );610 if (bSPIVMPFlag[uiMergeIndex] != 0)611 {612 Int iWidth, iHeight;613 UInt uiIdx;614 pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );615 616 UInt uiSPAddr;617 618 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;619 620 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);621 622 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)623 {624 pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);625 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);626 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);627 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);628 }629 }630 #endif631 }632 else633 {634 decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );635 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )636 {637 if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )638 {639 decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );640 decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );641 decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );642 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST643 if (bDebugPredEnabled)644 {645 std::cout << "refListIdx: " << uiRefListIdx << std::endl;646 std::cout << "MVD horizontal: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getHor() << std::endl;647 std::cout << "MVD vertical: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getVer() << std::endl;648 std::cout << "MVPIdxPU: " << pcCU->getMVPIdx(RefPicList( uiRefListIdx ), uiSubPartIdx) << std::endl;649 std::cout << "InterDir: " << (UInt)pcCU->getInterDir(uiSubPartIdx) << std::endl;650 }651 #endif652 }653 }654 #if NH_3D_IC655 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );656 #endif657 }658 659 if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) )660 {661 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx);662 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx);663 pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth);664 }665 }666 #endif667 #if NH_3D_SPIVMP668 delete[] pcMvFieldSP;669 delete[] puhInterDirSP;670 #endif671 283 return; 672 284 } … … 733 345 } 734 346 735 #if NH_3D736 347 Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) 737 348 { 738 349 Int iMVPIdx = -1; 350 351 TComMv cZeroMv( 0, 0 ); 352 TComMv cMv = cZeroMv; 353 Int iRefIdx = -1; 354 355 TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); 356 AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); 357 358 iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); 359 cMv = cZeroMv; 739 360 740 361 if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) … … 754 375 #endif 755 376 } 756 pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth );757 }758 759 Void TDecEntropy::decodeMvsAMVP( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )760 {761 TComMv cZeroMv( 0, 0 );762 TComMv cMv = cZeroMv;763 Int iRefIdx = -1;764 765 TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList );766 AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo();767 768 iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr);769 cMv = cZeroMv;770 771 pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo);772 pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth);773 if ( iRefIdx >= 0 )774 {775 m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv);776 cMv += pcSubCUMvField->getMvd( uiPartAddr );777 }778 779 PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr );780 pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx);781 }782 #else783 Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )784 {785 Int iMVPIdx = -1;786 787 TComMv cZeroMv( 0, 0 );788 TComMv cMv = cZeroMv;789 Int iRefIdx = -1;790 791 TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList );792 AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo();793 794 iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr);795 cMv = cZeroMv;796 797 if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) )798 {799 m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx );800 #if NH_MV_ENC_DEC_TRAC801 #if ENC_DEC_TRACE802 if ( eRefList == REF_PIC_LIST_0 )803 {804 DTRACE_PU("mvp_l0_flag", iMVPIdx)805 }806 else807 {808 DTRACE_PU("mvp_l1_flag", iMVPIdx)809 }810 #endif811 #endif812 }813 377 pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); 814 378 pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); … … 823 387 pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); 824 388 } 825 #endif826 389 827 390 Void TDecEntropy::xDecodeTransform ( Bool& bCodeDQP, Bool& isChromaQpAdjCoded, TComTU &rTu, const Int quadtreeTULog2MinSizeInCU ) … … 1085 648 Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool& bCodeDQP, Bool& isChromaQpAdjCoded ) 1086 649 { 1087 #if NH_3D_SDC_INTRA1088 if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) )1089 {1090 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );1091 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );1092 assert( pcCU->getCbf(uiAbsPartIdx, COMPONENT_Y) == 1 );1093 }1094 #endif1095 #if NH_3D_SDC_INTER1096 if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) )1097 {1098 assert( !pcCU->isSkipped( uiAbsPartIdx ) );1099 assert( !pcCU->isIntra( uiAbsPartIdx) );1100 assert( pcCU->getSlice()->getIsDepth() );1101 }1102 #endif1103 #if NH_3D1104 if( pcCU->getSlice()->getIsDepth() )1105 {1106 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER1107 if( pcCU->getSDCFlag( uiAbsPartIdx ) )1108 {1109 m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx, uiDepth );1110 return;1111 }1112 #endif1113 #if NH_3D_DMM1114 if( pcCU->isIntra( uiAbsPartIdx ) )1115 {1116 Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;1117 UInt uiPartOffset = ( pcCU->getPic()->getNumPartitionsInCtu() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;1118 for( Int iPart = 0; iPart < iPartNum; iPart++ )1119 {1120 if( isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx + uiPartOffset*iPart ) ) )1121 {1122 m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) );1123 }1124 }1125 }1126 #endif1127 }1128 #endif1129 650 1130 651 if( pcCU->isIntra(uiAbsPartIdx) ) … … 1162 683 } 1163 684 1164 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER1165 Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )1166 {1167 pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );1168 if ( pcCU->isSkipped( uiAbsPartIdx ) )1169 {1170 return;1171 }1172 1173 1174 if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getInterSdcFlag() ) ||1175 ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getIntraSdcWedgeFlag() ) )1176 {1177 return;1178 }1179 1180 if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )1181 {1182 return;1183 }1184 1185 assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );1186 m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth );1187 }1188 #endif1189 #if NH_3D_DBBP1190 Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )1191 {1192 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )1193 {1194 m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );1195 }1196 }1197 #endif1198 685 1199 686 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecEntropy.h
r1321 r1390 81 81 public: 82 82 virtual Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 83 #if NH_3D_DIS84 virtual Void parseDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;85 #endif86 83 virtual Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 87 84 virtual Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 88 85 virtual Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0; 89 86 virtual Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ) = 0; 90 #if NH_3D_ARP91 virtual Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;92 #endif93 #if NH_3D_IC94 virtual Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;95 #endif96 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER97 virtual Void parseDeltaDC ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) = 0;98 #endif99 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER100 virtual Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;101 #endif102 #if NH_3D_DBBP103 virtual Void parseDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;104 #endif105 87 virtual Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 106 88 virtual Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; … … 150 132 Void decodeMvdPU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ); 151 133 Void decodeMVPIdxPU ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ); 152 #if NH_3D153 Void decodeMvsAMVP ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx,154 RefPicList eRefList );155 #endif156 134 Void setEntropyDecoder ( TDecEntropyIf* p ); 157 135 Void setBitstream ( TComInputBitstream* p ) { m_pcEntropyDecoderIf->setBitstream(p); } … … 177 155 Void decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 178 156 Void decodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 179 #if NH_3D_DIS180 Void decodeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) ;181 #endif182 157 Void decodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 183 158 Void decodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); … … 186 161 Void decodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 187 162 188 #if NH_3D_ARP189 Void decodeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );190 #endif191 #if NH_3D_IC192 Void decodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );193 #endif194 163 195 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER196 Void decodeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );197 #endif198 #if NH_3D_DBBP199 Void decodeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );200 #endif201 164 Void decodeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 202 165 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecGop.cpp
r1386 r1390 122 122 } 123 123 124 #if NH_3D_NBDV125 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.126 {127 Int iColPoc = pcSlice->getRefPOC(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());128 pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc));129 }130 131 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.132 {133 pcPic->checkTemporalIVRef();134 }135 136 if(pcSlice->getIsDepth())137 {138 pcPic->checkTextureRef();139 }140 #endif141 #if NH_3D142 pcSlice->setDepthToDisparityLUTs();143 #endif144 124 145 125 m_pcSliceDecoder->decompressSlice( ppcSubstreams, pcPic, m_pcSbacDecoder); … … 172 152 m_pcSAO->PCMLFDisableProcess(pcPic); 173 153 } 174 #if NH_3D175 pcPic->compressMotion(2);176 #else177 154 pcPic->compressMotion(); 178 #endif179 155 TChar c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 180 156 if (!pcSlice->isReferenced()) -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecSbac.cpp
r1386 r1390 67 67 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 68 68 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 69 #if NH_3D_DIS70 , m_cCUDISFlagSCModel ( 1, 1, NUM_DIS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)71 , m_cCUDISTypeSCModel ( 1, 1, NUM_DIS_TYPE_CTX , m_contextModels + m_numContextModels, m_numContextModels)72 #endif73 69 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 74 70 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 75 #if NH_3D_ARP76 , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels)77 #endif78 #if NH_3D_IC79 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)80 #endif81 71 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 82 72 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 107 97 , m_ChromaQpAdjIdcSCModel ( 1, 1, NUM_CHROMA_QP_ADJ_IDC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 108 98 109 #if NH_3D_DMM110 , m_cNotDmmFlagSCModel ( 1, 1, NUM_NOTDMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)111 , m_cDmmModeSCModel ( 1, 1, NUM_DMM_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels)112 #endif113 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER114 , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)115 , m_cSDCFlagSCModel ( 1, 1, NUM_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)116 #endif117 #if NH_3D_SDC_INTRA118 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)119 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels)120 , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)121 #endif122 #if NH_3D_DBBP123 , m_cDBBPFlagSCModel ( 1, 1, DBBP_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)124 #endif125 99 126 100 { … … 159 133 m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 160 134 m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); 161 #if NH_3D_DIS162 m_cCUDISFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DIS_FLAG );163 m_cCUDISTypeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DIS_TYPE );164 #endif165 135 m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); 166 136 m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); 167 #if NH_3D_ARP168 m_cCUPUARPWSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW );169 #endif170 #if NH_3D_IC171 m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG );172 #endif173 137 m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); 174 138 m_cCUPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PRED_MODE ); … … 198 162 m_ChromaQpAdjFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CHROMA_QP_ADJ_FLAG ); 199 163 m_ChromaQpAdjIdcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CHROMA_QP_ADJ_IDC ); 200 #if NH_3D_DMM201 m_cNotDmmFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_NOTDMM_FLAG );202 m_cDmmModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_MODE );203 #endif204 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER205 m_cDdcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_DATA );206 m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG );207 #endif208 #if NH_3D_SDC_INTRA209 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG );210 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL );211 m_cDdcFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_FLAG );212 #endif213 #if NH_3D_DBBP214 m_cDBBPFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DBBP_FLAG );215 #endif216 164 217 165 for (UInt statisticIndex = 0; statisticIndex < RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS ; statisticIndex++) … … 512 460 513 461 } 514 #if NH_3D_DIS515 Void TDecSbac::parseDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )516 {517 pcCU->setDISFlagSubParts( false, uiAbsPartIdx, uiDepth );518 UInt uiSymbol = 0;519 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUDISFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__SKIP_FLAG) );520 if( uiSymbol )521 {522 pcCU->setDISFlagSubParts( true, uiAbsPartIdx, uiDepth );523 pcCU->setSkipFlagSubParts( false, uiAbsPartIdx, uiDepth );524 pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );525 pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth );526 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );527 pcCU->setIntraDirSubParts(CHANNEL_TYPE_LUMA, DC_IDX, uiAbsPartIdx, uiDepth );528 pcCU->setSizeSubParts( pcCU->getSlice()->getSPS()->getMaxCUWidth()>>uiDepth, pcCU->getSlice()->getSPS()->getMaxCUHeight()>>uiDepth, uiAbsPartIdx, uiDepth );529 pcCU->setMergeFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );530 pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);531 pcCU->setCbfSubParts(0, COMPONENT_Y, uiAbsPartIdx, uiDepth);532 533 UInt uiUnaryIdx = 0;534 UInt uiNumCand = 4;535 536 if ( uiNumCand > 1 )537 {538 for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx )539 {540 UInt uiSymbol2 = 0;541 if ( uiUnaryIdx==0 )542 {543 m_pcTDecBinIf->decodeBin( uiSymbol2, m_cCUDISTypeSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__SKIP_FLAG) );544 }545 else546 {547 m_pcTDecBinIf->decodeBinEP( uiSymbol2 RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__SKIP_FLAG));548 }549 if( uiSymbol2 == 0 )550 {551 break;552 }553 }554 }555 pcCU->setDISTypeSubParts((UChar)uiUnaryIdx, uiAbsPartIdx, uiDepth);556 }557 }558 #endif559 462 560 463 … … 642 545 643 546 UInt uiSymbol; 644 #if NH_3D_QTLPC645 Bool bParseSplitFlag = true;646 Bool bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();647 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();648 Bool bDepthMapDetect = (pcTexture != NULL);649 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);650 651 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);652 653 #if H_3D_FCO654 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark())655 #else656 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag)657 #endif658 {659 TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());660 assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth);661 bParseSplitFlag = (pcTextureCU->getDepth(uiAbsPartIdx) > uiDepth);662 }663 664 if(bParseSplitFlag)665 {666 #endif667 547 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) ); 668 548 #if NH_MV_ENC_DEC_TRAC … … 671 551 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 672 552 DTRACE_CABAC_T( "\tSplitFlag\n" ) 673 #endif674 #if NH_3D_QTLPC675 }676 else677 {678 uiSymbol = 0;679 }680 553 #endif 681 554 pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx ); … … 704 577 assert ( pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize() == log2DiffMaxMinCodingBlockSize); 705 578 706 #if NH_3D_QTLPC707 Bool bParsePartSize = true;708 709 Bool bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();710 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();711 Bool bDepthMapDetect = (pcTexture != NULL);712 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);713 714 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);715 716 Bool depthDependent = false;717 UInt uiTexturePart = uiMode;718 719 #if H_3D_FCO720 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark())721 #else722 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag )723 #endif724 {725 TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());726 assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth);727 if(pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth )728 {729 depthDependent = true;730 uiTexturePart = pcTextureCU->getPartitionSize( uiAbsPartIdx );731 }732 if (pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth && pcTextureCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N)733 {734 bParsePartSize = false;735 eMode = SIZE_2Nx2N;736 }737 }738 #endif739 579 740 580 if ( pcCU->isIntra( uiAbsPartIdx ) ) 741 581 { 742 #if NH_3D_QTLPC743 if(bParsePartSize)744 {745 #endif746 582 uiSymbol = 1; 747 583 if( uiDepth == log2DiffMaxMinCodingBlockSize ) … … 753 589 } 754 590 eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN; 755 #if NH_3D_QTLPC756 }757 #endif758 591 UInt uiTrLevel = 0; 759 592 UInt uiWidthInBit = g_aucConvertToBit[pcCU->getWidth(uiAbsPartIdx)]+2; … … 771 604 else 772 605 { 773 #if NH_3D_QTLPC774 if(bParsePartSize)775 {776 if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)777 {778 #endif779 606 UInt uiMaxNumBits = 2; 780 607 … … 815 642 } 816 643 } 817 #if NH_3D_QTLPC818 }819 else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)820 {821 UInt uiMaxNumBits = 1;822 if ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )823 {824 uiMaxNumBits ++;825 }826 for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )827 {828 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );829 if ( uiSymbol )830 {831 break;832 }833 uiMode++;834 }835 eMode = (PartSize) uiMode;836 if(uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==1 )837 {838 eMode = SIZE_2NxN;839 }840 else if (uiMode && (( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )==0) && uiSymbol==0)841 {842 eMode = SIZE_2NxN;843 }844 else if (uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==0)845 {846 m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));847 eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);848 }849 }850 else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N)851 {852 UInt uiMaxNumBits = 1;853 if ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )854 {855 uiMaxNumBits ++;856 }857 for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )858 {859 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));860 if ( uiSymbol )861 {862 break;863 }864 uiMode++;865 }866 eMode = (PartSize) uiMode;867 if(uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==1 )868 {869 eMode = SIZE_Nx2N;870 }871 else if (uiMode && (( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )==0) && uiSymbol==0)872 {873 eMode = SIZE_Nx2N;874 }875 else if (uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==0)876 {877 m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));878 eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);879 }880 }881 else882 {883 assert(0);884 }885 #endif886 644 #if NH_MV_ENC_DEC_TRAC 887 645 DTRACE_CU("part_mode", eMode ) 888 #endif889 #if NH_3D_QTLPC890 }891 646 #endif 892 647 } … … 937 692 for (j=0;j<partNum;j++) 938 693 { 939 #if NH_3D_DMM940 if( pcCU->getSlice()->getIntraSdcWedgeFlag() || pcCU->getSlice()->getIntraContourFlag() )941 {942 xParseIntraDepthMode( pcCU, absPartIdx+partOffset*j, depth );943 xParseDmmData ( pcCU, absPartIdx+partOffset*j, depth );944 }945 if( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx+partOffset*j ) < NUM_INTRA_MODE )946 {947 #endif948 694 m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) ); 949 695 mpmPred[j] = symbol; … … 951 697 DTRACE_CU("prev_intra_luma_pred_flag", symbol) 952 698 #endif 953 #if NH_3D_DMM954 }955 #endif956 699 } 957 700 for (j=0;j<partNum;j++) 958 701 { 959 #if NH_3D_DMM960 if( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx+partOffset*j ) < NUM_INTRA_MODE )961 {962 #endif963 702 Int preds[NUM_MOST_PROBABLE_MODES] = {-1, -1, -1}; 964 703 pcCU->getIntraDirPredictor(absPartIdx+partOffset*j, preds, COMPONENT_Y); … … 1003 742 } 1004 743 pcCU->setIntraDirSubParts(CHANNEL_TYPE_LUMA, (UChar)intraPredMode, absPartIdx+partOffset*j, depth ); 1005 #if NH_3D_DMM1006 }1007 #endif1008 744 } 1009 745 } … … 2269 2005 } 2270 2006 2271 #if NH_3D_ARP 2272 Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2273 { 2274 UInt uiW = 0; 2275 UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 2276 UInt uiCode = 0; 2277 2278 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__ARP_FLAG)); 2279 2280 uiW = uiCode; 2281 if( 1 == uiW ) 2282 { 2283 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 2 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__ARP_FLAG)); 2284 uiW += ( 1 == uiCode ? 1 : 0 ); 2285 } 2286 #if NH_MV_ENC_DEC_TRAC 2287 DTRACE_CU("iv_res_pred_weight_idx", uiW ) 2288 #endif 2289 pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth ); 2290 } 2291 #endif 2292 2293 #if NH_3D_IC 2294 /** parse illumination compensation flag 2295 * \param pcCU 2296 * \param uiAbsPartIdx 2297 * \param uiDepth 2298 * \returns Void 2299 */ 2300 Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2301 { 2302 UInt uiSymbol = 0; 2303 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__3D_IC) ); 2304 2305 #if !NH_MV_ENC_DEC_TRAC 2306 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 2307 DTRACE_CABAC_T( "\tICFlag" ); 2308 DTRACE_CABAC_T( "\tuiCtxIC: "); 2309 DTRACE_CABAC_V( uiCtxIC ); 2310 DTRACE_CABAC_T( "\tuiSymbol: "); 2311 DTRACE_CABAC_V( uiSymbol ); 2312 DTRACE_CABAC_T( "\n"); 2313 #else 2314 DTRACE_CU("ic_flag", uiSymbol) 2315 #endif 2316 2317 pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); 2318 } 2319 #endif 2320 2321 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER 2322 Void TDecSbac::parseDeltaDC( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) 2323 { 2324 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 2325 if( !(pcCU->getSDCFlag( absPartIdx )) ) 2326 #endif 2327 #if NH_3D_DMM 2328 if( !(pcCU->isIntra( absPartIdx ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) )) ) 2329 #endif 2330 assert( 0 ); 2331 2332 UInt symbol = 1; 2333 #if NH_3D_SDC_INTRA 2334 if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx )) 2335 { 2336 m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__SDC_DELTADC_FLAG) ); 2337 assert( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N ); 2338 assert( pcCU->getTransformIdx(absPartIdx) == 0 ); 2339 assert( pcCU->getCbf(absPartIdx, COMPONENT_Y) == 1 ); 2340 } 2341 #endif 2342 UInt uiNumSegments = 1; 2343 #if NH_3D_DMM 2344 uiNumSegments = isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) ) ? 2 : 1; 2345 #endif 2346 2347 for( UInt segment = 0; segment < uiNumSegments; segment++ ) 2348 { 2349 Pel valDeltaDC = 0; 2350 if( symbol ) 2351 { 2352 xParseDeltaDC( valDeltaDC, uiNumSegments ); 2353 } 2354 2355 if( pcCU->isIntra( absPartIdx ) ) 2356 { 2357 #if NH_3D_SDC_INTRA 2358 if( pcCU->getSDCFlag( absPartIdx ) ) 2359 { 2360 pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx ); 2361 } 2362 else 2363 { 2364 #endif 2365 #if NH_3D_DMM 2366 pcCU->setDmmDeltaDC( getDmmType( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) ), segment, absPartIdx, valDeltaDC ); 2367 #endif 2368 #if NH_3D_SDC_INTRA 2369 } 2370 #endif 2371 } 2372 #if NH_3D_SDC_INTER 2373 else 2374 { 2375 pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx ); 2376 } 2377 #endif 2378 } 2379 } 2380 2381 Void TDecSbac::xParseDeltaDC( Pel& rValDeltaDC, UInt uiNumSeg ) 2382 { 2383 UInt absValDeltaDC = 0; 2384 xReadExGolombLevelDdc( absValDeltaDC ); 2385 rValDeltaDC = (Pel)absValDeltaDC + ( uiNumSeg > 1 ? 0 : 1 ); 2386 2387 if( rValDeltaDC != 0 ) 2388 { 2389 UInt uiSign; 2390 m_pcTDecBinIf->decodeBinEP( uiSign RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DELTADC_SIGN_EP) ); 2391 if ( uiSign ) 2392 { 2393 rValDeltaDC = -rValDeltaDC; 2394 } 2395 } 2396 #if NH_MV_ENC_DEC_TRAC 2397 DTRACE_CU("delta_dc", rValDeltaDC); 2398 #endif 2399 } 2400 2401 Void TDecSbac::xReadExGolombLevelDdc( UInt& ruiSymbol ) 2402 { 2403 UInt uiSymbol; 2404 UInt uiCount = 0; 2405 do 2406 { 2407 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDdcDataSCModel.get(0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DELTADC_PREFIX) ); 2408 uiCount++; 2409 } 2410 while( uiSymbol && ( uiCount != 3 ) ); 2411 ruiSymbol = uiCount - 1; 2412 2413 if( uiSymbol ) 2414 { 2415 xReadEpExGolomb( uiSymbol, 0 RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DELTADC_SUFFIX_EP) ); 2416 ruiSymbol += uiSymbol + 1; 2417 } 2418 2419 return; 2420 } 2421 #endif 2422 #if NH_3D_DMM 2423 Void TDecSbac::xParseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) 2424 { 2425 pcCU->setIntraDirSubParts( CHANNEL_TYPE_LUMA, 0, absPartIdx, depth ); 2426 2427 UInt uiSymbol; 2428 if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed 2429 { 2430 m_pcTDecBinIf->decodeBin( uiSymbol, m_cNotDmmFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__NOTDMM_FLAG) ); 2431 } 2432 else 2433 { 2434 uiSymbol = 1; 2435 } 2436 2437 //decode DMM mode index 2438 if( !uiSymbol ) 2439 { 2440 if( pcCU->getSlice()->getIntraSdcWedgeFlag() && pcCU->getSlice()->getIntraContourFlag() ) 2441 { 2442 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DMMMODE) ); 2443 if( !uiSymbol ) 2444 { 2445 pcCU->setIntraDirSubParts( CHANNEL_TYPE_LUMA, DMM_OFFSET, absPartIdx, depth ); 2446 } 2447 else 2448 { 2449 pcCU->setIntraDirSubParts( CHANNEL_TYPE_LUMA, ( 1+ DMM_OFFSET ), absPartIdx, depth ); 2450 } 2451 } 2452 else if( pcCU->getSlice()->getIntraSdcWedgeFlag() ) 2453 { 2454 pcCU->setIntraDirSubParts( CHANNEL_TYPE_LUMA, DMM_OFFSET, absPartIdx, depth ); 2455 } 2456 else if( pcCU->getSlice()->getIntraContourFlag() ) 2457 { 2458 pcCU->setIntraDirSubParts( CHANNEL_TYPE_LUMA, ( 1+ DMM_OFFSET ), absPartIdx, depth ); 2459 } 2460 } 2461 } 2462 2463 Void TDecSbac::xParseDmmData( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) 2464 { 2465 UInt dir = pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ); 2466 switch( getDmmType( dir ) ) 2467 { 2468 case( DMM1_IDX ): 2469 { 2470 UInt uiTabIdx = 0; 2471 xParseDmm1WedgeIdx( uiTabIdx, g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] ); 2472 assert( uiTabIdx < getWedgeListScaled( pcCU->getWidth( absPartIdx ) )->size() ); 2473 pcCU->setDmm1WedgeTabIdxSubParts( uiTabIdx, absPartIdx, depth ); 2474 } break; 2475 case( DMM4_IDX ): break; 2476 default: break; 2477 } 2478 } 2479 2480 Void TDecSbac::xParseDmm1WedgeIdx( UInt& ruiTabIdx, Int iNumBit ) 2481 { 2482 UInt uiSymbol, uiIdx = 0; 2483 for( Int i = 0; i < iNumBit; i++ ) 2484 { 2485 m_pcTDecBinIf->decodeBinEP( uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DMM1_BITS_EP) ); 2486 uiIdx += uiSymbol << i; 2487 } 2488 ruiTabIdx = uiIdx; 2489 } 2490 #endif 2491 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 2492 Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2493 { 2494 UInt uiSymbol = 0; 2495 2496 m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__SDC_INTRA_FLAG) ); 2497 #if NH_MV_ENC_DEC_TRAC 2498 DTRACE_CU("dc_only_flag", uiSymbol) 2499 #endif 2500 if( uiSymbol ) 2501 { 2502 pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, uiDepth ); 2503 pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); 2504 pcCU->setCbfSubParts(1, COMPONENT_Y, uiAbsPartIdx, uiDepth); 2505 } 2506 else 2507 { 2508 pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth ); 2509 } 2510 } 2511 2512 #endif 2513 2514 #if NH_3D_DBBP 2515 Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2516 { 2517 AOF( pcCU->getSlice()->getDepthBasedBlkPartFlag() ); 2518 AOF( !pcCU->getSlice()->getIsDepth() ); 2519 2520 UInt uiSymbol = 0; 2521 2522 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DBBP_FLAG) ); 2523 DTRACE_CU("dbbp_flag", uiSymbol) 2524 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 2525 AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N ); 2526 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4; 2527 pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx, 0, uiDepth); 2528 pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx+uiPUOffset, 1, uiDepth); 2529 } 2530 #endif 2007 2008 2009 2531 2010 2532 2011 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecSbac.h
r1321 r1390 108 108 Void xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const Int maxLog2TrDynamicRange ); 109 109 #endif 110 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER111 Void xReadExGolombLevelDdc( UInt& ruiSymbol );112 Void xParseDeltaDC ( Pel& rValDeltaDC, UInt uiNumSeg );113 #endif114 #if NH_3D_DMM115 Void xParseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );116 Void xParseDmmData ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );117 Void xParseDmm1WedgeIdx ( UInt& ruiTabIdx, Int iNumBit );118 #endif119 #if NH_3D_SDC_INTRA120 Void xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );121 #endif122 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER123 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );124 #endif125 #if NH_3D_DBBP126 Void parseDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );127 #endif128 110 129 111 private: … … 134 116 135 117 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 136 #if NH_3D_DIS137 Void parseDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );138 #endif139 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER140 Void parseDeltaDC ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );141 #endif142 118 Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 143 119 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 144 120 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 145 121 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ); 146 #if NH_3D_ARP147 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );148 #endif149 #if NH_3D_IC150 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );151 #endif152 122 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 153 123 Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 183 153 ContextModel3DBuffer m_cCUSplitFlagSCModel; 184 154 ContextModel3DBuffer m_cCUSkipFlagSCModel; 185 #if NH_3D_DIS186 ContextModel3DBuffer m_cCUDISFlagSCModel;187 ContextModel3DBuffer m_cCUDISTypeSCModel;188 #endif189 155 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 190 156 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; 191 #if NH_3D_ARP192 ContextModel3DBuffer m_cCUPUARPWSCModel;193 #endif194 #if NH_3D_IC195 ContextModel3DBuffer m_cCUICFlagSCModel;196 #endif197 157 ContextModel3DBuffer m_cCUPartSizeSCModel; 198 158 ContextModel3DBuffer m_cCUPredModeSCModel; … … 226 186 ContextModel3DBuffer m_ChromaQpAdjFlagSCModel; 227 187 ContextModel3DBuffer m_ChromaQpAdjIdcSCModel; 228 #if NH_3D_DMM229 ContextModel3DBuffer m_cNotDmmFlagSCModel;230 ContextModel3DBuffer m_cDmmModeSCModel;231 #endif232 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER233 ContextModel3DBuffer m_cDdcDataSCModel;234 ContextModel3DBuffer m_cSDCFlagSCModel;235 #endif236 #if NH_3D_SDC_INTRA237 ContextModel3DBuffer m_cSDCResidualFlagSCModel;238 ContextModel3DBuffer m_cSDCResidualSCModel;239 ContextModel3DBuffer m_cDdcFlagSCModel;240 #endif241 #if NH_3D_DBBP242 ContextModel3DBuffer m_cDBBPFlagSCModel;243 #endif244 188 245 189 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecSlice.cpp
r1386 r1390 130 130 } 131 131 } 132 #if NH_3D_DLT133 if( pcSlice->getPPS()->getDLT() != NULL )134 {135 assert( pcSlice->getSPS()->getBitDepth( CHANNEL_TYPE_LUMA ) == pcSlice->getPPS()->getDLT()->getDepthViewBitDepth() );136 }137 #endif138 132 139 133 // for every CTU in the slice segment... -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecTop.cpp
r1386 r1390 44 44 //! \{ 45 45 46 #if NH_3D47 CamParsCollector::CamParsCollector()48 : m_bInitialized( false )49 {50 m_aaiCodedOffset = new Int* [ MAX_NUM_LAYERS ];51 m_aaiCodedScale = new Int* [ MAX_NUM_LAYERS ];52 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )53 {54 m_aaiCodedOffset [ uiId ] = new Int [ MAX_NUM_LAYERS ];55 m_aaiCodedScale [ uiId ] = new Int [ MAX_NUM_LAYERS ];56 }57 58 xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );59 m_iLog2Precision = LOG2_DISP_PREC_LUT;60 m_uiBitDepthForLUT = 8; // fixed61 m_receivedIdc = NULL;62 m_vps = NULL;63 }64 65 CamParsCollector::~CamParsCollector()66 {67 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )68 {69 delete [] m_aaiCodedOffset [ uiId ];70 delete [] m_aaiCodedScale [ uiId ];71 }72 delete [] m_aaiCodedOffset;73 delete [] m_aaiCodedScale;74 75 xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );76 xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );77 if ( m_receivedIdc != NULL )78 {79 xDeleteArray( m_receivedIdc, m_vps->getNumViews() );80 }81 }82 83 84 Void85 CamParsCollector::init( const TComVPS* vps)86 {87 assert( !isInitialized() ); // Only one initialization currently supported88 m_bInitialized = true;89 m_vps = vps;90 m_bCamParsVaryOverTime = false;91 m_lastPoc = -1;92 m_firstReceivedPoc = -2;93 94 for (Int i = 0; i <= vps->getMaxLayersMinus1(); i++)95 {96 Int curViewIdxInVps = m_vps->getVoiInVps( m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ) ) ) ;97 m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->getCpInSliceSegmentHeaderFlag( curViewIdxInVps );98 }99 100 assert( m_receivedIdc == NULL );101 m_receivedIdc = new Int*[ m_vps->getNumViews() ];102 for (Int i = 0; i < m_vps->getNumViews(); i++)103 {104 m_receivedIdc[i] = new Int[ m_vps->getNumViews() ];105 }106 107 xResetReceivedIdc( true );108 109 for (Int voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )110 {111 if( !m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )112 {113 for (Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )114 {115 if( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )116 {117 m_receivedIdc [ baseVoiInVps ][ voiInVps ] = -1;118 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] = m_vps->getCodedScale (voiInVps) [ baseVoiInVps ];119 m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] = m_vps->getCodedOffset (voiInVps) [ baseVoiInVps ];120 121 m_receivedIdc [ voiInVps ][ baseVoiInVps ] = -1;122 m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedScale (voiInVps) [ baseVoiInVps ];123 m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedOffset(voiInVps) [ baseVoiInVps ];124 xInitLUTs( baseVoiInVps, voiInVps, m_aaiCodedScale[ baseVoiInVps ][ voiInVps ], m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );125 xInitLUTs( voiInVps, baseVoiInVps, m_aaiCodedScale[ voiInVps ][ baseVoiInVps ], m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );126 }127 }128 }129 }130 }131 132 Void133 CamParsCollector::xResetReceivedIdc( Bool overWriteFlag )134 {135 for (Int i = 0; i < m_vps->getNumViews(); i++)136 {137 for (Int j = 0; j < m_vps->getNumViews(); j++)138 {139 if ( overWriteFlag || ( m_receivedIdc[i][j] != -1 ) )140 {141 m_receivedIdc[i][j] = 0;142 }143 }144 }145 }146 147 148 Void149 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)150 {151 152 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews );153 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews );154 155 radLUT = new Double***[ uiNumberSourceViews ];156 raiLUT = new Int ***[ uiNumberSourceViews ];157 158 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )159 {160 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ];161 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ];162 163 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )164 {165 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ];166 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];167 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];168 169 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ];170 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ];171 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ];172 }173 }174 }175 176 Void177 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)178 {179 Int iLog2DivLuma = m_uiBitDepthForLUT + m_vps->getCpPrecision() + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 );180 Int iLog2DivChroma = iLog2DivLuma + 1;181 182 iOffset <<= m_uiBitDepthForLUT;183 184 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma ));185 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));186 187 // offsets including rounding offsets188 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 );189 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );190 191 192 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )193 {194 195 // real-valued look-up tables196 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );197 Double dShiftChroma = dShiftLuma / 2;198 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;199 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;200 201 // integer-valued look-up tables202 Int64 iTempScale = (Int64)uiDepthValue * iScale;203 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma;204 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;205 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;206 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;207 }208 209 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];210 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];211 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];212 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];213 }214 215 Void216 CamParsCollector::uninit()217 {218 m_bInitialized = false;219 }220 221 Void CamParsCollector::setSlice( const TComSlice* pcSlice )222 {223 if( pcSlice == 0 )224 {225 xOutput( m_lastPoc );226 return;227 }228 229 #if !H_3D_FCO230 if ( pcSlice->getIsDepth())231 {232 return;233 }234 #endif235 236 Int curPoc = pcSlice->getPOC();237 if( m_firstReceivedPoc == -2 )238 {239 m_firstReceivedPoc = curPoc;240 }241 242 Bool newPocFlag = ( m_lastPoc != curPoc );243 244 if ( newPocFlag )245 {246 if( m_lastPoc != -1 )247 {248 xOutput( m_lastPoc );249 }250 251 xResetReceivedIdc( false );252 m_lastPoc = pcSlice->getPOC();253 }254 255 UInt voiInVps = m_vps->getVoiInVps(pcSlice->getViewIndex());256 if( m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) // check consistency of slice parameters here257 {258 for( Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )259 {260 if ( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )261 {262 if ( m_receivedIdc[ voiInVps ][ baseVoiInVps ] != 0 )263 {264 AOF( m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedScale () [ baseVoiInVps ] );265 AOF( m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedOffset() [ baseVoiInVps ] );266 }267 else268 {269 m_receivedIdc [ voiInVps ][ baseVoiInVps ] = 1;270 m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] = pcSlice->getInvCodedScale () [ baseVoiInVps ];271 m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] = pcSlice->getInvCodedOffset() [ baseVoiInVps ];272 xInitLUTs( voiInVps, baseVoiInVps, m_aaiCodedScale[ voiInVps ][ baseVoiInVps ], m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);273 }274 if ( m_receivedIdc[ baseVoiInVps ][ voiInVps ] != 0 )275 {276 AOF( m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedScale () [ baseVoiInVps ] );277 AOF( m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedOffset () [ baseVoiInVps ] );278 }279 else280 {281 m_receivedIdc [ baseVoiInVps ][ voiInVps ] = 1;282 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] = pcSlice->getCodedScale () [ baseVoiInVps ];283 m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] = pcSlice->getCodedOffset () [ baseVoiInVps ];284 xInitLUTs( baseVoiInVps, voiInVps, m_aaiCodedScale[ baseVoiInVps ][ voiInVps ], m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);285 }286 }287 }288 }289 }290 291 Void292 CamParsCollector::xOutput( Int iPOC )293 {294 if( m_pCodedScaleOffsetFile )295 {296 if( iPOC == m_firstReceivedPoc )297 {298 fprintf( m_pCodedScaleOffsetFile, "#ViewOrderIdx ViewIdVal\n" );299 fprintf( m_pCodedScaleOffsetFile, "#------------ -------------\n" );300 301 for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )302 {303 fprintf( m_pCodedScaleOffsetFile, "%13d %13d\n", m_vps->getViewOIdxList( voiInVps ), m_vps->getViewIdVal( m_vps->getViewOIdxList( voiInVps ) ) );304 }305 fprintf( m_pCodedScaleOffsetFile, "\n\n");306 fprintf( m_pCodedScaleOffsetFile, "# StartFrame EndFrame TargetVOI BaseVOI CodedScale CodedOffset Precision\n" );307 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" );308 }309 if( iPOC == m_firstReceivedPoc || m_bCamParsVaryOverTime )310 {311 Int iS = iPOC;312 Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) );313 for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )314 {315 for( UInt baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )316 {317 if( voiInVps != baseVoiInVps )318 {319 if ( m_receivedIdc[baseVoiInVps][voiInVps] != 0 )320 {321 fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",322 iS, iE, m_vps->getViewOIdxList( voiInVps ), m_vps->getViewOIdxList( baseVoiInVps ),323 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ],324 m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_vps->getCpPrecision() );325 }326 }327 }328 }329 }330 }331 }332 #endif333 46 334 47 … … 393 106 m_viewId = 0; 394 107 395 #if NH_3D396 m_viewIndex = 0;397 m_isDepth = false;398 m_pcCamParsCollector = 0;399 #endif400 108 401 109 m_decodingProcess = CLAUSE_8; … … 735 443 #endif 736 444 737 #if NH_3D738 if ( !m_pcCamParsCollector->isInitialized() )739 {740 m_pcCamParsCollector->init( vps );741 }742 #endif743 445 // Initialise the various objects for the new set of settings 744 446 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) ); … … 1063 765 m_pcPic->setLayerId( nalu.m_nuhLayerId ); 1064 766 m_pcPic->setViewId ( getViewId() ); 1065 #if NH_3D1066 m_pcPic->setViewIndex( getViewIndex() );1067 m_pcPic->setIsDepth ( getIsDepth () );1068 pcSlice->setIvPicLists( m_dpb );1069 #endif1070 767 #endif 1071 768 … … 1105 802 } 1106 803 } 1107 #if NH_3D_NBDV1108 pcSlice->setDefaultRefView();1109 #endif1110 #if NH_3D_ARP1111 pcSlice->setPocsInCurrRPSs();1112 pcSlice->setARPStepNum(m_dpb);1113 #endif1114 804 #endif 1115 805 … … 1155 845 //--------------- 1156 846 pcSlice->setRefPOCList(); 1157 #if NH_3D_TMVP1158 if(pcSlice->getLayerId())1159 {1160 pcSlice->generateAlterRefforTMVP();1161 }1162 #endif1163 847 } 1164 848 … … 1193 877 } 1194 878 1195 #if NH_3D1196 if ( decProcAnnexI() )1197 {1198 pcSlice->checkInCompPredRefLayers();1199 }1200 #endif1201 879 1202 880 // Decode a picture 1203 881 m_cGopDecoder.decompressSlice(&(nalu.getBitstream()), m_pcPic); 1204 882 1205 #if NH_3D1206 if( m_pcCamParsCollector )1207 {1208 m_pcCamParsCollector->setSlice( pcSlice );1209 }1210 #endif1211 883 1212 884 #if !NH_MV … … 1240 912 sps->setForceDecodeBitDepth(m_forceDecodeBitDepth); 1241 913 #endif 1242 #if NH_3D1243 // GT: Please don't add parsing dependency of SPS from VPS here again!!!1244 #endif1245 914 m_cEntropyDecoder.decodeSPS( sps ); 1246 915 m_parameterSetManager.storeSPS(sps, naluData); … … 1252 921 #if NH_MV 1253 922 pps->setLayerId( getLayerId() ); 1254 #endif1255 #if NH_3D_DLT1256 // create mapping from depth layer indexes to layer ids1257 Int j=0;1258 for( Int i=0; i<=m_parameterSetManager.getFirstVPS()->getMaxLayersMinus1(); i++ )1259 {1260 Int layerId = m_parameterSetManager.getFirstVPS()->getLayerIdInNuh(i);1261 if( m_parameterSetManager.getFirstVPS()->getDepthId(layerId) )1262 pps->getDLT()->setDepthIdxToLayerId(j++, layerId);1263 }1264 923 #endif 1265 924 m_cEntropyDecoder.decodePPS( pps ); … … 1806 1465 { 1807 1466 setViewId ( vps->getViewId ( getLayerId() ) ); 1808 #if NH_3D1809 setViewIndex( vps->getViewIndex( getLayerId() ) );1810 setIsDepth ( vps->getDepthId ( getLayerId() ) == 1 );1811 #endif1812 1467 1813 1468 if ( !vps->getVpsExtensionFlag() ) -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecTop.h
r1321 r1390 65 65 class TAppDecTop; 66 66 #endif 67 #if NH_3D68 class CamParsCollector69 {70 public:71 CamParsCollector ();72 ~CamParsCollector ();73 74 Void init ( const TComVPS* vps );75 Void setCodeScaleOffsetFile( FILE* pCodedScaleOffsetFile ) { m_pCodedScaleOffsetFile = pCodedScaleOffsetFile; };76 77 Void uninit ();78 Void setSlice ( const TComSlice* pcSlice );79 80 Bool isInitialized() const { return m_bInitialized; }81 Int**** getBaseViewShiftLUTI() { return m_aiBaseViewShiftLUT; }82 83 private:84 Void xResetReceivedIdc( Bool overWriteFlag );85 Void xOutput ( Int iPOC );86 87 private:88 Bool m_bInitialized;89 FILE* m_pCodedScaleOffsetFile;90 91 Int** m_aaiCodedOffset;92 Int** m_aaiCodedScale;93 94 const TComVPS* m_vps;95 Int** m_receivedIdc;96 Int m_lastPoc;97 Int m_firstReceivedPoc;98 99 100 Bool m_bCamParsVaryOverTime;101 102 UInt m_uiBitDepthForLUT;103 UInt m_iLog2Precision;104 // UInt m_uiInputBitDepth;105 106 // look-up tables107 Double**** m_adBaseViewShiftLUT; ///< Disparity LUT108 Int**** m_aiBaseViewShiftLUT; ///< Disparity LUT109 Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);110 Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);111 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );112 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2 );113 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize );114 115 };116 117 template <class T>118 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )119 {120 if( rpt )121 {122 for( UInt uiK = 0; uiK < uiSize1; uiK++ )123 {124 for( UInt uiL = 0; uiL < uiSize2; uiL++ )125 {126 for( UInt uiM = 0; uiM < uiSize3; uiM++ )127 {128 delete[] rpt[ uiK ][ uiL ][ uiM ];129 }130 delete[] rpt[ uiK ][ uiL ];131 }132 delete[] rpt[ uiK ];133 }134 delete[] rpt;135 }136 rpt = NULL;137 };138 139 140 template <class T>141 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )142 {143 if( rpt )144 {145 for( UInt uiK = 0; uiK < uiSize1; uiK++ )146 {147 for( UInt uiL = 0; uiL < uiSize2; uiL++ )148 {149 delete[] rpt[ uiK ][ uiL ];150 }151 delete[] rpt[ uiK ];152 }153 delete[] rpt;154 }155 rpt = NULL;156 };157 158 159 template <class T>160 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )161 {162 if( rpt )163 {164 for( UInt uiK = 0; uiK < uiSize; uiK++ )165 {166 delete[] rpt[ uiK ];167 }168 delete[] rpt;169 }170 rpt = NULL;171 };172 173 #endif //NH_3D174 67 /// decoder class 175 68 class TDecTop … … 240 133 static ParameterSetManager m_parameterSetManager; // storage for parameter sets 241 134 TComPicLists* m_dpb; 242 #if NH_3D243 CamParsCollector* m_pcCamParsCollector;244 #endif245 135 246 136 // Layer identification 247 137 Int m_layerId; 248 138 Int m_viewId; 249 #if NH_3D250 Int m_viewIndex;251 Bool m_isDepth;252 #endif253 139 254 140 // Layer set … … 349 235 Void setViewId ( Int viewId ) { m_viewId = viewId; } 350 236 Int getViewId ( ) { return m_viewId; } 351 #if NH_3D352 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; }353 Int getViewIndex ( ) { return m_viewIndex; }354 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }355 Bool getIsDepth ( ) { return m_isDepth; }356 #endif357 237 358 238 // Classes 359 239 Void setDpb ( TComPicLists* picLists) { m_dpb = picLists; } 360 #if NH_3D361 Void setCamParsCollector ( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }362 #endif363 240 364 241 // Slice pilot access -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/SEIwrite.cpp
r1386 r1390 172 172 xWriteSEIMultiviewViewPosition(*static_cast<const SEIMultiviewViewPosition*>(&sei)); 173 173 break; 174 #if NH_3D175 case SEI::ALTERNATIVE_DEPTH_INFO:176 xWriteSEIAlternativeDepthInfo(*static_cast<const SEIAlternativeDepthInfo*>(&sei));177 break;178 #endif179 174 #endif 180 175 … … 1295 1290 }; 1296 1291 1297 #if NH_3D1298 Void SEIWriter::xWriteSEIAlternativeDepthInfo( const SEIAlternativeDepthInfo& sei)1299 {1300 WRITE_FLAG( ( sei.m_alternativeDepthInfoCancelFlag ? 1 : 0 ), "alternative_depth_info_cancel_flag" );1301 if( sei.m_alternativeDepthInfoCancelFlag == 0 )1302 {1303 WRITE_CODE( sei.m_depthType, 2, "depth_type" );1304 1305 if( sei.m_depthType == 0 )1306 {1307 WRITE_UVLC( sei.m_numConstituentViewsGvdMinus1, "num_constituent_views_gvd_minus1" );1308 WRITE_FLAG( ( sei.m_depthPresentGvdFlag ? 1 : 0 ), "depth_present_gvd_flag" );1309 WRITE_FLAG( ( sei.m_zGvdFlag ? 1 : 0 ), "z_gvd_flag" );1310 WRITE_FLAG( ( sei.m_intrinsicParamGvdFlag ? 1 : 0 ), "intrinsic_param_gvd_flag" );1311 WRITE_FLAG( ( sei.m_rotationGvdFlag ? 1 : 0 ), "rotation_gvd_flag" );1312 WRITE_FLAG( ( sei.m_translationGvdFlag ? 1 : 0 ), "translation_gvd_flag" );1313 if( sei.m_zGvdFlag )1314 {1315 for( Int i = 0, j = 0; j <= sei.m_numConstituentViewsGvdMinus1 + 1; j++ )1316 {1317 WRITE_FLAG( ( sei.m_signGvdZNearFlag[i][j] ? 1 : 0 ), "sign_gvd_z_near_flag" );1318 WRITE_CODE( sei.m_expGvdZNear[i][j], 7, "exp_gvd_z_near" );1319 WRITE_CODE( sei.m_manLenGvdZNearMinus1[i][j], 5, "man_len_gvd_z_near_minus1" );1320 WRITE_CODE( sei.m_manGvdZNear[i][j], sei.m_manLenGvdZNearMinus1[i][j] + 1, "man_gvd_z_near" );1321 WRITE_FLAG( ( sei.m_signGvdZFarFlag[i][j] ? 1 : 0 ), "sign_gvd_z_far_flag" );1322 WRITE_CODE( sei.m_expGvdZFar[i][j], 7, "exp_gvd_z_far" );1323 WRITE_CODE( sei.m_manLenGvdZFarMinus1[i][j], 5, "man_len_gvd_z_far_minus1" );1324 WRITE_CODE( sei.m_manGvdZFar[i][j], sei.m_manLenGvdZFarMinus1[i][j] + 1, "man_gvd_z_far" );1325 }1326 }1327 if( sei.m_intrinsicParamGvdFlag )1328 {1329 WRITE_UVLC( sei.m_precGvdFocalLength, "prec_gvd_focal_length" );1330 WRITE_UVLC( sei.m_precGvdPrincipalPoint, "prec_gvd_principal_point" );1331 }1332 if( sei.m_rotationGvdFlag )1333 {1334 WRITE_UVLC( sei.m_precGvdRotationParam, "prec_gvd_rotation_param" );1335 }1336 if( sei.m_translationGvdFlag )1337 {1338 WRITE_UVLC( sei.m_precGvdTranslationParam, "prec_gvd_translation_param" );1339 }1340 for( Int i = 0, j = 0; j <= sei.m_numConstituentViewsGvdMinus1 + 1; j++ )1341 {1342 if( sei.m_intrinsicParamGvdFlag )1343 {1344 WRITE_FLAG( ( sei.m_signGvdFocalLengthX[i][j] ? 1 : 0 ), "sign_gvd_focal_length_x" );1345 WRITE_CODE( sei.m_expGvdFocalLengthX[i][j], 6, "exp_gvd_focal_length_x" );1346 WRITE_CODE( sei.m_manGvdFocalLengthX[i][j], sei.getManGvdFocalLengthXLen(i,j), "man_gvd_focal_length_x" );1347 WRITE_FLAG( ( sei.m_signGvdFocalLengthY[i][j] ? 1 : 0 ), "sign_gvd_focal_length_y" );1348 WRITE_CODE( sei.m_expGvdFocalLengthY[i][j], 6, "exp_gvd_focal_length_y" );1349 WRITE_CODE( sei.m_manGvdFocalLengthY[i][j], sei.getManGvdFocalLengthYLen(i,j), "man_gvd_focal_length_y" );1350 WRITE_FLAG( ( sei.m_signGvdPrincipalPointX[i][j] ? 1 : 0 ), "sign_gvd_principal_point_x" );1351 WRITE_CODE( sei.m_expGvdPrincipalPointX[i][j], 6, "exp_gvd_principal_point_x" );1352 WRITE_CODE( sei.m_manGvdPrincipalPointX[i][j], sei.getManGvdPrincipalPointXLen(i,j), "man_gvd_principal_point_x" );1353 WRITE_FLAG( ( sei.m_signGvdPrincipalPointY[i][j] ? 1 : 0 ), "sign_gvd_principal_point_y" );1354 WRITE_CODE( sei.m_expGvdPrincipalPointY[i][j], 6, "exp_gvd_principal_point_y" );1355 WRITE_CODE( sei.m_manGvdPrincipalPointY[i][j], sei.getManGvdPrincipalPointYLen(i,j), "man_gvd_principal_point_y" );1356 }1357 if( sei.m_rotationGvdFlag )1358 {1359 WRITE_FLAG( ( sei.m_signGvdR00[i][j] ? 1 : 0 ), "sign_gvd_r00" );1360 WRITE_CODE( sei.m_expGvdR00[i][j], 6, "exp_gvd_r00" );1361 WRITE_CODE( sei.m_manGvdR00[i][j], sei.m_precGvdRotationParam, "man_gvd_r00" );1362 WRITE_FLAG( ( sei.m_signGvdR01[i][j] ? 1 : 0 ), "sign_gvd_r01" );1363 WRITE_CODE( sei.m_expGvdR01[i][j], 6, "exp_gvd_r01" );1364 WRITE_CODE( sei.m_manGvdR01[i][j], sei.m_precGvdRotationParam, "man_gvd_r01" );1365 WRITE_FLAG( ( sei.m_signGvdR02[i][j] ? 1 : 0 ), "sign_gvd_r02" );1366 WRITE_CODE( sei.m_expGvdR02[i][j], 6, "exp_gvd_r02" );1367 WRITE_CODE( sei.m_manGvdR02[i][j], sei.m_precGvdRotationParam, "man_gvd_r02" );1368 WRITE_FLAG( ( sei.m_signGvdR10[i][j] ? 1 : 0 ), "sign_gvd_r10" );1369 WRITE_CODE( sei.m_expGvdR10[i][j], 6, "exp_gvd_r10" );1370 WRITE_CODE( sei.m_manGvdR10[i][j], sei.m_precGvdRotationParam, "man_gvd_r10" );1371 WRITE_FLAG( ( sei.m_signGvdR11[i][j] ? 1 : 0 ), "sign_gvd_r11" );1372 WRITE_CODE( sei.m_expGvdR11[i][j], 6, "exp_gvd_r11" );1373 WRITE_CODE( sei.m_manGvdR11[i][j], sei.m_precGvdRotationParam, "man_gvd_r11" );1374 WRITE_FLAG( ( sei.m_signGvdR12[i][j] ? 1 : 0 ), "sign_gvd_r12" );1375 WRITE_CODE( sei.m_expGvdR12[i][j], 6, "exp_gvd_r12" );1376 WRITE_CODE( sei.m_manGvdR12[i][j], sei.m_precGvdRotationParam, "man_gvd_r12" );1377 WRITE_FLAG( ( sei.m_signGvdR20[i][j] ? 1 : 0 ), "sign_gvd_r20" );1378 WRITE_CODE( sei.m_expGvdR20[i][j], 6, "exp_gvd_r20" );1379 WRITE_CODE( sei.m_manGvdR20[i][j], sei.m_precGvdRotationParam, "man_gvd_r20" );1380 WRITE_FLAG( ( sei.m_signGvdR21[i][j] ? 1 : 0 ), "sign_gvd_r21" );1381 WRITE_CODE( sei.m_expGvdR21[i][j], 6, "exp_gvd_r21" );1382 WRITE_CODE( sei.m_manGvdR21[i][j], sei.m_precGvdRotationParam, "man_gvd_r21" );1383 WRITE_FLAG( ( sei.m_signGvdR22[i][j] ? 1 : 0 ), "sign_gvd_r22" );1384 WRITE_CODE( sei.m_expGvdR22[i][j], 6, "exp_gvd_r22" );1385 WRITE_CODE( sei.m_manGvdR22[i][j], sei.m_precGvdRotationParam, "man_gvd_r22" );1386 }1387 if( sei.m_translationGvdFlag )1388 {1389 WRITE_FLAG( ( sei.m_signGvdTX[i][j] ? 1 : 0 ), "sign_gvd_t_x" );1390 WRITE_CODE( sei.m_expGvdTX[i][j], 6, "exp_gvd_t_x" );1391 WRITE_CODE( sei.m_manGvdTX[i][j], sei.getManGvdTXLen(i,j), "man_gvd_t_x" );1392 }1393 }1394 }1395 1396 if( sei.m_depthType == 1 )1397 {1398 WRITE_SVLC( sei.m_minOffsetXInt, "min_offset_x_int" );1399 WRITE_CODE( sei.m_minOffsetXFrac, 8, "min_offset_x_frac" );1400 WRITE_SVLC( sei.m_maxOffsetXInt, "max_offset_x_int" );1401 WRITE_CODE( sei.m_maxOffsetXFrac, 8, "max_offset_x_frac" );1402 WRITE_FLAG( ( sei.m_offsetYPresentFlag ? 1 : 0 ), "offset_y_present_flag" );1403 if( sei.m_offsetYPresentFlag )1404 {1405 WRITE_SVLC( sei.m_minOffsetYInt, "min_offset_y_int" );1406 WRITE_CODE( sei.m_minOffsetYFrac, 8, "min_offset_y_frac" );1407 WRITE_SVLC( sei.m_maxOffsetYInt, "max_offset_y_int" );1408 WRITE_CODE( sei.m_maxOffsetYFrac, 8, "max_offset_y_frac" );1409 }1410 WRITE_FLAG( ( sei.m_warpMapSizePresentFlag ? 1 : 0 ), "warp_map_size_present_flag" );1411 if( sei.m_warpMapSizePresentFlag )1412 {1413 WRITE_UVLC( sei.m_warpMapWidthMinus2, "warp_map_width_minus2" );1414 WRITE_UVLC( sei.m_warpMapHeightMinus2, "warp_map_height_minus2" );1415 }1416 }1417 }1418 };1419 1292 #endif 1420 #endif1421 1293 1422 1294 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/SEIwrite.h
r1386 r1390 96 96 Void xWriteSEIMultiviewAcquisitionInfo ( const SEIMultiviewAcquisitionInfo& sei); 97 97 Void xWriteSEIMultiviewViewPosition ( const SEIMultiviewViewPosition& sei); 98 #if NH_3D99 Void xWriteSEIAlternativeDepthInfo ( const SEIAlternativeDepthInfo& sei);100 #endif101 98 #endif 102 99 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncCavlc.cpp
r1386 r1390 186 186 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 187 187 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); 188 #if H_3D_PPS_FIX_DEPTH189 if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )190 {191 WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive(), "num_ref_idx_l0_default_active_minus1");192 WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive(), "num_ref_idx_l1_default_active_minus1");193 }194 else195 {196 #endif197 188 WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1, "num_ref_idx_l0_default_active_minus1"); 198 189 WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1, "num_ref_idx_l1_default_active_minus1"); 199 #if H_3D_PPS_FIX_DEPTH200 }201 #endif202 190 WRITE_SVLC( pcPPS->getPicInitQPMinus26(), "init_qp_minus26"); 203 191 WRITE_FLAG( pcPPS->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag" ); … … 257 245 codeScalingList( pcPPS->getScalingList() ); 258 246 } 259 #if H_3D_PPS_FIX_DEPTH260 if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )261 {262 WRITE_FLAG( 1, "lists_modification_present_flag" );263 }264 else265 #endif266 247 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); 267 248 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); … … 379 360 } 380 361 381 #if NH_3D382 if( pcPPS->getPps3dExtensionFlag( ) ) // This probably needs to be aligned with Rext and SHVC383 {384 codePps3dExtension( pcPPS );385 }386 #endif387 362 #endif 388 363 xWriteRbspTrailingBits(); 389 364 } 390 365 391 #if NH_3D392 Void TEncCavlc::codePps3dExtension ( const TComPPS* pcPPS )393 {394 #if NH_3D_DLT395 WRITE_FLAG( pcPPS->getDLT()->getDltPresentFlag() ? 1 : 0, "dlts_present_flag" );396 397 if ( pcPPS->getDLT()->getDltPresentFlag() )398 {399 WRITE_CODE(pcPPS->getDLT()->getNumDepthViews() - 1, 6, "pps_depth_layers_minus1");400 WRITE_CODE((pcPPS->getDLT()->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_layers_minus8");401 402 for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews()-1; i++ )403 {404 Int layerId = pcPPS->getDLT()->getDepthIdxToLayerId(i);405 406 WRITE_FLAG( pcPPS->getDLT()->getUseDLTFlag( layerId ) ? 1 : 0, "dlt_flag[i]" );407 408 if ( pcPPS->getDLT()->getUseDLTFlag( layerId ) )409 {410 std::vector<Int> aiIdx2DepthValue_coded(256, 0);411 UInt uiNumDepthValues_coded = pcPPS->getDLT()->getNumDepthValues(layerId);412 413 // ----------------------------- Actual coding -----------------------------414 WRITE_FLAG( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) ? 1 : 0, "dlt_pred_flag[i]");415 if ( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) == false )416 {417 WRITE_FLAG( pcPPS->getDLT()->getUseBitmapRep( layerId ) ? 1 : 0, "dlt_val_flags_present_flag[i]" );418 419 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )420 {421 aiIdx2DepthValue_coded[ui] = pcPPS->getDLT()->idx2DepthValue(layerId, ui);422 }423 }424 else425 {426 AOF( layerId > 1 );427 // assumes ref layer id to be 1428 std::vector<Int> viRefDLT = pcPPS->getDLT()->idx2DepthValue( 1 );429 UInt uiRefNum = pcPPS->getDLT()->getNumDepthValues( 1 );430 pcPPS->getDLT()->getDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);431 }432 433 // bit map coding434 if ( pcPPS->getDLT()->getUseBitmapRep( layerId ) )435 {436 UInt uiDltArrayIndex = 0;437 for (UInt d=0; d < 256; d++)438 {439 if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] )440 {441 WRITE_FLAG(1, "dlt_value_flag[i][j]");442 uiDltArrayIndex++;443 }444 else445 {446 WRITE_FLAG(0, "dlt_value_flag[i][j]");447 }448 }449 }450 // Diff Coding451 else452 {453 UInt uiMaxDiff = 0;454 UInt uiMinDiff = MAX_INT;455 UInt uiLengthMinDiff = 0;456 UInt uiLengthDltDiffMinusMin = 0;457 458 std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);459 460 for (UInt d = 1; d < uiNumDepthValues_coded; d++)461 {462 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];463 464 if ( uiMaxDiff < puiDltDiffValues[d] )465 {466 uiMaxDiff = puiDltDiffValues[d];467 }468 469 if ( uiMinDiff > puiDltDiffValues[d] )470 {471 uiMinDiff = puiDltDiffValues[d];472 }473 }474 475 if ( uiNumDepthValues_coded > 2 )476 {477 uiLengthMinDiff = (UInt) gCeilLog2(uiMaxDiff + 1);478 }479 if (uiMaxDiff > uiMinDiff)480 {481 uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);482 }483 484 WRITE_CODE(uiNumDepthValues_coded, 8, "num_val_delta_dlt"); // num_entry485 {486 // 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.487 if ( uiNumDepthValues_coded > 1 )488 {489 WRITE_CODE(uiMaxDiff, 8, "max_diff"); // max_diff490 }491 492 if ( uiNumDepthValues_coded > 2 )493 {494 WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1"); // min_diff_minus1495 }496 497 WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "delta_dlt_val0"); // entry0498 499 if (uiMaxDiff > uiMinDiff)500 {501 for (UInt d=1; d < uiNumDepthValues_coded; d++)502 {503 WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "delta_val_diff_minus_min[k]"); // entry_value_diff_minus_min[ k ]504 }505 }506 }507 508 }509 }510 }511 }512 #endif513 }514 #endif515 366 516 367 Void TEncCavlc::codeVUI( const TComVUI *pcVUI, const TComSPS* pcSPS ) … … 951 802 } 952 803 953 #if NH_3D954 if ( pcSPS->getSps3dExtensionFlag() )955 {956 codeSPS3dExtension( pcSPS );957 }958 959 #endif960 804 #endif 961 805 xWriteRbspTrailingBits(); … … 984 828 #endif 985 829 986 #if NH_3D987 Void TEncCavlc::codeSPS3dExtension( const TComSPS* pcSPS )988 {989 const TComSps3dExtension* sps3dExt = pcSPS->getSps3dExtension();990 for( Int d = 0; d <= 1; d++ )991 {992 WRITE_FLAG( sps3dExt->getIvDiMcEnabledFlag( d ) ? 1 : 0 , "iv_di_mc_enabled_flag" );993 WRITE_FLAG( sps3dExt->getIvMvScalEnabledFlag( d ) ? 1 : 0 , "iv_mv_scal_enabled_flag" );994 if( d == 0 )995 {996 WRITE_UVLC( sps3dExt->getLog2IvmcSubPbSizeMinus3( d ), "log2_sub_pb_size_minus3" );997 WRITE_FLAG( sps3dExt->getIvResPredEnabledFlag( d ) ? 1 : 0 , "iv_res_pred_enabled_flag" );998 WRITE_FLAG( sps3dExt->getDepthRefEnabledFlag( d ) ? 1 : 0 , "depth_ref_enabled_flag" );999 WRITE_FLAG( sps3dExt->getVspMcEnabledFlag( d ) ? 1 : 0 , "vsp_mc_enabled_flag" );1000 WRITE_FLAG( sps3dExt->getDbbpEnabledFlag( d ) ? 1 : 0 , "dbbp_enabled_flag" );1001 }1002 else1003 {1004 WRITE_FLAG( sps3dExt->getTexMcEnabledFlag( d ) ? 1 : 0 , "tex_mc_enabled_flag" );1005 WRITE_UVLC( sps3dExt->getLog2TexmcSubPbSizeMinus3( d ), "log2_texmc_sub_pb_size_minus3" );1006 WRITE_FLAG( sps3dExt->getIntraContourEnabledFlag( d ) ? 1 : 0 , "intra_contour_enabled_flag" );1007 WRITE_FLAG( sps3dExt->getIntraDcOnlyWedgeEnabledFlag( d ) ? 1 : 0 , "intra_dc_only_wedge_enabled_flag" );1008 WRITE_FLAG( sps3dExt->getCqtCuPartPredEnabledFlag( d ) ? 1 : 0 , "cqt_cu_part_pred_enabled_flag" );1009 WRITE_FLAG( sps3dExt->getInterDcOnlyEnabledFlag( d ) ? 1 : 0 , "inter_dc_only_enabled_flag" );1010 WRITE_FLAG( sps3dExt->getSkipIntraEnabledFlag( d ) ? 1 : 0 , "skip_intra_enabled_flag" );1011 }1012 }1013 }1014 #endif1015 830 1016 831 … … 1111 926 m_pcBitIf->writeAlignOne(); 1112 927 codeVPSExtension( pcVPS ); 1113 #if NH_3D1114 WRITE_FLAG( 1, "vps_extension2_flag" );1115 WRITE_FLAG( 1, "vps_3d_extension_flag" );1116 m_pcBitIf->writeAlignOne();1117 codeVPS3dExtension( pcVPS );1118 WRITE_FLAG( 0, "vps_extension3_flag" );1119 #else1120 928 WRITE_FLAG( 0, "vps_extension2_flag" ); 1121 #endif1122 929 #else 1123 930 WRITE_FLAG( 0, "vps_extension_flag" ); … … 1711 1518 #endif 1712 1519 1713 #if NH_3D1714 Void TEncCavlc::codeVPS3dExtension( const TComVPS* pcVPS )1715 {1716 WRITE_UVLC( pcVPS->getCpPrecision( ), "cp_precision" );1717 for (Int n = 1; n < pcVPS->getNumViews(); n++)1718 {1719 Int i = pcVPS->getViewOIdxList( n );1720 Int iInVps = pcVPS->getVoiInVps( i );1721 WRITE_CODE( pcVPS->getNumCp( iInVps ), 6, "num_cp" );1722 1723 if( pcVPS->getNumCp( iInVps ) > 0 )1724 {1725 WRITE_FLAG( pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) ? 1 : 0 , "cp_in_slice_segment_header_flag" );1726 for( Int m = 0; m < pcVPS->getNumCp( iInVps ); m++ )1727 {1728 WRITE_UVLC( pcVPS->getCpRefVoi( iInVps, m ), "cp_ref_voi" );1729 if( !pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) )1730 {1731 Int j = pcVPS->getCpRefVoi( iInVps, m );1732 Int jInVps = pcVPS->getVoiInVps( j );1733 WRITE_SVLC( pcVPS->getVpsCpScale ( iInVps, jInVps ), "vps_cp_scale" );1734 WRITE_SVLC( pcVPS->getVpsCpOff ( iInVps, jInVps ), "vps_cp_off" );1735 WRITE_SVLC( pcVPS->getVpsCpInvScale( iInVps, jInVps ) + pcVPS->getVpsCpScale( iInVps, jInVps ), "vps_cp_inv_scale_plus_scale" );1736 WRITE_SVLC( pcVPS->getVpsCpInvOff ( iInVps, jInVps ) + pcVPS->getVpsCpOff ( iInVps, jInVps ), "vps_cp_inv_off_plus_off" );1737 }1738 }1739 }1740 }1741 }1742 #endif1743 1520 1744 1521 … … 1783 1560 WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" ); 1784 1561 } 1785 #if H_3D_PPS_FIX_DEPTH1786 if( pcSlice->getIsDepth() )1787 {1788 WRITE_UVLC( 1, "slice_pic_parameter_set_id" );1789 }1790 else1791 #endif1792 1562 WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" ); 1793 1563 if ( pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag() && (sliceSegmentRsAddress!=0) ) … … 1990 1760 Bool interLayerPredLayerIdcPresentFlag = false; 1991 1761 Int layerId = pcSlice->getLayerId(); 1992 #if NH_3D1993 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 )1994 #else1995 1762 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) 1996 #endif1997 1763 { 1998 1764 WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" ); 1999 #if NH_3D2000 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 )2001 #else2002 1765 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 ) 2003 #endif2004 1766 { 2005 1767 if( !vps->getMaxOneActiveRefLayerFlag()) … … 2007 1769 WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" ); 2008 1770 } 2009 #if NH_3D2010 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) )2011 #else2012 1771 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) ) 2013 #endif2014 1772 { 2015 1773 interLayerPredLayerIdcPresentFlag = true; … … 2030 1788 #endif 2031 1789 2032 #if NH_3D2033 if( getEncTop()->decProcAnnexI() )2034 {2035 if ( pcSlice->getInCmpPredAvailFlag() )2036 {2037 WRITE_FLAG( pcSlice->getInCompPredFlag(), "in_comp_pred_flag" );2038 }2039 }2040 #endif2041 1790 2042 1791 if(pcSlice->getSPS()->getUseSAO()) … … 2054 1803 { 2055 1804 Bool overrideFlag = (pcSlice->getNumRefIdx( REF_PIC_LIST_0 )!=pcSlice->getPPS()->getNumRefIdxL0DefaultActive()||(pcSlice->isInterB()&&pcSlice->getNumRefIdx( REF_PIC_LIST_1 )!=pcSlice->getPPS()->getNumRefIdxL1DefaultActive())); 2056 #if H_3D_PPS_FIX_DEPTH2057 overrideFlag |= (pcSlice->getIsDepth() && !pcSlice->getViewIndex());2058 #endif2059 1805 WRITE_FLAG( overrideFlag ? 1 : 0, "num_ref_idx_active_override_flag"); 2060 1806 if (overrideFlag) … … 2076 1822 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 2077 1823 } 2078 #if H_3D_PPS_FIX_DEPTH2079 if( (pcSlice->getPPS()->getListsModificationPresentFlag() || (pcSlice->getIsDepth() && !pcSlice->getViewIndex())) && pcSlice->getNumRpsCurrTempList() > 1)2080 #else2081 1824 if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1) 2082 #endif2083 1825 { 2084 1826 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); … … 2162 1904 xCodePredWeightTable( pcSlice ); 2163 1905 } 2164 #if NH_3D_IC2165 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE )2166 && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 02167 && getEncTop()->decProcAnnexI()2168 )2169 {2170 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );2171 if( pcSlice->getApplyIC() )2172 {2173 WRITE_FLAG( pcSlice->getIcSkipParseFlag() ? 1 : 0, "slice_ic_disabled_merge_zero_idx_flag" );2174 }2175 }2176 #endif2177 #if NH_3D_IV_MERGE2178 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM);2179 #else2180 1906 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS); 2181 #endif2182 1907 if (!pcSlice->isIntra()) 2183 1908 { 2184 #if NH_3D_IV_MERGE2185 WRITE_UVLC( ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) || pcSlice->getViewSynthesisPredFlag( ) ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");2186 #else2187 1909 WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand"); 2188 #endif2189 1910 } 2190 1911 Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); … … 2232 1953 WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag"); 2233 1954 } 2234 #if NH_3D2235 if (getEncTop()->decProcAnnexI() )2236 {2237 Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() );2238 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )2239 {2240 for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ )2241 {2242 Int jInVps = vps->getVoiInVps( vps->getCpRefVoi( voiInVps, m ));2243 WRITE_SVLC( pcSlice->getCpScale ( jInVps ) , "cp_scale" );2244 WRITE_SVLC( pcSlice->getCpOff ( jInVps ) , "cp_off" );2245 WRITE_SVLC( pcSlice->getCpInvScale( jInVps ) + pcSlice->getCpScale( jInVps ) , "cp_inv_scale_plus_scale" );2246 WRITE_SVLC( pcSlice->getCpInvOff ( jInVps ) + pcSlice->getCpOff ( jInVps ) , "cp_inv_off_plus_off" );2247 }2248 }2249 }2250 #endif2251 1955 2252 1956 } … … 2554 2258 } 2555 2259 2556 #if NH_3D_ARP 2557 Void TEncCavlc::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2260 2261 2262 Void TEncCavlc::codeInterModeFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiEncMode*/ ) 2558 2263 { 2559 2264 assert(0); 2560 2265 } 2561 #endif 2562 2563 #if NH_3D_IC 2564 Void TEncCavlc::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2266 2267 Void TEncCavlc::codeCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ ) 2565 2268 { 2566 2269 assert(0); 2567 2270 } 2568 #endif 2569 2570 Void TEncCavlc::codeInterModeFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiEncMode*/ ) 2271 2272 Void TEncCavlc::codeSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ ) 2571 2273 { 2572 2274 assert(0); 2573 2275 } 2574 2575 Void TEncCavlc::codeCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ )2576 {2577 assert(0);2578 }2579 2580 Void TEncCavlc::codeSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ )2581 {2582 assert(0);2583 }2584 #if NH_3D_DIS2585 Void TEncCavlc::codeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx )2586 {2587 assert(0);2588 }2589 #endif2590 2276 2591 2277 Void TEncCavlc::codeSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) … … 2863 2549 assert(0); 2864 2550 } 2865 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER2866 Void TEncCavlc::codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )2867 {2868 assert(0);2869 }2870 #endif2871 2551 2872 #if NH_3D_DBBP2873 Void TEncCavlc::codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )2874 {2875 assert(0);2876 }2877 #endif2878 2552 2879 2553 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncCavlc.h
r1386 r1390 106 106 Void codeSPSExtension ( const TComSPS* pcSPS ); 107 107 #endif 108 #if NH_3D109 Void codeVPS3dExtension ( const TComVPS* pcVPS );110 Void codeSPS3dExtension ( const TComSPS* pcSPS );111 #endif112 108 Void codeSPS ( const TComSPS* pcSPS ); 113 109 Void codePPS ( const TComPPS* pcPPS ); 114 110 #if NH_MV 115 111 Void codePpsMultilayerExtension( const TComPPS* pcPPS ); 116 #endif117 #if NH_3D118 Void codePps3dExtension ( const TComPPS* pcPPS );119 112 #endif 120 113 Void codeSliceHeader ( TComSlice* pcSlice ); … … 130 123 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 131 124 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 132 #if NH_3D_DIS133 Void codeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx );134 #endif135 125 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 136 126 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 137 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER138 Void codeDeltaDC ( TComDataCU* /*pcCU*/, UInt /*absPartIdx*/ ) { assert(0); };139 #endif140 #if NH_3D_ARP141 Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx );142 #endif143 #if NH_3D_IC144 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );145 #endif146 127 147 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER148 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );149 #endif150 #if NH_3D_DBBP151 Void codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );152 #endif153 128 Void codeAlfCtrlFlag ( ComponentID /*component*/, UInt /*code*/ ) {printf("Not supported\n"); assert(0);} 154 129 Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ); -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncCfg.h
r1386 r1390 46 46 #include "TLibCommon/TComSlice.h" 47 47 #include <assert.h> 48 #if NH_3D_VSO49 #include "TAppCommon/TAppComCamPara.h"50 #include "TLibRenderer/TRenModSetupStrParser.h"51 #endif52 48 53 49 #if NH_MV … … 79 75 Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 80 76 #endif 81 #if NH_3D82 Bool m_interCompPredFlag;83 #endif84 77 85 78 GOPEntry() … … 100 93 #if NH_MV 101 94 , m_numActiveRefLayerPics(0) 102 #endif103 #if NH_3D104 , m_interCompPredFlag(false)105 95 #endif 106 96 … … 386 376 #endif 387 377 388 #if KWU_RC_MADPRED_E0227389 UInt m_depthMADPred;390 #endif391 #if KWU_RC_VIEWRC_E0227392 Bool m_bViewWiseRateCtrl;393 #endif394 378 Bool m_TransquantBypassEnableFlag; ///< transquant_bypass_enable_flag setting in PPS. 395 379 Bool m_CUTransquantBypassFlagForce; ///< if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true. … … 403 387 #endif 404 388 405 #if NH_3D_DLT406 TComDLT m_cDLT;407 #endif408 389 Bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value 409 390 Int m_activeParameterSetsSEIEnabled; ///< enable active parameter set SEI message … … 458 439 #endif 459 440 460 #if NH_3D_VSO461 Bool m_isDepth;462 Bool m_isAuxDepth;463 464 //====== Camera Parameters ======465 TAppComCamPara* m_cameraParameters;466 467 //====== View Synthesis Optimization ======468 TRenModSetupStrParser* m_renderModelParameters;469 Bool m_bUseVSO;470 Bool m_bForceLambdaScale;471 Bool m_bAllowNegDist;472 Double m_dLambdaScaleVSO;473 UInt m_uiVSOMode;474 // LGE_WVSO_A0119475 Bool m_bUseWVSO;476 Int m_iVSOWeight;477 Int m_iVSDWeight;478 Int m_iDWeight;479 // SAIT_VSO_EST_A0033480 Bool m_bUseEstimatedVSD;481 Double m_dDispCoeff;482 #endif483 #if NH_3D484 485 Bool m_bUseIC;486 Bool m_bUseICLowLatencyEnc;487 Bool m_useDMM;488 Bool m_useSDC;489 Bool m_useDLT;490 #endif491 #if NH_3D_QTL492 Bool m_bUseQTL;493 #endif494 #if NH_3D495 Int m_profileIdc;496 #endif497 441 public: 498 442 TEncCfg() … … 504 448 , m_viewId(-1) 505 449 , m_viewIndex(-1) 506 #if NH_3D_VSO507 , m_isDepth(false)508 , m_isAuxDepth(false)509 , m_bUseVSO(false)510 #endif511 #if NH_3D512 , m_profileIdc( -1 )513 #endif514 450 #endif 515 451 … … 555 491 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 556 492 Int getViewIndex () { return m_viewIndex; } 557 #if NH_3D_VSO558 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }559 Bool getIsDepth () { return m_isDepth; }560 Void setIsAuxDepth ( Bool isAuxDepth ) { m_isAuxDepth = isAuxDepth; }561 Bool getIsAuxDepth () { return m_isAuxDepth; }562 563 564 #endif565 493 #endif 566 494 //====== Coding Structure ======== … … 592 520 Void setMaxTotalCUDepth ( UInt u ) { m_maxTotalCUDepth = u; } 593 521 Void setLog2DiffMaxMinCodingBlockSize( UInt u ) { m_log2DiffMaxMinCodingBlockSize = u; } 594 #if NH_3D_IC595 Void setUseIC ( Bool bVal ) { m_bUseIC = bVal; }596 Bool getUseIC () { return m_bUseIC; }597 Void setUseICLowLatencyEnc ( Bool bVal ) { m_bUseICLowLatencyEnc = bVal; }598 Bool getUseICLowLatencyEnc () { return m_bUseICLowLatencyEnc; }599 #endif600 522 601 523 //======== Transform ============= … … 1015 937 #endif 1016 938 1017 #if KWU_RC_MADPRED_E02271018 UInt getUseDepthMADPred () { return m_depthMADPred; }1019 Void setUseDepthMADPred (UInt b) { m_depthMADPred = b; }1020 #endif1021 #if KWU_RC_VIEWRC_E02271022 Bool getUseViewWiseRateCtrl () { return m_bViewWiseRateCtrl; }1023 Void setUseViewWiseRateCtrl (Bool b) { m_bViewWiseRateCtrl = b; }1024 #endif1025 939 Bool getTransquantBypassEnableFlag() { return m_TransquantBypassEnableFlag; } 1026 940 Void setTransquantBypassEnableFlag(Bool flag) { m_TransquantBypassEnableFlag = flag; } … … 1037 951 #endif 1038 952 1039 #if NH_3D_DLT1040 Void setDLT( TComDLT p ) { m_cDLT = p; }1041 TComDLT* getDLT() { return &m_cDLT; }1042 #endif1043 953 Void setUseRecalculateQPAccordingToLambda (Bool b) { m_recalculateQPAccordingToLambda = b; } 1044 954 Bool getUseRecalculateQPAccordingToLambda () { return m_recalculateQPAccordingToLambda; } … … 1157 1067 UInt getSummaryVerboseness( ) const { return m_summaryVerboseness; } 1158 1068 1159 #if NH_3D_VSO 1160 // Only flags that are not in the SPS3dExtension should go here. 1161 /// 3D Tools 1162 1163 //==== CAMERA PARAMETERS ========== 1164 Void setCameraParameters ( TAppComCamPara* c) { m_cameraParameters = c; } 1165 //==== VSO ========== 1166 Void setRenderModelParameters ( TRenModSetupStrParser* c ) { m_renderModelParameters = c; } 1167 Bool getUseVSO () { return m_bUseVSO; } 1168 Void setUseVSO ( Bool b ) { m_bUseVSO = b; } 1169 UInt getVSOMode () { return m_uiVSOMode; } 1170 Void setVSOMode ( UInt ui ) { m_uiVSOMode = ui; } 1171 Bool getForceLambdaScaleVSO () { return m_bForceLambdaScale; } 1172 Void setForceLambdaScaleVSO ( Bool b ) { m_bForceLambdaScale = b; }; 1173 Double getLambdaScaleVSO () { return m_dLambdaScaleVSO; } 1174 Void setLambdaScaleVSO ( Double d ) { m_dLambdaScaleVSO = d; }; 1175 Bool getAllowNegDist () { return m_bAllowNegDist; } 1176 Void setAllowNegDist ( Bool b ) { m_bAllowNegDist = b; }; 1177 1178 // LGE_WVSO_A0119 1179 Bool getUseWVSO () { return m_bUseWVSO; } 1180 Void setUseWVSO ( Bool b ) { m_bUseWVSO = b; } 1181 Int getVSOWeight () { return m_iVSOWeight; } 1182 Void setVSOWeight ( Int i ) { m_iVSOWeight = i; } 1183 Int getVSDWeight () { return m_iVSDWeight; } 1184 Void setVSDWeight ( Int i ) { m_iVSDWeight = i; } 1185 Int getDWeight () { return m_iDWeight; } 1186 Void setDWeight ( Int i ) { m_iDWeight = i; } 1187 1188 // SAIT_VSO_EST_A0033 1189 Bool getUseEstimatedVSD () { return m_bUseEstimatedVSD; } 1190 Void setUseEstimatedVSD ( Bool b ) { m_bUseEstimatedVSD = b; } 1191 Double getDispCoeff () { return m_dDispCoeff; } 1192 Void setDispCoeff ( Double d ) { m_dDispCoeff = d; } 1193 #endif // NH_3D_VSO 1194 #if NH_3D 1195 Bool getUseDMM () { return m_useDMM; } 1196 Void setUseDMM ( Bool b) { m_useDMM = b; } 1197 Bool getUseSDC () { return m_useSDC; } 1198 Void setUseSDC ( Bool b) { m_useSDC = b; } 1199 1200 Bool getUseDLT () { return m_useDLT; } 1201 Void setUseDLT ( Bool b) { m_useDLT = b; } 1202 #endif 1203 1204 #if NH_3D_QTL 1205 Void setUseQTL ( Bool b ) { m_bUseQTL = b; } 1206 Bool getUseQTL () { return m_bUseQTL; } 1207 #endif 1208 #if NH_3D 1209 1210 Void setProfileIdc( Int a ) { assert( a == 1 || a == 6 || a == 8 ); m_profileIdc = a; } 1211 Bool decProcAnnexI() { assert( m_profileIdc != -1 ); return ( m_profileIdc == Profile::MAIN3D ); } 1212 #endif // NH_3D 1069 1213 1070 }; 1214 1071 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncCu.cpp
r1386 r1390 68 68 m_ppcTempCU = new TComDataCU*[m_uhTotalDepth-1]; 69 69 70 #if NH_3D_ARP71 m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1];72 #endif73 70 74 71 m_ppcPredYuvBest = new TComYuv*[m_uhTotalDepth-1]; … … 79 76 m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1]; 80 77 m_ppcOrigYuv = new TComYuv*[m_uhTotalDepth-1]; 81 #if NH_3D_DBBP82 m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1];83 #endif84 78 85 79 UInt uiNumPartitions; … … 92 86 m_ppcBestCU[i] = new TComDataCU; m_ppcBestCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 93 87 m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 94 #if NH_3D_ARP95 m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );96 #endif97 88 98 89 m_ppcPredYuvBest[i] = new TComYuv; m_ppcPredYuvBest[i]->create(uiWidth, uiHeight, chromaFormat); … … 105 96 106 97 m_ppcOrigYuv [i] = new TComYuv; m_ppcOrigYuv [i]->create(uiWidth, uiHeight, chromaFormat); 107 #if NH_3D_DBBP108 m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight, chromaFormat);109 #endif110 98 111 99 } … … 113 101 m_bEncodeDQP = false; 114 102 115 #if KWU_RC_MADPRED_E0227116 m_LCUPredictionSAD = 0;117 m_addSADDepth = 0;118 m_temporalSAD = 0;119 m_spatialSAD = 0;120 #endif121 103 122 104 m_stillToCodeChromaQpOffsetFlag = false; … … 147 129 m_ppcTempCU[i]->destroy(); delete m_ppcTempCU[i]; m_ppcTempCU[i] = NULL; 148 130 } 149 #if NH_3D_ARP150 if(m_ppcWeightedTempCU[i])151 {152 m_ppcWeightedTempCU[i]->destroy(); delete m_ppcWeightedTempCU[i]; m_ppcWeightedTempCU[i] = NULL;153 }154 #endif155 131 if(m_ppcPredYuvBest[i]) 156 132 { … … 181 157 m_ppcOrigYuv[i]->destroy(); delete m_ppcOrigYuv[i]; m_ppcOrigYuv[i] = NULL; 182 158 } 183 #if NH_3D_DBBP184 if(m_ppcOrigYuvDBBP[i])185 {186 m_ppcOrigYuvDBBP[i]->destroy(); delete m_ppcOrigYuvDBBP[i]; m_ppcOrigYuvDBBP[i] = NULL;187 }188 #endif189 159 } 190 160 if(m_ppcBestCU) … … 199 169 } 200 170 201 #if NH_3D_ARP202 if(m_ppcWeightedTempCU)203 {204 delete [] m_ppcWeightedTempCU;205 m_ppcWeightedTempCU = NULL;206 }207 #endif208 171 if(m_ppcPredYuvBest) 209 172 { … … 241 204 m_ppcOrigYuv = NULL; 242 205 } 243 #if NH_3D_DBBP244 if(m_ppcOrigYuvDBBP)245 {246 delete [] m_ppcOrigYuvDBBP;247 m_ppcOrigYuvDBBP = NULL;248 }249 #endif250 206 } 251 207 … … 281 237 m_ppcTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() ); 282 238 283 #if NH_3D_ARP 284 m_ppcWeightedTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() ); 285 #endif 286 287 #if KWU_RC_MADPRED_E0227 288 m_LCUPredictionSAD = 0; 289 m_addSADDepth = 0; 290 m_temporalSAD = 0; 291 m_spatialSAD = 0; 292 #endif 239 293 240 294 241 // analysis of CU … … 420 367 const UInt fastDeltaQPCuMaxSize = Clip3(sps.getMaxCUHeight()>>sps.getLog2DiffMaxMinCodingBlockSize(), sps.getMaxCUHeight(), 32u); 421 368 422 #if NH_3D_QTL423 #if NH_3D_QTLPC424 Bool bLimQtPredFalg = pcPic->getSlice(0)->getQtPredFlag();425 #else426 Bool bLimQtPredFalg = false;427 #endif428 TComPic *pcTexture = rpcBestCU->getSlice()->getTexturePic();429 430 Bool depthMapDetect = (pcTexture != NULL);431 Bool bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType() == I_SLICE);432 433 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);434 435 Bool bTry2NxN = true;436 Bool bTryNx2N = true;437 #endif438 369 439 370 // get Original YUV data from picture 440 371 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getCtuRsAddr(), rpcBestCU->getZorderIdxInCtu() ); 441 372 442 #if NH_3D_QTL443 Bool bTrySplit = true;444 Bool bTrySplitDQP = true;445 #endif446 373 // variable for Cbf fast mode PU decision 447 374 Bool doNotBlockPu = true; 448 375 Bool earlyDetectionSkipMode = false; 449 376 450 #if NH_3D_NBDV451 DisInfo DvInfo;452 DvInfo.m_acNBDV.setZero();453 DvInfo.m_aVIdxCan = 0;454 #if NH_3D_NBDV_REF455 DvInfo.m_acDoNBDV.setZero();456 #endif457 #endif458 377 const UInt uiLPelX = rpcBestCU->getCUPelX(); 459 378 const UInt uiRPelX = uiLPelX + rpcBestCU->getWidth(0) - 1; … … 512 431 } 513 432 514 #if NH_3D_IC515 Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth();516 bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC();517 #endif518 433 519 434 TComSlice * pcSlice = rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx()); 520 435 521 436 const Bool bBoundary = !( uiRPelX < sps.getPicWidthInLumaSamples() && uiBPelY < sps.getPicHeightInLumaSamples() ); 522 #if NH_3D_FAST_TEXTURE_ENCODING523 Bool bIVFMerge = false;524 Int iIVFMaxD = 0;525 Bool bFMD = false;526 Bool bSubBranch = true;527 #endif528 437 if ( !bBoundary ) 529 438 { … … 537 446 } 538 447 539 #if NH_3D_QTL540 bTrySplit = true;541 #endif542 448 543 449 m_cuChromaQpOffsetIdxPlus1 = 0; … … 555 461 556 462 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 557 #if NH_3D_QTL 558 //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU 559 #if H_3D_FCO 560 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ) && pcTexture->getReconMark()) 561 #else 562 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg )) 563 #endif 564 { 565 TComDataCU* pcTextureCU = pcTexture->getCtu( rpcBestCU->getCtuRsAddr() ); //Corresponding texture LCU 566 UInt uiCUIdx = rpcBestCU->getZorderIdxInCtu(); 567 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partitioned than the texture. 568 if (pcTextureCU->getDepth(uiCUIdx) > uiDepth || pcTextureCU->getPartitionSize(uiCUIdx) == SIZE_NxN) //Texture was split. 569 { 570 bTrySplit = true; 571 bTryNx2N = true; 572 bTry2NxN = true; 573 } 574 else 575 { 576 bTrySplit = false; 577 bTryNx2N = false; 578 bTry2NxN = false; 579 if( pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize(uiCUIdx) != SIZE_2Nx2N) 580 { 581 if(pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxN || pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnU|| pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnD) 582 { 583 bTry2NxN = true; 584 } 585 else 586 { 587 bTryNx2N = true; 588 } 589 } 590 } 591 } 592 #endif 593 594 #if NH_3D_NBDV 595 if( rpcTempCU->getSlice()->getSliceType() != I_SLICE ) 596 { 597 #if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP 598 if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 599 #else 600 #if NH_3D_IV_MERGE && NH_3D_VSP 601 if( rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 602 #else 603 #if NH_3D_ARP && NH_3D_VSP 604 if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 605 #else 606 #if NH_3D_VSP 607 if( rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 608 #else 609 #if NH_3D_ARP 610 if( rpcTempCU->getSlice()->getIvResPredFlag() ) 611 #else 612 #if H_3D_IV_MERGE 613 if( rpcTempCU->getSlice()->getVPS()->getIvMvPredFlag(rpcTempCU->getSlice()->getLayerId()) ) 614 #else 615 #if NH_3D_DBBP 616 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() ) 617 #else 618 if (0) 619 #endif 620 #endif 621 #endif 622 #endif 623 #endif 624 #endif 625 #endif 626 { 627 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 628 rpcTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth); 629 #if NH_3D_IV_MERGE 630 if (rpcTempCU->getSlice()->getIsDepth() ) 631 { 632 rpcTempCU->getDispforDepth(0, 0, &DvInfo); 633 } 634 else 635 { 636 #endif 637 #if NH_3D_NBDV_REF 638 if( rpcTempCU->getSlice()->getDepthRefinementFlag() ) 639 { 640 rpcTempCU->getDisMvpCandNBDV(&DvInfo, true); 641 } 642 else 643 #endif 644 { 645 rpcTempCU->getDisMvpCandNBDV(&DvInfo); 646 } 647 #if NH_3D_IV_MERGE 648 } 649 #endif 650 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 651 rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 652 rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 653 } 654 } 655 #if NH_3D_FAST_TEXTURE_ENCODING 656 if(rpcTempCU->getSlice()->getViewIndex() && !rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() ) 657 { 658 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 659 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 660 rpcTempCU->getIVNStatus( 0, &DvInfo, bIVFMerge, iIVFMaxD); 661 rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 662 } 663 #endif 664 #endif 463 665 464 // do inter modes, SKIP and 2Nx2N 666 465 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 667 466 { 668 #if NH_3D_IC669 for( UInt uiICId = 0; uiICId < ( bICEnabled ? 2 : 1 ); uiICId++ )670 {671 Bool bICFlag = uiICId ? true : false;672 #endif673 467 // 2Nx2N 674 468 if(m_pcEncCfg->getUseEarlySkipDetection()) 675 469 { 676 #if NH_3D_IC677 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);678 #endif679 #if NH_3D_FAST_TEXTURE_ENCODING680 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N681 #else682 470 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 683 471 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 684 #endif685 #if NH_3D_VSP || NH_3D_DBBP686 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);687 #endif688 472 } 689 473 // SKIP 690 #if NH_3D_IC691 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);692 #endif693 474 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 694 #if NH_3D_FAST_TEXTURE_ENCODING695 bFMD = bIVFMerge && rpcBestCU->isSkipped(0);696 #endif697 475 698 476 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 699 #if NH_3D_VSP || NH_3D_DBBP700 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);701 #endif702 477 703 478 if(!m_pcEncCfg->getUseEarlySkipDetection()) 704 479 { 705 480 // 2Nx2N, NxN 706 #if NH_3D_IC707 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);708 #endif709 #if NH_3D_FAST_TEXTURE_ENCODING710 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );711 #else712 481 713 482 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 714 483 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 715 #endif716 #if NH_3D_VSP || NH_3D_DBBP717 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);718 #endif719 #if NH_3D_DBBP720 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )721 {722 xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), false );723 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );724 #if NH_3D_VSP || NH_3D_DBBP725 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);726 #endif727 }728 #endif729 484 730 485 if(m_pcEncCfg->getUseCbfFastMode()) … … 733 488 } 734 489 } 735 #if NH_3D_IC736 }737 #endif738 490 } 739 #if NH_3D_QTL740 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ))741 {742 bTrySplitDQP = bTrySplit;743 }744 #endif745 491 746 492 if (bIsLosslessMode) // Restore loop variable if lossless mode was searched. … … 750 496 } 751 497 752 #if KWU_RC_MADPRED_E0227753 if ( uiDepth <= m_addSADDepth )754 {755 m_LCUPredictionSAD += m_temporalSAD;756 m_addSADDepth = uiDepth;757 }758 #endif759 #if NH_3D_ENC_DEPTH760 if( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() )761 {762 earlyDetectionSkipMode = false;763 }764 #endif765 #if NH_3D_DIS766 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );767 if( rpcBestCU->getSlice()->getDepthIntraSkipFlag() )768 {769 xCheckRDCostDIS( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) );770 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );771 }772 #endif773 498 if(!earlyDetectionSkipMode) 774 499 { … … 792 517 { 793 518 if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() && doNotBlockPu 794 #if NH_3D_QTL795 && bTrySplit796 #endif797 519 ) 798 520 { 799 #if NH_3D_FAST_TEXTURE_ENCODING800 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bFMD );801 #else802 521 803 522 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug) ); 804 #endif805 523 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 806 #if NH_3D_VSP || NH_3D_DBBP807 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);808 #endif809 524 810 525 } … … 812 527 813 528 if(doNotBlockPu 814 #if NH_3D_QTL815 && bTryNx2N816 #endif817 529 ) 818 530 { 819 #if NH_3D_FAST_TEXTURE_ENCODING820 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD );821 #else822 531 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 823 #endif824 532 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 825 #if NH_3D_VSP || NH_3D_DBBP826 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);827 #endif828 533 829 534 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N ) … … 833 538 } 834 539 if(doNotBlockPu 835 #if NH_3D_QTL836 && bTry2NxN837 #endif838 540 ) 839 541 { 840 #if NH_3D_FAST_TEXTURE_ENCODING841 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN DEBUG_STRING_PASS_INTO(sDebug), bFMD );842 #else843 542 844 543 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN DEBUG_STRING_PASS_INTO(sDebug) ); 845 #endif846 544 847 545 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 848 #if NH_3D_VSP || NH_3D_DBBP849 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);850 #endif851 546 852 547 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN) … … 874 569 { 875 570 if(doNotBlockPu 876 #if NH_3D_QTL877 && bTry2NxN878 #endif879 571 ) 880 572 { 881 #if NH_3D_FAST_TEXTURE_ENCODING882 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug), bFMD );883 #else884 573 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug) ); 885 #endif886 574 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 887 #if NH_3D_VSP || NH_3D_DBBP888 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);889 #endif890 575 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 891 576 { … … 894 579 } 895 580 if(doNotBlockPu 896 #if NH_3D_QTL897 && bTry2NxN898 #endif899 581 ) 900 582 { 901 #if NH_3D_FAST_TEXTURE_ENCODING902 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug), bFMD );903 #else904 583 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug) ); 905 #endif906 584 907 585 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 908 #if NH_3D_VSP || NH_3D_DBBP909 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);910 #endif911 586 912 587 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) … … 920 595 { 921 596 if(doNotBlockPu 922 #if NH_3D_QTL923 && bTry2NxN924 #endif925 597 ) 926 598 { 927 #if NH_3D_FAST_TEXTURE_ENCODING928 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );929 #else930 599 931 600 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug), true ); 932 #endif933 601 934 602 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 935 #if NH_3D_VSP || NH_3D_DBBP936 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);937 #endif938 603 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 939 604 { … … 942 607 } 943 608 if(doNotBlockPu 944 #if NH_3D_QTL945 && bTry2NxN946 #endif947 609 ) 948 610 { 949 #if NH_3D_FAST_TEXTURE_ENCODING950 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );951 #else952 611 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug), true ); 953 #endif954 612 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 955 #if NH_3D_VSP || NH_3D_DBBP956 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);957 #endif958 613 959 614 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) … … 969 624 { 970 625 if(doNotBlockPu 971 #if NH_3D_QTL972 && bTryNx2N973 #endif974 626 ) 975 627 { 976 #if NH_3D_FAST_TEXTURE_ENCODING977 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD );978 #else979 628 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug) ); 980 #endif981 629 982 630 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 983 #if NH_3D_VSP || NH_3D_DBBP984 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);985 #endif986 631 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 987 632 { … … 990 635 } 991 636 if(doNotBlockPu 992 #if NH_3D_QTL993 && bTryNx2N994 #endif995 637 ) 996 638 { 997 #if NH_3D_FAST_TEXTURE_ENCODING998 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD );999 #else1000 639 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug) ); 1001 #endif1002 640 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1003 #if NH_3D_VSP || NH_3D_DBBP1004 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1005 #endif1006 641 } 1007 642 } … … 1010 645 { 1011 646 if(doNotBlockPu 1012 #if NH_3D_QTL1013 && bTryNx2N1014 #endif1015 647 ) 1016 648 { 1017 #if NH_3D_FAST_TEXTURE_ENCODING1018 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );1019 #else1020 649 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug), true ); 1021 #endif1022 650 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1023 #if NH_3D_VSP || NH_3D_DBBP1024 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1025 #endif1026 651 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 1027 652 { … … 1030 655 } 1031 656 if(doNotBlockPu 1032 #if NH_3D_QTL1033 && bTryNx2N1034 #endif1035 657 ) 1036 658 { 1037 #if NH_3D_FAST_TEXTURE_ENCODING1038 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );1039 #else1040 659 1041 660 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug), true ); 1042 #endif1043 661 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1044 #if NH_3D_VSP || NH_3D_DBBP1045 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1046 #endif1047 662 1048 663 } … … 1051 666 1052 667 #else 1053 #if NH_3D_QTL1054 if (bTry2NxN)1055 {1056 #endif1057 668 1058 669 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 1059 670 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1060 #if NH_3D_VSP || NH_3D_DBBP1061 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1062 #endif1063 671 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 1064 672 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1065 #if NH_3D_VSP || NH_3D_DBBP1066 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1067 #endif1068 #if NH_3D_QTL1069 }1070 if (bTryNx2N)1071 {1072 #endif1073 673 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 1074 674 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1075 #if NH_3D_VSP || NH_3D_DBBP1076 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1077 #endif1078 675 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 1079 676 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1080 #if NH_3D_VSP || NH_3D_DBBP1081 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1082 #endif1083 #if NH_3D_QTL1084 }1085 #endif1086 677 1087 678 … … 1089 680 } 1090 681 } 1091 #if NH_3D_FAST_TEXTURE_ENCODING1092 if(!bFMD)1093 {1094 #endif1095 682 1096 683 // do normal intra modes … … 1103 690 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) || 1104 691 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) // avoid very complex intra if it is unlikely 1105 #if NH_3D_ENC_DEPTH1106 || rpcBestCU->getSlice()->getIsDepth()1107 #endif1108 692 ))) 1109 693 { 1110 #if NH_3D_ENC_DEPTH1111 Bool bOnlyIVP = false;1112 Bool bUseIVP = true;1113 if( (rpcBestCU->getSlice()->getSliceType() != I_SLICE) &&1114 !( (rpcBestCU->getCbf( 0, COMPONENT_Y ) != 0) ||1115 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) ||1116 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) ) &&1117 (rpcBestCU->getSlice()->getIsDepth() && !(rpcBestCU->getSlice()->isIRAP())) )1118 {1119 bOnlyIVP = true;1120 bUseIVP = rpcBestCU->getSlice()->getIntraContourFlag();1121 }1122 if( bUseIVP )1123 {1124 xCheckRDCostIntra( rpcBestCU, rpcTempCU, intraCost, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug), bOnlyIVP );1125 #else1126 694 xCheckRDCostIntra( rpcBestCU, rpcTempCU, intraCost, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 1127 #endif1128 #if KWU_RC_MADPRED_E02271129 if ( uiDepth <= m_addSADDepth )1130 {1131 m_LCUPredictionSAD += m_spatialSAD;1132 m_addSADDepth = uiDepth;1133 }1134 #endif1135 695 1136 696 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1137 697 if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() ) 1138 698 { 1139 #if NH_3D_QTL //Try IntraNxN1140 if(bTrySplit)1141 {1142 #endif1143 699 if( rpcTempCU->getWidth(0) > ( 1 << sps.getQuadtreeTULog2MinSize() ) ) 1144 700 { 1145 701 Double tmpIntraCost; 1146 #if NH_3D_ENC_DEPTH1147 xCheckRDCostIntra( rpcBestCU, rpcTempCU, tmpIntraCost, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bOnlyIVP );1148 #else1149 702 xCheckRDCostIntra( rpcBestCU, rpcTempCU, tmpIntraCost, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug) ); 1150 #endif1151 703 1152 704 intraCost = std::min(intraCost, tmpIntraCost); 1153 705 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1154 706 } 1155 #if NH_3D_QTL1156 }1157 #endif1158 707 } 1159 #if NH_3D_ENC_DEPTH1160 }1161 #endif1162 708 } 1163 709 … … 1169 715 UInt uiRawBits = getTotalBits(rpcBestCU->getWidth(0), rpcBestCU->getHeight(0), rpcBestCU->getPic()->getChromaFormat(), sps.getBitDepths().recon); 1170 716 UInt uiBestBits = rpcBestCU->getTotalBits(); 1171 #if NH_3D_VSO // M71172 Double dRDCostTemp = m_pcRdCost->getUseLambdaScaleVSO() ? m_pcRdCost->calcRdCostVSO(uiRawBits, 0) : m_pcRdCost->calcRdCost(uiRawBits, 0);1173 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > dRDCostTemp ))1174 #else1175 717 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))) 1176 #endif1177 718 1178 719 { … … 1181 722 } 1182 723 } 1183 #if NH_3D_FAST_TEXTURE_ENCODING1184 }1185 #endif1186 724 if (bIsLosslessMode) // Restore loop variable if lossless mode was searched. 1187 725 { … … 1198 736 rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 1199 737 rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1200 #if NH_3D_VSO // M81201 if ( m_pcRdCost->getUseVSO() )1202 {1203 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );1204 }1205 else1206 #endif1207 738 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 1208 739 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]); 1209 740 } 1210 #if NH_3D_FAST_TEXTURE_ENCODING1211 if(rpcBestCU->getSlice()->getViewIndex() && !rpcBestCU->getSlice()->getIsDepth() && (uiDepth >=iIVFMaxD) && rpcBestCU->isSkipped(0))1212 {1213 bSubBranch = false;1214 }1215 #endif1216 741 } 1217 742 … … 1250 775 iMaxQP = iMinQP; // If all TUs are forced into using transquant bypass, do not loop here. 1251 776 } 1252 #if NH_3D_FAST_TEXTURE_ENCODING1253 bSubBranch = bSubBranch && (bBoundary || !( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isSkipped(0) ));1254 #else1255 777 const Bool bSubBranch = bBoundary || !( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isSkipped(0) ); 1256 #endif1257 #if NH_3D_QTL1258 if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() && (!getFastDeltaQp() || uiWidth > fastDeltaQPCuMaxSize || bBoundary) && bTrySplitDQP )1259 #else1260 778 if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() && (!getFastDeltaQp() || uiWidth > fastDeltaQPCuMaxSize || bBoundary)) 1261 #endif1262 779 { 1263 780 // further split … … 1268 785 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1269 786 1270 #if NH_3D_VSO // M91271 // reset Model1272 if( m_pcRdCost->getUseRenModel() )1273 {1274 UInt uiWidthOy = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y );1275 UInt uiHeightOy = m_ppcOrigYuv[uiDepth]->getHeight( COMPONENT_Y );1276 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y, 0 );1277 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride( COMPONENT_Y );1278 m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidthOy, uiHeightOy );1279 }1280 #endif1281 787 UChar uhNextDepth = uiDepth+1; 1282 788 TComDataCU* pcSubBestPartCU = m_ppcBestCU[uhNextDepth]; … … 1284 790 DEBUG_STRING_NEW(sTempDebug) 1285 791 1286 #if NH_3D_ARP1287 m_ppcWeightedTempCU[uhNextDepth]->setSlice( m_ppcWeightedTempCU[ uiDepth]->getSlice());1288 m_ppcWeightedTempCU[uhNextDepth]->setPic ( m_ppcWeightedTempCU[ uiDepth] );1289 #endif1290 792 for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) 1291 793 { … … 1339 841 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1340 842 } 1341 #if NH_3D_VSO // M101342 if ( m_pcRdCost->getUseVSO() )1343 {1344 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1345 }1346 else1347 #endif1348 843 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1349 844 … … 1368 863 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 1369 864 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1370 #if NH_3D_VSO // M111371 if ( m_pcRdCost->getUseLambdaScaleVSO())1372 {1373 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1374 }1375 else1376 #endif1377 865 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1378 866 … … 1414 902 } 1415 903 } 1416 #if NH_3D_VSO // M121417 if( m_pcRdCost->getUseRenModel() )1418 {1419 UInt uiWidthRy = m_ppcRecoYuvBest[uiDepth]->getWidth ( COMPONENT_Y );1420 UInt uiHeightRy = m_ppcRecoYuvBest[uiDepth]->getHeight ( COMPONENT_Y );1421 Pel* piSrc = m_ppcRecoYuvBest[uiDepth]->getAddr ( COMPONENT_Y, 0 );1422 UInt uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride ( COMPONENT_Y );1423 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidthRy, uiHeightRy );1424 }1425 #endif1426 904 1427 905 DEBUG_STRING_APPEND(sDebug_, sDebug); … … 1595 1073 1596 1074 m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx ); 1597 #if NH_3D_ARP1598 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );1599 #endif1600 #if NH_3D_IC1601 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx );1602 #endif1603 1075 1604 1076 finishCU(pcCU,uiAbsPartIdx); … … 1606 1078 } 1607 1079 1608 #if NH_3D_DIS1609 m_pcEntropyCoder->encodeDIS( pcCU, uiAbsPartIdx );1610 if(!pcCU->getDISFlag(uiAbsPartIdx))1611 {1612 #endif1613 1080 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1614 1081 m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth ); … … 1620 1087 if(pcCU->getIPCMFlag(uiAbsPartIdx)) 1621 1088 { 1622 #if NH_3D_SDC_INTRA1623 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx );1624 #endif1625 1089 1626 1090 // Encode slice finish … … 1632 1096 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1633 1097 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1634 #if NH_3D_DBBP1635 m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx );1636 #endif1637 #if NH_3D_SDC_INTRA1638 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx );1639 #endif1640 #if NH_3D_ARP1641 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );1642 #endif1643 #if NH_3D_IC1644 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx );1645 #endif1646 1098 1647 1099 // Encode Coefficients … … 1651 1103 setCodeChromaQpAdjFlag( codeChromaQpAdj ); 1652 1104 setdQPFlag( bCodeDQP ); 1653 #if NH_3D_DIS1654 }1655 #endif1656 1105 1657 1106 … … 1792 1241 #endif 1793 1242 1794 #if NH_3D_MLC1795 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists1796 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];1797 #else1798 1243 TComMvField cMvFieldNeighbours[2 * MRG_MAX_NUM_CANDS]; // double length for mv of both lists 1799 1244 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1800 #endif1801 1245 Int numValidMergeCand = 0; 1802 1246 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0); … … 1807 1251 } 1808 1252 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1809 #if NH_3D_IC 1810 Bool bICFlag = rpcTempCU->getICFlag( 0 ); 1811 #endif 1812 #if NH_3D_VSO // M1 //necessary here? 1813 if( m_pcRdCost->getUseRenModel() ) 1814 { 1815 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y ); 1816 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y ); 1817 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y ); 1818 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y ); 1819 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1820 } 1821 #endif 1822 1823 #if NH_3D_ARP 1824 DisInfo cOrigDisInfo = rpcTempCU->getDvInfo(0); 1825 #else 1826 #endif 1253 1827 1254 1828 1255 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to CTU level 1829 1256 1830 #if NH_3D_SPIVMP 1831 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 1832 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 1833 TComMvField* pcMvFieldSP; 1834 UChar* puhInterDirSP; 1835 pcMvFieldSP = new TComMvField[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2]; 1836 puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()]; 1837 #endif 1838 1839 #if NH_3D_VSP 1840 #if !NH_3D_ARP 1841 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 1842 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1843 #if NH_3D_MLC 1844 rpcTempCU->initAvailableFlags(); 1845 #endif 1846 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1847 #if NH_3D_MLC 1848 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1849 #if NH_3D_SPIVMP 1850 , pcMvFieldSP, puhInterDirSP 1851 #endif 1852 , numValidMergeCand 1853 ); 1854 1855 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag 1856 #if NH_3D_SPIVMP 1857 , bSPIVMPFlag 1858 #endif 1859 , numValidMergeCand 1860 ); 1861 #endif 1862 #endif 1863 #else 1864 #if NH_3D_MLC 1865 rpcTempCU->initAvailableFlags(); 1866 #endif 1257 1867 1258 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1868 #if NH_3D_MLC 1869 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1870 #if H_3D_SPIVMP 1871 , pcMvFieldSP, puhInterDirSP 1872 #endif 1873 , numValidMergeCand 1874 ); 1875 #if NH_3D_MLC 1876 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours 1877 #if H_3D_SPIVMP 1878 , bSPIVMPFlag 1879 #endif 1880 , numValidMergeCand 1881 ); 1882 #endif 1883 #endif 1884 #endif 1885 1886 #if NH_3D_MLC 1887 Int mergeCandBuffer[MRG_MAX_NUM_CANDS_MEM]; 1888 #else 1259 1889 1260 Int mergeCandBuffer[MRG_MAX_NUM_CANDS]; 1890 #endif1891 #if NH_3D_MLC1892 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )1893 #else1894 1261 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1895 #endif1896 1262 { 1897 1263 mergeCandBuffer[ui] = 0; … … 1911 1277 DEBUG_STRING_NEW(bestStr) 1912 1278 1913 #if NH_3D_ARP1914 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;1915 #if NH_3D_IC1916 if( nARPWMax < 0 || bICFlag )1917 #else1918 if( nARPWMax < 0 )1919 #endif1920 {1921 nARPWMax = 0;1922 }1923 for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- )1924 {1925 #if NH_3D1926 #if DEBUG_STRING1927 bestStr.clear();1928 #endif1929 #endif1930 #if NH_3D_IV_MERGE1931 memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS_MEM*sizeof(Int) );1932 #else1933 memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS * sizeof(Int) );1934 #endif1935 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level1936 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );1937 #if NH_3D_IC1938 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );1939 #endif1940 rpcTempCU->getDvInfo(0) = cOrigDisInfo;1941 rpcTempCU->setDvInfoSubParts(cOrigDisInfo, 0, uhDepth );1942 #if NH_3D_VSP1943 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];1944 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);1945 #endif1946 #if NH_3D1947 #if NH_3D_MLC1948 rpcTempCU->initAvailableFlags();1949 #endif1950 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );1951 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours1952 #if NH_3D_SPIVMP1953 , pcMvFieldSP, puhInterDirSP1954 #endif1955 , numValidMergeCand1956 );1957 1958 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours1959 #if NH_3D_VSP1960 , vspFlag1961 #endif1962 #if NH_3D_SPIVMP1963 , bSPIVMPFlag1964 #endif1965 , numValidMergeCand1966 );1967 1968 #else1969 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );1970 #endif1971 1972 1973 #endif1974 1279 1975 1280 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual ) … … 1981 1286 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1982 1287 { 1983 #if NH_3D_IC1984 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )1985 {1986 if( bICFlag && uiMergeCand == 0 )1987 {1988 continue;1989 }1990 }1991 #endif1992 1288 #if NH_MV 1993 1289 D_PRINT_INC_INDENT ( g_traceModeCheck, "uiMergeCand: "+ n2s(uiMergeCand) ); … … 2001 1297 // set MC parameters 2002 1298 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to CTU level 2003 #if NH_3D_IC2004 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );2005 #endif2006 1299 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 2007 1300 rpcTempCU->setChromaQpAdjSubParts( bTransquantBypassFlag ? 0 : m_cuChromaQpOffsetIdxPlus1, 0, uhDepth ); … … 2009 1302 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to CTU level 2010 1303 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to CTU level 2011 #if NH_3D_ARP 2012 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2013 #endif 2014 2015 #if NH_3D_VSP 2016 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth ); 2017 #endif 2018 #if NH_3D_SPIVMP 2019 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 2020 if (bSPIVMPFlag[uiMergeCand]) 1304 2021 1305 { 2022 UInt uiSPAddr;2023 Int iWidth = rpcTempCU->getWidth(0);2024 Int iHeight = rpcTempCU->getHeight(0);2025 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;2026 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);2027 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)2028 {2029 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);2030 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);2031 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);2032 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);2033 }2034 }2035 else2036 #endif2037 {2038 #if NH_3D_VSP2039 if ( vspFlag[uiMergeCand] )2040 {2041 UInt partAddr;2042 Int vspSize;2043 Int width, height;2044 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );2045 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )2046 {2047 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );2048 rpcTempCU->setVSPFlag( partAddr, vspSize );2049 }2050 else2051 {2052 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2053 }2054 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )2055 {2056 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );2057 rpcTempCU->setVSPFlag( partAddr, vspSize );2058 }2059 else2060 {2061 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2062 }2063 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level2064 }2065 else2066 {2067 #endif2068 1306 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU level 2069 1307 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2070 1308 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2071 #if NH_3D_VSP2072 }2073 #endif2074 1309 } 2075 1310 // do MC 2076 1311 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 2077 1312 // estimate residual and encode everything 2078 #if NH_3D_VSO //M22079 if( m_pcRdCost->getUseRenModel() )2080 { //Reset2081 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2082 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ( COMPONENT_Y );2083 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2084 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ( COMPONENT_Y );2085 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2086 }2087 #endif2088 1313 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 2089 1314 m_ppcOrigYuv [uhDepth], … … 2103 1328 mergeCandBuffer[uiMergeCand] = 1; 2104 1329 } 2105 #if NH_3D_DIS2106 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2107 #endif2108 #if NH_3D_VSP2109 if( rpcTempCU->getSkipFlag(0) )2110 {2111 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);2112 }2113 #endif2114 #if NH_3D_SDC_INTER2115 TComDataCU *rpcTempCUPre = rpcTempCU;2116 #endif2117 1330 Int orgQP = rpcTempCU->getQP( 0 ); 2118 1331 xCheckDQP( rpcTempCU ); 2119 1332 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr)); 2120 #if NH_3D_SDC_INTER2121 if( rpcTempCU->getSlice()->getInterSdcFlag() && !uiNoResidual )2122 {2123 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};2124 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )2125 {2126 if( uiOffest > 3)2127 {2128 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )2129 {2130 continue;2131 }2132 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5)2133 {2134 continue;2135 }2136 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4)2137 {2138 continue;2139 }2140 }2141 if( rpcTempCU != rpcTempCUPre )2142 {2143 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );2144 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );2145 }2146 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2147 #if NH_3D_DIS2148 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2149 #endif2150 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2151 rpcTempCU->setCbfSubParts( 1, COMPONENT_Y, 0, uhDepth );2152 #if NH_3D_VSO //M22153 if( m_pcRdCost->getUseRenModel() )2154 { //Reset2155 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2156 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ( COMPONENT_Y );2157 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2158 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ( COMPONENT_Y );2159 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2160 }2161 #endif2162 Int iSdcOffset = 0;2163 if(uiOffest % 2 == 0)2164 {2165 iSdcOffset = uiOffest >> 1;2166 }2167 else2168 {2169 iSdcOffset = -1 * (uiOffest >> 1);2170 }2171 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2172 m_ppcOrigYuv[uhDepth],2173 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2174 m_ppcResiYuvTemp[uhDepth],2175 m_ppcRecoYuvTemp[uhDepth],2176 iSdcOffset,2177 uhDepth );2178 if (uiOffest <= 3 )2179 {2180 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();2181 }2182 2183 xCheckDQP( rpcTempCU );2184 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr) );2185 }2186 }2187 #endif2188 1333 2189 1334 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); … … 2191 1336 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2192 1337 { 2193 #if NH_3D_SDC_INTER2194 if( rpcTempCU->getSlice()->getInterSdcFlag() )2195 {2196 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );2197 }2198 else2199 {2200 #endif2201 1338 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2202 #if NH_3D_SDC_INTER2203 }2204 #endif2205 1339 } 2206 1340 } … … 2245 1379 } 2246 1380 DEBUG_STRING_APPEND(sDebug, bestStr) 2247 #if NH_3D_ARP2248 }2249 #endif2250 #if NH_3D_SPIVMP2251 delete[] pcMvFieldSP;2252 delete[] puhInterDirSP;2253 #endif2254 1381 #if NH_MV 2255 1382 D_DEC_INDENT( g_traceModeCheck ); … … 2259 1386 2260 1387 #if AMP_MRG 2261 #if NH_3D_FAST_TEXTURE_ENCODING2262 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug), Bool bFMD, Bool bUseMRG)2263 #else2264 1388 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG) 2265 #endif2266 1389 #else 2267 1390 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ) … … 2286 1409 2287 1410 // prior to this, rpcTempCU will have just been reset using rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 2288 #if NH_3D_ARP2289 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0);2290 #endif2291 #if NH_3D_FAST_TEXTURE_ENCODING2292 if(!(bFMD && (ePartSize == SIZE_2Nx2N))) //have motion estimation or merge check2293 {2294 #endif2295 1411 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2296 #if NH_3D_ARP2297 Bool bFirstTime = true;2298 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;2299 #if NH_3D_IC2300 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) )2301 #else2302 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N )2303 #endif2304 {2305 nARPWMax = 0;2306 }2307 2308 for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )2309 {2310 #if DEBUG_STRING && NH_MV_ENC_DEC_TRAC2311 sTest.clear();2312 #endif2313 2314 if( !bFirstTime && rpcTempCU->getSlice()->getIvResPredFlag() )2315 {2316 rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag );2317 }2318 #endif2319 #if NH_3D_VSO // M32320 if( m_pcRdCost->getUseRenModel() )2321 {2322 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2323 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y );2324 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2325 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y );2326 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2327 }2328 #endif2329 #if NH_3D_DIS2330 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2331 #endif2332 1412 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 2333 1413 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2334 1414 rpcTempCU->setChromaQpAdjSubParts( rpcTempCU->getCUTransquantBypass(0) ? 0 : m_cuChromaQpOffsetIdxPlus1, 0, uhDepth ); 2335 #if NH_3D_ARP2336 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );2337 #endif2338 #if NH_3D_ARP2339 if( bFirstTime == false && nARPWMax )2340 {2341 rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth );2342 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );2343 2344 m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );2345 }2346 else2347 {2348 bFirstTime = false;2349 #endif2350 1415 #if AMP_MRG 2351 1416 rpcTempCU->setMergeAMP (true); 2352 #if NH_3D_FAST_TEXTURE_ENCODING2353 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] DEBUG_STRING_PASS_INTO(sTest), bFMD, false, bUseMRG );2354 #else2355 1417 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] DEBUG_STRING_PASS_INTO(sTest), false, bUseMRG ); 2356 #endif2357 1418 2358 1419 #else 2359 1420 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 2360 1421 #endif 2361 #if NH_3D_ARP2362 if( nARPWMax )2363 {2364 m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );2365 }2366 }2367 #endif2368 1422 2369 1423 #if AMP_MRG 2370 1424 if ( !rpcTempCU->getMergeAMP() ) 2371 1425 { 2372 #if NH_3D_ARP2373 if( nARPWMax )2374 {2375 continue;2376 }2377 else2378 #endif2379 1426 { 2380 1427 #if NH_MV … … 2385 1432 } 2386 1433 #endif 2387 #if KWU_RC_MADPRED_E02272388 if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )2389 {2390 UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),2391 m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),2392 rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );2393 m_temporalSAD = (Int)SAD;2394 }2395 #endif2396 1434 2397 1435 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false DEBUG_STRING_PASS_INTO(sTest) ); 2398 #if NH_3D_VSP2399 if( rpcTempCU->getQtRootCbf(0)==0 )2400 {2401 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);2402 }2403 #endif2404 #if NH_3D_VSO // M42405 if( m_pcRdCost->getUseLambdaScaleVSO() )2406 {2407 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2408 }2409 else2410 #endif2411 1436 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2412 1437 … … 2414 1439 DebugInterPredResiReco(sTest, *(m_ppcPredYuvTemp[uhDepth]), *(m_ppcResiYuvBest[uhDepth]), *(m_ppcRecoYuvTemp[uhDepth]), DebugStringGetPredModeMask(rpcTempCU->getPredictionMode(0))); 2415 1440 #endif 2416 #if NH_3D_SDC_INTER2417 TComDataCU *rpcTempCUPre = rpcTempCU;2418 #endif2419 1441 2420 1442 xCheckDQP( rpcTempCU ); 2421 1443 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest)); 2422 #if NH_3D_SDC_INTER2423 if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N)2424 {2425 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};2426 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )2427 {2428 if( uiOffest > 3)2429 {2430 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )2431 {2432 continue;2433 }2434 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5)2435 {2436 continue;2437 }2438 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4)2439 {2440 continue;2441 }2442 }2443 2444 if( rpcTempCU != rpcTempCUPre )2445 {2446 Int orgQP = rpcBestCU->getQP( 0 );2447 rpcTempCU->initEstData( uhDepth, orgQP ,bTransquantBypassFlag );2448 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );2449 }2450 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2451 #if NH_3D_DIS2452 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2453 #endif2454 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2455 rpcTempCU->setCbfSubParts( 1, COMPONENT_Y, 0, uhDepth );2456 #if NH_3D_VSO // M32457 if( m_pcRdCost->getUseRenModel() )2458 {2459 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2460 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y );2461 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2462 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y );2463 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2464 }2465 #endif2466 2467 Int iSdcOffset = 0;2468 if(uiOffest % 2 == 0)2469 {2470 iSdcOffset = uiOffest >> 1;2471 }2472 else2473 {2474 iSdcOffset = -1 * (uiOffest >> 1);2475 }2476 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2477 m_ppcOrigYuv[uhDepth],2478 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2479 m_ppcResiYuvTemp[uhDepth],2480 m_ppcRecoYuvTemp[uhDepth],2481 iSdcOffset,2482 uhDepth );2483 if (uiOffest <= 3 )2484 {2485 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();2486 }2487 2488 xCheckDQP( rpcTempCU );2489 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest));2490 }2491 2492 }2493 #endif2494 #if NH_3D_ARP2495 }2496 #endif2497 #if NH_3D_FAST_TEXTURE_ENCODING2498 }2499 #endif2500 1444 #if NH_MV 2501 1445 D_DEC_INDENT( g_traceModeCheck ); … … 2503 1447 } 2504 1448 2505 #if NH_3D_DBBP 2506 Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment ) 2507 { 2508 UInt uiWidth = pOrigYuv->getWidth (COMPONENT_Y); 2509 UInt uiHeight = pOrigYuv->getHeight(COMPONENT_Y); 2510 Pel* piSrc = pOrigYuv->getAddr(COMPONENT_Y); 2511 UInt uiSrcStride = pOrigYuv->getStride(COMPONENT_Y); 2512 Pel* piDst = pOrigYuvTemp->getAddr(COMPONENT_Y); 2513 UInt uiDstStride = pOrigYuvTemp->getStride(COMPONENT_Y); 2514 2515 UInt uiMaskStride= MAX_CU_SIZE; 2516 2517 AOF( uiWidth == uiHeight ); 2518 2519 // backup pointer 2520 Bool* pMaskStart = pMask; 2521 2522 for (Int y=0; y<uiHeight; y++) 2523 { 2524 for (Int x=0; x<uiWidth; x++) 2525 { 2526 UChar ucSegment = (UChar)pMask[x]; 2527 AOF( ucSegment < 2 ); 2528 2529 piDst[x] = (ucSegment==uiValidSegment)?piSrc[x]:DBBP_INVALID_SHORT; 2530 } 2531 2532 piSrc += uiSrcStride; 2533 piDst += uiDstStride; 2534 pMask += uiMaskStride; 2535 } 2536 2537 // now invalidate chroma 2538 Pel* piSrcU = pOrigYuv->getAddr(COMPONENT_Cb); 2539 Pel* piSrcV = pOrigYuv->getAddr(COMPONENT_Cr); 2540 UInt uiSrcStrideC = pOrigYuv->getStride(COMPONENT_Cb); 2541 Pel* piDstU = pOrigYuvTemp->getAddr(COMPONENT_Cb); 2542 Pel* piDstV = pOrigYuvTemp->getAddr(COMPONENT_Cr); 2543 UInt uiDstStrideC = pOrigYuvTemp->getStride(COMPONENT_Cb); 2544 pMask = pMaskStart; 2545 2546 for (Int y=0; y<uiHeight/2; y++) 2547 { 2548 for (Int x=0; x<uiWidth/2; x++) 2549 { 2550 UChar ucSegment = (UChar)pMask[x*2]; 2551 AOF( ucSegment < 2 ); 2552 2553 piDstU[x] = (ucSegment==uiValidSegment)?piSrcU[x]:DBBP_INVALID_SHORT; 2554 piDstV[x] = (ucSegment==uiValidSegment)?piSrcV[x]:DBBP_INVALID_SHORT; 2555 } 2556 2557 piSrcU += uiSrcStrideC; 2558 piSrcV += uiSrcStrideC; 2559 piDstU += uiDstStrideC; 2560 piDstV += uiDstStrideC; 2561 pMask += 2*uiMaskStride; 2562 } 2563 } 2564 #endif 2565 2566 #if NH_3D_DBBP 2567 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG ) 2568 { 2569 DEBUG_STRING_NEW(sTest) 2570 AOF( !rpcTempCU->getSlice()->getIsDepth() ); 2571 2572 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2573 2574 #if NH_3D_VSO 2575 if( m_pcRdCost->getUseRenModel() ) 2576 { 2577 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y ); 2578 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y ); 2579 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y ); 2580 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y ); 2581 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2582 } 2583 #endif 2584 2585 UInt uiWidth = rpcTempCU->getWidth(0); 2586 UInt uiHeight = rpcTempCU->getHeight(0); 2587 AOF( uiWidth == uiHeight ); 2588 2589 #if NH_3D_DBBP 2590 if(uiWidth <= 8) 2591 { 2592 return; 2593 } 2594 #endif 2595 2596 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); 2597 2598 // fetch virtual depth block 2599 UInt uiDepthStride = 0; 2600 #if H_3D_FCO 2601 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(rpcTempCU->getZorderIdxInCU(), uiWidth, uiHeight, uiDepthStride); 2602 #else 2603 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(0, uiWidth, uiHeight, uiDepthStride); 2604 #endif 2605 AOF( pDepthPels != NULL ); 2606 AOF( uiDepthStride != 0 ); 2607 2608 PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth, rpcTempCU); 2609 2610 // derive partitioning from depth 2611 Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE]; 2612 Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask, rpcTempCU); 2613 2614 if( !bValidMask ) 2615 { 2616 return; 2617 } 2618 2619 // find optimal motion/disparity vector for each segment 2620 DisInfo originalDvInfo = rpcTempCU->getDvInfo(0); 2621 DbbpTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData(); 2622 TComYuv* apPredYuv[2] = { m_ppcRecoYuvTemp[uhDepth], m_ppcPredYuvTemp[uhDepth] }; 2623 2624 // find optimal motion vector fields for both segments (as 2Nx2N) 2625 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 2626 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); 2627 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); 2628 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 2629 { 2630 rpcTempCU->setDBBPFlagSubParts(true, 0, 0, uhDepth); 2631 rpcTempCU->setDvInfoSubParts(originalDvInfo, 0, uhDepth); 2632 2633 // invalidate all other segments in original YUV 2634 xInvalidateOriginalSegments(m_ppcOrigYuv[uhDepth], m_ppcOrigYuvDBBP[uhDepth], pMask, uiSegment); 2635 2636 // do motion estimation for this segment 2637 m_pcRdCost->setUseMask(true); 2638 rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize; 2639 rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment; 2640 m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth] DEBUG_STRING_PASS_INTO(sTest), false, bUseMRG ); 2641 m_pcRdCost->setUseMask(false); 2642 2643 // extract motion parameters of full block for this segment 2644 pDBBPTmpData->auhInterDir[uiSegment] = rpcTempCU->getInterDir(0); 2645 2646 pDBBPTmpData->abMergeFlag[uiSegment] = rpcTempCU->getMergeFlag(0); 2647 pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0); 2648 2649 #if NH_3D_VSP 2650 AOF( rpcTempCU->getSPIVMPFlag(0) == false ); 2651 AOF( rpcTempCU->getVSPFlag(0) == 0 ); 2652 #endif 2653 2654 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2655 { 2656 RefPicList eRefList = (RefPicList)uiRefListIdx; 2657 2658 pDBBPTmpData->acMvd[uiSegment][eRefList] = rpcTempCU->getCUMvField(eRefList)->getMvd(0); 2659 pDBBPTmpData->aiMvpNum[uiSegment][eRefList] = rpcTempCU->getMVPNum(eRefList, 0); 2660 pDBBPTmpData->aiMvpIdx[uiSegment][eRefList] = rpcTempCU->getMVPIdx(eRefList, 0); 2661 2662 rpcTempCU->getMvField(rpcTempCU, 0, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]); 2663 } 2664 } 2665 2666 // store final motion/disparity information in each PU using derived partitioning 2667 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 2668 rpcTempCU->setPartSizeSubParts ( eVirtualPartSize, 0, uhDepth ); 2669 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2670 2671 UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uhDepth ) << 1 ) ) >> 4; 2672 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 2673 { 2674 UInt uiPartAddr = uiSegment*uiPUOffset; 2675 2676 rpcTempCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uhDepth); 2677 2678 // now set stored information from 2Nx2N motion search to each partition 2679 rpcTempCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uhDepth); // interprets depth relative to LCU level 2680 2681 rpcTempCU->setMergeFlagSubParts(pDBBPTmpData->abMergeFlag[uiSegment], uiPartAddr, uiSegment, uhDepth); 2682 rpcTempCU->setMergeIndexSubParts(pDBBPTmpData->auhMergeIndex[uiSegment], uiPartAddr, uiSegment, uhDepth); 2683 2684 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2685 { 2686 RefPicList eRefList = (RefPicList)uiRefListIdx; 2687 2688 rpcTempCU->getCUMvField( eRefList )->setAllMvd(pDBBPTmpData->acMvd[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment); 2689 rpcTempCU->setMVPNum(eRefList, uiPartAddr, pDBBPTmpData->aiMvpNum[uiSegment][eRefList]); 2690 rpcTempCU->setMVPIdx(eRefList, uiPartAddr, pDBBPTmpData->aiMvpIdx[uiSegment][eRefList]); 2691 2692 rpcTempCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level 2693 } 2694 } 2695 2696 // reconstruct final prediction signal by combining both segments 2697 Int bitDepthY = rpcTempCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 2698 m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize, bitDepthY); 2699 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false DEBUG_STRING_PASS_INTO(sTest) ); 2700 2701 xCheckDQP( rpcTempCU ); 2702 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) ); 2703 } 2704 #endif 2705 #if NH_3D_DIS 2706 Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize DEBUG_STRING_FN_DECLARE(sDebug) ) 2707 { 2708 DEBUG_STRING_NEW(sTest) 2709 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2710 if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N)) 2711 { 2712 return; 2713 } 2714 2715 #if NH_MV 2716 D_PRINT_INC_INDENT(g_traceModeCheck, "xCheckRDCostDIS" ); 2717 #endif 2718 2719 #if NH_3D_VSO // M5 2720 if( m_pcRdCost->getUseRenModel() ) 2721 { 2722 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y ); 2723 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ( COMPONENT_Y ); 2724 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y ); 2725 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ( COMPONENT_Y ); 2726 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2727 } 2728 #endif 2729 2730 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2731 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 2732 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); 2733 rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth ); 2734 2735 rpcTempCU->setTrIdxSubParts(0, 0, uiDepth); 2736 rpcTempCU->setCbfSubParts(0, COMPONENT_Y, 0, uiDepth); 2737 rpcTempCU->setDISFlagSubParts(true, 0, uiDepth); 2738 rpcTempCU->setIntraDirSubParts(CHANNEL_TYPE_LUMA, DC_IDX, 0, uiDepth); 2739 #if NH_3D_SDC_INTRA 2740 rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth); 2741 #endif 2742 2743 UInt uiPreCalcDistC; 2744 m_pcPredSearch ->estIntraPredDIS ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false ); 2745 2746 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 2747 Int oldTraceCopyBack = g_traceCopyBack; 2748 g_traceCopyBack = false; 2749 #endif 2750 m_ppcRecoYuvTemp[uiDepth]->copyToPicComponent(COMPONENT_Y, rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getCtuRsAddr(), rpcTempCU->getZorderIdxInCtu() ); 2751 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 2752 g_traceCopyBack = oldTraceCopyBack; 2753 #endif 2754 2755 m_pcEntropyCoder->resetBits(); 2756 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 2757 { 2758 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); 2759 } 2760 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2761 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2762 2763 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2764 2765 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2766 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2767 2768 #if NH_3D_VSO // M6 2769 if( m_pcRdCost->getUseLambdaScaleVSO()) 2770 { 2771 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2772 } 2773 else 2774 #endif 2775 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2776 2777 xCheckDQP( rpcTempCU ); 2778 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) ); 2779 #if NH_MV 2780 D_DEC_INDENT( g_traceModeCheck ); 2781 #endif 2782 } 2783 #endif 1449 2784 1450 Void TEncCu::xCheckRDCostIntra( TComDataCU *&rpcBestCU, 2785 1451 TComDataCU *&rpcTempCU, … … 2787 1453 PartSize eSize 2788 1454 DEBUG_STRING_FN_DECLARE(sDebug) 2789 #if NH_3D_ENC_DEPTH2790 , Bool bOnlyIVP2791 #endif2792 1455 ) 2793 1456 { … … 2808 1471 2809 1472 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2810 #if NH_3D_VSO // M52811 if( m_pcRdCost->getUseRenModel() )2812 {2813 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y );2814 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ( COMPONENT_Y );2815 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y );2816 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ( COMPONENT_Y );2817 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2818 }2819 #endif2820 1473 2821 1474 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2822 #if NH_3D_DIS2823 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth );2824 #endif2825 1475 2826 1476 … … 2832 1482 2833 1483 m_pcPredSearch->estIntraPredLumaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], resiLuma DEBUG_STRING_PASS_INTO(sTest) 2834 #if NH_3D_ENC_DEPTH2835 , bOnlyIVP2836 #endif2837 1484 ); 2838 1485 … … 2844 1491 } 2845 1492 2846 #if NH_3D_SDC_INTRA2847 if( rpcTempCU->getSDCFlag( 0 ) )2848 {2849 assert( rpcTempCU->getTransformIdx(0) == 0 );2850 assert( rpcTempCU->getCbf(0, COMPONENT_Y) == 1 );2851 }2852 #endif2853 1493 2854 1494 m_pcEntropyCoder->resetBits(); … … 2859 1499 } 2860 1500 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2861 #if NH_3D_DIS2862 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true );2863 if(!rpcTempCU->getDISFlag(0))2864 {2865 #endif2866 1501 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2867 1502 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); 2868 1503 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0 ); 2869 1504 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); 2870 #if NH_3D_SDC_INTRA2871 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );2872 #endif2873 1505 2874 1506 // Encode Coefficients … … 2878 1510 setCodeChromaQpAdjFlag( codeChromaQpAdjFlag ); 2879 1511 setdQPFlag( bCodeDQP ); 2880 #if NH_3D_DIS2881 }2882 #endif2883 1512 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2884 1513 2885 1514 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2886 1515 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2887 #if NH_3D_VSO // M62888 if( m_pcRdCost->getUseLambdaScaleVSO())2889 {2890 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2891 }2892 else2893 #endif2894 1516 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2895 1517 … … 2927 1549 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2928 1550 2929 #if NH_3D_VSO // VERY NEW2930 if( m_pcRdCost->getUseRenModel() )2931 {2932 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y );2933 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ( COMPONENT_Y );2934 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y );2935 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ( COMPONENT_Y );2936 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2937 }2938 #endif2939 1551 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2940 #if NH_3D_DIS2941 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth );2942 #endif2943 1552 rpcTempCU->setIPCMFlag(0, true); 2944 1553 rpcTempCU->setIPCMFlagSubParts (true, 0, rpcTempCU->getDepth(0)); … … 2960 1569 2961 1570 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2962 #if NH_3D_DIS2963 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true );2964 #endif2965 1571 m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0, true ); 2966 1572 m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true ); 2967 1573 m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true ); 2968 #if NH_3D_SDC_INTRA2969 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );2970 #endif2971 1574 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2972 1575 2973 1576 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2974 1577 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2975 #if NH_3D_VSO // M442976 if ( m_pcRdCost->getUseVSO() )2977 {2978 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2979 }2980 else2981 #endif2982 1578 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2983 1579 … … 3046 1642 pcCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 3047 1643 pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 3048 #if NH_3D_VSO // M453049 if ( m_pcRdCost->getUseVSO() )3050 {3051 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( pcCU->getTotalBits(), pcCU->getTotalDistortion() );3052 }3053 else3054 #endif3055 1644 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( pcCU->getTotalBits(), pcCU->getTotalDistortion() ); 3056 1645 } -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncCu.h
r1321 r1390 69 69 TComDataCU** m_ppcBestCU; ///< Best CUs in each depth 70 70 TComDataCU** m_ppcTempCU; ///< Temporary CUs in each depth 71 #if NH_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 NH_3D_DBBP85 TComYuv** m_ppcOrigYuvDBBP;86 #endif87 81 88 82 // Data : encoder control … … 106 100 TEncRateCtrl* m_pcRateCtrl; 107 101 108 #if KWU_RC_MADPRED_E0227109 UInt m_LCUPredictionSAD;110 Int m_addSADDepth;111 Int m_temporalSAD;112 Int m_spatialSAD;113 #endif114 102 public: 115 103 /// copy parameters from encoder class … … 129 117 130 118 Int updateCtuDataISlice ( TComDataCU* pCtu, Int width, Int height ); 131 #if KWU_RC_MADPRED_E0227132 UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; }133 #endif134 119 135 120 Void setFastDeltaQp ( Bool b) { m_bFastDeltaQP = b; } … … 150 135 151 136 #if AMP_MRG 152 #if NH_3D_FAST_TEXTURE_ENCODING153 Void xCheckRDCostInter ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug), Bool bFMD, Bool bUseMRG = false ) ;154 #else155 137 Void xCheckRDCostInter ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG = false ); 156 #endif157 138 #else 158 139 Void xCheckRDCostInter ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); 159 #endif160 #if NH_3D_DBBP161 Void xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );162 Void xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG = false );163 #endif164 #if NH_3D_DIS165 Void xCheckRDCostDIS ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug) );166 140 #endif 167 141 Void xCheckRDCostIntra ( TComDataCU *&rpcBestCU, … … 170 144 PartSize ePartSize 171 145 DEBUG_STRING_FN_DECLARE(sDebug) 172 #if NH_3D_ENC_DEPTH173 , Bool bOnlyIVP174 #endif175 146 ); 176 147 Void xCheckDQP ( TComDataCU* pcCU ); -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncEntropy.cpp
r1386 r1390 116 116 m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx ); 117 117 } 118 #if NH_3D_DIS119 Void TEncEntropy::encodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )120 {121 if( !pcCU->getSlice()->getDepthIntraSkipFlag() )122 {123 return;124 }125 if( bRD )126 {127 uiAbsPartIdx = 0;128 }129 m_pcEntropyCoderIf->codeDIS( pcCU, uiAbsPartIdx );130 }131 #endif132 118 //! encode merge flag 133 119 Void TEncEntropy::encodeMergeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 148 134 } 149 135 150 #if NH_3D_IC 151 Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 152 { 153 #if NH_3D_ARP 154 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 ) 155 #else 156 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() ) 157 #endif 158 { 159 return; 160 } 161 162 if( !pcCU->getSlice()->getApplyIC() ) 163 { 164 return; 165 } 166 167 if( bRD ) 168 { 169 uiAbsPartIdx = 0; 170 } 171 else 172 { 173 Int ICEnableCandidate = pcCU->getSlice()->getICEnableCandidate(pcCU->getSlice()->getDepth()); 174 Int ICEnableNum = pcCU->getSlice()->getICEnableNum(pcCU->getSlice()->getDepth()); 175 ICEnableCandidate++; 176 if(pcCU->getICFlag(uiAbsPartIdx)) 177 { 178 ICEnableNum++; 179 } 180 pcCU->getSlice()->setICEnableCandidate(pcCU->getSlice()->getDepth(), ICEnableCandidate); 181 pcCU->getSlice()->setICEnableNum(pcCU->getSlice()->getDepth(), ICEnableNum); 182 } 183 if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) 184 { 185 m_pcEntropyCoderIf->codeICFlag( pcCU, uiAbsPartIdx ); 186 } 187 } 188 #endif 189 190 #if NH_3D_ARP 191 Void TEncEntropy::encodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 192 { 193 if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) 194 { 195 return; 196 } 197 198 if ( pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_2Nx2N ) 199 { 200 assert(pcCU->getARPW (uiAbsPartIdx) == 0); 201 } 202 else 203 { 204 m_pcEntropyCoderIf->codeARPW( pcCU, uiAbsPartIdx ); 205 } 206 } 207 #endif 136 208 137 209 138 … … 715 644 #endif 716 645 717 #if NH_3D_SDC_INTRA718 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, COMPONENT_Y) == 1 );723 }724 #endif725 #if NH_3D_SDC_INTER726 if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx ) )727 {728 assert( !pcCU->isSkipped( uiAbsPartIdx ) );729 assert( !pcCU->isIntra( uiAbsPartIdx) );730 assert( pcCU->getSlice()->getIsDepth() );731 }732 #endif733 #if NH_3D734 if( pcCU->getSlice()->getIsDepth() )735 {736 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER737 if( pcCU->getSDCFlag( uiAbsPartIdx ) )738 {739 m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx );740 return;741 }742 #endif743 #if NH_3D_DMM744 if( pcCU->isIntra(uiAbsPartIdx) )745 {746 Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;747 UInt uiPartOffset = ( pcCU->getPic()->getNumPartitionsInCtu() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;748 for( Int iPart = 0; iPart < iPartNum; iPart++ )749 {750 if( isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx + uiPartOffset*iPart ) ) )751 {752 m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart );753 }754 }755 }756 #endif757 }758 #endif759 646 760 647 if( pcCU->isIntra(uiAbsPartIdx) ) … … 851 738 } 852 739 853 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER854 Void TEncEntropy::encodeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx )855 {856 m_pcEntropyCoderIf->codeDeltaDC( pcCU, absPartIdx );857 }858 #endif859 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER860 Void TEncEntropy::encodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )861 {862 if( bRD )863 {864 uiAbsPartIdx = 0;865 }866 867 if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getInterSdcFlag() ) ||868 ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getIntraSdcWedgeFlag() ) )869 {870 return;871 }872 873 if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )874 {875 return;876 }877 878 assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N );879 880 m_pcEntropyCoderIf->codeSDCFlag( pcCU, uiAbsPartIdx );881 }882 883 #endif884 #if NH_3D_DBBP885 Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )886 {887 if( bRD )888 {889 uiAbsPartIdx = 0;890 }891 892 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() &&893 ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN ||894 pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) &&895 pcCU->getWidth(uiAbsPartIdx) > 8 &&896 pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )897 {898 m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );899 }900 }901 #endif902 740 903 741 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncEntropy.h
r1386 r1390 79 79 virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 80 80 virtual Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 81 #if NH_3D_DIS82 virtual Void codeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;83 #endif84 81 virtual Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 85 82 virtual Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 86 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER87 virtual Void codeDeltaDC ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;88 #endif89 #if NH_3D_ARP90 virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;91 #endif92 #if NH_3D_IC93 virtual Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;94 #endif95 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER96 virtual Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;97 #endif98 #if NH_3D_DBBP99 virtual Void codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;100 #endif101 83 virtual Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 102 84 … … 163 145 Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 164 146 Void encodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 165 #if NH_3D_DIS166 Void encodeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false );167 #endif168 147 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 169 148 Void encodeInterDirPU ( TComDataCU* pcSubCU, UInt uiAbsPartIdx ); … … 173 152 Void encodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 174 153 Void encodeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 175 #if NH_3D_ARP176 Void encodeARPW ( TComDataCU* pcCU, UInt uiAbspartIdx );177 #endif178 #if NH_3D_IC179 Void encodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );180 #endif181 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER182 Void encodeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx );183 #endif184 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER185 Void encodeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );186 #endif187 #if NH_3D_DBBP188 Void encodeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );189 #endif190 154 Void encodePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 191 155 Void encodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncGOP.cpp
r1386 r1390 101 101 m_viewId = 0; 102 102 m_pocLastCoded = -1; 103 #if NH_3D104 m_viewIndex = 0;105 m_isDepth = false;106 #endif107 103 #endif 108 104 m_associatedIRAPType = NAL_UNIT_CODED_SLICE_IDR_N_LP; … … 150 146 m_layerId = pcTEncTop->getLayerId(); 151 147 m_viewId = pcTEncTop->getViewId(); 152 #if NH_3D153 m_viewIndex = pcTEncTop->getViewIndex();154 m_isDepth = pcTEncTop->getIsDepth();155 #endif156 #endif157 #if NH_3D_IC158 m_aICEnableCandidate = pcTEncTop->getICEnableCandidate();159 m_aICEnableNum = pcTEncTop->getICEnableNum();160 #endif161 #if KWU_FIX_URQ162 m_pcRateCtrl = pcTEncTop->getRateCtrl();163 148 #endif 164 149 } … … 1238 1223 pcPic ->setLayerId ( getLayerId() ); 1239 1224 pcPic ->setViewId ( getViewId() ); 1240 #if !NH_3D1241 1225 pcSlice->setLayerId ( getLayerId() ); 1242 1226 pcSlice->setViewId ( getViewId() ); 1243 1227 pcSlice->setVPS ( m_pcEncTop->getVPS() ); 1244 #else1245 pcPic ->setViewIndex ( getViewIndex() );1246 pcPic ->setIsDepth( getIsDepth() );1247 pcSlice->setCamparaSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() );1248 #endif1249 1228 #endif 1250 1229 //set default slice level flag to the same as SPS level flag … … 1417 1396 1418 1397 const TComVPS* vps = pcSlice->getVPS(); 1419 #if NH_3D1420 Int numDirectRefLayers = vps ->getNumRefListLayers( getLayerId() );1421 #else1422 1398 Int numDirectRefLayers = vps ->getNumDirectRefLayers( getLayerId() ); 1423 #endif1424 #if NH_3D_QTL1425 pcSlice->setIvPicLists( m_ivPicLists );1426 #endif1427 #if NH_3D1428 1429 1430 Int gopNum = (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid;1431 GOPEntry gopEntry = m_pcCfg->getGOPEntry( gopNum );1432 #else1433 1399 GOPEntry gopEntry = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid ); 1434 #endif1435 1400 1436 1401 … … 1446 1411 pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 ); 1447 1412 } 1448 #if NH_3D1449 if ( gopEntry.m_numActiveRefLayerPics != vps->getNumRefListLayers( getLayerId() ) )1450 #else1451 1413 if ( gopEntry.m_numActiveRefLayerPics != vps->getNumDirectRefLayers( getLayerId() ) ) 1452 #endif1453 1414 { 1454 1415 interLayerPredLayerIdcPresentFlag = true; … … 1471 1432 assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics ); 1472 1433 1473 #if NH_3D1474 if ( m_pcEncTop->decProcAnnexI() )1475 {1476 pcSlice->deriveInCmpPredAndCpAvailFlag( );1477 if ( pcSlice->getInCmpPredAvailFlag() )1478 {1479 pcSlice->setInCompPredFlag( gopEntry.m_interCompPredFlag );1480 }1481 else1482 {1483 if (gopEntry.m_interCompPredFlag )1484 {1485 if ( gopNum == MAX_GOP)1486 {1487 printf( "\nError: FrameI_l%d cannot enable inter-component prediction on slice level. All reference layers need to be available and at least one tool using inter-component prediction must be enabled in the SPS. \n", pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );1488 }1489 else1490 {1491 printf( "\nError: Frame%d_l%d cannot enable inter-component prediction on slice level. All reference layers need to be available and at least one tool using inter-component prediction must be enabled in the SPS. \n", gopNum, pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );1492 }1493 1494 exit(EXIT_FAILURE);1495 }1496 }1497 pcSlice->init3dToolParameters();1498 pcSlice->checkInCompPredRefLayers();1499 }1500 #if NH_3D_IV_MERGE1501 // This needs to be done after initialization of 3D tool parameters.1502 pcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() + ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) || pcSlice->getViewSynthesisPredFlag( ) ) ? 1 : 0 ));1503 #endif1504 #endif1505 1434 1506 1435 pcSlice->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); … … 1526 1455 pcSlice->setRefPicList ( rcListPic ); 1527 1456 #endif 1528 #if NH_3D_NBDV1529 pcSlice->setDefaultRefView();1530 #endif1531 #if NH_3D_ARP1532 //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh1533 pcSlice->setARPStepNum(m_ivPicLists);1534 #endif1535 #if NH_3D_IC1536 pcSlice->setICEnableCandidate( m_aICEnableCandidate );1537 pcSlice->setICEnableNum( m_aICEnableNum );1538 #endif1539 1457 1540 1458 // Slice info. refinement … … 1590 1508 1591 1509 pcSlice->setList1IdxToList0Idx(); 1592 #if NH_3D_TMVP1593 if(pcSlice->getLayerId())1594 pcSlice->generateAlterRefforTMVP();1595 #endif1596 1510 1597 1511 if (m_pcEncTop->getTMVPModeId() == 2) … … 1622 1536 #endif 1623 1537 1624 #if NH_3D_VSO1625 // Should be moved to TEncTop !!!1626 Bool bUseVSO = m_pcEncTop->getUseVSO();1627 1628 TComRdCost* pcRdCost = m_pcEncTop->getRdCost();1629 1630 pcRdCost->setUseVSO( bUseVSO );1631 1632 // SAIT_VSO_EST_A00331633 pcRdCost->setUseEstimatedVSD( m_pcEncTop->getUseEstimatedVSD() );1634 1635 if ( bUseVSO )1636 {1637 Int iVSOMode = m_pcEncTop->getVSOMode();1638 pcRdCost->setVSOMode( iVSOMode );1639 pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() );1640 1641 // SAIT_VSO_EST_A00331642 #if H_3D_FCO1643 Bool flagRec;1644 flagRec = ((m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false, pcSlice->getPOC(), true) == NULL) ? false: true);1645 pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false, pcSlice->getPOC(), flagRec ) );1646 pcRdCost->setDepthPicYuv ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true, pcSlice->getPOC(), false ) );1647 #else1648 Int curAuxId = pcSlice->getVPS()->getAuxId( getLayerId() );1649 Int curDepthFlag = pcSlice->getIsDepth();1650 assert( curAuxId == 2 || curDepthFlag );1651 pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false , 0 , pcSlice->getPOC(), true ) );1652 pcRdCost->setDepthPicYuv ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), curDepthFlag, curAuxId, pcSlice->getPOC(), false ) );1653 #endif1654 // LGE_WVSO_A01191655 Bool bUseWVSO = m_pcEncTop->getUseWVSO();1656 pcRdCost->setUseWVSO( bUseWVSO );1657 1658 }1659 #endif1660 1538 // set adaptive search range for non-intra-slices 1661 1539 if (m_pcCfg->getUseASR() && pcSlice->getSliceType()!=I_SLICE) … … 1707 1585 estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits(); 1708 1586 1709 #if KWU_RC_MADPRED_E02271710 if(m_pcCfg->getLayerId() != 0)1711 {1712 m_pcRateCtrl->getRCPic()->setIVPic( m_pcEncTop->getEncTop()->getTEncTop(0)->getRateCtrl()->getRCPic() );1713 }1714 #endif1715 1587 1716 1588 #if U0132_TARGET_BITS_SATURATION … … 1790 1662 else // normal case 1791 1663 { 1792 #if KWU_RC_MADPRED_E02271793 if(m_pcRateCtrl->getLayerID() != 0)1794 {1795 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList();1796 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambdaIV( listPreviousPicture, pcSlice->getPOC() );1797 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture );1798 }1799 else1800 {1801 #endif1802 1664 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList(); 1803 1665 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType()); 1804 1666 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture ); 1805 #if KWU_RC_MADPRED_E02271806 }1807 #endif1808 1667 } 1809 1668 … … 1816 1675 UInt uiNumSliceSegments = 1; 1817 1676 1818 #if NH_3D_NBDV 1819 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. 1820 { 1821 Int iColPoc = pcSlice->getRefPOC(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx()); 1822 pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc)); 1823 } 1824 #endif 1825 #if NH_3D 1826 pcSlice->setDepthToDisparityLUTs(); 1827 1828 #endif 1829 1830 #if NH_3D_NBDV 1831 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. 1832 { 1833 pcPic->checkTemporalIVRef(); 1834 } 1835 1836 if(pcSlice->getIsDepth()) 1837 { 1838 pcPic->checkTextureRef(); 1839 } 1840 #endif 1677 1841 1678 // Allocate some coders, now the number of tiles are known. 1842 1679 const Int numSubstreamsColumns = (pcSlice->getPPS()->getNumTileColumnsMinus1() + 1); … … 1913 1750 // write various parameter sets 1914 1751 actualTotalBits += xWriteParameterSets(accessUnit, pcSlice); 1915 #if H_3D_PPS_FIX_DEPTH1916 if(!pcSlice->getIsDepth() || !pcSlice->getViewIndex() )1917 {1918 #endif1919 #if H_3D_PPS_FIX_DEPTH1920 }1921 #endif1922 1752 1923 1753 … … 2086 1916 // cabac_zero_words processing 2087 1917 cabac_zero_word_padding(pcSlice, pcPic, binCountsInNalUnits, numBytesInVclNalUnits, accessUnit.back()->m_nalUnitData, m_pcCfg->getCabacZeroWordPaddingEnabled()); 2088 #if NH_3D2089 pcPic->compressMotion(2);2090 #else2091 1918 pcPic->compressMotion(); 2092 #endif2093 1919 #if NH_MV 2094 1920 m_pocLastCoded = pcPic->getPOC(); … … 2240 2066 } 2241 2067 2242 #if NH_3D_VSO2243 Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, Dist64& ruiDist )2244 #else2245 2068 Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, UInt64& ruiDist ) 2246 #endif2247 2069 { 2248 2070 Bool bCalcDist = false; … … 2325 2147 } 2326 2148 2327 #if NH_3D_VSO2328 Dist64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths)2329 #else2330 2149 UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths) 2331 #endif 2332 { 2333 #if NH_3D_VSO 2334 Dist64 uiTotalDiff = 0; 2335 #else 2150 { 2336 2151 UInt64 uiTotalDiff = 0; 2337 #endif2338 2152 2339 2153 for(Int chan=0; chan<pcPic0 ->getNumberValidComponents(); chan++) … … 2475 2289 pRec += iRecStride; 2476 2290 } 2477 #if NH_3D_VSO2478 #if H_3D_VSO_SYNTH_DIST_OUT2479 if ( m_pcRdCost->getUseRenModel() )2480 {2481 unsigned int maxval = 255 * (1<<(g_uiBitDepth + g_uiBitIncrement -8));2482 Double fRefValueY = (double) maxval * maxval * iSize;2483 Double fRefValueC = fRefValueY / 4.0;2484 TRenModel* pcRenModel = m_pcEncTop->getEncTop()->getRenModel();2485 Int64 iDistVSOY, iDistVSOU, iDistVSOV;2486 pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV );2487 dYPSNR = ( iDistVSOY ? 10.0 * log10( fRefValueY / (Double) iDistVSOY ) : 99.99 );2488 dUPSNR = ( iDistVSOU ? 10.0 * log10( fRefValueC / (Double) iDistVSOU ) : 99.99 );2489 dVPSNR = ( iDistVSOV ? 10.0 * log10( fRefValueC / (Double) iDistVSOV ) : 99.99 );2490 }2491 else2492 {2493 #endif2494 #endif2495 2291 const Int maxval = 255 << (pcPic->getPicSym()->getSPS().getBitDepth(toChannelType(ch)) - 8); 2496 2292 const Double fRefValue = (Double) maxval * maxval * iSize; … … 2499 2295 } 2500 2296 2501 #if NH_3D_VSO2502 #if H_3D_VSO_SYNTH_DIST_OUT2503 }2504 #endif2505 #endif2506 2297 /* calculate the size of the access unit, excluding: 2507 2298 * - any AnnexB contributions (start_code_prefix, zero_byte, etc.,) -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncGOP.h
r1386 r1390 58 58 #include "TEncAnalyze.h" 59 59 #include "TEncRateCtrl.h" 60 #if KWU_RC_MADPRED_E022761 #include "../App/TAppEncoder/TAppEncTop.h"62 #endif63 60 #include <vector> 64 61 … … 127 124 Int m_layerId; 128 125 Int m_viewId; 129 #if NH_3D130 Int m_viewIndex;131 Bool m_isDepth;132 #endif133 #endif134 #if NH_3D_IC135 Int* m_aICEnableCandidate;136 Int* m_aICEnableNum;137 126 #endif 138 127 //--Adaptive Loop filter … … 176 165 Int getLayerId () { return m_layerId; } 177 166 Int getViewId () { return m_viewId; } 178 #if NH_3D179 Int getViewIndex () { return m_viewIndex; }180 Bool getIsDepth () { return m_isDepth; }181 #endif182 167 #endif 183 168 … … 186 171 TComList<TComPic*>* getListPic() { return m_pcListPic; } 187 172 Void printOutSummary ( UInt uiNumAllPicCoded, Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE, const BitDepths &bitDepths ); 188 #if NH_3D_VSO189 Void preLoopFilterPicAll ( TComPic* pcPic, Dist64& ruiDist);190 #else191 173 Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist ); 192 #endif 193 194 #if KWU_RC_MADPRED_E0227 195 TEncTop* getEncTop() { return m_pcEncTop; } 196 #endif 174 197 175 198 176 TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } … … 213 191 TComPicYuv* pcPicRecFirstField, TComPicYuv* pcPicRecSecondField, 214 192 const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE ); 215 #if NH_3D_VSO216 Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths);217 #else218 193 UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1, const BitDepths &bitDepths); 219 #endif220 194 Double xCalculateRVM(); 221 195 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncRateCtrl.cpp
r1386 r1390 482 482 483 483 m_LCUs = NULL; 484 #if KWU_RC_MADPRED_E0227485 m_lastIVPicture = NULL;486 #endif487 484 488 485 m_picActualHeaderBits = 0; … … 491 488 m_picLambda = 0.0; 492 489 493 #if KWU_RC_MADPRED_E0227494 m_IVtotalMAD = 0.0;495 #endif496 490 } 497 491 … … 567 561 } 568 562 569 #if KWU_RC_MADPRED_E0227 570 Void TEncRCPic::addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures ) 571 { 572 m_lastIVPicture = NULL; 573 m_lastIVPicture = this; 574 } 575 576 Void TEncRCPic::setIVPic( TEncRCPic* BaseRCPic ) 577 { 578 m_lastIVPicture = BaseRCPic; 579 } 580 #endif 581 582 #if KWU_RC_MADPRED_E0227 583 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID ) 584 #else 563 585 564 Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures ) 586 #endif587 565 { 588 566 destroy(); … … 633 611 m_LCUs[LCUIdx].m_numberOfPixel = currWidth * currHeight; 634 612 635 #if KWU_RC_MADPRED_E0227636 m_LCUs[LCUIdx].m_CUWidth = currWidth;637 m_LCUs[LCUIdx].m_CUHeight = currHeight;638 m_LCUs[LCUIdx].m_IVMAD = -1.0;639 #endif640 613 } 641 614 } … … 646 619 647 620 648 #if KWU_RC_MADPRED_E0227 649 m_LayerID = layerID; 650 m_lastIVPicture = NULL; 651 m_IVtotalMAD = 0.0; 652 #endif 653 654 655 #if KWU_RC_MADPRED_E0227 656 list<TEncRCPic*>::reverse_iterator it; 657 if( m_LayerID != 0) 658 { 659 m_lastIVPicture = NULL; 660 for ( it = listPreviousPictures.rbegin(); it != listPreviousPictures.rend(); it++ ) 661 { 662 if ( (*it)->getLayerID() == 0 ) 663 { 664 m_lastIVPicture = (*it); 665 break; 666 } 667 } 668 } 669 670 m_lastPicture = NULL; 671 for ( it = listPreviousPictures.rbegin(); it != listPreviousPictures.rend(); it++ ) 672 { 673 if ( (*it)->getFrameLevel() == m_frameLevel ) 674 { 675 m_lastPicture = (*it); 676 break; 677 } 678 } 679 #endif 621 622 680 623 } 681 624 … … 825 768 826 769 827 #if KWU_RC_MADPRED_E0227828 Double TEncRCPic::estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int CurPOC )829 {830 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha;831 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta;832 Double bpp = (Double)m_targetBits/(Double)m_numberOfPixel;833 Double estLambda = alpha * pow( bpp, beta );834 Double lastLevelLambda = -1.0;835 Double lastPicLambda = -1.0;836 Double lastValidLambda = -1.0;837 list<TEncRCPic*>::iterator it;838 839 if(listPreviousPictures.size() == 0 || CurPOC%8 == 0)840 {841 lastLevelLambda = m_lastIVPicture->getPicActualLambda();842 lastPicLambda = m_lastIVPicture->getPicActualLambda();843 }844 else845 {846 for ( it = listPreviousPictures.begin(); it != listPreviousPictures.end(); it++ )847 {848 if ( (*it)->getFrameLevel() == m_frameLevel )849 {850 lastLevelLambda = (*it)->getPicActualLambda();851 }852 lastPicLambda = (*it)->getPicActualLambda();853 854 if ( lastPicLambda > 0.0 )855 {856 lastValidLambda = lastPicLambda;857 }858 }859 }860 861 if ( lastLevelLambda > 0.0 )862 {863 lastLevelLambda = Clip3( 0.1, 10000.0, lastLevelLambda );864 estLambda = Clip3( lastLevelLambda * pow( 2.0, -3.0/3.0 ), lastLevelLambda * pow( 2.0, 3.0/3.0 ), estLambda );865 }866 867 if ( lastPicLambda > 0.0 )868 {869 lastPicLambda = Clip3( 0.1, 2000.0, lastPicLambda );870 estLambda = Clip3( lastPicLambda * pow( 2.0, -10.0/3.0 ), lastPicLambda * pow( 2.0, 10.0/3.0 ), estLambda );871 }872 else if ( lastValidLambda > 0.0 )873 {874 lastValidLambda = Clip3( 0.1, 2000.0, lastValidLambda );875 estLambda = Clip3( lastValidLambda * pow(2.0, -10.0/3.0), lastValidLambda * pow(2.0, 10.0/3.0), estLambda );876 }877 else878 {879 estLambda = Clip3( 0.1, 10000.0, estLambda );880 }881 882 if ( estLambda < 0.1 )883 {884 estLambda = 0.1;885 }886 887 m_estPicLambda = estLambda;888 return estLambda;889 }890 #endif891 770 892 771 … … 937 816 938 817 939 #if KWU_RC_MADPRED_E0227940 Double TEncRCPic::getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity )941 {942 Int LCUIdx = getLCUCoded();943 Double bpp = -1.0;944 Int avgBits = 0;945 #if !M0036_RC_IMPROVEMENT946 Double totalMAD = -1.0;947 Double MAD = -1.0;948 #endif949 950 Double totalMAD = -1.0;951 Double MAD = -1.0;952 953 Double IVMAD = -1.0;954 Double SAD = 0.0;955 Int x, y;956 Int Sum = 0;957 958 {959 Pel* pOrg = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);960 Pel* pRec = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), 0);961 Pel* pDep = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);962 Int iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride();963 964 Int width = m_LCUs[ LCUIdx ].m_CUWidth;965 Int height = m_LCUs[ LCUIdx ].m_CUHeight;966 967 for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8)968 {969 for( x = 0 ; x < pcCU->getSlice()->getSPS()->getMaxCUWidth() ; x+=8)970 {971 Sum += pDep[x];972 }973 pDep += iStride;974 }975 976 Double AvgDepth = (Double)Sum/((pcCU->getSlice()->getSPS()->getMaxCUHeight()/8)*(pcCU->getSlice()->getSPS()->getMaxCUWidth()/8));977 978 Double fL = focalLen * abs( basePos - curPos );979 Double z = abs( 1.0 / znear - 1.0 / zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / zfar);980 *disparity = (Int)(direction*fL * z);981 Int shift = DISTORTION_PRECISION_ADJUSTMENT(g_bitDepthY-8);982 983 Int disp = *disparity;984 Int posX, posY;985 pcCU->getPosInPic(0, posX, posY);986 if((posX + *disparity) < 0 || (posX + *disparity + width) >= pcCU->getSlice()->getSPS()->getMaxCUWidth())987 {988 disp = 0;989 }990 991 for( y = 0; y < height; y++ )992 {993 for( x = 0; x < width; x++ )994 {995 SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)]996 - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] )>>shift;997 }998 pOrg += iStride;999 pRec += iStride;1000 }1001 IVMAD = SAD / (Double)(height * width);1002 IVMAD = IVMAD * IVMAD;1003 1004 m_LCUs[ LCUIdx ].m_IVMAD = IVMAD;1005 if(m_lastPicture)1006 {1007 m_LCUs[ LCUIdx ].m_MAD = m_lastPicture->getLCU(LCUIdx).m_MAD;1008 }1009 1010 MAD = m_LCUs[ LCUIdx ].m_IVMAD;1011 1012 if(m_lastPicture)1013 {1014 totalMAD = m_lastPicture->getTotalMAD(); // get total MAD of temporal frame1015 for ( Int i=0; i<LCUIdx; i++ )1016 {1017 totalMAD -= m_lastPicture->getLCU(i).m_MAD;1018 }1019 }1020 else1021 {1022 totalMAD = m_lastIVPicture->getTotalMAD(); // get total MAD of inter-view frame1023 for ( Int i=0; i<LCUIdx; i++ )1024 {1025 totalMAD -= m_lastIVPicture->getLCU(i).m_MAD;1026 }1027 }1028 1029 1030 if ( totalMAD > 0.1 )1031 {1032 avgBits = Int( (m_bitsLeft * MAD) / totalMAD );1033 }1034 else1035 {1036 avgBits = Int( (m_bitsLeft) / m_LCULeft );1037 }1038 }1039 1040 if ( avgBits < 5 )1041 {1042 avgBits = 5;1043 }1044 1045 bpp = ( Double )avgBits/( Double )m_LCUs[ LCUIdx ].m_numberOfPixel;1046 m_LCUs[ LCUIdx ].m_targetBits = avgBits;1047 1048 return bpp;1049 }1050 #endif1051 818 1052 819 … … 1261 1028 } 1262 1029 m_picLambda = averageLambda; 1263 #if KWU_RC_MADPRED_E02271264 m_totalMAD = 0;1265 for ( Int i=0; i<m_numberOfLCU; i++ )1266 {1267 m_totalMAD += m_LCUs[i].m_MAD;1268 }1269 #endif1270 1030 1271 1031 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; … … 1446 1206 } 1447 1207 1448 #if KWU_RC_MADPRED_E02271449 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 )1450 #else1451 1208 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] ) 1452 #endif1453 1209 { 1454 1210 destroy(); … … 1646 1402 #endif 1647 1403 1648 #if KWU_RC_MADPRED_E02271649 setLayerID(layerID);1650 #endif1651 1404 1652 1405 delete[] bitsRatio; … … 1657 1410 { 1658 1411 m_encRCPic = new TEncRCPic; 1659 #if KWU_RC_MADPRED_E02271660 m_encRCPic->create( m_encRCSeq, m_encRCGOP, frameLevel, m_listRCPictures, m_LayerID );1661 #else1662 1412 m_encRCPic->create( m_encRCSeq, m_encRCGOP, frameLevel, m_listRCPictures ); 1663 #endif1664 1413 } 1665 1414 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncRateCtrl.h
r1386 r1390 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(); … … 291 271 Void setTotalIntraCost(Double cost) { m_totalCostIntra = cost; } 292 272 Void getLCUInitTargetBits(); 293 #if KWU_RC_MADPRED_E0227294 Double getTotalMAD() { return m_totalMAD; }295 Void setTotalMAD( Double MAD ) { m_totalMAD = MAD; }296 297 Double getIVTotalMAD() { return m_IVtotalMAD; }298 Void setIVTotalMAD( Double MAD ) { m_IVtotalMAD = MAD; }299 #endif300 273 301 274 Int getPicActualBits() { return m_picActualBits; } … … 307 280 Void setPicEstLambda( Double lambda ) { m_picLambda = lambda; } 308 281 309 #if KWU_RC_MADPRED_E0227310 Int getLayerID() { return m_LayerID; }311 Void setLayerID(Int layerid) { m_LayerID = layerid; }312 #endif313 282 private: 314 283 TEncRCSeq* m_encRCSeq; … … 334 303 Int m_picQP; // in integer form 335 304 Double m_picLambda; 336 #if KWU_RC_MADPRED_E0227337 Double m_totalMAD;338 TEncRCPic* m_lastPicture;339 Int m_LayerID;340 TEncRCPic* m_lastIVPicture;341 Double m_IVtotalMAD;342 #endif343 305 }; 344 306 … … 350 312 351 313 public: 352 #if KWU_RC_MADPRED_E0227353 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 );354 #else355 314 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] ); 356 #endif357 315 Void destroy(); 358 316 Void initRCPic( Int frameLevel ); … … 368 326 list<TEncRCPic*>& getPicList() { return m_listRCPictures; } 369 327 370 #if KWU_RC_MADPRED_E0227371 Int getLayerID() { return m_LayerID; }372 Void setLayerID(Int layerid) { m_LayerID = layerid; }373 #endif374 328 #if U0132_TARGET_BITS_SATURATION 375 329 Bool getCpbSaturationEnabled() { return m_CpbSaturationEnabled; } … … 394 348 #endif 395 349 396 #if KWU_RC_MADPRED_E0227 397 Int m_LayerID; 350 }; 351 398 352 #endif 399 }; 400 401 #endif 402 403 353 354 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncSbac.cpp
r1386 r1390 62 62 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 63 63 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 64 #if NH_3D_DIS65 , m_cCUDISFlagSCModel ( 1, 1, NUM_DIS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)66 , m_cCUDISTypeSCModel ( 1, 1, NUM_DIS_TYPE_CTX , m_contextModels + m_numContextModels, m_numContextModels)67 #endif68 64 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 69 65 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 70 #if NH_3D_ARP71 , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels)72 #endif73 #if NH_3D_IC74 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)75 #endif76 66 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 77 67 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 102 92 , m_ChromaQpAdjIdcSCModel ( 1, 1, NUM_CHROMA_QP_ADJ_IDC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 103 93 104 #if NH_3D_DMM105 , m_cNotDmmFlagSCModel ( 1, 1, NUM_NOTDMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)106 , m_cDmmModeSCModel ( 1, 1, NUM_DMM_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels)107 #endif108 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER109 , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)110 , m_cSDCFlagSCModel ( 1, 1, NUM_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)111 #endif112 #if NH_3D_SDC_INTRA113 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)114 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels)115 , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)116 #endif117 #if NH_3D_DBBP118 , m_cDBBPFlagSCModel ( 1, 1, DBBP_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)119 #endif120 94 { 121 95 assert( m_numContextModels <= MAX_NUM_CTX_MOD ); … … 143 117 m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); 144 118 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 145 #if NH_3D_DIS146 m_cCUDISFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_FLAG );147 m_cCUDISTypeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_TYPE );148 #endif149 119 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); 150 120 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT); 151 #if NH_3D_ARP152 m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW );153 #endif154 #if NH_3D_IC155 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );156 #endif157 121 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 158 122 m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); … … 183 147 m_ChromaQpAdjIdcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CHROMA_QP_ADJ_IDC ); 184 148 185 #if NH_3D_DMM186 m_cNotDmmFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_NOTDMM_FLAG );187 m_cDmmModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_MODE );188 #endif189 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER190 m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );191 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );192 #endif193 #if NH_3D_SDC_INTRA194 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );195 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );196 m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );197 #endif198 #if NH_3D_DBBP199 m_cDBBPFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );200 #endif201 149 202 150 for (UInt statisticIndex = 0; statisticIndex < RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS ; statisticIndex++) … … 231 179 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 232 180 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 233 #if NH_3D_DIS234 curCost += m_cCUDISFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DIS_FLAG );235 curCost += m_cCUDISTypeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DIS_TYPE );236 #endif237 181 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); 238 182 curCost += m_cCUMergeIdxExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT); 239 #if NH_3D_ARP240 curCost += m_cCUPUARPWSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ARPW );241 #endif242 #if NH_3D_IC243 curCost += m_cCUICFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_IC_FLAG );244 #endif245 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER246 curCost += m_cSDCFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SDC_FLAG );247 #endif248 #if NH_3D_DBBP249 curCost += m_cDBBPFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DBBP_FLAG );250 #endif251 183 curCost += m_cCUPartSizeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_PART_SIZE ); 252 184 curCost += m_cCUPredModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_PRED_MODE ); … … 276 208 curCost += m_ChromaQpAdjFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_CHROMA_QP_ADJ_FLAG ); 277 209 curCost += m_ChromaQpAdjIdcSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_CHROMA_QP_ADJ_IDC ); 278 #if NH_3D_DMM279 curCost += m_cNotDmmFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_NOTDMM_FLAG );280 curCost += m_cDmmModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DMM_MODE );281 #endif282 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER283 curCost += m_cDdcDataSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_DATA );284 #endif285 210 286 211 if (curCost < bestCost) … … 406 331 } 407 332 408 #if NH_3D_DIS409 Void TEncSbac::codeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx )410 {411 UInt uiSymbol = pcCU->getDISFlag(uiAbsPartIdx ) ? 1 : 0;412 m_pcBinIf->encodeBin( uiSymbol, m_cCUDISFlagSCModel.get( 0, 0, 0 ) );413 if(uiSymbol)414 {415 UInt uiUnaryIdx = (UInt) pcCU->getDISType(uiAbsPartIdx);416 UInt uiNumCand = 4;417 418 if ( uiNumCand > 1 )419 {420 for( UInt ui = 0; ui < uiNumCand - 1; ++ui )421 {422 const UInt uiSymbol2 = ui == uiUnaryIdx ? 0 : 1;423 if ( ui == 0 )424 {425 m_pcBinIf->encodeBin( uiSymbol2, m_cCUDISTypeSCModel.get( 0, 0, 0 ) );426 }427 else428 {429 m_pcBinIf->encodeBinEP( uiSymbol2 );430 }431 if( uiSymbol2 == 0 )432 {433 break;434 }435 }436 }437 }438 }439 #endif440 333 441 334 … … 522 415 } 523 416 524 #if NH_3D_DMM525 Void TEncSbac::loadIntraDepthDmm( const TEncSbac* pSrc )526 {527 m_pcBinIf->copyState( pSrc->m_pcBinIf );528 this->m_cNotDmmFlagSCModel.copyFrom( &pSrc->m_cNotDmmFlagSCModel );529 this->m_cDmmModeSCModel .copyFrom( &pSrc->m_cDmmModeSCModel );530 }531 #endif532 417 533 418 … … 567 452 { 568 453 PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx ); 569 #if NH_3D_QTLPC570 Bool bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();571 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();572 Bool bDepthMapDetect = (pcTexture != NULL);573 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);574 575 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);576 577 Bool depthDependent = false;578 UInt uiTexturePart = eSize;579 580 #if H_3D_FCO581 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark())582 #else583 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag )584 #endif585 {586 TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());587 UInt uiCUIdx = (pcCU->getZorderIdxInCtu() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCtu();588 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);589 if(pcTextureCU->getDepth(uiCUIdx) == uiDepth )590 {591 depthDependent = true;592 uiTexturePart = pcTextureCU->getPartitionSize( uiCUIdx );593 }594 if (pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize( uiCUIdx ) == SIZE_2Nx2N)595 {596 assert( eSize == SIZE_2Nx2N );597 return;598 }599 }600 #endif601 454 const UInt log2DiffMaxMinCodingBlockSize = pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize(); 602 455 … … 616 469 DTRACE_CU("part_mode", eSize ) 617 470 #endif 618 #if NH_3D_QTLPC619 if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)620 {621 #endif622 471 623 472 switch(eSize) … … 690 539 } 691 540 } 692 #if NH_3D_QTLPC693 }694 else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)695 {696 //assert(eSize!=SIZE_NxN);697 //assert(eSize!=SIZE_Nx2N);698 //assert(eSize==SIZE_2Nx2N || eSize==SIZE_2NxN || eSize==SIZE_2NxnU || eSize==SIZE_2NxnD);699 switch(eSize)700 {701 case SIZE_2Nx2N:702 {703 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );704 break;705 }706 case SIZE_2NxN:707 {708 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );709 if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )710 {711 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );712 }713 break;714 }715 case SIZE_2NxnU:716 case SIZE_2NxnD:717 {718 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );719 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );720 m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));721 break;722 }723 default:724 {725 assert(0);726 }727 }728 }729 else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N)730 {731 //assert(eSize!=SIZE_NxN);732 //assert(eSize!=SIZE_2NxN);733 //assert(eSize==SIZE_2Nx2N ||eSize==SIZE_Nx2N || eSize==SIZE_nLx2N || eSize==SIZE_nRx2N);734 switch(eSize)735 {736 case SIZE_2Nx2N:737 {738 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );739 break;740 }741 case SIZE_Nx2N:742 {743 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );744 if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )745 {746 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );747 }748 break;749 }750 case SIZE_nLx2N:751 case SIZE_nRx2N:752 {753 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );754 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );755 m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));756 break;757 }758 default:759 {760 assert(0);761 }762 }763 }764 else765 {766 printf("uiTexturePart=%d",uiTexturePart);767 assert(0);768 }769 #endif770 541 771 542 } … … 885 656 } 886 657 887 #if NH_3D_ARP 888 Void TEncSbac::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 889 { 890 Int iW = (Int)pcCU->getARPW( uiAbsPartIdx ); 891 Int iMaxW = pcCU->getSlice()->getARPStepNum() - 1; 892 assert( iMaxW > 0); 893 894 Int nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 895 Int nBinNum = iW + ( iW != iMaxW ); 896 m_pcBinIf->encodeBin( iW ? 1 : 0 , m_cCUPUARPWSCModel.get( 0, 0, 0 + nOffset ) ); 897 if( nBinNum > 1 ) 898 { 899 m_pcBinIf->encodeBin( ( iW == iMaxW ) ? 1 : 0, m_cCUPUARPWSCModel.get( 0, 0, 2 ) ); 900 } 901 #if NH_MV_ENC_DEC_TRAC 902 DTRACE_CU("iv_res_pred_weight_idx", iW); 903 #endif 904 } 905 #endif 906 907 #if NH_3D_IC 908 /** code Illumination Compensation flag 909 * \param pcCU 910 * \param uiAbsPartIdx 911 * \returns Void 912 */ 913 Void TEncSbac::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 914 { 915 // get context function is here 916 UInt uiSymbol = pcCU->getICFlag( uiAbsPartIdx ) ? 1 : 0; 917 m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) ); 918 #if !NH_MV_ENC_DEC_TRAC 919 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 920 DTRACE_CABAC_T( "\tICFlag" ); 921 DTRACE_CABAC_T( "\tuiSymbol: "); 922 DTRACE_CABAC_V( uiSymbol ); 923 DTRACE_CABAC_T( "\n"); 924 #else 925 DTRACE_CU("ic_flag", uiSymbol ); 926 #endif 927 } 928 #endif 658 929 659 930 660 … … 940 670 941 671 assert( uiCtx < 3 ); 942 #if NH_3D_QTLPC943 Bool bCodeSplitFlag = true;944 945 946 Bool bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();947 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();948 Bool bDepthMapDetect = (pcTexture != NULL);949 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);950 951 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);952 953 #if H_3D_FCO954 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark() )955 #else956 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag )957 #endif958 {959 TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());960 UInt uiCUIdx = (pcCU->getZorderIdxInCtu() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCtu();961 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);962 bCodeSplitFlag = (pcTextureCU->getDepth(uiCUIdx) > uiDepth);963 }964 965 if(!bCodeSplitFlag)966 {967 assert(uiCurrSplitFlag == 0);968 return;969 }970 #endif971 672 972 673 m_pcBinIf->encodeBin( uiCurrSplitFlag, m_cCUSplitFlagSCModel.get( 0, 0, uiCtx ) ); … … 1009 710 { 1010 711 dir[j] = pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx+partOffset*j ); 1011 #if NH_3D_DMM1012 if( pcCU->getSlice()->getIntraSdcWedgeFlag() || pcCU->getSlice()->getIntraContourFlag() )1013 {1014 xCodeIntraDepthMode( pcCU, absPartIdx+partOffset*j );1015 xCodeDmmData ( pcCU, absPartIdx+partOffset*j );1016 }1017 if( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1018 {1019 #endif1020 712 pcCU->getIntraDirPredictor(absPartIdx+partOffset*j, preds[j], COMPONENT_Y); 1021 713 for(UInt i = 0; i < NUM_MOST_PROBABLE_MODES; i++) … … 1030 722 DTRACE_CU("prev_intra_luma_pred_flag", (predIdx[j] != -1)? 1 : 0); 1031 723 #endif 1032 #if NH_3D_DMM1033 }1034 #endif1035 724 1036 725 } 1037 726 for (j=0;j<partNum;j++) 1038 727 { 1039 #if NH_3D_DMM1040 if( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1041 {1042 #endif1043 728 if(predIdx[j] != -1) 1044 729 { … … 1075 760 #endif 1076 761 } 1077 #if NH_3D_DMM1078 }1079 #endif1080 762 } 1081 763 return; … … 2459 2141 } 2460 2142 2461 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER 2462 Void TEncSbac::codeDeltaDC( TComDataCU* pcCU, UInt absPartIdx ) 2463 { 2464 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 2465 if( !(pcCU->getSDCFlag( absPartIdx )) ) 2466 #endif 2467 #if NH_3D_DMM 2468 if( !(pcCU->isIntra( absPartIdx ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) )) ) 2469 #endif 2470 assert( 0 ); 2471 2472 UInt uiNumSegments = 1; 2473 #if NH_3D_DMM 2474 uiNumSegments = isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) ) ? 2 : 1; 2475 #endif 2476 2477 UInt hasDeltaDC = 1; 2478 #if NH_3D_SDC_INTRA 2479 if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx )) 2480 { 2481 if( uiNumSegments == 1 ) 2482 { 2483 hasDeltaDC = pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) ? 1 : 0; 2484 } 2485 else 2486 { 2487 hasDeltaDC = ( pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) || pcCU->getSDCSegmentDCOffset( 1, absPartIdx ) ) ? 1 : 0; 2488 } 2489 m_pcBinIf->encodeBin( hasDeltaDC, m_cDdcFlagSCModel.get( 0, 0, 0 ) ); 2490 } 2491 #endif 2492 2493 if( hasDeltaDC ) 2494 { 2495 for( UInt segment = 0; segment < uiNumSegments; segment++ ) 2496 { 2497 Pel deltaDC = 0; 2498 if( pcCU->isIntra( absPartIdx ) ) 2499 { 2500 #if NH_3D_SDC_INTRA 2501 if( pcCU->getSDCFlag( absPartIdx ) ) 2502 { 2503 deltaDC = pcCU->getSDCSegmentDCOffset( segment, absPartIdx ); 2504 } 2505 else 2506 { 2507 #endif 2508 #if NH_3D_DMM 2509 deltaDC = pcCU->getDmmDeltaDC( getDmmType( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ) ), segment, absPartIdx ); 2510 #endif 2511 #if NH_3D_SDC_INTRA 2512 } 2513 #endif 2514 } 2515 #if NH_3D_SDC_INTER 2516 else 2517 { 2518 deltaDC = pcCU->getSDCSegmentDCOffset( segment, absPartIdx ); 2519 } 2520 #endif 2521 xCodeDeltaDC( deltaDC, uiNumSegments ); 2522 } 2523 } 2524 } 2525 2526 Void TEncSbac::xCodeDeltaDC( Pel valDeltaDC, UInt uiNumSeg ) 2527 { 2528 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 2529 DTRACE_CU("delta_dc", valDeltaDC); 2530 #endif 2531 xWriteExGolombLevelDdc( UInt( abs( valDeltaDC ) - ( uiNumSeg > 1 ? 0 : 1 ) ) ); 2532 if( valDeltaDC != 0 ) 2533 { 2534 UInt uiSign = valDeltaDC > 0 ? 0 : 1; 2535 m_pcBinIf->encodeBinEP( uiSign ); 2536 } 2537 } 2538 2539 Void TEncSbac::xWriteExGolombLevelDdc( UInt uiSymbol ) 2540 { 2541 if( uiSymbol ) 2542 { 2543 m_pcBinIf->encodeBin( 1, m_cDdcDataSCModel.get(0, 0, 0) ); 2544 UInt uiCount = 0; 2545 Bool bNoExGo = ( uiSymbol < 3 ); 2546 2547 while( --uiSymbol && ++uiCount < 3 ) 2548 { 2549 m_pcBinIf->encodeBin( 1, m_cDdcDataSCModel.get(0, 0, 0) ); 2550 } 2551 if( bNoExGo ) 2552 { 2553 m_pcBinIf->encodeBin( 0, m_cDdcDataSCModel.get(0, 0, 0) ); 2554 } 2555 else 2556 { 2557 xWriteEpExGolomb( uiSymbol, 0 ); 2558 } 2559 } 2560 else 2561 { 2562 m_pcBinIf->encodeBin( 0, m_cDdcDataSCModel.get(0, 0, 0) ); 2563 } 2564 2565 return; 2566 } 2567 #endif 2568 2569 #if NH_3D_DMM 2570 Void TEncSbac::xCodeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx ) 2571 { 2572 UInt dir = pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ); 2573 2574 if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed 2575 { 2576 m_pcBinIf->encodeBin( isDmmMode( dir ) ? 0 : 1, m_cNotDmmFlagSCModel.get( 0, 0, 0 ) ); 2577 } 2578 if( isDmmMode( dir ) ) 2579 { 2580 UInt uiCodeIdx = 0; 2581 2582 switch( getDmmType( dir ) ) 2583 { 2584 case DMM1_IDX: uiCodeIdx = 0; break; 2585 case DMM4_IDX: uiCodeIdx = 1; break; 2586 default: break; 2587 } 2588 //mode coding 2589 if( pcCU->getSlice()->getIntraSdcWedgeFlag() && pcCU->getSlice()->getIntraContourFlag()) 2590 { 2591 m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDmmModeSCModel.get( 0, 0, 0 ) ); 2592 } 2593 } 2594 } 2595 2596 Void TEncSbac::xCodeDmmData( TComDataCU* pcCU, UInt absPartIdx ) 2597 { 2598 UInt dir = pcCU->getIntraDir( CHANNEL_TYPE_LUMA, absPartIdx ); 2599 switch( getDmmType( dir ) ) 2600 { 2601 case( DMM1_IDX ): { xCodeDmm1WedgeIdx( pcCU->getDmm1WedgeTabIdx( absPartIdx ), g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] ); } break; 2602 case( DMM4_IDX ): break; 2603 default: break; 2604 } 2605 } 2606 2607 Void TEncSbac::xCodeDmm1WedgeIdx( UInt uiTabIdx, Int iNumBit ) 2608 { 2609 for ( Int i = 0; i < iNumBit; i++ ) 2610 { 2611 m_pcBinIf->encodeBinEP( ( uiTabIdx >> i ) & 1 ); 2612 } 2613 } 2614 #endif 2615 2616 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 2617 Void TEncSbac::codeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2618 { 2619 UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0; 2620 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC 2621 DTRACE_CU("dc_only_flag", uiSymbol) 2622 #endif 2623 m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, 0 ) ); 2624 } 2625 2626 #endif 2627 2628 #if NH_3D_DBBP 2629 Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2630 { 2631 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 2632 AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N ); 2633 AOF( pcCU->getSlice()->getDepthBasedBlkPartFlag() ); 2634 AOF( !pcCU->getSlice()->getIsDepth() ); 2635 2636 UInt uiSymbol = pcCU->getDBBPFlag( uiAbsPartIdx ) ? 1 : 0; 2637 m_pcBinIf->encodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) ); 2638 DTRACE_CU("dbbp_flag", uiSymbol) 2639 } 2640 #endif 2143 2144 2145 2641 2146 2642 2147 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncSbac.h
r1313 r1390 80 80 Void load ( const TEncSbac* pSrc ); 81 81 Void loadIntraDirMode ( const TEncSbac* pScr, const ChannelType chType ); 82 #if NH_3D_DMM83 Void loadIntraDepthDmm ( const TEncSbac* pSrc );84 #endif85 82 Void store ( TEncSbac* pDest ) const; 86 83 Void loadContexts ( const TEncSbac* pSrc ); … … 115 112 Void xWriteEpExGolomb ( UInt uiSymbol, UInt uiCount ); 116 113 Void xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam, const Bool useLimitedPrefixLength, const Int maxLog2TrDynamicRange ); 117 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER118 Void xWriteExGolombLevelDdc( UInt uiSymbol );119 Void xCodeDeltaDC ( Pel valDeltaDC, UInt uiNumSeg );120 #endif121 #if NH_3D_DMM122 Void xCodeIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx );123 Void xCodeDmmData ( TComDataCU* pcCU, UInt absPartIdx );124 Void xCodeDmm1WedgeIdx ( UInt uiTabIdx, Int iNumBit );125 #endif126 114 127 115 … … 138 126 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 139 127 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 140 #if NH_3D_DIS141 Void codeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx );142 #endif143 128 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 144 129 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 145 #if NH_3D_ARP146 Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx );147 #endif148 #if NH_3D_IC149 Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );150 #endif151 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER152 Void codeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx );153 #endif154 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER155 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );156 #endif157 #if NH_3D_DBBP158 Void codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx );159 #endif160 130 Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 161 131 Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ); … … 204 174 ContextModel3DBuffer m_cCUSplitFlagSCModel; 205 175 ContextModel3DBuffer m_cCUSkipFlagSCModel; 206 #if NH_3D_DIS207 ContextModel3DBuffer m_cCUDISFlagSCModel;208 ContextModel3DBuffer m_cCUDISTypeSCModel;209 #endif210 176 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 211 177 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; 212 #if NH_3D_ARP213 ContextModel3DBuffer m_cCUPUARPWSCModel;214 #endif215 #if NH_3D_IC216 ContextModel3DBuffer m_cCUICFlagSCModel;217 #endif218 178 ContextModel3DBuffer m_cCUPartSizeSCModel; 219 179 ContextModel3DBuffer m_cCUPredModeSCModel; … … 248 208 ContextModel3DBuffer m_ChromaQpAdjIdcSCModel; 249 209 250 #if NH_3D_DMM251 ContextModel3DBuffer m_cNotDmmFlagSCModel;252 ContextModel3DBuffer m_cDmmModeSCModel;253 #endif254 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER255 ContextModel3DBuffer m_cDdcDataSCModel;256 ContextModel3DBuffer m_cSDCFlagSCModel;257 #endif258 #if NH_3D_SDC_INTRA259 ContextModel3DBuffer m_cSDCResidualFlagSCModel;260 ContextModel3DBuffer m_cSDCResidualSCModel;261 ContextModel3DBuffer m_cDdcFlagSCModel;262 #endif263 #if NH_3D_DBBP264 ContextModel3DBuffer m_cDBBPFlagSCModel;265 #endif266 210 267 211 UInt m_golombRiceAdaptationStatistics[RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS]; -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncSearch.cpp
r1386 r1390 316 316 const Pel* const piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 317 317 318 #if NH_3D_IC319 m_cDistParam.bUseIC = pcPatternKey->getICFlag();320 #endif321 #if NH_3D_SDC_INTER322 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();323 #endif324 318 //-- jclee for using the SAD function pointer 325 319 m_pcRdCost->setDistParam( pcPatternKey, piRefSrch, rcStruct.iYStride, m_cDistParam ); … … 868 862 869 863 setDistParamComp(COMPONENT_Y); 870 #if NH_3D_IC871 m_cDistParam.bUseIC = pcPatternKey->getICFlag();872 #endif873 #if NH_3D_SDC_INTER874 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();875 #endif876 864 877 865 m_cDistParam.pCur = piRefPos; … … 1025 1013 } 1026 1014 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 1027 #if NH_3D_DIS1028 m_pcEntropyCoder->encodeDIS(pcCU, 0, true );1029 if(!pcCU->getDISFlag(uiAbsPartIdx))1030 #endif1031 1015 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 1032 1016 } 1033 #if NH_3D_DIS1034 else1035 {1036 m_pcEntropyCoder->encodeDIS(pcCU, 0, true );1037 }1038 #endif1039 #if NH_3D_DIS1040 if(!pcCU->getDISFlag(uiAbsPartIdx))1041 {1042 #endif1043 1017 m_pcEntropyCoder ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 1044 1018 … … 1049 1023 if ( pcCU->getIPCMFlag (0)) 1050 1024 { 1051 #if NH_3D_SDC_INTRA1052 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );1053 #endif1054 1025 return; 1055 1026 } 1056 1027 } 1057 #if NH_3D_DIS 1058 } 1059 #endif 1060 } 1061 #if NH_3D_DIS 1062 if(!pcCU->getDISFlag(uiAbsPartIdx)) 1063 { 1064 #endif 1028 } 1065 1029 // luma prediction mode 1066 1030 if( pcCU->getPartitionSize(0) == SIZE_2Nx2N ) … … 1069 1033 { 1070 1034 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 ); 1071 #if NH_3D_SDC_INTRA1072 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );1073 #if NH_3D_DMM1074 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, 0 ) ) )1075 {1076 m_pcEntropyCoder->encodeDeltaDC( pcCU, 0 );1077 }1078 #endif1079 #endif1080 1035 } 1081 1036 } … … 1086 1041 { 1087 1042 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 1088 #if NH_3D_SDC_INTRA1089 if( uiAbsPartIdx == 0 )1090 {1091 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );1092 }1093 #if NH_3D_DMM1094 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx ) ) )1095 {1096 m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx );1097 }1098 #endif1099 #endif1100 #if NH_3D_DIS1101 }1102 #endif1103 1043 } 1104 1044 } … … 1171 1111 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 1172 1112 const Bool checkCrossCPrediction, 1173 #if NH_3D_VSO1174 Dist& ruiDist,1175 #else1176 1113 Distortion& ruiDist, 1177 #endif1178 1114 const ComponentID compID, 1179 1115 TComTU& rTu 1180 1116 DEBUG_STRING_FN_DECLARE(sDebug) 1181 1117 ,Int default0Save1Load2 1182 #if NH_3D_ENC_DEPTH1183 , Bool zeroResiFlag1184 #endif1185 1118 1186 1119 ) … … 1253 1186 1254 1187 //===== get prediction signal ===== 1255 #if NH_3D_DMM1256 if( bIsLuma && isDmmMode( uiChFinalMode ) )1257 {1258 predIntraLumaDmm( pcCU, uiAbsPartIdx, getDmmType( uiChFinalMode ), piPred, uiStride, uiWidth, uiHeight );1259 }1260 else1261 {1262 #endif1263 1188 predIntraAng( compID, uiChFinalMode, piOrg, uiStride, piPred, uiStride, rTu, bUseFilteredPredictions ); 1264 #if NH_3D_DMM1265 }1266 #endif1267 1189 1268 1190 // save prediction … … 1309 1231 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1310 1232 { 1311 #if NH_3D_ENC_DEPTH1312 if( zeroResiFlag )1313 {1314 memset( pResi, 0, sizeof( Pel ) * uiWidth );1315 pResi += uiStride;1316 }1317 else1318 {1319 #endif1320 1233 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1321 1234 { … … 1326 1239 pResi += uiStride; 1327 1240 pPred += uiStride; 1328 #if NH_3D_ENC_DEPTH1329 }1330 #endif1331 1241 1332 1242 } … … 1491 1401 1492 1402 //===== update distortion ===== 1493 #if NH_3D_VSO // M391494 if ( m_pcRdCost->getUseVSO() )1495 {1496 ruiDist += m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, bitDepth, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );1497 }1498 else1499 #endif1500 1403 ruiDist += m_pcRdCost->getDistPart( bitDepth, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, compID ); 1501 1404 } … … 1507 1410 TComYuv* pcResiYuv, 1508 1411 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 1509 #if NH_3D_VSO1510 Dist& ruiDistY,1511 #else1512 1412 Distortion& ruiDistY, 1513 #endif1514 1413 #if HHI_RQT_INTRA_SPEEDUP 1515 1414 Bool bCheckFirst, … … 1518 1417 TComTU& rTu 1519 1418 DEBUG_STRING_FN_DECLARE(sDebug) 1520 #if NH_3D_ENC_DEPTH1521 , Bool zeroResiFlag1522 #endif1523 1419 ) 1524 1420 { … … 1576 1472 } 1577 1473 #endif 1578 #if NH_3D_DMM1579 if( isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx ) ) )1580 {1581 bCheckSplit = false;1582 }1583 #endif1584 1474 Double dSingleCost = MAX_DOUBLE; 1585 #if NH_3D_VSO1586 Dist uiSingleDistLuma = 0;1587 #else1588 1475 Distortion uiSingleDistLuma = 0; 1589 #endif1590 1476 UInt uiSingleCbfLuma = 0; 1591 1477 Bool checkTransformSkip = pcCU->getSlice()->getPPS()->getUseTransformSkip(); … … 1608 1494 //----- store original entropy coding status ----- 1609 1495 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] ); 1610 #if NH_3D_VSO1611 Dist singleDistTmpLuma = 0;1612 #else1613 1496 Distortion singleDistTmpLuma = 0; 1614 #endif1615 1497 UInt singleCbfTmpLuma = 0; 1616 1498 Double singleCostTmp = 0; … … 1646 1528 { 1647 1529 UInt uiSingleBits = xGetIntraBitsQT( rTu, true, false, false ); 1648 #if NH_3D_VSO // M NEW1649 if ( m_pcRdCost->getUseRenModel() )1650 {1651 singleCostTmp = m_pcRdCost->calcRdCostVSO( uiSingleBits, singleDistTmpLuma );1652 }1653 else1654 #endif1655 1530 singleCostTmp = m_pcRdCost->calcRdCost( uiSingleBits, singleDistTmpLuma ); 1656 1531 } … … 1707 1582 //----- code luma/chroma block with given intra prediction mode and store Cbf----- 1708 1583 dSingleCost = 0.0; 1709 #if NH_3D_ENC_DEPTH1710 xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug), 0, zeroResiFlag );1711 #else1712 1584 pcCU ->setTransformSkipSubParts ( 0, COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan ); 1713 1585 xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug)); 1714 #endif1715 1586 1716 1587 if( bCheckSplit ) … … 1725 1596 uiSingleBits=uiSingleBits*4; 1726 1597 } 1727 #if NH_3D_VSO // M401728 if ( m_pcRdCost->getUseLambdaScaleVSO())1729 {1730 dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDistLuma );1731 }1732 else1733 #endif1734 1598 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistLuma ); 1735 1599 … … 1763 1627 //----- code splitted block ----- 1764 1628 Double dSplitCost = 0.0; 1765 #if NH_3D_VSO1766 Dist uiSplitDistLuma = 0;1767 #else1768 1629 Distortion uiSplitDistLuma = 0; 1769 #endif1770 1630 1771 1631 UInt uiSplitCbfLuma = 0; … … 1803 1663 1804 1664 UInt uiSplitBits = xGetIntraBitsQT( rTu, true, false, false ); 1805 #if NH_3D_VSO // M411806 if( m_pcRdCost->getUseLambdaScaleVSO() )1807 {1808 dSplitCost = m_pcRdCost->calcRdCostVSO( uiSplitBits, uiSplitDistLuma );1809 }1810 else1811 #endif1812 1665 dSplitCost = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistLuma ); 1813 1666 … … 1866 1719 } 1867 1720 1868 #if NH_3D_VSO // M421869 if ( m_pcRdCost->getUseRenModel() && bCheckFull )1870 {1871 UInt uiWidth = pcCU->getWidth ( 0 ) >> uiTrDepth;1872 UInt uiHeight = pcCU->getHeight( 0 ) >> uiTrDepth;1873 UInt uiQTLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;1874 Pel* piSrc = m_pcQTTempTComYuv[ uiQTLayer ].getAddr( COMPONENT_Y, uiAbsPartIdx );1875 UInt uiSrcStride = m_pcQTTempTComYuv[ uiQTLayer ].getStride( COMPONENT_Y );1876 1877 m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight );1878 }1879 #endif1880 1721 1881 1722 ruiDistY += uiSingleDistLuma; … … 1886 1727 } 1887 1728 1888 #if NH_3D_DIS1889 Void TEncSearch::xIntraCodingDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode )1890 {1891 UInt uiWidth = pcCU ->getWidth ( 0 );1892 UInt uiHeight = pcCU ->getHeight ( 0 );1893 UInt uiStride = pcOrgYuv ->getStride (COMPONENT_Y);1894 Pel* piOrg = pcOrgYuv ->getAddr(COMPONENT_Y, uiAbsPartIdx );1895 Pel* piPred = pcPredYuv->getAddr(COMPONENT_Y, uiAbsPartIdx );1896 1897 AOF( uiWidth == uiHeight );1898 AOF( uiAbsPartIdx == 0 );1899 pcCU->setDISTypeSubParts((UChar)uiPredMode, uiAbsPartIdx, pcCU->getDepth(0));1900 //===== reconstruction =====1901 1902 TComTURecurse rTu(pcCU, 0);1903 const ChromaFormat chFmt = rTu.GetChromaFormat();1904 DEBUG_STRING_NEW(sTemp)1905 if ( uiPredMode == 0 )1906 {1907 const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, VER_IDX, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag());1908 initIntraPatternChType( rTu, COMPONENT_Y, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) );1909 predIntraAng( COMPONENT_Y, VER_IDX, 0, uiStride, piPred, uiStride, rTu, bUseFilteredPredictions );1910 }1911 else if ( uiPredMode == 1 )1912 {1913 const Bool bUseFilteredPredictions=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, HOR_IDX, uiWidth, uiHeight, chFmt, pcCU->getSlice()->getSPS()->getSpsRangeExtension().getIntraSmoothingDisabledFlag());1914 initIntraPatternChType( rTu, COMPONENT_Y, bUseFilteredPredictions DEBUG_STRING_PASS_INTO(sTemp) );1915 predIntraAng( COMPONENT_Y, HOR_IDX, 0, uiStride, piPred, uiStride, rTu, bUseFilteredPredictions );1916 }1917 else if ( uiPredMode == 2 )1918 {1919 Pel pSingleDepth = 1 << ( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 );1920 pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 0 );1921 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1922 {1923 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1924 {1925 piPred[ uiX ] = pSingleDepth;1926 }1927 piPred+= uiStride;1928 }1929 }1930 else if ( uiPredMode == 3 )1931 {1932 Pel pSingleDepth = 1 << ( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 );1933 pcCU->getNeighDepth ( 0, 0, &pSingleDepth, 1 );1934 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1935 {1936 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1937 {1938 piPred[ uiX ] = pSingleDepth;1939 }1940 piPred+= uiStride;1941 }1942 }1943 1944 // clear UV1945 UInt uiStrideC = pcPredYuv->getStride(COMPONENT_Cb);1946 Pel *pRecCb = pcPredYuv->getAddr(COMPONENT_Cb);1947 Pel *pRecCr = pcPredYuv->getAddr(COMPONENT_Cr);1948 1949 for (Int y=0; y<uiHeight/2; y++)1950 {1951 for (Int x=0; x<uiWidth/2; x++)1952 {1953 pRecCb[x] = 1<<(pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-1);1954 pRecCr[x] = 1<<(pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-1);1955 }1956 1957 pRecCb += uiStrideC;1958 pRecCr += uiStrideC;1959 }1960 1961 piPred = pcPredYuv->getAddr(COMPONENT_Y, uiAbsPartIdx );1962 //===== determine distortion =====1963 #if NH_3D_VSO1964 if ( m_pcRdCost->getUseVSO() )1965 ruiDist = m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );1966 else1967 #endif1968 ruiDist = m_pcRdCost->getDistPart(pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, COMPONENT_Y );1969 1970 //===== determine rate and r-d cost =====1971 m_pcEntropyCoder->resetBits();1972 m_pcEntropyCoder->encodeDIS( pcCU, 0, true );1973 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();1974 1975 #if NH_3D_VSO1976 if ( m_pcRdCost->getUseLambdaScaleVSO())1977 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );1978 else1979 #endif1980 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );1981 }1982 #endif1983 #if NH_3D_SDC_INTRA1984 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi )1985 {1986 UInt uiWidth = pcCU->getWidth ( 0 );1987 UInt uiHeight = pcCU->getHeight( 0 );1988 UInt uiLumaPredMode = pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx );1989 const Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);1990 const TComSPS &sps = *(pcCU->getSlice()->getSPS());1991 const ChromaFormat chFmt = pcCU->getPic()->getChromaFormat();1992 1993 UInt sdcDepth = 0;1994 UInt uiStride;1995 Pel* piOrg;1996 Pel* piPred;1997 Pel* piReco;1998 1999 Pel* piRecIPred;2000 UInt uiRecIPredStride;2001 2002 Pel apDCPredValues[2];2003 Pel apDCOrigValues[2];2004 UInt uiNumSegments;2005 2006 Bool* pbMask = NULL;2007 UInt uiMaskStride = 0;2008 #if NH_3D_DMM2009 if( isDmmMode( uiLumaPredMode ) )2010 {2011 assert( uiWidth == uiHeight );2012 assert( uiWidth >= DMM_MIN_SIZE && uiWidth <= DMM_MAX_SIZE );2013 assert( !(( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1) );2014 2015 uiNumSegments = 2;2016 2017 uiStride = pcOrgYuv ->getStride( COMPONENT_Y );2018 piOrg = pcOrgYuv ->getAddr ( COMPONENT_Y, uiAbsPartIdx );2019 piPred = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );2020 piReco = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );2021 2022 piRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr ( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx );2023 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride( COMPONENT_Y );2024 2025 //===== init availability pattern =====2026 TComTURecurse tuRecurseCU(pcCU, 0);2027 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, TComTU::DONT_SPLIT);2028 DEBUG_STRING_NEW(sTemp)2029 initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, false DEBUG_STRING_PASS_INTO(sTemp) );2030 2031 // get partition2032 pbMask = new Bool[ uiWidth*uiHeight ];2033 uiMaskStride = uiWidth;2034 switch( getDmmType( uiLumaPredMode ) )2035 {2036 case( DMM1_IDX ): { (getWedgeListScaled( uiWidth )->at( pcCU->getDmm1WedgeTabIdx( uiAbsPartIdx ) )).getPatternScaledCopy( uiWidth, pbMask ); } break;2037 case( DMM4_IDX ): { predContourFromTex( pcCU, uiAbsPartIdx, uiWidth, uiHeight, pbMask ); } break;2038 default: assert(0);2039 }2040 2041 // get predicted partition values2042 Pel predDC1 = 0, predDC2 = 0;2043 predBiSegDCs( pcCU, uiAbsPartIdx, uiWidth, uiHeight, pbMask, uiMaskStride, predDC1, predDC2 );2044 2045 // set prediction signal2046 Pel* pDst = piPred;2047 assignBiSegDCs( pDst, uiStride, pbMask, uiMaskStride, predDC1, predDC2 );2048 apDCPredValues[0] = predDC1;2049 apDCPredValues[1] = predDC2;2050 2051 // get original partition values2052 xCalcBiSegDCs( piOrg, uiStride, pbMask, uiMaskStride, apDCOrigValues[0], apDCOrigValues[1], 0, (uiMaskStride > 16) );2053 }2054 else // regular HEVC intra modes2055 {2056 #endif2057 uiNumSegments = 1;2058 2059 if( ( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1 )2060 {2061 sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();2062 }2063 2064 //===== loop over partitions =====2065 TComTURecurse tuRecurseCU(pcCU, 0);2066 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, (sdcDepth==0)?TComTU::DONT_SPLIT:TComTU::QUAD_SPLIT);2067 2068 do2069 {2070 const TComRectangle &puRect = tuRecurseWithPU.getRect(COMPONENT_Y);2071 const UInt uiAbsPartIdxTU = tuRecurseWithPU.GetAbsPartIdxTU();2072 2073 Pel* piOrgTU = pcOrgYuv ->getAddr ( COMPONENT_Y, uiAbsPartIdxTU );2074 Pel* piPredTU = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdxTU );2075 UInt uiStrideTU = pcPredYuv->getStride ( COMPONENT_Y );2076 2077 Pel* piRecIPredTU = pcCU->getPic()->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdxTU );2078 UInt uiRecIPredStrideTU = pcCU->getPic()->getPicYuvRec()->getStride(COMPONENT_Y);2079 2080 const Bool bUseFilter = TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiLumaPredMode, puRect.width, puRect.height, chFmt, sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag());2081 2082 //===== init pattern for luma prediction =====2083 DEBUG_STRING_NEW(sTemp2)2084 initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, bUseFilter DEBUG_STRING_PASS_INTO(sTemp2) );2085 2086 predIntraAng( COMPONENT_Y, uiLumaPredMode, piOrgTU, uiStrideTU, piPredTU, uiStrideTU, tuRecurseWithPU, bUseFilter );2087 2088 // copy for prediction of next part2089 for( UInt uiY = 0; uiY < puRect.height; uiY++ )2090 {2091 for( UInt uiX = 0; uiX < puRect.width; uiX++ )2092 {2093 piPredTU [ uiX ] = ClipBD( piPredTU[ uiX ], bitDepthY );2094 piRecIPredTU [ uiX ] = piPredTU[ uiX ];2095 }2096 piPredTU += uiStrideTU;2097 piRecIPredTU += uiRecIPredStrideTU;2098 }2099 2100 } while (tuRecurseWithPU.nextSection(tuRecurseCU));2101 2102 // reset to full block2103 uiWidth = pcCU->getWidth( 0 );2104 uiHeight = pcCU->getHeight( 0 );2105 2106 uiStride = pcOrgYuv ->getStride( COMPONENT_Y );2107 piOrg = pcOrgYuv ->getAddr ( COMPONENT_Y, uiAbsPartIdx );2108 piPred = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );2109 piReco = pcPredYuv->getAddr ( COMPONENT_Y, uiAbsPartIdx );2110 2111 piRecIPred = pcCU->getPic()->getPicYuvRec()->getAddr ( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiAbsPartIdx );2112 uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride( COMPONENT_Y );2113 2114 // get predicted and original DC2115 predConstantSDC( piPred, uiStride, uiWidth, apDCPredValues[0] ); apDCPredValues[1] = 0;2116 xCalcConstantSDC( piOrg, uiStride, uiWidth, apDCOrigValues[0] ); apDCOrigValues[1] = 0;2117 #if NH_3D_DMM2118 }2119 #endif2120 2121 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )2122 {2123 // remap reconstructed value to valid depth values2124 Pel pDCRec = ( !bZeroResidual ) ? apDCOrigValues[uiSegment] : apDCPredValues[uiSegment];2125 // get residual (idx)2126 #if NH_3D_DLT2127 Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );2128 #else2129 Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];2130 #endif2131 if( !bZeroResidual )2132 {2133 #if NH_3D_DLT2134 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );2135 Int pTestIdx = pPredIdx + pResidualIdx + iSDCDeltaResi;2136 if( pTestIdx >= 0 && pTestIdx < pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) )2137 {2138 pResidualIdx += iSDCDeltaResi;2139 }2140 #else2141 pResidualIdx += iSDCDeltaResi;2142 #endif2143 }2144 // save SDC DC offset2145 pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx);2146 }2147 2148 // reconstruct residual based on mask + DC residuals2149 Pel apDCResiValues[2];2150 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )2151 {2152 #if NH_3D_DLT2153 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );2154 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);2155 Pel pRecoValue = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );2156 2157 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment];2158 #else2159 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);2160 #endif2161 }2162 2163 //===== reconstruction =====2164 Bool* pMask = pbMask;2165 Pel* pPred = piPred;2166 Pel* pReco = piReco;2167 Pel* pRecIPred = piRecIPred;2168 2169 for( UInt uiY = 0; uiY < uiHeight; uiY++ )2170 {2171 for( UInt uiX = 0; uiX < uiWidth; uiX++ )2172 {2173 UChar ucSegment = pMask?(UChar)pMask[uiX]:0;2174 assert( ucSegment < uiNumSegments );2175 2176 Pel pResiDC = apDCResiValues[ucSegment];2177 2178 pReco [ uiX ] = ClipBD( pPred[ uiX ] + pResiDC, bitDepthY);2179 pRecIPred[ uiX ] = pReco[ uiX ];2180 }2181 pPred += uiStride;2182 pReco += uiStride;2183 pRecIPred += uiRecIPredStride;2184 pMask += uiMaskStride;2185 }2186 2187 // clear chroma2188 UInt uiStrideC = pcPredYuv->getStride( COMPONENT_Cb );2189 Pel *pRecCb = pcPredYuv->getAddr ( COMPONENT_Cb, uiAbsPartIdx );2190 Pel *pRecCr = pcPredYuv->getAddr ( COMPONENT_Cr, uiAbsPartIdx );2191 2192 for (Int y=0; y<uiHeight/2; y++)2193 {2194 for (Int x=0; x<uiWidth/2; x++)2195 {2196 pRecCb[x] = 128;2197 pRecCr[x] = 128;2198 }2199 2200 pRecCb += uiStrideC;2201 pRecCr += uiStrideC;2202 }2203 2204 #if NH_3D_DMM2205 if( pbMask ) { delete[] pbMask; }2206 #endif2207 2208 //===== determine distortion =====2209 #if NH_3D_VSO2210 if( m_pcRdCost->getUseVSO() )2211 {2212 ruiDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );2213 }2214 else2215 #endif2216 {2217 ruiDist = m_pcRdCost->getDistPart( bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, COMPONENT_Y, DF_SAD );2218 }2219 2220 //===== determine rate and r-d cost =====2221 m_pcEntropyCoder->resetBits();2222 2223 // encode reduced intra header2224 if( !pcCU->getSlice()->isIntra() )2225 {2226 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())2227 {2228 m_pcEntropyCoder->encodeCUTransquantBypassFlag( pcCU, 0, true );2229 }2230 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );2231 m_pcEntropyCoder->encodePredMode( pcCU, 0, true );2232 }2233 2234 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth( 0 ), true );2235 2236 // encode pred direction + DC residual data2237 m_pcEntropyCoder->encodePredInfo( pcCU, 0 );2238 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );2239 2240 Bool bDummy = false;2241 m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), bDummy, bDummy );2242 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();2243 2244 #if NH_3D_VSO2245 if ( m_pcRdCost->getUseLambdaScaleVSO())2246 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );2247 else2248 #endif2249 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );2250 }2251 #endif2252 1729 2253 1730 … … 2456 1933 TComYuv* pcResiYuv, 2457 1934 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 2458 #if NH_3D_VSO2459 Dist& ruiDist,2460 #else2461 1935 Distortion& ruiDist, 2462 #endif2463 1936 TComTU& rTu 2464 1937 DEBUG_STRING_FN_DECLARE(sDebug)) … … 2520 1993 Double dSingleCost = MAX_DOUBLE; 2521 1994 Int bestModeId = 0; 2522 #if NH_3D_VSO2523 Dist singleDistC = 0;2524 #else2525 1995 Distortion singleDistC = 0; 2526 #endif2527 1996 UInt singleCbfC = 0; 2528 #if NH_3D_VSO2529 Dist singleDistCTmp = 0;2530 #else2531 1997 Distortion singleDistCTmp = 0; 2532 #endif2533 1998 Double singleCostTmp = 0; 2534 1999 UInt singleCbfCTmp = 0; … … 2723 2188 } 2724 2189 2725 #if NH_3D_DIS2726 Void TEncSearch::estIntraPredDIS( TComDataCU* pcCU,2727 TComYuv* pcOrgYuv,2728 TComYuv* pcPredYuv,2729 TComYuv* pcResiYuv,2730 TComYuv* pcRecoYuv,2731 UInt& ruiDistC,2732 Bool bLumaOnly )2733 {2734 #if NH_MV2735 D_PRINT_INC_INDENT(g_traceModeCheck, "estIntraPredDis");2736 #endif2737 2738 UInt uiDepth = pcCU->getDepth(0);2739 UInt uiWidth = pcCU->getWidth (0);2740 UInt uiHeight = pcCU->getHeight(0);2741 2742 #if NH_3D_VSO // M362743 Pel* piOrg = pcOrgYuv ->getAddr(COMPONENT_Y, 0, uiWidth );2744 UInt uiStride = pcPredYuv->getStride(COMPONENT_Y);2745 #endif2746 Dist uiDist = 0;2747 Double dCost = 0.0;2748 Dist uiBestDist = 0;2749 Double dBestCost = MAX_DOUBLE;2750 UInt uiBestDISType = 0;2751 2752 for( UInt uiPredMode = 0; uiPredMode < 4 ; uiPredMode++ )2753 {2754 #if NH_MV2755 D_PRINT_INC_INDENT(g_traceModeCheck, "uiPredMode" + n2s(uiPredMode ) );2756 #endif2757 2758 // set context models2759 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );2760 2761 // determine residual for partition2762 uiDist = 0;2763 dCost = 0.0;2764 #if NH_3D_VSO // M362765 if( m_pcRdCost->getUseRenModel() )2766 {2767 m_pcRdCost->setRenModelData( pcCU, 0, piOrg, uiStride, uiWidth, uiHeight );2768 }2769 #endif2770 xIntraCodingDIS(pcCU, 0, pcOrgYuv, pcPredYuv, uiDist, dCost, uiPredMode);2771 // check r-d cost2772 if( dCost < dBestCost )2773 {2774 uiBestDist = uiDist;2775 dBestCost = dCost;2776 uiBestDISType = pcCU->getDISType(0);2777 // copy reconstruction2778 pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight);2779 }2780 #if NH_MV2781 D_DEC_INDENT( g_traceModeCheck );2782 #endif2783 }2784 2785 2786 pcCU->setDISTypeSubParts((UChar)uiBestDISType, 0, uiDepth);2787 2788 //===== reset context models =====2789 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);2790 2791 //===== set distortion (rate and r-d costs are determined later) =====2792 pcCU->getTotalDistortion() = uiBestDist;2793 #if NH_MV2794 D_DEC_INDENT( g_traceModeCheck );2795 #endif2796 }2797 #endif2798 2190 2799 2191 … … 2807 2199 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE] 2808 2200 DEBUG_STRING_FN_DECLARE(sDebug) 2809 #if NH_3D_ENC_DEPTH2810 , Bool bOnlyIVP2811 #endif2812 2201 ) 2813 2202 { … … 2825 2214 const TComSPS &sps = *(pcCU->getSlice()->getSPS()); 2826 2215 const TComPPS &pps = *(pcCU->getSlice()->getPPS()); 2827 #if NH_3D_VSO2828 Dist uiOverallDistY = 0;2829 #else2830 2216 Distortion uiOverallDistY = 0; 2831 #endif2832 2217 UInt CandNum; 2833 2218 Double CandCostList[ FAST_UDI_MAX_RDMODE_NUM ]; … … 2887 2272 assert (tuRecurseWithPU.ProcessComponentSection(COMPONENT_Y)); 2888 2273 initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, true DEBUG_STRING_PASS_INTO(sTemp2) ); 2889 #if NH_3D_ENC_DEPTH2890 if( bOnlyIVP )2891 {2892 numModesForFullRD = 0;2893 }2894 else2895 {2896 #endif2897 2274 2898 2275 Bool doFastSearch = (numModesForFullRD != numModesAvailable); … … 2917 2294 m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard); 2918 2295 2919 #if NH_3D2920 distParam.bUseIC = false;2921 #endif2922 #if NH_3D_SDC_INTER2923 distParam.bUseSDCMRSAD = false;2924 #endif2925 2296 distParam.bApplyWeight = false; 2926 2297 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ ) 2927 2298 { 2928 2299 UInt uiMode = modeIdx; 2929 #if !NH_3D_VSO2930 2300 Distortion uiSad = 0; 2931 #endif2932 2301 #if NH_MV 2933 2302 D_PRINT_INC_INDENT(g_traceModeCheck, "preTest; uiMode " + n2s(uiMode) ); … … 2937 2306 2938 2307 predIntraAng( COMPONENT_Y, uiMode, piOrg, uiStride, piPred, uiStride, tuRecurseWithPU, bUseFilter, TComPrediction::UseDPCMForFirstPassIntraEstimation(tuRecurseWithPU, uiMode) ); 2939 #if NH_3D_VSO // M342940 Dist uiSad;2941 if ( m_pcRdCost->getUseVSO() )2942 {2943 if ( m_pcRdCost->getUseEstimatedVSD() )2944 {2945 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, distParam.bitDepth , piPred, uiStride, piOrg, uiStride, distParam.iCols, distParam.iRows, true ) );2946 }2947 else2948 {2949 uiSad = m_pcRdCost->getDistPartVSO( pcCU, uiPartOffset, distParam.bitDepth , piPred, uiStride, piOrg, uiStride, distParam.iCols, distParam.iRows, true );2950 }2951 }2952 else2953 {2954 uiSad = distParam.DistFunc(&distParam);2955 }2956 #else2957 2308 // use hadamard transform here 2958 2309 uiSad+=distParam.DistFunc(&distParam); 2959 #endif2960 2310 2961 2311 UInt iModeBits = 0; … … 2964 2314 iModeBits+=xModeBitsIntra( pcCU, uiMode, uiPartOffset, uiDepth, CHANNEL_TYPE_LUMA ); 2965 2315 2966 #if NH_3D_VSO // M352967 Double dLambda;2968 if ( m_pcRdCost->getUseLambdaScaleVSO() )2969 {2970 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : sqrtLambdaForFirstPass;2971 }2972 else2973 {2974 dLambda = m_pcRdCost->getSqrtLambda();2975 }2976 2977 Double cost = (Double)uiSad + (Double)iModeBits * dLambda;2978 #else2979 2316 Double cost = (Double)uiSad + (Double)iModeBits * sqrtLambdaForFirstPass; 2980 #endif2981 2317 2982 2318 #if DEBUG_INTRA_SEARCH_COSTS … … 3022 2358 } 3023 2359 } 3024 #if NH_3D_ENC_DEPTH 3025 } 3026 #endif 3027 3028 #if NH_3D_DMM 3029 if( m_pcEncCfg->getIsDepth() ) 3030 { 3031 const TComRectangle &puRect=tuRecurseWithPU.getRect(COMPONENT_Y); 3032 const UInt uiAbsPartIdx=tuRecurseWithPU.GetAbsPartIdxTU(); 3033 3034 Pel* piOrg = pcOrgYuv ->getAddr( COMPONENT_Y, uiAbsPartIdx ); 3035 Pel* piPred = pcPredYuv->getAddr( COMPONENT_Y, uiAbsPartIdx ); 3036 UInt uiStride = pcPredYuv->getStride( COMPONENT_Y ); 3037 3038 if( puRect.width >= DMM_MIN_SIZE && puRect.width <= DMM_MAX_SIZE && puRect.width == puRect.height && 3039 ((m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag()) || pcCU->getSlice()->getIntraContourFlag()) ) 3040 { 3041 #if NH_3D_ENC_DEPTH 3042 if( bOnlyIVP ) 3043 { 3044 Bool* dmm4Pattern = new Bool[ puRect.width*puRect.height ]; 3045 UInt patternStride = puRect.width; 3046 predContourFromTex( pcCU, uiPartOffset, puRect.width, puRect.height, dmm4Pattern ); 3047 3048 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3049 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, dmm4Pattern, patternStride, puRect.width, puRect.height, deltaDC1, deltaDC2 ); 3050 pcCU->setDmmDeltaDC( DMM4_IDX, 0, uiPartOffset, deltaDC1 ); 3051 pcCU->setDmmDeltaDC( DMM4_IDX, 1, uiPartOffset, deltaDC2 ); 3052 3053 uiRdModeList[ numModesForFullRD++ ] = (DMM4_IDX+DMM_OFFSET); 3054 delete[] dmm4Pattern; 3055 } 3056 else 3057 { 3058 Int threshold = max(((pcCU->getQP(0))>>3)-1,3); 3059 Int varThreshold = (Int)( threshold * threshold - 8 ); 3060 UInt varCU = m_pcRdCost->calcVAR( piOrg, uiStride, puRect.width, puRect.height, pcCU->getDepth(0), pcCU->getSlice()->getSPS()->getMaxCUWidth() ); 3061 if( uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold ) 3062 { 3063 #endif 3064 UInt startIdx = ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) ? 0 : 1; 3065 UInt endIdx = ( pcCU->getSlice()->getIntraContourFlag() ) ? 1 : 0; 3066 for( UInt dmmType = startIdx; dmmType <= endIdx; dmmType++ ) 3067 { 3068 #if H_3D_FCO 3069 if ( !(pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() )->getReconMark()) && (DMM4_IDX == dmmType ) ) { continue; } 3070 #endif 3071 Bool* biSegPattern = new Bool[ puRect.width*puRect.height ]; 3072 UInt patternStride = puRect.width; 3073 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3074 switch( dmmType ) 3075 { 3076 case( DMM1_IDX ): 3077 { 3078 UInt uiTabIdx = 0; 3079 xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, puRect.width, puRect.height, uiTabIdx ); 3080 pcCU->setDmm1WedgeTabIdxSubParts( uiTabIdx, uiPartOffset, uiDepth + uiInitTrDepth ); 3081 (getWedgeListScaled( puRect.width )->at( pcCU->getDmm1WedgeTabIdx( uiAbsPartIdx ) )).getPatternScaledCopy( puRect.width, biSegPattern ); 3082 } break; 3083 case( DMM4_IDX ): 3084 { 3085 predContourFromTex( pcCU, uiPartOffset, puRect.width, puRect.height, biSegPattern ); 3086 } break; 3087 default: assert(0); 3088 } 3089 3090 if( biSegPattern ) 3091 { 3092 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegPattern, patternStride, puRect.width, puRect.height, deltaDC1, deltaDC2 ); 3093 pcCU->setDmmDeltaDC( (DmmID)dmmType, 0, uiPartOffset, deltaDC1 ); 3094 pcCU->setDmmDeltaDC( (DmmID)dmmType, 1, uiPartOffset, deltaDC2 ); 3095 3096 uiRdModeList[ numModesForFullRD++ ] = (dmmType+DMM_OFFSET); 3097 delete[] biSegPattern; 3098 } 3099 } 3100 #if NH_3D_ENC_DEPTH 3101 } 3102 } 3103 #endif 3104 } 3105 } 3106 #endif 2360 3107 2361 3108 2362 //===== check modes (using r-d costs) ===== … … 3113 2367 DEBUG_STRING_NEW(sPU) 3114 2368 UInt uiBestPUMode = 0; 3115 #if NH_3D_ENC_DEPTH 3116 UInt uiBestPUModeConv = 0; 3117 UInt uiSecondBestPUModeConv = 0; 3118 UInt uiThirdBestPUModeConv = 0; 3119 #endif 3120 3121 #if NH_3D_VSO 3122 Dist uiBestPUDistY = 0; 3123 #else 2369 3124 2370 Distortion uiBestPUDistY = 0; 3125 #endif3126 2371 Double dBestPUCost = MAX_DOUBLE; 3127 2372 3128 #if NH_3D_ENC_DEPTH3129 Double dBestPUCostConv = MAX_DOUBLE;3130 UInt rdSDC = m_pcEncCfg->getIsDepth() ? numModesForFullRD : 0;3131 #endif3132 #if NH_3D_SDC_INTRA3133 Bool bBestUseSDC = false;3134 Pel apBestDCOffsets[2] = {0,0};3135 #endif3136 #if NH_3D_ENC_DEPTH3137 for( UInt uiMode = 0; uiMode < numModesForFullRD + rdSDC; uiMode++ )3138 #else3139 2373 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 3140 2374 UInt max=numModesForFullRD; … … 3149 2383 #endif 3150 2384 3151 #endif3152 2385 { 3153 2386 // set luma prediction mode 3154 #if !NH_3D_ENC_DEPTH3155 2387 UInt uiOrgMode = uiRdModeList[uiMode]; 3156 #endif 3157 3158 #if NH_3D_ENC_DEPTH 3159 UInt uiOrgMode; 3160 if (uiMode < numModesForFullRD) 3161 { 3162 uiOrgMode = uiRdModeList[uiMode]; 3163 } 3164 else 3165 { 3166 const TComRectangle &puRect=tuRecurseWithPU.getRect(COMPONENT_Y); 3167 const UInt uiAbsPartIdx=tuRecurseWithPU.GetAbsPartIdxTU(); 3168 3169 Pel* piOrg = pcOrgYuv ->getAddr( COMPONENT_Y, uiAbsPartIdx ); 3170 UInt uiStride = pcPredYuv->getStride( COMPONENT_Y ); 3171 3172 UInt varCU = m_pcRdCost->calcVAR(piOrg, uiStride, puRect.width, puRect.height, pcCU->getDepth(0), pcCU->getSlice()->getSPS()->getMaxCUWidth()); 3173 3174 uiOrgMode = uiRdModeList[uiMode - numModesForFullRD]; 3175 3176 if (uiBestPUModeConv <= 1 ) 3177 { 3178 if (uiOrgMode > 1 && varCU < 1) continue; 3179 } 3180 else 3181 { 3182 if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv 3183 && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4) 3184 continue; 3185 } 3186 } 3187 #endif 2388 3188 2389 3189 2390 #if NH_MV … … 3193 2394 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3194 2395 3195 #if NH_3D_SDC_INTRA3196 #if NH_3D_ENC_DEPTH3197 Bool bTestSDC = ( ( m_pcEncCfg->getUseSDC() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) && pcCU->getSDCAvailable(uiPartOffset) && uiMode >= numModesForFullRD);3198 #else3199 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) );3200 #endif3201 3202 for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ )3203 {3204 #if NH_3D_ENC_DEPTH3205 if (!uiSDC && uiMode >= numModesForFullRD) continue;3206 #endif3207 pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth );3208 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};3209 for( Int iOffset = 1; iOffset <= 5; iOffset++ )3210 {3211 Int iSDCDeltaResi = 0;3212 if(iOffset % 2 == 0)3213 {3214 iSDCDeltaResi = iOffset >> 1;3215 }3216 else3217 {3218 iSDCDeltaResi = -1 * (iOffset >> 1);3219 }3220 if( ( uiSDC == 0 ) && iSDCDeltaResi != 0 )3221 {3222 continue;3223 }3224 if( iOffset > 3)3225 {3226 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )3227 {3228 continue;3229 }3230 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && iOffset == 5)3231 {3232 continue;3233 }3234 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && iOffset == 4)3235 {3236 continue;3237 }3238 }3239 #endif3240 #if NH_3D_ENC_DEPTH3241 Bool zeroResiTest = (pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP());3242 #if NH_3D_SDC_INTRA3243 zeroResiTest = zeroResiTest || pcCU->getSDCFlag(uiPartOffset);3244 if( uiSDC != 0 && iSDCDeltaResi != 0 )3245 {3246 zeroResiTest = false;3247 }3248 #endif3249 for( UInt zeroResi = 0; zeroResi <= ( zeroResiTest ? 1 : 0 ); zeroResi++ )3250 {3251 #endif3252 2396 DEBUG_STRING_NEW(sMode) 3253 2397 // set context models … … 3255 2399 3256 2400 // determine residual for partition 3257 #if NH_3D_VSO3258 Dist uiPUDistY = 0;3259 #else3260 2401 Distortion uiPUDistY = 0; 3261 #endif3262 2402 Double dPUCost = 0.0; 3263 #if NH_3D_VSO // M363264 if( m_pcRdCost->getUseRenModel() )3265 {3266 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, pcOrgYuv, &tuRecurseWithPU );3267 }3268 #endif3269 #if NH_3D_SDC_INTRA3270 if( pcCU->getSDCFlag(uiPartOffset) )3271 {3272 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);3273 pcCU->setCbfSubParts(1, COMPONENT_Y, uiPartOffset, uiDepth + uiInitTrDepth);3274 3275 // start encoding with SDC3276 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( zeroResi != 0 ), iSDCDeltaResi );3277 if ( zeroResi == 0 && iOffset <= 3 )3278 {3279 dOffsetCost [iOffset -1] = dPUCost;3280 }3281 }3282 else3283 {3284 #endif3285 2403 3286 2404 #if HHI_RQT_INTRA_SPEEDUP 3287 #if NH_3D_ENC_DEPTH3288 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode), (zeroResi != 0) );3289 #if NH_3D_ENC_DEPTH3290 if( dPUCost < dBestPUCostConv )3291 {3292 uiThirdBestPUModeConv = uiSecondBestPUModeConv;3293 uiSecondBestPUModeConv = uiBestPUModeConv;3294 uiBestPUModeConv = uiOrgMode;3295 dBestPUCostConv = dPUCost;3296 }3297 #endif3298 #else3299 2405 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) ); 3300 #endif3301 #else3302 #if NH_3D_ENC_DEPTH3303 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode), (zeroResi != 0) );3304 2406 #else 3305 2407 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) ); 3306 #endif3307 #endif3308 #if NH_3D_SDC_INTRA3309 }3310 2408 #endif 3311 2409 … … 3327 2425 dBestPUCost = dPUCost; 3328 2426 3329 #if NH_3D_SDC_INTRA3330 if( pcCU->getSDCFlag(uiPartOffset) )3331 {3332 bBestUseSDC = true;3333 3334 // copy reconstruction3335 UInt uiWidthPU = tuRecurseWithPU.getRect( COMPONENT_Y ).width;3336 UInt uiHeightPU = tuRecurseWithPU.getRect( COMPONENT_Y ).height;3337 UInt uiWidth = pcCU->getWidth (0) >> uiInitTrDepth;3338 UInt uiHeight = pcCU->getHeight(0) >> uiInitTrDepth;3339 AOF(uiWidth==uiWidthPU);3340 AOF(uiHeight==uiHeightPU);3341 pcPredYuv->copyPartToPartComponent(COMPONENT_Y, pcRecoYuv, uiPartOffset, uiWidth, uiHeight);3342 3343 // copy DC values3344 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);3345 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);3346 }3347 else3348 {3349 bBestUseSDC = false;3350 #endif3351 2427 xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU ); 3352 2428 … … 3373 2449 ::memcpy( m_puhQTTempTransformSkipFlag[compID], pcCU->getTransformSkip(compID) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3374 2450 } 3375 #if NH_3D_SDC_INTRA3376 }3377 #endif3378 2451 } 3379 2452 #if HHI_RQT_INTRA_SPEEDUP_MOD … … 3383 2456 dSecondBestPUCost = dPUCost; 3384 2457 } 3385 #endif3386 #if NH_3D_ENC_DEPTH3387 }3388 #endif3389 #if NH_3D_SDC_INTRA3390 } // SDC residual loop3391 } // SDC loop3392 2458 #endif 3393 2459 #if NH_MV … … 3420 2486 3421 2487 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3422 #if NH_3D_SDC_INTRA3423 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth);3424 #endif3425 2488 3426 2489 DEBUG_STRING_NEW(sModeTree) … … 3430 2493 3431 2494 // determine residual for partition 3432 #if NH_3D_VSO3433 Dist uiPUDistY = 0;3434 #else3435 2495 Distortion uiPUDistY = 0; 3436 #endif3437 2496 Double dPUCost = 0.0; 3438 #if NH_3D_VSO // M37 //check if necessary3439 // reset Model3440 if( m_pcRdCost->getUseRenModel() )3441 {3442 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, pcOrgYuv, &tuRecurseWithPU );3443 }3444 #endif3445 2497 3446 2498 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, false, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sModeTree)); … … 3453 2505 uiBestPUDistY = uiPUDistY; 3454 2506 dBestPUCost = dPUCost; 3455 #if NH_3D_SDC_INTRA3456 bBestUseSDC = false;3457 #endif3458 2507 3459 2508 … … 3490 2539 //--- update overall distortion --- 3491 2540 uiOverallDistY += uiBestPUDistY; 3492 #if NH_3D_SDC_INTRA3493 if( bBestUseSDC )3494 {3495 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);3496 pcCU->setCbfSubParts(1, COMPONENT_Y, uiPartOffset, uiDepth + uiInitTrDepth);3497 3498 //=== copy best DC segment values back to CU ====3499 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset);3500 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[1], 1, uiPartOffset);3501 }3502 else3503 {3504 #endif3505 2541 3506 2542 //--- update transform index and cbf --- … … 3512 2548 ::memcpy( pcCU->getCbf( compID ) + uiPartOffset, m_puhQTTempCbf[compID], uiQPartNum * sizeof( UChar ) ); 3513 2549 ::memcpy( pcCU->getTransformSkip( compID ) + uiPartOffset, m_puhQTTempTransformSkipFlag[compID ], uiQPartNum * sizeof( UChar ) ); 3514 #if NH_3D_SDC_INTRA3515 }3516 #endif3517 2550 3518 2551 } … … 3538 2571 } 3539 2572 } 3540 #if NH_3D_VSO // M383541 // set model3542 if( m_pcRdCost->getUseRenModel() )3543 {3544 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, pcRecoYuv, &tuRecurseWithPU );3545 }3546 #endif3547 2573 } 3548 2574 3549 2575 //=== update PU data ==== 3550 2576 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3551 #if NH_3D_SDC_INTRA3552 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, uiDepth + uiInitTrDepth );3553 #endif3554 2577 #if NH_MV 3555 2578 D_DEC_INDENT( g_traceModeCheck ); … … 3611 2634 { 3612 2635 UInt uiBestMode = 0; 3613 #if NH_3D_VSO3614 Dist uiBestDist = 0;3615 #else3616 2636 Distortion uiBestDist = 0; 3617 #endif3618 2637 Double dBestCost = MAX_DOUBLE; 3619 2638 … … 3652 2671 DEBUG_STRING_NEW(sMode) 3653 2672 //----- chroma coding ----- 3654 #if NH_3D_VSO3655 Dist uiDist = 0;3656 #else3657 2673 Distortion uiDist = 0; 3658 #endif3659 2674 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_CHROMA, uiModeList[uiMode], uiPartOffset, uiDepthCU+uiInitTrDepth ); 3660 2675 xRecurIntraChromaCodingQT ( pcOrgYuv, pcPredYuv, pcResiYuv, resiLuma, uiDist, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) ); … … 3832 2847 uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 3833 2848 3834 #if NH_3D_VSO // M433835 3836 // GT: This needs to be checked distortion is not necessarily 0 in case of VSO.3837 if( m_pcRdCost->getUseLambdaScaleVSO() )3838 {3839 dCost = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion );3840 }3841 else3842 #endif3843 2849 dCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 3844 2850 … … 3874 2880 iWidth, iHeight, m_pcEncCfg->getUseHADME() && (pcCU->getCUTransquantBypass(iPartIdx) == 0) ); 3875 2881 3876 #if NH_3D_IC3877 cDistParam.bUseIC = false;3878 #endif3879 #if NH_3D_SDC_INTER3880 cDistParam.bUseSDCMRSAD = false;3881 #endif3882 2882 3883 2883 ruiErr = cDistParam.DistFunc( &cDistParam ); … … 3886 2886 //! estimation of best merge coding 3887 2887 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, Distortion& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand 3888 #if NH_3D_VSP3889 , Int* vspFlag3890 #endif3891 #if NH_3D_SPIVMP3892 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP3893 #endif3894 2888 ) 3895 2889 { … … 3905 2899 UInt uiDepth = pcCU->getDepth( uiAbsPartIdx ); 3906 2900 3907 #if NH_3D_DBBP3908 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();3909 if( pcCU->getDBBPFlag(0) )3910 {3911 AOF( uiAbsPartIdx == 0 );3912 AOF( iPUIdx == 0 );3913 AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );3914 AOF( pDBBPTmpData->eVirtualPartSize != NUMBER_OF_PART_SIZES );3915 3916 // temporary change of partition size for candidate derivation3917 pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));3918 iPUIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;3919 3920 // if this is handling the second segment, make sure that motion info of first segment is available3921 if( iPUIdx == 1 )3922 {3923 pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level3924 3925 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )3926 {3927 RefPicList eRefList = (RefPicList)uiRefListIdx;3928 3929 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level3930 }3931 }3932 3933 // update these values to virtual partition size3934 pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );3935 }3936 #endif3937 2901 3938 2902 PartSize partSize = pcCU->getPartitionSize( 0 ); 3939 #if NH_3D_DBBP3940 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(0) == false )3941 #else3942 2903 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 ) 3943 #endif3944 2904 { 3945 2905 if ( iPUIdx == 0 ) 3946 2906 { 3947 2907 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set 3948 #if NH_3D_MLC3949 pcCU->initAvailableFlags();3950 2908 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 3951 pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours3952 #if NH_3D_SPIVMP3953 , pcMvFieldSP, puhInterDirSP3954 #endif3955 , numValidMergeCand3956 );3957 3958 pcCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours3959 #if NH_3D_VSP3960 , vspFlag3961 #endif3962 #if NH_3D_SPIVMP3963 , pbSPIVMPFlag3964 #endif3965 , numValidMergeCand3966 );3967 #else3968 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );3969 #endif3970 2909 pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); // restore 3971 2910 } … … 3973 2912 else 3974 2913 { 3975 #if NH_3D_MLC3976 pcCU->initAvailableFlags();3977 2914 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 3978 pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours3979 #if NH_3D_SPIVMP3980 , pcMvFieldSP, puhInterDirSP3981 #endif3982 , numValidMergeCand3983 );3984 3985 pcCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours3986 #if NH_3D_VSP3987 , vspFlag3988 #endif3989 #if NH_3D_SPIVMP3990 , pbSPIVMPFlag3991 #endif3992 , numValidMergeCand3993 );3994 #else3995 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );3996 #endif3997 2915 } 3998 2916 3999 2917 xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 4000 2918 4001 #if NH_3D_DBBP4002 if( pcCU->getDBBPFlag(0) )4003 {4004 // reset to 2Nx2N for actual motion search4005 iPUIdx = 0;4006 AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize );4007 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0));4008 4009 // restore values for 2Nx2N partition size4010 pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );4011 4012 AOF( uiAbsPartIdx == 0 );4013 AOF( iWidth == iHeight );4014 }4015 #endif4016 2919 4017 2920 ruiCost = std::numeric_limits<Distortion>::max(); … … 4025 2928 4026 2929 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 4027 #if NH_3D_VSP 4028 pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 4029 #endif 4030 4031 #if NH_3D_SPIVMP 4032 pcCU->setSPIVMPFlagSubParts( pbSPIVMPFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx )); 4033 if (pbSPIVMPFlag[uiMergeCand]) 4034 { 4035 UInt uiSPAddr; 4036 4037 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 4038 4039 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 4040 4041 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 4042 { 4043 pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); 4044 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); 4045 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 4046 } 4047 } 4048 else 4049 #endif 4050 #if NH_3D_VSP 4051 #if NH_3D_DBBP 4052 if ( vspFlag[uiMergeCand] && !pcCU->getDBBPFlag(0) ) 4053 #else 4054 if ( vspFlag[uiMergeCand] ) 4055 #endif 4056 { 4057 UInt partAddr; 4058 Int vspSize; 4059 Int width, height; 4060 pcCU->getPartIndexAndSize( iPUIdx, partAddr, width, height ); 4061 4062 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 ) 4063 { 4064 pcCU->setMvFieldPUForVSP( pcCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize ); 4065 pcCU->setVSPFlag( partAddr, vspSize ); 4066 } 4067 else 4068 { 4069 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4070 } 4071 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 ) 4072 { 4073 pcCU->setMvFieldPUForVSP( pcCU, partAddr, width, height, REF_PIC_LIST_1, cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize ); 4074 pcCU->setVSPFlag( partAddr, vspSize ); 4075 } 4076 else 4077 { 4078 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4079 } 4080 } 4081 else 4082 { 4083 #endif 2930 4084 2931 4085 2932 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4086 2933 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4087 #if NH_3D_VSP4088 }4089 #endif4090 2934 4091 2935 … … 4144 2988 //! search of the best candidate for inter prediction 4145 2989 #if AMP_MRG 4146 #if NH_3D_FAST_TEXTURE_ENCODING4147 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv, TComYuv* pcRecoYuv DEBUG_STRING_FN_DECLARE(sDebug), Bool bFMD, Bool bUseRes, Bool bUseMRG )4148 #else4149 2990 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv, TComYuv* pcRecoYuv DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseRes, Bool bUseMRG ) 4150 #endif4151 2991 #else 4152 2992 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv, TComYuv* pcRecoYuv, Bool bUseRes ) … … 4212 3052 Distortion biPDistTemp = std::numeric_limits<Distortion>::max(); 4213 3053 4214 #if NH_3D_IV_MERGE4215 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists4216 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];4217 #else4218 3054 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 4219 3055 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 4220 #endif4221 3056 4222 3057 Int numValidMergeCand = 0 ; … … 4251 3086 4252 3087 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4253 #if NH_3D_VSP4254 pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );4255 #endif4256 3088 4257 3089 #if AMP_MRG 4258 3090 Bool bTestNormalMC = true; 4259 #if NH_3D_FAST_TEXTURE_ENCODING4260 if (bFMD||( bUseMRG && pcCU->getWidth( 0 ) > 8 && iNumPart == 2 ))4261 #else4262 3091 if ( bUseMRG && pcCU->getWidth( 0 ) > 8 && iNumPart == 2 ) 4263 #endif4264 3092 4265 3093 { … … 4608 3436 } // end if bTestNormalMC 4609 3437 #endif 4610 #if NH_3D_DBBP4611 // test merge mode for DBBP (2Nx2N)4612 if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N || pcCU->getDBBPFlag(0) )4613 #else4614 3438 if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N ) 4615 #endif4616 3439 { 4617 3440 UInt uiMRGInterDir = 0; … … 4651 3474 Distortion uiMRGCost = std::numeric_limits<Distortion>::max(); 4652 3475 4653 #if NH_3D_VSP4654 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];4655 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);4656 UInt uiAbsPartIdx = 0;4657 Int iWidth = 0;4658 Int iHeight = 0;4659 pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight );4660 DisInfo OriginalDvInfo = pcCU->getDvInfo(uiAbsPartIdx);4661 #endif4662 #if NH_3D_SPIVMP4663 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];4664 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);4665 TComMvField* pcMvFieldSP;4666 UChar* puhInterDirSP;4667 pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];4668 puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];4669 #endif4670 3476 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand 4671 #if NH_3D_VSP4672 , vspFlag4673 #endif4674 #if NH_3D_SPIVMP4675 , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP4676 #endif4677 3477 ); 4678 3478 … … 4682 3482 pcCU->setMergeFlagSubParts ( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4683 3483 pcCU->setMergeIndexSubParts( uiMRGIndex, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4684 #if NH_3D_VSP4685 pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4686 #endif4687 #if NH_3D_SPIVMP4688 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4689 if (bSPIVMPFlag[uiMRGIndex]!=0)4690 {4691 UInt uiSPAddr;4692 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;4693 pcCU->getSPPara(iRoiWidth, iRoiHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);4694 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)4695 {4696 pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);4697 pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);4698 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);4699 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);4700 }4701 if ( pcCU->getInterDir(uiPartAddr) == 3 && pcCU->isBipredRestriction(iPartIdx) )4702 {4703 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiPartAddr, 0, iPartIdx);4704 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiPartAddr, 0, iPartIdx);4705 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ));4706 }4707 }4708 else4709 #endif4710 #if NH_3D_VSP4711 #if NH_3D_DBBP4712 if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) )4713 #else4714 if ( vspFlag[uiMRGIndex] )4715 #endif4716 {4717 UInt partAddrTemp;4718 Int vspSize;4719 Int width, height;4720 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==2564721 if( uiMRGInterDir & 0x01 )4722 {4723 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize );4724 pcCU->setVSPFlag( partAddrTemp, vspSize );4725 }4726 else4727 {4728 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );4729 }4730 if( uiMRGInterDir & 0x02 )4731 {4732 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize );4733 pcCU->setVSPFlag( partAddrTemp, vspSize );4734 }4735 else4736 {4737 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );4738 }4739 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4740 }4741 else4742 {4743 #endif4744 3484 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4745 3485 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4746 3486 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4747 #if NH_3D_VSP4748 }4749 #endif4750 #if H_3D4751 }4752 #endif4753 3487 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4754 3488 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); … … 4761 3495 else 4762 3496 { 4763 #if NH_3D_SPIVMP4764 pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4765 #endif4766 3497 // set ME result 4767 3498 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4768 3499 pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4769 #if NH_3D_VSP4770 pcCU->setVSPFlagSubParts ( 0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4771 pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4772 #endif4773 3500 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4774 3501 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4775 3502 } 4776 #if NH_3D_SPIVMP4777 delete[] pcMvFieldSP;4778 delete[] puhInterDirSP;4779 #endif4780 3503 } 4781 3504 … … 4819 3542 { 4820 3543 4821 #if NH_3D_DBBP4822 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();4823 if( pcCU->getDBBPFlag(0) )4824 {4825 AOF( uiPartAddr == 0 );4826 AOF( uiPartIdx == 0 );4827 AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );4828 AOF( pDBBPTmpData->eVirtualPartSize != NUMBER_OF_PART_SIZES );4829 AOF( iRoiWidth == iRoiHeight );4830 4831 // temporary change of partition size for candidate derivation4832 pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));4833 uiPartIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;4834 4835 // if this is handling the second segment, make sure that motion info of first segment is set to first segment4836 if( uiPartIdx == 1 )4837 {4838 pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level4839 4840 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )4841 {4842 RefPicList eRefList = (RefPicList)uiRefListIdx;4843 pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level4844 }4845 }4846 4847 // update values to virtual partition size4848 pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );4849 }4850 #endif4851 3544 4852 3545 pcCU->fillMvpCand( uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pcAMVPInfo ); 4853 #if NH_3D_DBBP4854 if( pcCU->getDBBPFlag(0) )4855 {4856 // restore 2Nx2N partitioning for motion estimation4857 uiPartIdx = 0;4858 AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize );4859 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0));4860 4861 // restore values for 2Nx2N partition size4862 pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );4863 AOF(uiPartAddr==0);4864 }4865 #endif4866 3546 4867 3547 } … … 5093 3773 pcCU->clipMv( cMvCand ); 5094 3774 5095 #if NH_3D_IC5096 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() );5097 #endif5098 3775 5099 3776 // prediction pattern … … 5101 3778 { 5102 3779 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) 5103 #if NH_3D_ARP5104 , false //add this for IC, otherwise, it could be removed5105 #endif5106 3780 ); 5107 3781 } … … 5109 3783 { 5110 3784 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) 5111 #if NH_3D_ARP5112 , false5113 #endif5114 #if NH_3D_IC5115 , bICFlag5116 #endif5117 3785 5118 3786 ); … … 5161 3829 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 5162 3830 5163 #if NH_3D_IC5164 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getViewIndex() );5165 pcPatternKey->setICFlag( bICFlag );5166 #endif5167 #if NH_3D_SDC_INTER5168 pcPatternKey->setSDCMRSADFlag( pcCU->getSlice()->getInterSdcFlag() );5169 #endif5170 3831 5171 3832 if ( bBi ) // Bipredictive ME … … 5209 3870 5210 3871 m_pcRdCost->setPredictor ( *pcMvPred ); 5211 #if NH_3D_INTEGER_MV_DEPTH5212 if( pcCU->getSlice()->getIsDepth() )5213 {5214 m_pcRdCost->setCostScale ( 0 );5215 }5216 else5217 {5218 #endif5219 3872 m_pcRdCost->setCostScale ( 2 ); 5220 #if NH_3D_INTEGER_MV_DEPTH5221 }5222 #endif5223 3873 5224 3874 … … 5245 3895 5246 3896 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 5247 #if NH_3D_INTEGER_MV_DEPTH5248 if( ! pcCU->getSlice()->getIsDepth() )5249 {5250 #endif5251 3897 m_pcRdCost->setCostScale ( 1 ); 5252 3898 … … 5258 3904 rcMv += (cMvHalf <<= 1); 5259 3905 rcMv += cMvQter; 5260 #if NH_3D_INTEGER_MV_DEPTH5261 }5262 #endif5263 3906 5264 3907 UInt uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer() ); 5265 #if NH_3D_INTEGER_MV_DEPTH5266 if( pcCU->getSlice()->getIsDepth() )5267 {5268 ruiCost += m_pcRdCost->getCost( uiMvBits );5269 }5270 #endif5271 3908 ruiBits += uiMvBits; 5272 3909 ruiCost = (Distortion)( floor( fWeight * ( (Double)ruiCost - (Double)m_pcRdCost->getCost( uiMvBits ) ) ) + (Double)m_pcRdCost->getCost( ruiBits ) ); … … 5283 3920 { 5284 3921 Int iMvShift = 2; 5285 #if NH_3D_INTEGER_MV_DEPTH5286 if( pcCU->getSlice()->getIsDepth() )5287 {5288 iMvShift = 0;5289 }5290 #endif5291 3922 TComMv cTmpMvPred = cMvPred; 5292 3923 pcCU->clipMv( cTmpMvPred ); … … 5364 3995 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 5365 3996 5366 #if NH_3D_IC5367 m_cDistParam.bUseIC = pcPatternKey->getICFlag();5368 #endif5369 #if NH_3D_SDC_INTER5370 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();5371 #endif5372 3997 5373 3998 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); … … 5470 4095 UInt uiSearchRange = m_iSearchRange; 5471 4096 pcCU->clipMv( rcMv ); 5472 #if NH_3D_INTEGER_MV_DEPTH5473 if( ! pcCU->getSlice()->getIsDepth() )5474 #endif5475 4097 #if ME_ENABLE_ROUNDING_OF_MVS 5476 4098 rcMv.divideByPowerOf2(2); … … 5495 4117 TComMv cMv = m_acMvPredictors[index]; 5496 4118 pcCU->clipMv( cMv ); 5497 #if NH_3D_INTEGER_MV_DEPTH5498 if( ! pcCU->getSlice()->getIsDepth() )5499 {5500 #endif5501 4119 #if ME_ENABLE_ROUNDING_OF_MVS 5502 4120 cMv.divideByPowerOf2(2); … … 5505 4123 #endif 5506 4124 5507 #if NH_3D_INTEGER_MV_DEPTH5508 }5509 #endif5510 4125 if (cMv != rcMv && (cMv.getHor() != cStruct.iBestX && cMv.getVer() != cStruct.iBestY)) 5511 4126 { … … 5993 4608 5994 4609 pcYuvPred->copyToPartYuv( pcYuvRec, 0 ); 5995 #if NH_3D_VSO5996 Dist distortion = 0;5997 #else5998 4610 Distortion distortion = 0; 5999 #endif6000 4611 6001 4612 for (Int comp=0; comp < numValidComponents; comp++) … … 6004 4615 const UInt csx=pcYuvOrg->getComponentScaleX(compID); 6005 4616 const UInt csy=pcYuvOrg->getComponentScaleY(compID); 6006 #if NH_3D_VSO // M136007 if ( m_pcRdCost->getUseVSO() )6008 {6009 distortion += m_pcRdCost->getDistPartVSO( pcCU, 0, sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID),6010 pcYuvOrg->getStride(compID), cuWidthPixels >> csx, cuHeightPixels >> csy, false );6011 }6012 else6013 {6014 #endif6015 4617 distortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID), 6016 4618 pcYuvOrg->getStride(compID), cuWidthPixels >> csx, cuHeightPixels >> csy, compID); 6017 #if NH_3D_VSO // MIgnore6018 }6019 #endif6020 4619 } 6021 4620 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST]); … … 6029 4628 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 6030 4629 m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, true ); 6031 #if NH_3D_ARP6032 m_pcEntropyCoder->encodeARPW( pcCU, 0 );6033 #endif6034 #if NH_3D_IC6035 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );6036 #endif6037 4630 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 6038 4631 pcCU->getTotalBits() = uiBits; 6039 4632 pcCU->getTotalDistortion() = distortion; 6040 #if NH_3D_VSO //M 146041 if ( m_pcRdCost->getUseLambdaScaleVSO() )6042 {6043 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( uiBits, distortion );6044 }6045 else6046 #endif6047 4633 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( uiBits, distortion ); 6048 4634 … … 6057 4643 #endif 6058 4644 6059 #if NH_3D_VSO // necessary? // M156060 // set Model6061 if( !m_pcRdCost->getUseEstimatedVSD() && m_pcRdCost->getUseRenModel() )6062 {6063 const UInt csx = pcYuvRec->getComponentScaleX( COMPONENT_Y );6064 const UInt csy = pcYuvRec->getComponentScaleY( COMPONENT_Y );6065 6066 Pel* piSrc = pcYuvRec->getAddr ( COMPONENT_Y );6067 UInt uiSrcStride = pcYuvRec->getStride( COMPONENT_Y );6068 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, cuWidthPixels >> csx, cuHeightPixels >> csy);6069 }6070 #endif6071 4645 #if NH_MV 6072 4646 D_DEC_INDENT( g_traceModeCheck ); … … 6084 4658 Double nonZeroCost = 0; 6085 4659 UInt nonZeroBits = 0; 6086 #if NH_3D_VSO6087 Dist nonZeroDistortion = 0;6088 Dist zeroDistortion = 0;6089 #else6090 4660 Distortion nonZeroDistortion = 0; 6091 4661 Distortion zeroDistortion = 0; 6092 #endif6093 4662 6094 4663 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_CURR_BEST ] ); 6095 #if NH_3D_VSO // M16 // M186096 if ( m_pcRdCost->getUseVSO() ) // This creating and destroying need to be fixed.6097 {6098 m_cYuvRecTemp.create( pcYuvPred->getWidth( COMPONENT_Y ), pcYuvPred->getHeight( COMPONENT_Y ), CHROMA_400 );6099 }6100 6101 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC6102 Bool oldTraceRDCost = g_traceRDCost;6103 g_traceRDCost = false;6104 6105 Bool oldTraceModeCheck = g_traceModeCheck;6106 g_traceModeCheck = false;6107 6108 Bool oldTraceFracBits = g_traceEncFracBits;6109 g_traceEncFracBits = false;6110 6111 #endif6112 xEstimateInterResidualQT( pcYuvResi, pcYuvOrg, pcYuvPred, nonZeroCost, nonZeroBits, nonZeroDistortion, &zeroDistortion, tuLevel0 DEBUG_STRING_PASS_INTO(sDebug) );6113 6114 #if ENC_DEC_TRACE && NH_MV_ENC_DEC_TRAC6115 g_traceRDCost = oldTraceRDCost;6116 g_traceEncFracBits = oldTraceFracBits;6117 g_traceModeCheck = oldTraceModeCheck;6118 #endif6119 6120 if ( m_pcRdCost->getUseVSO() )6121 {6122 m_cYuvRecTemp.destroy();6123 }6124 #else6125 4664 xEstimateInterResidualQT( pcYuvResi, nonZeroCost, nonZeroBits, nonZeroDistortion, &zeroDistortion, tuLevel0 DEBUG_STRING_PASS_INTO(sDebug) ); 6126 #endif6127 4665 // ------------------------------------------------------- 6128 4666 // set the coefficients in the pcCU, and also calculates the residual data. … … 6133 4671 m_pcEntropyCoder->encodeQtRootCbfZero( ); 6134 4672 const UInt zeroResiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 6135 #if NH_3D_VSO // M196136 Double zeroCost;6137 if( m_pcRdCost->getUseLambdaScaleVSO() )6138 {6139 zeroCost = (pcCU->isLosslessCoded( 0 )) ? (nonZeroCost+1) : (m_pcRdCost->calcRdCostVSO( zeroResiBits, zeroDistortion ));6140 }6141 else6142 {6143 zeroCost = (pcCU->isLosslessCoded( 0 )) ? (nonZeroCost+1) : (m_pcRdCost->calcRdCost( zeroResiBits, zeroDistortion ));6144 }6145 #else6146 4673 const Double zeroCost = (pcCU->isLosslessCoded( 0 )) ? (nonZeroCost+1) : (m_pcRdCost->calcRdCost( zeroResiBits, zeroDistortion )); 6147 #endif6148 #if NH_3D_SPIVMP6149 if ( zeroCost < nonZeroCost || pcCU->getQtRootCbf(0)==0)6150 #else6151 4674 if ( zeroCost < nonZeroCost || !pcCU->getQtRootCbf(0) ) 6152 #endif6153 4675 { 6154 4676 const UInt uiQPartNum = tuLevel0.GetAbsPartIdxNumParts(); … … 6196 4718 // update with clipped distortion and cost (previously unclipped reconstruction values were used) 6197 4719 6198 #if NH_3D_VSO6199 Dist finalDistortion = 0;6200 #else6201 4720 Distortion finalDistortion = 0; 6202 #endif6203 4721 for(Int comp=0; comp<numValidComponents; comp++) 6204 4722 { 6205 4723 const ComponentID compID=ComponentID(comp); 6206 #if NH_3D_VSO // M22 // GT: might be removed since VSO already provided clipped distortion6207 if ( m_pcRdCost->getUseVSO() )6208 {6209 finalDistortion += m_pcRdCost->getDistPartVSO ( pcCU, 0, sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr( compID ), pcYuvRec->getStride( compID ), pcYuvOrg->getAddr( compID ), pcYuvOrg->getStride( compID ), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), false );6210 }6211 else6212 {6213 #endif6214 4724 finalDistortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID); 6215 #if NH_3D_VSO // M236216 }6217 #endif6218 4725 } 6219 4726 6220 4727 pcCU->getTotalBits() = finalBits; 6221 4728 pcCU->getTotalDistortion() = finalDistortion; 6222 #if NH_3D_VSO6223 if ( m_pcRdCost->getUseLambdaScaleVSO() )6224 {6225 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( finalBits, finalDistortion );6226 }6227 else6228 #endif6229 4729 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( finalBits, finalDistortion ); 6230 4730 6231 #if NH_3D_VSO // M24 // necessary??6232 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() )6233 {6234 Pel* piSrc = pcYuvRec->getAddr ( COMPONENT_Y );6235 UInt uiSrcStride = pcYuvRec->getStride( COMPONENT_Y );6236 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, cuWidthPixels >> pcYuvOrg->getComponentScaleX(COMPONENT_Y), cuHeightPixels >> pcYuvOrg->getComponentScaleY(COMPONENT_Y));6237 }6238 #endif6239 4731 #if NH_MV 6240 4732 D_DEC_INDENT( g_traceModeCheck ); … … 6242 4734 } 6243 4735 6244 #if NH_3D_SDC_INTER6245 Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, Int uiOffest, const UInt uiDepth )6246 {6247 if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( 0 ) )6248 {6249 return;6250 }6251 pcCU->setSDCFlagSubParts( true, 0, uiDepth );6252 6253 UInt uiWidth = pcCU->getWidth ( 0 );6254 UInt uiHeight = pcCU->getHeight( 0 );6255 UInt uiSegSize = 0;6256 6257 Pel *pPred, *pOrg;6258 UInt uiPredStride = pcPred->getStride( COMPONENT_Y );6259 UInt uiOrgStride = pcOrg->getStride( COMPONENT_Y );6260 UInt uiPelX, uiPelY;6261 6262 pPred = pcPred->getAddr( COMPONENT_Y );6263 pOrg = pcOrg->getAddr( COMPONENT_Y );6264 Int pResDC = 0;6265 Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);6266 Int bitDepthC = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA);6267 6268 //calculate dc value for prediction and original signal, and calculate residual and reconstruction6269 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )6270 {6271 for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )6272 {6273 pResDC += (Int)( pOrg [uiPelX] - pPred[uiPelX] );6274 uiSegSize++;6275 }6276 pOrg += uiOrgStride;6277 pPred += uiPredStride;6278 }6279 6280 Int iResiOffset = ( pResDC > 0 ? ( uiSegSize >> 1 ) : -1*( uiSegSize >> 1 ) );6281 pResDC = ( pResDC + iResiOffset ) / (Int) uiSegSize;6282 6283 pcCU->setSDCSegmentDCOffset( pResDC + uiOffest, 0, 0 );6284 6285 6286 Pel *pRec;6287 UInt uiRecStride = pcRec->getStride( COMPONENT_Y );6288 pPred = pcPred->getAddr( COMPONENT_Y );6289 pRec = pcRec->getAddr( COMPONENT_Y );6290 6291 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )6292 {6293 for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )6294 {6295 pRec[ uiPelX ] = Clip3( 0, (1 << bitDepthY) - 1, pPred[uiPelX] + pcCU->getSDCSegmentDCOffset(0, 0) );6296 }6297 pPred += uiPredStride;6298 pRec += uiRecStride;6299 }6300 6301 // clear UV6302 UInt uiStrideC = pcRec->getStride( COMPONENT_Cb );6303 Pel *pRecCb = pcRec->getAddr( COMPONENT_Cb );6304 Pel *pRecCr = pcRec->getAddr( COMPONENT_Cr );6305 6306 for (Int y=0; y < uiHeight/2; y++)6307 {6308 for (Int x=0; x < uiWidth/2; x++)6309 {6310 pRecCb[x] = (Pel)( 1 << ( bitDepthC - 1 ) );6311 pRecCr[x] = (Pel)( 1 << ( bitDepthC - 1 ) );6312 }6313 6314 pRecCb += uiStrideC;6315 pRecCr += uiStrideC;6316 }6317 6318 Dist ruiDist;6319 Double rdCost;6320 #if NH_3D_VSO // M136321 if ( m_pcRdCost->getUseVSO() )6322 {6323 ruiDist = m_pcRdCost->getDistPartVSO( pcCU, 0, bitDepthY, pcRec->getAddr( COMPONENT_Y ), pcRec->getStride( COMPONENT_Y ), pcOrg->getAddr( COMPONENT_Y ), pcOrg->getStride( COMPONENT_Y ), uiWidth, uiHeight , false );6324 }6325 else6326 {6327 #endif6328 {6329 ruiDist = m_pcRdCost->getDistPart( bitDepthY, pcRec->getAddr( COMPONENT_Y ), uiRecStride, pcOrg->getAddr( COMPONENT_Y ), uiOrgStride, uiWidth, uiHeight, COMPONENT_Y );6330 }6331 #if NH_3D_VSO6332 }6333 #endif6334 6335 Bool bNonSkip = false;6336 bNonSkip |= ( pcCU->getSDCSegmentDCOffset( 0, 0 ) != 0 ) ? 1 : 0;6337 if( !bNonSkip )6338 {6339 pcCU->getTotalBits() = MAX_INT;6340 pcCU->getTotalDistortion() = MAX_INT;6341 pcCU->getTotalCost() = MAX_DOUBLE;6342 }6343 else6344 {6345 //----- determine rate and r-d cost -----6346 UInt uiBits = 0;6347 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] );6348 6349 xAddSymbolBitsInter( pcCU, uiBits );6350 6351 #if NH_3D_VSO //M 146352 if ( m_pcRdCost->getUseLambdaScaleVSO() )6353 {6354 rdCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );6355 }6356 else6357 #endif6358 {6359 rdCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );6360 }6361 6362 pcCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();6363 pcCU->getTotalDistortion() = ruiDist;6364 pcCU->getTotalCost() = rdCost;6365 6366 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] );6367 }6368 6369 #if NH_3D_VSO // necessary? // M156370 // set Model6371 if( !m_pcRdCost->getUseEstimatedVSD() && m_pcRdCost->getUseRenModel() )6372 {6373 Pel* piSrc = pcRec->getAddr( COMPONENT_Y );6374 UInt uiSrcStride = pcRec->getStride( COMPONENT_Y );6375 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );6376 }6377 #endif6378 }6379 #endif6380 4736 6381 4737 6382 4738 Void TEncSearch::xEstimateInterResidualQT( TComYuv *pcResi, 6383 #if NH_3D_VSO // M256384 TComYuv *pcOrg,6385 TComYuv *pcPred,6386 #endif6387 4739 Double &rdCost, 6388 4740 UInt &ruiBits, 6389 #if NH_3D_VSO6390 Dist &ruiDist,6391 Dist *puiZeroDist,6392 #else6393 4741 Distortion &ruiDist, 6394 4742 Distortion *puiZeroDist, 6395 #endif6396 4743 TComTU &rTu 6397 4744 DEBUG_STRING_FN_DECLARE(sDebug) ) … … 6435 4782 Double dSingleCost = MAX_DOUBLE; 6436 4783 UInt uiSingleBits = 0; 6437 #if NH_3D_VSO6438 Dist uiSingleDistComp [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}};6439 Dist uiSingleDist = 0;6440 #else6441 4784 Distortion uiSingleDistComp [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}}; 6442 4785 Distortion uiSingleDist = 0; 6443 #endif6444 4786 TCoeff uiAbsSum [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}}; 6445 4787 UInt uiBestTransformMode [MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/] = {{0,0},{0,0},{0,0}}; … … 6584 4926 TCoeff currAbsSum = 0; 6585 4927 UInt currCompBits = 0; 6586 #if NH_3D_VSO6587 Dist currCompDist = 0;6588 #else6589 4928 Distortion currCompDist = 0; 6590 #endif6591 4929 Double currCompCost = 0; 6592 4930 UInt nonCoeffBits = 0; 6593 #if NH_3D_VSO6594 Dist nonCoeffDist = 0;6595 #else6596 4931 Distortion nonCoeffDist = 0; 6597 #endif6598 4932 Double nonCoeffCost = 0; 6599 4933 … … 6654 4988 m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(compID), 6655 4989 true); 6656 #if NH_3D_VSO6657 // No VSO needed here.6658 assert( !m_pcRdCost->getUseVSO() );6659 #endif6660 4990 nonCoeffDist = m_pcRdCost->getDistPart( channelBitDepth, m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), 6661 4991 m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride( compID ), pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), … … 6664 4994 else 6665 4995 { 6666 #if NH_3D_VSO // M276667 if ( m_pcRdCost->getUseVSO() )6668 {6669 if( m_pcRdCost->getUseEstimatedVSD() )6670 {6671 nonCoeffDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, channelBitDepth, m_pTempPel, tuCompRect.width, pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),6672 pcResi->getStride( compID ), tuCompRect.width, tuCompRect.height, false );6673 }6674 else6675 {6676 nonCoeffDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, channelBitDepth, pcPred->getAddr( compID, uiAbsPartIdx ),6677 pcPred->getStride( compID ), pcOrg->getAddr( compID, uiAbsPartIdx), pcOrg->getStride( compID ),6678 tuCompRect.width, tuCompRect.height, false ); // initialized with zero residual distortion6679 }6680 }6681 else6682 #endif6683 4996 nonCoeffDist = m_pcRdCost->getDistPart( channelBitDepth, m_pTempPel, tuCompRect.width, pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), 6684 4997 pcResi->getStride(compID), tuCompRect.width, tuCompRect.height, compID); // initialized with zero residual distortion … … 6694 5007 6695 5008 nonCoeffBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 6696 #if NH_3D_VSO // M296697 if ( m_pcRdCost->getUseLambdaScaleVSO())6698 {6699 nonCoeffCost = m_pcRdCost->calcRdCostVSO( nonCoeffBits, nonCoeffDist );6700 }6701 else6702 #endif6703 5009 nonCoeffCost = m_pcRdCost->calcRdCost( nonCoeffBits, nonCoeffDist ); 6704 5010 } … … 6740 5046 if (bUseCrossCPrediction) 6741 5047 { 6742 #if NH_3D_VSO6743 assert( !m_pcRdCost->getUseVSO() );6744 #endif6745 5048 TComTrQuant::crossComponentPrediction(TUIterator, 6746 5049 compID, … … 6756 5059 } 6757 5060 6758 #if NH_3D_VSO // M286759 if ( m_pcRdCost->getUseVSO() )6760 {6761 if ( m_pcRdCost->getUseEstimatedVSD() )6762 {6763 currCompDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, channelBitDepth, m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),6764 m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(compID),6765 pcResi->getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ),6766 pcResi->getStride(compID),6767 tuCompRect.width, tuCompRect.height, false);6768 }6769 else6770 {6771 m_cYuvRecTemp.addClipPartLuma( channelBitDepth, &m_pcQTTempTComYuv[uiQTTempAccessLayer], pcPred, uiAbsPartIdx, tuCompRect.width );6772 currCompDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, channelBitDepth,6773 m_cYuvRecTemp.getAddr(compID, uiAbsPartIdx),6774 m_cYuvRecTemp.getStride( compID),6775 pcOrg->getAddr ( compID, uiAbsPartIdx ),6776 pcOrg->getStride( compID ),6777 tuCompRect.width, tuCompRect.height, false );6778 }6779 }6780 else6781 #endif6782 5061 currCompDist = m_pcRdCost->getDistPart( channelBitDepth, m_pcQTTempTComYuv[uiQTTempAccessLayer].getAddrPix( compID, tuCompRect.x0, tuCompRect.y0 ), 6783 5062 m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(compID), … … 6786 5065 tuCompRect.width, tuCompRect.height, compID); 6787 5066 6788 #if NH_3D_VSO // M NEW016789 if ( m_pcRdCost->getUseRenModel() )6790 {6791 currCompCost = m_pcRdCost->calcRdCostVSO(currCompBits, currCompDist);6792 }6793 else6794 #endif6795 5067 currCompCost = m_pcRdCost->calcRdCost(currCompBits, currCompDist); 6796 5068 … … 6954 5226 uiSingleBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 6955 5227 6956 #if NH_3D_VSO6957 if ( m_pcRdCost->getUseRenModel() )6958 {6959 dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDist );6960 }6961 else6962 #endif6963 5228 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist ); 6964 5229 … … 6980 5245 m_pcRDGoOnSbacCoder->load ( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 6981 5246 } 6982 #if NH_3D_VSO6983 Dist uiSubdivDist = 0;6984 #else6985 5247 Distortion uiSubdivDist = 0; 6986 #endif6987 5248 UInt uiSubdivBits = 0; 6988 5249 Double dSubdivCost = 0.0; … … 7021 5282 { 7022 5283 DEBUG_STRING_NEW(childString) 7023 #if NH_3D_VSO7024 xEstimateInterResidualQT( pcResi, pcOrg, pcPred, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist, tuRecurseChild DEBUG_STRING_PASS_INTO(childString));7025 #else7026 5284 xEstimateInterResidualQT( pcResi, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist, tuRecurseChild DEBUG_STRING_PASS_INTO(childString)); 7027 #endif7028 5285 #if DEBUG_STRING 7029 5286 // split the string by component and append to the relevant output (because decoder decodes in channel order, whereas this search searches by TU-order) … … 7076 5333 7077 5334 uiSubdivBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 7078 #if NH_3D_VSO7079 if( m_pcRdCost->getUseLambdaScaleVSO())7080 {7081 dSubdivCost = m_pcRdCost->calcRdCostVSO( uiSubdivBits, uiSubdivDist );7082 }7083 else7084 #endif7085 5335 dSubdivCost = m_pcRdCost->calcRdCost( uiSubdivBits, uiSubdivDist ); 7086 5336 … … 7331 5581 // Reload only contexts required for coding intra mode information 7332 5582 m_pcRDGoOnSbacCoder->loadIntraDirMode( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST], chType ); 7333 #if NH_3D_DMM7334 if( pcCU->getSlice()->getIsDepth() && isLuma(chType) )7335 {7336 m_pcRDGoOnSbacCoder->loadIntraDepthDmm( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );7337 }7338 #endif7339 5583 7340 5584 // Temporarily set the intra dir being tested, and only … … 7414 5658 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 7415 5659 m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, true); 7416 #if NH_3D_ARP7417 m_pcEntropyCoder->encodeARPW( pcCU, 0 );7418 #endif7419 #if NH_3D_IC7420 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );7421 #endif7422 5660 ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits(); 7423 5661 } … … 7432 5670 7433 5671 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true ); 7434 #if NH_3D_DIS7435 m_pcEntropyCoder->encodeDIS ( pcCU, 0, true );7436 #endif7437 5672 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 7438 5673 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 7439 5674 m_pcEntropyCoder->encodePredInfo( pcCU, 0 ); 7440 #if NH_3D_SDC_INTRA7441 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );7442 #endif7443 #if NH_3D_ARP7444 m_pcEntropyCoder->encodeARPW( pcCU , 0 );7445 #endif7446 #if NH_3D_IC7447 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );7448 #endif7449 #if NH_3D_DBBP7450 m_pcEntropyCoder->encodeDBBPFlag( pcCU, 0, true );7451 #endif7452 5675 7453 5676 Bool codeDeltaQp = false; … … 7718 5941 } 7719 5942 7720 #if NH_3D_DMM7721 // -------------------------------------------------------------------------------------------------------------------7722 // Depth intra search7723 // -------------------------------------------------------------------------------------------------------------------7724 Void TEncSearch::xCalcBiSegDCs( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2, Pel defaultVal, Bool subSamp )7725 {7726 valDC1 = defaultVal;7727 valDC2 = defaultVal;7728 7729 UInt uiDC1 = 0;7730 UInt uiDC2 = 0;7731 UInt uiNumPixDC1 = 0, uiNumPixDC2 = 0;7732 7733 Int subSamplePix = subSamp ? 2 : 1;7734 7735 Pel* piTemp = ptrSrc;7736 for( UInt uiY = 0; uiY < patternStride; uiY += subSamplePix )7737 {7738 for( UInt uiX = 0; uiX < patternStride; uiX += subSamplePix )7739 {7740 if( true == biSegPattern[uiX] )7741 {7742 uiDC2 += piTemp[uiX];7743 uiNumPixDC2++;7744 }7745 else7746 {7747 uiDC1 += piTemp[uiX];7748 uiNumPixDC1++;7749 }7750 }7751 piTemp += subSamplePix*srcStride;7752 biSegPattern += subSamplePix*patternStride;7753 }7754 7755 if( uiNumPixDC1 > 0 ) { valDC1 = uiDC1 / uiNumPixDC1; }7756 if( uiNumPixDC2 > 0 ) { valDC2 = uiDC2 / uiNumPixDC2; }7757 }7758 7759 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 )7760 {7761 assert( biSegPattern );7762 Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);7763 7764 Pel origDC1 = 0; Pel origDC2 = 0;7765 xCalcBiSegDCs ( piOrig, uiStride, biSegPattern, patternStride, origDC1, origDC2, (1<<(bitDepthY-1)) );7766 assignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, origDC1, origDC2 );7767 7768 Pel predDC1 = 0; Pel predDC2 = 0;7769 predBiSegDCs( pcCU, uiAbsPtIdx, uiWidth, uiHeight, biSegPattern, patternStride, predDC1, predDC2 );7770 7771 rDeltaDC1 = origDC1 - predDC1;7772 rDeltaDC2 = origDC2 - predDC2;7773 7774 #if NH_3D_VSO7775 if( m_pcRdCost->getUseVSO() )7776 {7777 Pel fullDeltaDC1 = rDeltaDC1;7778 Pel fullDeltaDC2 = rDeltaDC2;7779 7780 Dist uiBestDist = RDO_DIST_MAX;7781 UInt uiBestQStepDC1 = 0;7782 UInt uiBestQStepDC2 = 0;7783 7784 UInt uiDeltaDC1Max = abs(fullDeltaDC1);7785 UInt uiDeltaDC2Max = abs(fullDeltaDC2);7786 7787 //VSO Level delta DC check range extension7788 uiDeltaDC1Max += (uiDeltaDC1Max>>1);7789 uiDeltaDC2Max += (uiDeltaDC2Max>>1);7790 7791 // limit search range to [0, IBDI_MAX]7792 if( fullDeltaDC1 < 0 && uiDeltaDC1Max > abs(predDC1) ) { uiDeltaDC1Max = abs(predDC1); }7793 if( fullDeltaDC1 >= 0 && uiDeltaDC1Max > ((1<<bitDepthY)-1) - abs(predDC1) ) { uiDeltaDC1Max = ((1<<bitDepthY)-1) - abs(predDC1); }7794 7795 if( fullDeltaDC2 < 0 && uiDeltaDC2Max > abs(predDC2) ) { uiDeltaDC2Max = abs(predDC2); }7796 if( fullDeltaDC2 >= 0 && uiDeltaDC2Max > ((1<<bitDepthY)-1) - abs(predDC2) ) { uiDeltaDC2Max = ((1<<bitDepthY)-1) - abs(predDC2); }7797 7798 // init dist with original segment DCs7799 assignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, origDC1, origDC2 );7800 7801 Dist uiOrgDist = RDO_DIST_MAX;7802 if( m_pcRdCost->getUseEstimatedVSD() )7803 {7804 uiOrgDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, bitDepthY, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7805 }7806 else7807 {7808 uiOrgDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, bitDepthY, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7809 }7810 7811 uiBestDist = uiOrgDist;7812 uiBestQStepDC1 = abs(fullDeltaDC1);7813 uiBestQStepDC2 = abs(fullDeltaDC2);7814 7815 // coarse search with step size 47816 for( UInt uiQStepDC1 = 0; uiQStepDC1 < uiDeltaDC1Max; uiQStepDC1 += 4 )7817 {7818 Pel testDC1 = ClipBD( predDC1 + ((Int)(uiQStepDC1) * (( fullDeltaDC1 < 0 ) ? -1 : 1)), bitDepthY );7819 for( UInt uiQStepDC2 = 0; uiQStepDC2 < uiDeltaDC2Max; uiQStepDC2 += 4 )7820 {7821 Pel testDC2 = ClipBD( predDC2 + ((Int)(uiQStepDC2) * (( fullDeltaDC2 < 0 ) ? -1 : 1)), bitDepthY );7822 assignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, testDC1, testDC2 );7823 7824 Dist uiAct4Dist = RDO_DIST_MAX;7825 if( m_pcRdCost->getUseEstimatedVSD() )7826 {7827 uiAct4Dist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, bitDepthY, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7828 }7829 else7830 {7831 uiAct4Dist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, bitDepthY, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7832 }7833 7834 if( uiAct4Dist < uiBestDist || uiBestDist == RDO_DIST_MAX )7835 {7836 uiBestDist = uiAct4Dist;7837 uiBestQStepDC1 = uiQStepDC1;7838 uiBestQStepDC2 = uiQStepDC2;7839 }7840 }7841 }7842 7843 // refinement +-37844 for( UInt uiQStepDC1 = (UInt)max(0, ((Int)uiBestQStepDC1-3)); uiQStepDC1 <= (uiBestQStepDC1+3); uiQStepDC1++ )7845 {7846 Pel testDC1 = ClipBD( predDC1 + ((Int)(uiQStepDC1) * (( fullDeltaDC1 < 0 ) ? -1 : 1)), bitDepthY );7847 for( UInt uiQStepDC2 = (UInt)max(0, ((Int)uiBestQStepDC2-3)); uiQStepDC2 <= (uiBestQStepDC2+3); uiQStepDC2++ )7848 {7849 Pel testDC2 = ClipBD( predDC2 + ((Int)(uiQStepDC2) * (( fullDeltaDC2 < 0 ) ? -1 : 1)), bitDepthY );7850 assignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, testDC1, testDC2 );7851 7852 Dist uiActDist = RDO_DIST_MAX;7853 if( m_pcRdCost->getUseEstimatedVSD() )7854 {7855 uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, bitDepthY, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7856 }7857 else7858 {7859 uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, bitDepthY, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );7860 }7861 7862 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )7863 {7864 uiBestDist = uiActDist;7865 uiBestQStepDC1 = uiQStepDC1;7866 uiBestQStepDC2 = uiQStepDC2;7867 }7868 }7869 }7870 rDeltaDC1 = (Int)(uiBestQStepDC1) * (Int)(( fullDeltaDC1 < 0 ) ? -1 : 1);7871 rDeltaDC2 = (Int)(uiBestQStepDC2) * (Int)(( fullDeltaDC2 < 0 ) ? -1 : 1);7872 }7873 #endif7874 7875 #if NH_3D_DLT7876 rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC1 + rDeltaDC1, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );7877 rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC2 + rDeltaDC2, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );7878 #endif7879 }7880 7881 Void TEncSearch::xSearchDmm1Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx )7882 {7883 ruiTabIdx = 0;7884 Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);7885 7886 // local pred buffer7887 TComYuv cPredYuv;7888 cPredYuv.create( uiWidth, uiHeight, CHROMA_400 );7889 cPredYuv.clear();7890 7891 UInt uiPredStride = cPredYuv.getStride( COMPONENT_Y );7892 Pel* piPred = cPredYuv.getAddr( COMPONENT_Y );7893 7894 Pel refDC1 = 0; Pel refDC2 = 0;7895 7896 WedgeList* pacWedgeList = getWedgeListScaled ( uiWidth );7897 WedgeNodeList* pacWedgeNodeList = getWedgeNodeListScaled( uiWidth );7898 7899 // coarse wedge search7900 Dist uiBestDist = RDO_DIST_MAX;7901 UInt uiBestNodeId = 0;7902 for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ )7903 {7904 TComWedgelet* pcWedgelet = &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx()));7905 Bool *pbPattern = pcWedgelet->getPatternScaled(uiWidth);7906 UInt uiStride = uiWidth;7907 xCalcBiSegDCs ( piRef, uiRefStride, pbPattern, uiStride, refDC1, refDC2, (1<<(bitDepthY-1)) );7908 assignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );7909 7910 Dist uiActDist = RDO_DIST_MAX;7911 #if NH_3D_VSO7912 if( m_pcRdCost->getUseVSO() )7913 {7914 if( m_pcRdCost->getUseEstimatedVSD() )7915 {7916 uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7917 }7918 else7919 {7920 uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7921 }7922 }7923 else7924 #endif7925 {7926 uiActDist = m_pcRdCost->getDistPart( bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, COMPONENT_Y, DF_SAD );7927 }7928 7929 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )7930 {7931 uiBestDist = uiActDist;7932 uiBestNodeId = uiNodeId;7933 }7934 }7935 7936 // refinement7937 Dist uiBestDistRef = uiBestDist;7938 UInt uiBestTabIdxRef = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx();7939 for( UInt uiRefId = 0; uiRefId < DMM_NUM_WEDGE_REFINES; uiRefId++ )7940 {7941 if( pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ) != DMM_NO_WEDGE_IDX )7942 {7943 TComWedgelet* pcWedgelet = &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId )));7944 Bool *pbPattern = pcWedgelet->getPatternScaled(uiWidth);7945 UInt uiStride = uiWidth;7946 xCalcBiSegDCs ( piRef, uiRefStride, pbPattern, uiStride, refDC1, refDC2, (1<<(bitDepthY-1)) );7947 assignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );7948 Dist uiActDist = RDO_DIST_MAX;7949 #if NH_3D_VSO7950 if( m_pcRdCost->getUseVSO() )7951 {7952 if( m_pcRdCost->getUseEstimatedVSD() )7953 {7954 uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7955 }7956 else7957 {7958 uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );7959 }7960 }7961 else7962 #endif7963 {7964 uiActDist = m_pcRdCost->getDistPart( bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, COMPONENT_Y, DF_SAD );7965 }7966 7967 if( uiActDist < uiBestDistRef || uiBestDistRef == RDO_DIST_MAX )7968 {7969 uiBestDistRef = uiActDist;7970 uiBestTabIdxRef = pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId );7971 }7972 }7973 }7974 7975 ruiTabIdx = uiBestTabIdxRef;7976 7977 cPredYuv.destroy();7978 return;7979 }7980 7981 #endif7982 #if NH_3D_SDC_INTRA7983 Void TEncSearch::xCalcConstantSDC( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& valDC )7984 {7985 valDC = 0;7986 UInt uiDC = 0;7987 UInt uiNumPixDC = 0;7988 7989 Int subSamplePix = ( uiSize > 16 ) ? 2 : 1;7990 7991 Pel* piTemp = ptrSrc;7992 for( UInt uiY = 0; uiY < uiSize; uiY += subSamplePix )7993 {7994 for( UInt uiX = 0; uiX < uiSize; uiX += subSamplePix )7995 {7996 uiDC += piTemp[uiX];7997 uiNumPixDC++;7998 }7999 piTemp += subSamplePix*srcStride;8000 }8001 8002 if( uiNumPixDC > 0 ) { valDC = uiDC / uiNumPixDC; }8003 }8004 #endif8005 5943 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncSearch.h
r1386 r1390 113 113 Pel* m_pTempPel; 114 114 115 #if NH_3D_VSO // M17116 TComYuv m_cYuvRecTemp;117 #endif118 115 // AMVP cost computation 119 116 // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; … … 178 175 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE] 179 176 DEBUG_STRING_FN_DECLARE(sDebug) 180 #if NH_3D_ENC_DEPTH181 , Bool bOnlyIVP182 #endif183 177 ); 184 178 … … 190 184 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE] 191 185 DEBUG_STRING_FN_DECLARE(sDebug)); 192 #if NH_3D_DIS193 Void estIntraPredDIS ( TComDataCU* pcCU,194 TComYuv* pcOrgYuv,195 TComYuv* pcPredYuv,196 TComYuv* pcResiYuv,197 TComYuv* pcRecoYuv,198 UInt& ruiDistC,199 Bool bLumaOnly );200 #endif201 186 202 187 /// encoder estimation - inter prediction (non-skip) … … 207 192 TComYuv* pcRecoYuv 208 193 DEBUG_STRING_FN_DECLARE(sDebug), 209 #if NH_3D_FAST_TEXTURE_ENCODING210 Bool bFMD,211 #endif212 194 Bool bUseRes = false 213 195 #if AMP_MRG … … 225 207 Bool bSkipResidual 226 208 DEBUG_STRING_FN_DECLARE(sDebug) ); 227 #if NH_3D_SDC_INTER228 Void encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU,229 TComYuv* pcOrg,230 TComYuv* pcPred,231 TComYuv* pcResi,232 TComYuv* pcRec,233 Int uiOffset,234 const UInt uiDepth );235 #endif236 209 237 210 /// set ME search range … … 272 245 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 273 246 const Bool checkCrossCPrediction, 274 #if NH_3D_VSO275 Dist& ruiDist,276 #else277 247 Distortion& ruiDist, 278 #endif279 248 const ComponentID compID, 280 249 TComTU &rTu 281 250 DEBUG_STRING_FN_DECLARE(sTest) 282 251 ,Int default0Save1Load2 = 0 283 #if NH_3D_ENC_DEPTH284 , Bool zeroResiFlag = false285 #endif286 252 ); 287 253 … … 290 256 TComYuv* pcResiYuv, 291 257 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 292 #if NH_3D_VSO293 Dist& ruiDistY,294 #else295 258 Distortion& ruiDistY, 296 #endif297 259 #if HHI_RQT_INTRA_SPEEDUP 298 260 Bool bCheckFirst, … … 301 263 TComTU &rTu 302 264 DEBUG_STRING_FN_DECLARE(sDebug) 303 #if NH_3D_ENC_DEPTH304 , Bool zeroResiFlag = false305 #endif306 265 ); 307 266 … … 330 289 TComYuv* pcResiYuv, 331 290 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE], 332 #if NH_3D_VSO333 Dist& ruiDist,334 #else335 291 Distortion& ruiDist, 336 #endif337 292 TComTU &rTu 338 293 DEBUG_STRING_FN_DECLARE(sDebug)); … … 342 297 Void xStoreIntraResultQT ( const ComponentID compID, TComTU &rTu); 343 298 Void xLoadIntraResultQT ( const ComponentID compID, TComTU &rTu); 344 #if NH_3D_DIS 345 Void xIntraCodingDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode ); 346 #endif 347 348 #if NH_3D_DMM 349 // ------------------------------------------------------------------------------------------------------------------- 350 // Depth intra search 351 // ------------------------------------------------------------------------------------------------------------------- 352 353 Void xCalcBiSegDCs ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2, Pel defaultVal, Bool subSamp = false ); 354 Void xSearchDmmDeltaDCs ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 ); 355 Void xSearchDmm1Wedge ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx ); 356 #endif 357 #if NH_3D_SDC_INTRA 358 Void xIntraCodingSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi ); 359 Void xCalcConstantSDC ( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& valDC ); 360 #endif 299 361 300 362 301 … … 411 350 UChar* uhInterDirNeighbours, 412 351 Int& numValidMergeCand 413 #if NH_3D_VSP414 , Int* vspFlag415 #endif416 #if NH_3D_SPIVMP417 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP418 #endif419 352 ); 420 353 … … 508 441 509 442 Void xEncodeInterResidualQT( const ComponentID compID, TComTU &rTu ); 510 #if NH_3D_VSO // M26511 Void xEstimateInterResidualQT( TComYuv* pcResi, TComYuv* pcOrg, TComYuv* pcPred, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist, TComTU &rTu DEBUG_STRING_FN_DECLARE(sDebug) );512 #else513 443 Void xEstimateInterResidualQT( TComYuv* pcResi , Double &rdCost, UInt &ruiBits, Distortion &ruiDist, Distortion *puiZeroDist, TComTU &rTu DEBUG_STRING_FN_DECLARE(sDebug) ); 514 #endif515 444 Void xSetInterResidualQTData( TComYuv* pcResi, Bool bSpatial, TComTU &rTu ); 516 445 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncSlice.cpp
r1386 r1390 136 136 m_pdRdPicQp = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); 137 137 m_piRdPicQp = (Int* )xMalloc( Int, m_pcCfg->getDeltaQpRD() * 2 + 1 ); 138 #if KWU_RC_MADPRED_E0227139 if(m_pcCfg->getUseRateCtrl())140 {141 m_pcRateCtrl = pcEncTop->getRateCtrl();142 }143 else144 {145 m_pcRateCtrl = NULL;146 }147 #else148 138 m_pcRateCtrl = pcEncTop->getRateCtrl(); 149 #endif150 139 151 140 } … … 217 206 rpcSlice->setViewId ( pVPS->getViewId ( layerId ) ); 218 207 rpcSlice->setViewIndex ( pVPS->getViewIndex ( layerId ) ); 219 #if NH_3D220 rpcSlice->setIsDepth ( pVPS->getDepthId ( layerId ) != 0 );221 #endif222 208 #endif 223 209 rpcSlice->setSliceBits(0); … … 226 212 rpcSlice->setPicOutputFlag( true ); 227 213 rpcSlice->setPOC( pocCurr ); 228 #if NH_3D_IC229 rpcSlice->setApplyIC( false );230 #endif231 214 // depth computation based on GOP size 232 215 Int depth; … … 460 443 setUpLambda(rpcSlice, dLambda, iQP); 461 444 462 #if NH_3D_VSO463 m_pcRdCost->setUseLambdaScaleVSO ( (m_pcCfg->getUseVSO() || m_pcCfg->getForceLambdaScaleVSO()) && ( m_pcCfg->getIsDepth() | m_pcCfg->getIsAuxDepth() ) );464 m_pcRdCost->setLambdaVSO ( dLambda * m_pcCfg->getLambdaScaleVSO() );465 466 // Should be moved to TEncTop467 468 // SAIT_VSO_EST_A0033469 m_pcRdCost->setDisparityCoeff( m_pcCfg->getDispCoeff() );470 471 // LGE_WVSO_A0119472 if( m_pcCfg->getUseWVSO() && ( m_pcCfg->getIsDepth() || m_pcCfg->getIsAuxDepth() ) )473 {474 m_pcRdCost->setDWeight ( m_pcCfg->getDWeight() );475 m_pcRdCost->setVSOWeight( m_pcCfg->getVSOWeight() );476 m_pcRdCost->setVSDWeight( m_pcCfg->getVSDWeight() );477 }478 479 #endif480 445 481 446 if (m_pcCfg->getFastMEForGenBLowDelayEnabled()) … … 584 549 rpcSlice->setSliceSegmentMode ( m_pcCfg->getSliceSegmentMode() ); 585 550 rpcSlice->setSliceSegmentArgument ( m_pcCfg->getSliceSegmentArgument() ); 586 #if NH_3D_IV_MERGE587 #else588 551 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() ); 589 #endif590 552 } 591 553 … … 699 661 compressSlice ( pcPic, true, m_pcCfg->getFastDeltaQp()); 700 662 701 #if NH_3D_VSO702 Dist64 uiPicDist = m_uiPicDist;703 #else704 663 UInt64 uiPicDist = m_uiPicDist; // Distortion, as calculated by compressSlice. 705 664 // NOTE: This distortion is the chroma-weighted SSE distortion for the slice. … … 710 669 // m_pcGOPEncoder->preLoopFilterPicAll( pcPic, uiPicDist ); 711 670 712 #endif713 671 714 672 // compute RD cost and choose the best 715 #if NH_3D_VSO716 Double dPicRdCost = m_pcRdCost->calcRdCost( (Double)m_uiPicTotalBits, uiPicDist, DF_SSE_FRAME);717 #else718 673 Double dPicRdCost = m_pcRdCost->calcRdCost( (Double)m_uiPicTotalBits, (Double)uiPicDist, DF_SSE_FRAME); 719 #endif720 #if H_3D721 // Above calculation need to be fixed for VSO, including frameLambda value.722 #endif723 674 724 675 if ( dPicRdCost < dPicRdCostBest ) … … 846 797 #endif 847 798 848 #if NH_3D_IC849 if ( m_pcCfg->getViewIndex() && m_pcCfg->getUseIC() &&850 !( ( pcSlice->getSliceType() == P_SLICE && pcSlice->getPPS()->getUseWP() ) || ( pcSlice->getSliceType() == B_SLICE && pcSlice->getPPS()->getWPBiPred() ) )851 )852 {853 pcSlice ->xSetApplyIC(m_pcCfg->getUseICLowLatencyEnc());854 if ( pcSlice->getApplyIC() )855 {856 pcSlice->setIcSkipParseFlag( pcSlice->getPOC() % m_pcCfg->getIntraPeriod() != 0 );857 }858 }859 #endif860 799 861 800 … … 878 817 879 818 // for every CTU in the slice segment (may terminate sooner if there is a byte limit on the slice-segment) 880 #if NH_3D_VSO881 Int iLastPosY = -1;882 #endif883 819 884 820 for( UInt ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr; ++ctuTsAddr ) … … 888 824 TComDataCU* pCtu = pcPic->getCtu( ctuRsAddr ); 889 825 pCtu->initCtu( pcPic, ctuRsAddr ); 890 #if NH_3D_VSO891 if ( m_pcRdCost->getUseRenModel() )892 {893 // updated renderer model if necessary894 Int iCurPosX;895 Int iCurPosY;896 pCtu->getPosInPic(0, iCurPosX, iCurPosY );897 if ( iCurPosY != iLastPosY )898 {899 iLastPosY = iCurPosY;900 TEncTop* pcEncTop = (TEncTop*) m_pcCfg; // Fix this later.901 pcEncTop->setupRenModel( pcSlice->getPOC() , pcSlice->getViewIndex(), pcSlice->getIsDepth() || pcSlice->getVPS()->getAuxId( pcSlice->getLayerId() ) ? 1 : 0, iCurPosY, pcSlice->getSPS()->getMaxCUHeight() );902 }903 }904 #endif905 826 906 827 // update CABAC state … … 952 873 else 953 874 { 954 #if KWU_RC_MADPRED_E0227955 if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth())956 {957 Double zn, zf, focallength, position, camShift;958 Double basePos;959 Bool bInterpolated;960 Int direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId();961 Int disparity;962 963 pcEncTop->getCamParam()->xGetZNearZFar(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), zn, zf);964 pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[0], pcSlice->getPOC(), focallength, basePos, camShift, bInterpolated);965 pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), focallength, position, camShift, bInterpolated);966 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBppforInterView( m_pcRateCtrl->getPicList(), pcCU,967 basePos, position, focallength, zn, zf, (direction > 0 ? 1 : -1), &disparity );968 }969 else970 {971 #endif972 875 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(pcSlice->getSliceType()); 973 876 if ( pcPic->getSlice( 0 )->getSliceType() == I_SLICE) … … 980 883 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() ); 981 884 } 982 #if KWU_RC_MADPRED_E0227983 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp );984 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() );985 #endif986 885 987 886 estQP = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP ); … … 1060 959 if ( m_pcCfg->getUseRateCtrl() ) 1061 960 { 1062 #if KWU_RC_MADPRED_E02271063 UInt SAD = m_pcCuEncoder->getLCUPredictionSAD();1064 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );1065 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );1066 Double MAD = (Double)SAD / (Double)(height * width);1067 MAD = MAD * MAD;1068 ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD;1069 #endif1070 961 1071 962 Int actualQP = g_RCInvalidQPValue; … … 1224 1115 } 1225 1116 1226 #if NH_3D_QTLPC1227 pcPic->setReduceBitsFlag(true);1228 #endif1229 1117 if ( pcSlice->getSPS()->getUseSAO() ) 1230 1118 { … … 1296 1184 } 1297 1185 } 1298 #if NH_3D_QTLPC1299 pcPic->setReduceBitsFlag(false);1300 #endif1301 1186 } // CTU-loop 1302 1187 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncSlice.h
r1386 r1390 89 89 TEncSbac* m_pcRDGoOnSbacCoder; ///< go-on SBAC encoder 90 90 UInt64 m_uiPicTotalBits; ///< total bits for the picture 91 #if NH_3D_VSO92 Dist64 m_uiPicDist; ///< total distortion for the picture93 #else94 91 UInt64 m_uiPicDist; ///< total distortion for the picture 95 #endif96 92 Double m_dPicRdCost; ///< picture-level RD cost 97 93 Double* m_pdRdPicLambda; ///< array of lambda candidates -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncTop.cpp
r1386 r1390 79 79 m_ivPicLists = NULL; 80 80 #endif 81 #if NH_3D_IC82 m_aICEnableCandidate = NULL;83 m_aICEnableNum = NULL;84 #endif85 81 #if NH_MV 86 82 m_cCavlcCoder.setEncTop(this); … … 126 122 if ( m_RCEnableRateControl ) 127 123 { 128 #if KWU_RC_MADPRED_E0227129 m_cRateCtrl.init( m_framesToBeEncoded, m_RCTargetBitrate, m_iFrameRate, m_iGOPSize, m_iSourceWidth, m_iSourceHeight,130 g_uiMaxCUWidth, g_uiMaxCUHeight, m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList, getLayerId() );131 #else132 124 m_cRateCtrl.init( m_framesToBeEncoded, m_RCTargetBitrate, m_iFrameRate, m_iGOPSize, m_iSourceWidth, m_iSourceHeight, 133 125 m_maxCUWidth, m_maxCUHeight, m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList ); 134 #endif135 126 } 136 127 … … 202 193 } 203 194 204 #if KWU_RC_MADPRED_E0227205 Void TEncTop::init(TAppEncTop* pcTAppEncTop, Bool isFieldCoding)206 #else207 195 Void TEncTop::init(Bool isFieldCoding) 208 #endif209 196 { 210 197 // initialize SPS 211 #if H_3D212 // Assuming that all PPS indirectly refer to the same VPS via different SPS213 m_cSPS.setVPS(m_cVPS);214 #endif215 198 xInitSPS(); 216 199 xInitVPS(); … … 234 217 235 218 xInitPPSforTiles(); 236 #if NH_3D_IC237 m_aICEnableCandidate = new Int[ 10 ];238 m_aICEnableNum = new Int[ 10 ];239 240 for(int i=0;i<10;i++)241 {242 m_aICEnableCandidate[i]=0;243 m_aICEnableNum[i]=0;244 }245 #endif246 219 247 220 // initialize processing unit classes … … 250 223 m_cCuEncoder. init( this ); 251 224 252 #if KWU_RC_MADPRED_E0227253 m_pcTAppEncTop = pcTAppEncTop;254 #endif255 225 // initialize transform & quantization class 256 226 m_pcCavlcCoder = getCavlcCoder(); … … 357 327 } 358 328 pcPicCurr->setLayerId( getLayerId()); 359 #if NH_3D360 pcPicCurr->setScaleOffset( m_cameraParameters->getCodedScale(), m_cameraParameters->getCodedOffset() );361 #endif362 329 } 363 330 #endif … … 399 366 Void TEncTop::encode( Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ) 400 367 { 401 #endif402 #if NH_3D403 TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() );404 if( picLastCoded )405 {406 picLastCoded->compressMotion(1);407 }408 368 #endif 409 369 #if NH_MV … … 717 677 m_cSPS.setSpsExtensionPresentFlag ( true ); 718 678 m_cSPS.setSpsMultilayerExtensionFlag ( true ); 719 #if NH_3D720 m_cSPS.setSps3dExtensionFlag ( true );721 #endif722 679 #endif 723 680 … … 728 685 m_cSPS.setMaxCUHeight ( m_maxCUHeight ); 729 686 m_cSPS.setMaxTotalCUDepth ( m_maxTotalCUDepth ); 730 #if NH_3D731 assert( !getIsDepth() || m_chromaFormatIDC == CHROMA_400 );732 #endif733 687 m_cSPS.setChromaFormatIdc( m_chromaFormatIDC); 734 688 m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_log2DiffMaxMinCodingBlockSize); … … 1043 997 #if NH_MV 1044 998 m_cPPS.setLayerId( getLayerId() ); 1045 #if NH_3D1046 // Check if this condition is still correct1047 if( getVPS()->getNumRefListLayers( getLayerId() ) > 0 )1048 #else1049 999 if( getVPS()->getNumDirectRefLayers( getLayerId() ) > 0 ) 1050 #endif1051 1000 { 1052 1001 m_cPPS.setListsModificationPresentFlag( true ); … … 1055 1004 m_cPPS.setSPSId( getLayerIdInVps() ); 1056 1005 m_cPPS.setPpsMultilayerExtensionFlag ( true ); 1057 #if NH_3D 1058 // Might be used for DLT 1059 m_cPPS.setPps3dExtensionFlag ( getIsDepth() ); 1060 #endif 1061 #endif 1062 1063 #if NH_3D_DLT 1064 // create mapping from depth layer indexes to layer ids 1065 Int j=0; 1066 for( Int i=0; i<=getVPS()->getMaxLayersMinus1(); i++ ) 1067 { 1068 Int layerId = getVPS()->getLayerIdInNuh(i); 1069 if( getVPS()->getDepthId(layerId) ) 1070 m_cDLT.setDepthIdxToLayerId(j++, layerId); 1071 } 1072 m_cPPS.setDLT( m_cDLT ); 1073 #endif 1006 #endif 1007 1074 1008 1075 1009 m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred ); … … 1542 1476 #endif 1543 1477 1544 #if NH_3D_VSO1545 Void TEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset, Int maxCuHeight )1546 {1547 TRenModel* rendererModel = m_cRdCost.getRenModel();1548 rendererModel->setupPart( iHorOffset, std::min( maxCuHeight, (Int) ( m_iSourceHeight - iHorOffset ) )) ;1549 1550 Int iEncViewSIdx = m_cameraParameters->getBaseId2SortedId()[ iEncViewIdx ];1551 1552 // setup base views1553 Int iNumOfBV = m_renderModelParameters->getNumOfBaseViewsForView( iEncViewSIdx, iEncContent );1554 1555 for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ )1556 {1557 Int iBaseViewSIdx;1558 Int iVideoDistMode;1559 Int iDepthDistMode;1560 1561 m_renderModelParameters->getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode );1562 1563 AOT( iVideoDistMode < 0 || iVideoDistMode > 2 );1564 1565 Int iBaseViewIdx = m_cameraParameters->getBaseSortedId2Id()[ iBaseViewSIdx ];1566 1567 Int auxId = getVPS()->getAuxId ( getLayerId() );1568 Bool depthFlag = ( getVPS()->getDepthId( getLayerId() ) == 1 );1569 1570 if( auxId == 0 && !depthFlag )1571 {1572 // Defaults for texture layers1573 #if NH_3D1574 depthFlag = true;1575 auxId = 0;1576 #else1577 depthFlag = false;1578 auxId = 2;1579 #endif1580 }1581 1582 TComPicYuv* pcPicYuvVideoRec = m_ivPicLists->getPicYuv( iBaseViewIdx, false , 0 , iPoc, true );1583 TComPicYuv* pcPicYuvDepthRec = m_ivPicLists->getPicYuv( iBaseViewIdx, depthFlag, auxId, iPoc, true );1584 TComPicYuv* pcPicYuvVideoOrg = m_ivPicLists->getPicYuv( iBaseViewIdx, false, 0 , iPoc, false );1585 TComPicYuv* pcPicYuvDepthOrg = m_ivPicLists->getPicYuv( iBaseViewIdx, depthFlag, auxId, iPoc, false );1586 1587 TComPicYuv* pcPicYuvVideoRef = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg : NULL;1588 TComPicYuv* pcPicYuvDepthRef = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg : NULL;1589 1590 TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg : pcPicYuvVideoRec;1591 TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg : pcPicYuvDepthRec;1592 1593 AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) );1594 AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) );1595 AOT( pcPicYuvDepthTest == NULL );1596 AOT( pcPicYuvVideoTest == NULL );1597 1598 rendererModel->setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef );1599 }1600 1601 rendererModel->setErrorMode( iEncViewSIdx, iEncContent, 0 );1602 // setup virtual views1603 Int iNumOfSV = m_renderModelParameters->getNumOfModelsForView( iEncViewSIdx, iEncContent );1604 for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )1605 {1606 Int iOrgRefBaseViewSIdx;1607 Int iLeftBaseViewSIdx;1608 Int iRightBaseViewSIdx;1609 Int iSynthViewRelNum;1610 Int iModelNum;1611 Int iBlendMode;1612 m_renderModelParameters->getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );1613 1614 Int iLeftBaseViewIdx = -1;1615 Int iRightBaseViewIdx = -1;1616 1617 TComPicYuv* pcPicYuvOrgRef = NULL;1618 Int** ppiShiftLUTLeft = NULL;1619 Int** ppiShiftLUTRight = NULL;1620 Int** ppiBaseShiftLUTLeft = NULL;1621 Int** ppiBaseShiftLUTRight = NULL;1622 1623 1624 Int iDistToLeft = -1;1625 1626 Int iSynthViewIdx = m_cameraParameters->synthRelNum2Idx( iSynthViewRelNum );1627 1628 if ( iLeftBaseViewSIdx != -1 )1629 {1630 iLeftBaseViewIdx = m_cameraParameters->getBaseSortedId2Id() [ iLeftBaseViewSIdx ];1631 ppiShiftLUTLeft = m_cameraParameters->getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ];1632 }1633 1634 if ( iRightBaseViewSIdx != -1 )1635 {1636 iRightBaseViewIdx = m_cameraParameters->getBaseSortedId2Id() [iRightBaseViewSIdx ];1637 ppiShiftLUTRight = m_cameraParameters->getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];1638 }1639 1640 if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )1641 {1642 iDistToLeft = m_cameraParameters->getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);1643 ppiBaseShiftLUTLeft = m_cameraParameters->getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ];1644 ppiBaseShiftLUTRight = m_cameraParameters->getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ];1645 1646 }1647 1648 if ( iOrgRefBaseViewSIdx != -1 )1649 {1650 pcPicYuvOrgRef = m_ivPicLists->getPicYuv( m_cameraParameters->getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , false, 0, iPoc, false );1651 AOF ( pcPicYuvOrgRef );1652 }1653 1654 rendererModel->setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );1655 }1656 }1657 #endif1658 1478 1659 1479 //! \} -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibEncoder/TEncTop.h
r1321 r1390 65 65 // ==================================================================================================================== 66 66 67 #if KWU_RC_MADPRED_E022768 class TAppEncTop;69 #endif70 67 /// encoder class 71 68 class TEncTop : public TEncCfg … … 82 79 #if NH_MV 83 80 TComPicLists* m_ivPicLists; ///< access to picture lists of other layers 84 #endif85 #if NH_3D_IC86 Int *m_aICEnableCandidate;87 Int *m_aICEnableNum;88 81 #endif 89 82 // encoder search … … 124 117 TEncRateCtrl m_cRateCtrl; ///< Rate control class 125 118 126 #if KWU_RC_MADPRED_E0227127 TAppEncTop* m_pcTAppEncTop;128 TAppComCamPara* m_cCamParam;129 #endif130 119 #if NH_MV 131 120 TEncAnalyze m_cAnalyzeAll; … … 152 141 Void create (); 153 142 Void destroy (); 154 #if KWU_RC_MADPRED_E0227155 Void init ( TAppEncTop* pcTAppEncTop, Bool isFieldCoding );156 #else157 143 Void init (Bool isFieldCoding); 158 #endif159 144 #if NH_MV 160 145 TComPicLists* getIvPicLists() { return m_ivPicLists; } 161 #endif162 #if NH_3D_IC163 Int* getICEnableCandidate() { return m_aICEnableCandidate; }164 Int* getICEnableNum() { return m_aICEnableNum; }165 146 #endif 166 147 Void deletePicBuffer (); … … 194 175 TEncSbac* getRDGoOnSbacCoder () { return &m_cRDGoOnSbacCoder; } 195 176 TEncRateCtrl* getRateCtrl () { return &m_cRateCtrl; } 196 #if KWU_RC_MADPRED_E0227197 TAppEncTop* getEncTop () { return m_pcTAppEncTop; }198 TAppComCamPara* getCamParam() { return m_cCamParam;}199 Void setCamParam(TAppComCamPara * pCamparam) { m_cCamParam = pCamparam;}200 #endif201 177 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 202 178 Int getReferencePictureSetIdxForSOP(Int POCCurr, Int GOPid ); … … 210 186 TComPic* getPic ( Int poc ); 211 187 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 212 #endif213 #if NH_3D214 Void setSps3dExtension ( TComSps3dExtension sps3dExtension ) { m_cSPS.setSps3dExtension( sps3dExtension ); };215 #endif216 #if NH_3D_IC217 Void setICEnableCandidate ( Int* ICEnableCandidate) { m_aICEnableCandidate = ICEnableCandidate; }218 Void setICEnableNum ( Int* ICEnableNum) { m_aICEnableNum = ICEnableNum; }219 188 #endif 220 189 // ------------------------------------------------------------------------------------------------------------------- … … 250 219 Void printSummary(Bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_cSPS.getBitDepths()); } 251 220 252 #if NH_3D_VSO253 Void setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset, Int maxCuHeight );254 #endif255 221 }; 256 222 -
branches/HTM-16.0-MV-draft-5/source/Lib/TLibRenderer/TRenFilter.cpp
r1386 r1390 36 36 #include "TRenFilter.h" 37 37 #include "TRenInterpFilter.h" 38 #if NH_3D_VSO39 38 40 ///// COMMON /////