- Timestamp:
- 20 Feb 2013, 22:07:43 (13 years ago)
- Location:
- trunk
- Files:
-
- 101 edited
-
CommonTestConditionsCfgs/baseCfg_2view+depth.cfg (modified) (1 diff)
-
CommonTestConditionsCfgs/baseCfg_3view+depth.cfg (modified) (1 diff)
-
source/App/TAppDecoder/TAppDecTop.cpp (modified) (10 diffs)
-
source/App/TAppDecoder/TAppDecTop.h (modified) (2 diffs)
-
source/App/TAppEncoder/TAppEncCfg.cpp (modified) (29 diffs)
-
source/App/TAppEncoder/TAppEncCfg.h (modified) (10 diffs)
-
source/App/TAppEncoder/TAppEncTop.cpp (modified) (48 diffs)
-
source/App/TAppEncoder/TAppEncTop.h (modified) (2 diffs)
-
source/App/TAppRenderer/TAppRendererTop.cpp (modified) (4 diffs)
-
source/Lib/TAppCommon/TAppComCamPara.cpp (modified) (2 diffs)
-
source/Lib/TAppCommon/TAppComCamPara.h (modified) (2 diffs)
-
source/Lib/TLibCommon/CommonDef.h (modified) (8 diffs)
-
source/Lib/TLibCommon/ContextModel.cpp (modified) (3 diffs)
-
source/Lib/TLibCommon/ContextModel.h (modified) (1 diff)
-
source/Lib/TLibCommon/ContextTables.h (modified) (17 diffs)
-
source/Lib/TLibCommon/NAL.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComAdaptiveLoopFilter.cpp (modified) (30 diffs)
-
source/Lib/TLibCommon/TComAdaptiveLoopFilter.h (modified) (14 diffs)
-
source/Lib/TLibCommon/TComBitStream.cpp (modified) (3 diffs)
-
source/Lib/TLibCommon/TComBitStream.h (modified) (3 diffs)
-
source/Lib/TLibCommon/TComDataCU.cpp (modified) (185 diffs)
-
source/Lib/TLibCommon/TComDataCU.h (modified) (24 diffs)
-
source/Lib/TLibCommon/TComDepthMapGenerator.cpp (modified) (22 diffs)
-
source/Lib/TLibCommon/TComDepthMapGenerator.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComLoopFilter.cpp (modified) (14 diffs)
-
source/Lib/TLibCommon/TComLoopFilter.h (modified) (1 diff)
-
source/Lib/TLibCommon/TComMotionInfo.cpp (modified) (2 diffs)
-
source/Lib/TLibCommon/TComMotionInfo.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TComMv.h (modified) (4 diffs)
-
source/Lib/TLibCommon/TComPattern.cpp (modified) (4 diffs)
-
source/Lib/TLibCommon/TComPattern.h (modified) (1 diff)
-
source/Lib/TLibCommon/TComPic.cpp (modified) (11 diffs)
-
source/Lib/TLibCommon/TComPic.h (modified) (8 diffs)
-
source/Lib/TLibCommon/TComPicSym.h (modified) (1 diff)
-
source/Lib/TLibCommon/TComPrediction.cpp (modified) (44 diffs)
-
source/Lib/TLibCommon/TComPrediction.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComRdCost.cpp (modified) (1 diff)
-
source/Lib/TLibCommon/TComRdCost.h (modified) (1 diff)
-
source/Lib/TLibCommon/TComResidualGenerator.cpp (modified) (17 diffs)
-
source/Lib/TLibCommon/TComResidualGenerator.h (modified) (4 diffs)
-
source/Lib/TLibCommon/TComRom.cpp (modified) (26 diffs)
-
source/Lib/TLibCommon/TComRom.h (modified) (8 diffs)
-
source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp (modified) (23 diffs)
-
source/Lib/TLibCommon/TComSampleAdaptiveOffset.h (modified) (5 diffs)
-
source/Lib/TLibCommon/TComSlice.cpp (modified) (45 diffs)
-
source/Lib/TLibCommon/TComSlice.h (modified) (61 diffs)
-
source/Lib/TLibCommon/TComTrQuant.cpp (modified) (77 diffs)
-
source/Lib/TLibCommon/TComTrQuant.h (modified) (7 diffs)
-
source/Lib/TLibCommon/TComWedgelet.cpp (modified) (7 diffs)
-
source/Lib/TLibCommon/TComWedgelet.h (modified) (4 diffs)
-
source/Lib/TLibCommon/TComYuv.cpp (modified) (11 diffs)
-
source/Lib/TLibCommon/TComYuv.h (modified) (2 diffs)
-
source/Lib/TLibCommon/TypeDef.h (modified) (26 diffs)
-
source/Lib/TLibDecoder/NALread.cpp (modified) (4 diffs)
-
source/Lib/TLibDecoder/TDecBinCoder.h (modified) (2 diffs)
-
source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp (modified) (14 diffs)
-
source/Lib/TLibDecoder/TDecBinCoderCABAC.h (modified) (3 diffs)
-
source/Lib/TLibDecoder/TDecCAVLC.cpp (modified) (80 diffs)
-
source/Lib/TLibDecoder/TDecCAVLC.h (modified) (5 diffs)
-
source/Lib/TLibDecoder/TDecCu.cpp (modified) (29 diffs)
-
source/Lib/TLibDecoder/TDecCu.h (modified) (2 diffs)
-
source/Lib/TLibDecoder/TDecEntropy.cpp (modified) (21 diffs)
-
source/Lib/TLibDecoder/TDecEntropy.h (modified) (8 diffs)
-
source/Lib/TLibDecoder/TDecGop.cpp (modified) (18 diffs)
-
source/Lib/TLibDecoder/TDecGop.h (modified) (4 diffs)
-
source/Lib/TLibDecoder/TDecSbac.cpp (modified) (63 diffs)
-
source/Lib/TLibDecoder/TDecSbac.h (modified) (8 diffs)
-
source/Lib/TLibDecoder/TDecSlice.cpp (modified) (13 diffs)
-
source/Lib/TLibDecoder/TDecTop.cpp (modified) (32 diffs)
-
source/Lib/TLibDecoder/TDecTop.h (modified) (8 diffs)
-
source/Lib/TLibEncoder/NALwrite.cpp (modified) (4 diffs)
-
source/Lib/TLibEncoder/NALwrite.h (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.cpp (modified) (54 diffs)
-
source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.h (modified) (16 diffs)
-
source/Lib/TLibEncoder/TEncBinCoder.h (modified) (1 diff)
-
source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp (modified) (5 diffs)
-
source/Lib/TLibEncoder/TEncBinCoderCABAC.h (modified) (1 diff)
-
source/Lib/TLibEncoder/TEncCavlc.cpp (modified) (55 diffs)
-
source/Lib/TLibEncoder/TEncCavlc.h (modified) (8 diffs)
-
source/Lib/TLibEncoder/TEncCfg.h (modified) (28 diffs)
-
source/Lib/TLibEncoder/TEncCu.cpp (modified) (78 diffs)
-
source/Lib/TLibEncoder/TEncCu.h (modified) (4 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.cpp (modified) (44 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.h (modified) (16 diffs)
-
source/Lib/TLibEncoder/TEncGOP.cpp (modified) (53 diffs)
-
source/Lib/TLibEncoder/TEncGOP.h (modified) (1 diff)
-
source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp (modified) (18 diffs)
-
source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h (modified) (2 diffs)
-
source/Lib/TLibEncoder/TEncSbac.cpp (modified) (76 diffs)
-
source/Lib/TLibEncoder/TEncSbac.h (modified) (10 diffs)
-
source/Lib/TLibEncoder/TEncSearch.cpp (modified) (108 diffs)
-
source/Lib/TLibEncoder/TEncSearch.h (modified) (13 diffs)
-
source/Lib/TLibEncoder/TEncSlice.cpp (modified) (44 diffs)
-
source/Lib/TLibEncoder/TEncSlice.h (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncTop.cpp (modified) (27 diffs)
-
source/Lib/TLibEncoder/TEncTop.h (modified) (3 diffs)
-
source/Lib/TLibExtractor/TExtrTop.cpp (modified) (1 diff)
-
source/Lib/TLibRenderer/TRenFilter.cpp (modified) (2 diffs)
-
source/Lib/TLibRenderer/TRenTop.cpp (modified) (4 diffs)
-
source/Lib/TLibVideoIO/TVideoIOYuv.cpp (modified) (4 diffs)
-
source/Lib/TLibVideoIO/TVideoIOYuv.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg
r210 r296 157 157 SignHideFlag : 1 # sign hiding 158 158 SignHideThreshold : 4 # sign hiding threshold 159 IlluCompEnable : 1 # illumination compensation (0: OFF, 1: ON)159 IlluCompEnable : 1 1 # illumination compensation (0: OFF, 1: ON) 160 160 161 161 #============ PCM ================ -
trunk/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg
r210 r296 161 161 SignHideFlag : 1 # sign hiding 162 162 SignHideThreshold : 4 # sign hiding threshold 163 IlluCompEnable : 1 # illumination compensation (0: OFF, 1: ON)163 IlluCompEnable : 1 1 # illumination compensation (0: OFF, 1: ON) 164 164 165 165 #============ PCM ================ -
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r210 r296 96 96 #endif 97 97 98 #if SONY_COLPIC_AVAILABILITY99 m_tDecTop[0]->setViewOrderIdx(0);100 #endif101 98 Int viewDepthId = 0; 102 99 Int previousViewDepthId = 0; … … 111 108 newPicture[i] = false; 112 109 #if FLEX_CODING_ORDER_M23723 113 #if FIX_FCO_COMP_WARNING114 110 m_fcoOrder[i] = ' '; 115 #else116 m_fcoOrder[i]=NULL;117 #endif118 111 #endif 119 112 … … 302 295 if( ( viewDepthId == 0 && (viewDepthId != previousViewDepthId) ) || m_tDecTop.size() == 1 ) 303 296 { 304 #if H HI_INTER_VIEW_RESIDUAL_PRED297 #if H3D_IVRP 305 298 for( Int i = 0; i < m_tDecTop.size(); i++ ) 306 299 { … … 376 369 if(newPicture[viewDepthId]) 377 370 { 378 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER379 371 xWriteOutput( pcListPic[viewDepthId], viewDepthId, nalu.m_temporalId ); 380 #else381 xWriteOutput( pcListPic[viewDepthId], viewDepthId );382 #endif383 372 } 384 373 } … … 447 436 } 448 437 449 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER450 438 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId ) 451 #else452 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId )453 #endif454 439 { 455 440 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); … … 470 455 { 471 456 TComPic* pcPic = *(iterPic); 472 #if PIC_CROPPING473 457 TComSPS *sps = pcPic->getSlice(0)->getSPS(); 474 #endif475 458 476 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER477 459 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getSlice(0)->getSPS()->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[viewDepthId])) 478 #else479 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getSlice(0)->getSPS()->getNumReorderFrames() && pcPic->getPOC() > m_pocLastDisplay[viewDepthId]))480 #endif481 460 { 482 461 // write to file … … 484 463 if ( m_pchReconFile ) 485 464 { 486 #if PIC_CROPPING487 465 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 488 #else489 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );490 #endif491 466 } 492 467 … … 533 508 { 534 509 TComPic* pcPic = *(iterPic); 535 #if PIC_CROPPING536 510 TComSPS *sps = pcPic->getSlice(0)->getSPS(); 537 #endif538 511 539 512 if ( pcPic->getOutputMark() ) … … 542 515 if ( m_pchReconFile ) 543 516 { 544 #if PIC_CROPPING545 517 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 546 #else547 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );548 #endif549 518 } 550 519 … … 764 733 #endif 765 734 } 735 736 #if MERL_VSP_C0152 737 Void TAppDecTop::setBWVSPLUT(TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc) 738 { 739 //first view does not have VSP 740 if((iCodedViewIdx == 0)) return; 741 742 AOT( iCodedViewIdx <= 0); 743 //AOT( iCodedViewIdx >= m_iNumberOfViews ); 744 Int iNeighborViewId = 0; 745 // Int* piShiftLUT = bRenderFromLeft ? m_cCamParsCollector.getBaseViewShiftLUTI()[iCodedViewIdx][iNeighborViewId][0] : m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0]; 746 Int* piShiftLUT = m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0]; 747 pcSlice->setBWVSPLUTParam(piShiftLUT, 2-LOG2_DISP_PREC_LUT ); 748 } 749 #endif 750 766 751 //! \} -
trunk/source/App/TAppDecoder/TAppDecTop.h
r210 r296 112 112 #endif 113 113 114 #if MERL_VSP_C0152 115 Void setBWVSPLUT( TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc ); 116 #endif 117 114 118 protected: 115 119 // Void xCreateDecLib (); ///< create internal classes … … 117 121 // Void xInitDecLib (); ///< initialize decoder class 118 122 119 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER120 123 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId); ///< write YUV to file 121 #else122 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< write YUV to file123 #endif124 124 Void xFlushOutput ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< flush all remaining decoded pictures to file 125 125 -
trunk/source/App/TAppEncoder/TAppEncCfg.cpp
r210 r296 220 220 221 221 /* File, I/O and source parameters */ 222 ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv input file name %d") 223 ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv depth input file name %d") 224 ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv output file name %d") 225 ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv depth output file name %d") 226 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") 227 ("CodeDepthMaps", m_bUsingDepthMaps, false, "Encode depth maps" ) 228 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" ) 229 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0") 230 ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1") 231 ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2") 232 ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3") 233 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") 234 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") 235 #if PIC_CROPPING 236 ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 237 ("CropLeft", m_cropLeft, 0, "Left cropping/padding for cropping mode 3") 238 ("CropRight", m_cropRight, 0, "Right cropping/padding for cropping mode 3") 239 ("CropTop", m_cropTop, 0, "Top cropping/padding for cropping mode 3") 240 ("CropBottom", m_cropBottom, 0, "Bottom cropping/padding for cropping mode 3") 241 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") 242 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") 243 #endif 222 ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv input file name %d") 223 ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv depth input file name %d") 224 ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv output file name %d") 225 ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv depth output file name %d") 226 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") 227 ("CodeDepthMaps", m_bUsingDepthMaps, false, "Encode depth maps" ) 228 ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" ) 229 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0") 230 ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1") 231 ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2") 232 ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3") 233 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") 234 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") 235 ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 236 ("CropLeft", m_cropLeft, 0, "Left cropping/padding for cropping mode 3") 237 ("CropRight", m_cropRight, 0, "Right cropping/padding for cropping mode 3") 238 ("CropTop", m_cropTop, 0, "Top cropping/padding for cropping mode 3") 239 ("CropBottom", m_cropBottom, 0, "Bottom cropping/padding for cropping mode 3") 240 ("HorizontalPadding,-pdx", m_aiPad[0], 0, "horizontal source padding for cropping mode 2") 241 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") 244 242 ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") 245 243 ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") 246 244 ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") 247 245 ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") 248 #if !PIC_CROPPING249 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding size")250 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding size")251 ("PAD", m_bUsePAD, false, "automatic source padding of multiple of 16" )252 #endif253 246 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 254 247 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") 255 248 ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)") 256 ("FrameToBeEncoded", m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded")249 ("FrameToBeEncoded", m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded") 257 250 258 251 ("NumberOfViews", m_iNumberOfViews, 0, "Number of views") … … 279 272 ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CRA 2:IDR)") 280 273 ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") 281 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER282 ("MaxNumberOfReorderPictures", m_numReorderFrames, -1, "Max. number of reorder pictures: -1: encoder determines value, >=0: set explicitly")283 ("MaxNumberOfReferencePictures", m_maxNumberOfReferencePictures, 6, "Max. number of reference pictures")284 #endif285 274 ("ListCombination,-lc", m_bUseLComb, true, "combined reference list flag for uni-prediction in B-slices") 286 275 ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation") … … 321 310 ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], MAX_QP + 1, "QP offset of temporal layer 3") 322 311 323 #if !H0566_TLA324 ("TLayeringBasedOnCodingStruct,-tl", m_bTLayering, false, "Temporal ID is set based on the hierarchical coding structure")325 326 ("TLayerSwitchingFlag_L0,-ts0", m_abTLayerSwitchingFlag[0], false, "Switching flag for temporal layer 0")327 ("TLayerSwitchingFlag_L1,-ts1", m_abTLayerSwitchingFlag[1], false, "Switching flag for temporal layer 1")328 ("TLayerSwitchingFlag_L2,-ts2", m_abTLayerSwitchingFlag[2], false, "Switching flag for temporal layer 2")329 ("TLayerSwitchingFlag_L3,-ts3", m_abTLayerSwitchingFlag[3], false, "Switching flag for temporal layer 3")330 #endif331 312 332 313 /* Entropy coding parameters */ … … 340 321 ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) 341 322 #if LGE_ILLUCOMP_B0045 323 #if LGE_ILLUCOMP_DEPTH_C0046 324 ("IlluCompEnable", m_abUseIC, std::vector<Bool>(2, true), "Enable illumination compensation for inter-view prediction") 325 #else 342 326 ("IlluCompEnable", m_bUseIC , true , "Use illumination compensation for inter-view prediction" ) 343 327 #endif 344 #if DBL_CONTROL 328 #endif 329 #if INTER_VIEW_VECTOR_SCALING_C0115 330 ("IVSEnable", m_bUseIVS , true , "Use inter-view vector scaling" ) 331 #endif 345 332 ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, true) 346 #endif347 333 348 334 /* Camera Paremetes */ … … 391 377 ("PredDepthMapGen", m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" ) 392 378 #endif 393 #if H HI_INTER_VIEW_MOTION_PRED379 #if H3D_IVMP 394 380 ("MultiviewMvPred", m_uiMultiviewMvPredMode, (UInt)0, "usage of predicted depth maps" ) 395 381 ("MultiviewMvRegMode", m_uiMultiviewMvRegMode, (UInt)0, "regularization mode for multiview motion vectors" ) 396 382 ("MultiviewMvRegLambdaScale", m_dMultiviewMvRegLambdaScale, (Double)0, "lambda scale for multiview motion vector regularization" ) 397 383 #endif 398 #if H HI_INTER_VIEW_RESIDUAL_PRED384 #if H3D_IVRP 399 385 ("MultiviewResPred", m_uiMultiviewResPredMode, (UInt)0, "usage of inter-view residual prediction" ) 400 386 #endif … … 405 391 ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF") 406 392 ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO") 407 #if SAO_UNIT_INTERLEAVING408 393 ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "2048: default") 409 394 ("SAOInterleaving", m_saoInterleavingFlag, false, "0: SAO Picture Mode, 1: SAO Interleaving ") 410 #endif411 395 412 396 ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding") 413 397 414 398 ("ALFMaxNumFilter,-ALFMNF", m_iALFMaxNumberFilters, 16, "16: No Constrained, 1-15: Constrained max number of filter") 415 #if LCU_SYNTAX_ALF416 399 ("ALFParamInSlice", m_bALFParamInSlice, false, "ALF parameters in 0: APS, 1: slice header") 417 400 ("ALFPicBasedEncode", m_bALFPicBasedEncode, true, "ALF picture-based encoding 0: false, 1: true") 418 #endif419 401 420 402 ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") … … 439 421 ("TileInfoPresentFlag", m_iColumnRowInfoPresent, 1, "0: tiles parameters are NOT present in the PPS. 1: tiles parameters are present in the PPS") 440 422 ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") 441 #if !REMOVE_TILE_DEPENDENCE442 ("TileBoundaryIndependenceIdc", m_iTileBoundaryIndependenceIdr, 1, "Indicates if the column and row boundaries break the prediction")443 #endif444 423 ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") 445 424 ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") … … 456 435 ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") 457 436 ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") 458 #if MULTIBITS_DATA_HIDING459 437 ("SignHideFlag,-SBH", m_signHideFlag, 1) 460 438 ("SignHideThreshold,-TSIG", m_signHidingThreshold, 4) 461 #endif462 439 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 463 440 ("DMM", m_bUseDMM, false, "depth model modes flag") … … 477 454 ("FEN", m_bUseFastEnc, false, "fast encoder setting") 478 455 ("ECU", m_bUseEarlyCU, false, "Early CU setting") 479 #if FAST_DECISION_FOR_MRG_RD_COST480 456 ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") 481 #endif482 457 ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") 483 458 #if HHI_INTERVIEW_SKIP … … 617 592 } 618 593 619 #if PIC_CROPPING620 594 switch (m_croppingMode) 621 595 { … … 667 641 } 668 642 } 669 #else670 671 // compute source padding size672 if ( m_bUsePAD )673 {674 if ( m_iSourceWidth%MAX_PAD_SIZE )675 {676 m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth;677 }678 679 if ( m_iSourceHeight%MAX_PAD_SIZE )680 {681 m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight;682 }683 }684 m_iSourceWidth += m_aiPad[0];685 m_iSourceHeight += m_aiPad[1];686 #endif687 643 688 644 // allocate slice-based dQP values … … 890 846 xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); 891 847 xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); 892 #if H0736_AVC_STYLE_QP_RANGE893 848 xConfirmPara( m_aiQP[0] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[0] > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); 894 849 if ( m_aiQP.size() >= 2 ) … … 896 851 xConfirmPara( m_aiQP[1] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[1] > 51, "QP depth exceeds supported range (-QpBDOffsety to 51)" ); 897 852 } 898 #else899 xConfirmPara( m_aiQP[0] < 0 || m_aiQP[0] > 51, "QP exceeds supported range (0 to 51)" );900 if ( m_aiQP.size() >= 2 )901 {902 xConfirmPara( m_aiQP[1] < 0 || m_aiQP[1] > 51, "QP Depth exceeds supported range (0 to 51)" );903 }904 #endif905 853 xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2, "ALFEncodePassReduction must be equal to 0, 1 or 2"); 906 #if LCU_SYNTAX_ALF907 854 xConfirmPara( m_iALFMaxNumberFilters < 1, "ALFMaxNumFilter should be larger than 1"); 908 #else909 xConfirmPara( m_iALFMaxNumberFilters < 1 || m_iALFMaxNumberFilters > 16, "ALFMaxNumFilter exceeds supported range (1 to 16)");910 #endif911 855 xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); 912 856 xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)"); … … 934 878 xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); 935 879 xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); 936 #if PIC_CROPPING937 880 xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); 938 881 xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); 939 #else940 xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Frame width should be multiple of minimum CU size");941 xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Frame height should be multiple of minimum CU size");942 #endif943 882 944 883 xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); … … 967 906 xConfirmPara ( m_uiPredDepthMapGeneration >= 2 && !m_bUsingDepthMaps, "PredDepthMapGen >= 2 requires CodeDepthMaps = 1" ); 968 907 #endif 969 #if H HI_INTER_VIEW_MOTION_PRED908 #if H3D_IVMP 970 909 xConfirmPara ( m_uiMultiviewMvPredMode > 7, "MultiviewMvPred must be less than or equal to 7" ); 971 910 xConfirmPara ( m_uiMultiviewMvPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewMvPred > 0 requires PredDepthMapGen > 0" ); … … 977 916 } 978 917 #endif 979 #if H HI_INTER_VIEW_RESIDUAL_PRED918 #if H3D_IVRP 980 919 xConfirmPara ( m_uiMultiviewResPredMode > 1, "MultiviewResPred must be less than or equal to 1" ); 981 920 xConfirmPara ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" ); … … 998 937 } 999 938 #if ADAPTIVE_QP_SELECTION 1000 #if H0736_AVC_STYLE_QP_RANGE1001 939 xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[0] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); 1002 940 xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[1] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); 1003 941 xConfirmPara( m_bUseAdaptQpSelect == true && (m_iChromaQpOffset !=0 || m_iChromaQpOffset2nd != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); 1004 #endif1005 942 #endif 1006 943 … … 1013 950 } 1014 951 1015 #if FIXED_NUMBER_OF_TILES_SLICE_MODE1016 952 xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); 1017 #endif1018 953 if (m_iSliceMode!=0) 1019 954 { 1020 955 xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); 1021 956 } 1022 #if FIXED_NUMBER_OF_TILES_SLICE_MODE1023 957 if (m_iSliceMode==3) 1024 958 { 1025 959 xConfirmPara( m_iSliceGranularity > 0 , "When SliceMode == 3 is chosen, the SliceGranularity must be 0" ); 1026 960 } 1027 #endif1028 961 xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" ); 1029 962 if (m_iEntropySliceMode!=0) … … 1035 968 xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" ); 1036 969 1037 #if NO_COMBINED_PARALLEL1038 970 bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); 1039 971 xConfirmPara( tileFlag && m_iEntropySliceMode, "Tile and Entropy Slice can not be applied together"); 1040 972 xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); 1041 973 xConfirmPara( m_iWaveFrontSynchro && m_iEntropySliceMode, "Wavefront and Entropy Slice can not be applied together"); 1042 #endif1043 974 1044 975 // max CU width and height should be power of 2 … … 1232 1163 for( Int i = 0; i < MAX_GOP; i++ ) { isOK[i] = false; } 1233 1164 Int numOK = 0; 1234 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1235 Int numReorderFramesRequired=0;1236 m_maxNumberOfReferencePictures=0;1237 Int lastDisp = -1;1238 #endif1239 1165 m_extraRPSs[viewId] = 0; 1240 1166 //start looping through frames in coding order until we can verify that the GOP structure is correct. … … 1420 1346 } 1421 1347 } 1422 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1423 if(m_maxNumberOfReferencePictures<numRefs)1424 {1425 m_maxNumberOfReferencePictures=numRefs;1426 }1427 #endif1428 1348 refList[numRefs] = curPOC; 1429 1349 numRefs++; 1430 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1431 Int nonDisplayed=0;1432 for(Int i=0; i<numRefs; i++)1433 {1434 if(refList[i]==lastDisp+1)1435 {1436 lastDisp=refList[i];1437 i=0;1438 }1439 }1440 for(Int i=0; i<numRefs; i++)1441 {1442 if(refList[i]>lastDisp)1443 {1444 nonDisplayed++;1445 }1446 }1447 if(nonDisplayed>numReorderFramesRequired)1448 {1449 numReorderFramesRequired=nonDisplayed;1450 }1451 #endif1452 1350 } 1453 1351 checkGOP++; 1454 1352 } 1455 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1456 if (m_numReorderFrames == -1)1457 {1458 m_numReorderFrames = numReorderFramesRequired;1459 }1460 #endif1461 1353 xConfirmPara( errorGOP, "Invalid GOP structure given" ); 1462 #if H0566_TLA1463 1354 m_maxTempLayer[viewId] = 1; 1464 #endif1465 1355 for( Int i = 0; i < m_iGOPSize; i++ ) 1466 1356 { 1467 #if H0566_TLA1468 1357 if( m_GOPListsMvc[viewId][i].m_temporalId >= m_maxTempLayer[viewId] ) 1469 1358 { 1470 1359 m_maxTempLayer[viewId] = m_GOPListsMvc[viewId][i].m_temporalId + 1; 1471 1360 } 1472 #endif1473 1361 xConfirmPara( m_GOPListsMvc[viewId][i].m_sliceType != 'B' && m_GOPListsMvc[viewId][i].m_sliceType != 'P', "Slice type must be equal to B or P" ); 1474 1362 } 1475 1363 1476 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1477 1364 for( Int i = 0; i < MAX_TLAYER; i++ ) 1478 1365 { … … 1531 1418 m_maxDecPicBuffering[viewId][MAX_TLAYER-1] = m_numReorderPics[viewId][MAX_TLAYER-1]; 1532 1419 } 1533 #endif 1534 1535 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1420 1536 1421 xConfirmPara( m_bUseLComb == false && m_numReorderPics[viewId][MAX_TLAYER-1] != 0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. 1537 #else1538 xConfirmPara( m_bUseLComb==false && m_numReorderFrames!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.1539 xConfirmPara( m_numReorderFrames < numReorderFramesRequired, "For the used GOP the encoder requires more pictures for reordering than specified in MaxNumberOfReorderPictures" );1540 #endif1541 1422 } 1542 1423 } … … 1648 1529 } 1649 1530 } 1650 #if PIC_CROPPING1651 1531 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate ); 1652 #else1653 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate );1654 #endif1655 1532 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 1656 1533 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded ); … … 1720 1597 1721 1598 printf("TOOL CFG General: "); 1722 #if LCU_SYNTAX_ALF1723 1599 printf("ALFMNF:%d ", m_iALFMaxNumberFilters); 1724 1600 printf("ALFInSlice:%d ", m_bALFParamInSlice); 1725 1601 printf("ALFPicEnc:%d ", m_bALFPicBasedEncode); 1726 #endif1727 1602 printf("IBD:%d ", !!g_uiBitIncrement); 1728 1603 printf("HAD:%d ", m_bUseHADME ); … … 1730 1605 printf("SQP:%d ", m_uiDeltaQpRD ); 1731 1606 printf("ASR:%d ", m_bUseASR ); 1732 #if !PIC_CROPPING1733 printf("PAD:%d ", m_bUsePAD );1734 #endif1735 1607 printf("LComb:%d ", m_bUseLComb ); 1736 1608 printf("LCMod:%d ", m_bLCMod ); 1737 1609 printf("FEN:%d ", m_bUseFastEnc ); 1738 1610 printf("ECU:%d ", m_bUseEarlyCU ); 1739 #if FAST_DECISION_FOR_MRG_RD_COST1740 1611 printf("FDM:%d ", m_useFastDecisionForMerge ); 1741 #endif1742 1612 printf("CFM:%d ", m_bUseCbfFastMode ); 1743 1613 printf("RQT:%d ", 1 ); … … 1754 1624 } 1755 1625 printf("CIP:%d ", m_bUseConstrainedIntraPred); 1756 #if BURST_IPCM1757 1626 printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); 1758 #else1759 printf("PCM:%d ", ((1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);1760 #endif1761 #if SAO_UNIT_INTERLEAVING1762 1627 printf("SAOInterleaving:%d ", (m_saoInterleavingFlag)?(1):(0)); 1763 #endif1764 1628 #if LOSSLESS_CODING 1765 1629 printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); … … 1767 1631 printf("WPP:%d ", (Int)m_bUseWeightPred); 1768 1632 printf("WPB:%d ", m_uiBiPredIdc); 1769 #if !REMOVE_TILE_DEPENDENCE1770 printf("TileBoundaryIndependence:%d ", m_iTileBoundaryIndependenceIdr );1771 #endif1772 1633 printf("TileLocationInSliceHdr:%d ", m_iTileLocationInSliceHeaderFlag); 1773 1634 printf("TileMarker:%d", m_iTileMarkerFlag); … … 1792 1653 #endif 1793 1654 1794 #if MULTIBITS_DATA_HIDING1795 1655 printf(" SignBitHidingFlag:%d SignBitHidingThreshold:%d", m_signHideFlag, m_signHidingThreshold); 1796 #endif1797 1656 printf("\n"); 1798 1657 printf("TOOL CFG VIDEO : "); … … 1804 1663 #endif 1805 1664 #if LGE_ILLUCOMP_B0045 1665 #if LGE_ILLUCOMP_DEPTH_C0046 1666 printf("IlluCompEnable: %d %d", m_abUseIC[0] ? 1 : 0, m_abUseIC[1] ? 1 : 0); 1667 #else 1806 1668 printf("IlluCompEnable: %d ", m_bUseIC); 1807 1669 #endif 1808 1670 #endif 1671 #if INTER_VIEW_VECTOR_SCALING_C0115 1672 printf("IVSEnable: %d ", m_bUseIVS); 1673 #endif 1809 1674 printf("\n"); 1810 1675 -
trunk/source/App/TAppEncoder/TAppEncCfg.h
r210 r296 73 73 Int m_iSourceWidth; ///< source width in pixel 74 74 Int m_iSourceHeight; ///< source height in pixel 75 #if PIC_CROPPING76 75 Int m_croppingMode; 77 76 Int m_cropLeft; … … 79 78 Int m_cropTop; 80 79 Int m_cropBottom; 81 #endif82 80 Int m_iFrameToBeEncoded; ///< number of encoded frames 83 #if !PIC_CROPPING84 Bool m_bUsePAD; ///< flag for using source padding85 #endif86 81 Int m_aiPad[2]; ///< number of padded pixels for width and height 87 82 … … 100 95 Int m_extraRPSs[MAX_VIEW_NUM]; 101 96 GOPEntryMvc m_GOPListsMvc[MAX_VIEW_NUM][MAX_GOP+1]; 102 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER103 97 Int m_numReorderPics[MAX_VIEW_NUM][MAX_TLAYER]; ///< total number of reorder pictures 104 98 Int m_maxDecPicBuffering[MAX_VIEW_NUM][MAX_TLAYER]; ///< total number of reference pictures needed for decoding 105 #else106 Int m_numReorderFrames; ///< total number of reorder pictures107 Int m_maxNumberOfReferencePictures; ///< total number of reference pictures needed for decoding108 #endif109 99 Bool m_bUseLComb; ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421) 110 100 Bool m_bLCMod; ///< flag for specifying whether the combined reference list for uni-prediction in B-slices is uploaded explicitly … … 136 126 Int m_iQPAdaptationRange; ///< dQP range by QP adaptation 137 127 138 #if H0566_TLA139 128 Int m_maxTempLayer[MAX_VIEW_NUM]; ///< Max temporal layer 140 #else141 Bool m_bTLayering; ///< indicates whether temporal IDs are set based on the hierarchical coding structure142 Bool m_abTLayerSwitchingFlag[MAX_TLAYER]; ///< temporal layer switching flags corresponding to each temporal layer143 #endif144 129 145 130 // coding unit (CU) definition … … 170 155 vector<Bool> m_abUseSAO; 171 156 #if LGE_ILLUCOMP_B0045 157 #if LGE_ILLUCOMP_DEPTH_C0046 158 vector<Bool> m_abUseIC; ///< flag for using illumination compensation for inter-view prediction 159 #else 172 160 Bool m_bUseIC; ///< flag for using illumination compensation for inter-view prediction 173 161 #endif 174 #if SAO_UNIT_INTERLEAVING 162 #endif 163 #if INTER_VIEW_VECTOR_SCALING_C0115 164 Bool m_bUseIVS; ///< flag for using inter-view vector scaling 165 #endif 175 166 Int m_maxNumOffsetsPerPic; ///< SAO maximun number of offset per picture 176 167 Bool m_saoInterleavingFlag; ///< SAO interleaving flag 177 #endif178 168 // coding tools (loop filter) 179 169 vector<Bool> m_abUseALF; ///< flag for using adaptive loop filter [0] - video, [1] - depth … … 181 171 182 172 Int m_iALFMaxNumberFilters; ///< ALF Max Number Filters in one picture 183 #if LCU_SYNTAX_ALF184 173 Bool m_bALFParamInSlice; 185 174 Bool m_bALFPicBasedEncode; 186 #endif187 175 188 176 vector<Bool> m_abLoopFilterDisable; ///< flag for using deblocking filter filter [0] - video, [1] - depth … … 190 178 Int m_loopFilterBetaOffsetDiv2; ///< beta offset for deblocking filter 191 179 Int m_loopFilterTcOffsetDiv2; ///< tc offset for deblocking filter 192 #if DBL_CONTROL193 180 Bool m_DeblockingFilterControlPresent; ///< deblocking filter control present flag in PPS 194 #endif195 181 196 182 Bool m_bUseLMChroma; ///< JL: Chroma intra prediction based on luma signal … … 226 212 UInt m_uiPredDepthMapGeneration; ///< using of (virtual) depth maps for texture coding 227 213 #endif 228 #if H HI_INTER_VIEW_MOTION_PRED214 #if H3D_IVMP 229 215 UInt m_uiMultiviewMvPredMode; ///< usage of predictors for multi-view mv prediction 230 216 UInt m_uiMultiviewMvRegMode; ///< regularization for multiview motion vectors 231 217 Double m_dMultiviewMvRegLambdaScale; ///< lambda scale for multiview motion vectors regularization 232 218 #endif 233 #if H HI_INTER_VIEW_RESIDUAL_PRED219 #if H3D_IVRP 234 220 UInt m_uiMultiviewResPredMode; ///< using multiview residual prediction 235 221 #endif 236 222 237 #if FAST_DECISION_FOR_MRG_RD_COST238 223 Bool m_useFastDecisionForMerge; ///< flag for using Fast Decision Merge RD-Cost 239 #endif240 224 Bool m_bUseCbfFastMode; ///< flag for using Cbf Fast PU Mode Decision 241 225 Int m_iSliceMode; ///< 0: Disable all Recon slice limits, 1 : Maximum number of largest coding units per slice, 2: Maximum number of bytes in a slice … … 250 234 Int m_iColumnRowInfoPresent; 251 235 Int m_iUniformSpacingIdr; 252 #if !REMOVE_TILE_DEPENDENCE253 Int m_iTileBoundaryIndependenceIdr;254 #endif255 236 Int m_iNumColumnsMinus1; 256 237 char* m_pchColumnWidth; … … 280 261 #endif 281 262 282 #if MULTIBITS_DATA_HIDING283 263 Int m_signHideFlag; 284 264 Int m_signHidingThreshold; 285 #endif286 265 #if HHI_MPI 287 266 Bool m_bUseMVI; ///< flag for using Motion Vector Inheritance for depth map coding -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r210 r296 97 97 m_acTEncTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); 98 98 m_acTEncTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); 99 #if PIC_CROPPING100 99 m_acTEncTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); 101 100 m_acTEncTopList[iViewIdx]->setCropLeft ( m_cropLeft ); … … 103 102 m_acTEncTopList[iViewIdx]->setCropTop ( m_cropTop ); 104 103 m_acTEncTopList[iViewIdx]->setCropBottom ( m_cropBottom ); 105 #endif106 104 m_acTEncTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); 107 105 m_acTEncTopList[iViewIdx]->setViewId ( iViewIdx ); … … 121 119 m_cVPS.setDependentFlag ( iViewIdx ? true:false, layerId ); 122 120 m_cVPS.setDependentLayer ( layerId - (m_bUsingDepthMaps ? 2:1), layerId ); 121 #if INTER_VIEW_VECTOR_SCALING_C0115 122 m_cVPS.setIVScalingFlag ( m_bUseIVS ); 123 #endif 123 124 #endif 124 125 … … 135 136 m_acTEncTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); 136 137 m_acTEncTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); 137 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER138 138 for(Int i = 0; i < MAX_TLAYER; i++) 139 139 { … … 141 141 m_acTEncTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); 142 142 } 143 #else144 m_acTEncTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames );145 m_acTEncTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures );146 #endif147 143 for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) 148 144 { … … 154 150 m_acTEncTopList[iViewIdx]->setPad ( m_aiPad ); 155 151 156 #if H0566_TLA157 152 m_acTEncTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); 158 #else159 m_acTEncTopList[iViewIdx]->setTLayering ( m_bTLayering );160 m_acTEncTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag );161 #endif162 153 163 154 m_acTEncTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); … … 173 164 m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); 174 165 m_acTEncTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 175 #if DBL_CONTROL176 166 m_acTEncTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 177 #endif178 167 179 168 //====== Motion search ======== … … 198 187 #if LOSSLESS_CODING 199 188 Int lowestQP; 200 #if H0736_AVC_STYLE_QP_RANGE201 189 lowestQP = - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) ); 202 #else203 lowestQP = 0;204 #endif205 190 if ((m_iMaxDeltaQP == 0 ) && (m_aiQP[0] == lowestQP) && (m_useLossless == true)) 206 191 { … … 232 217 m_acTEncTopList[iViewIdx]->setPdmOffset ( m_cCameraData.getPdmOffset () ); 233 218 #endif 234 #if H HI_INTER_VIEW_MOTION_PRED219 #if H3D_IVMP 235 220 m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode ( m_uiMultiviewMvPredMode ); 236 221 m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode ( iViewIdx ? m_uiMultiviewMvRegMode : 0 ); 237 222 m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 ); 238 223 #endif 239 #if H HI_INTER_VIEW_RESIDUAL_PRED224 #if H3D_IVRP 240 225 m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); 241 226 #endif … … 257 242 m_acTEncTopList[iViewIdx]->setdQPs ( m_aidQP ); 258 243 m_acTEncTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[0] ); 259 #if !PIC_CROPPING260 m_acTEncTopList[iViewIdx]->setUsePAD ( m_bUsePAD );261 #endif262 244 m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 263 245 m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 266 248 m_acTEncTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); 267 249 m_acTEncTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); 268 #if FAST_DECISION_FOR_MRG_RD_COST269 250 m_acTEncTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 270 #endif271 251 m_acTEncTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); 272 252 #if HHI_INTERVIEW_SKIP … … 301 281 m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 302 282 } 303 #if FIXED_NUMBER_OF_TILES_SLICE_MODE304 283 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) 305 284 { 306 285 m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 307 286 } 308 #endif309 287 m_acTEncTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); 310 288 if(m_iSliceMode == 0 ) … … 315 293 m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); 316 294 #if LGE_ILLUCOMP_B0045 295 #if LGE_ILLUCOMP_DEPTH_C0046 296 m_acTEncTopList[iViewIdx]->setUseIC ( m_abUseIC[0] ); 297 #else 317 298 m_acTEncTopList[iViewIdx]->setUseIC ( m_bUseIC ); 318 299 #endif 319 #if SAO_UNIT_INTERLEAVING 300 #endif 301 #if INTER_VIEW_VECTOR_SCALING_C0115 302 m_acTEncTopList[iViewIdx]->setUseIVS ( m_bUseIVS ); 303 #endif 320 304 m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 321 305 m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); 322 #endif323 306 m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 324 307 m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); … … 328 311 m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); 329 312 m_acTEncTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); 330 #if !REMOVE_TILE_DEPENDENCE331 m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );332 #endif333 313 m_acTEncTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); 334 314 m_acTEncTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); … … 347 327 m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); 348 328 m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); 349 #if !REMOVE_TILE_DEPENDENCE350 if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1)351 #else352 329 if(uiTilesCount == 1) 353 #endif354 330 { 355 331 m_bLFCrossTileBoundaryFlag = true; … … 366 342 m_acTEncTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); 367 343 m_acTEncTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); 368 #if MULTIBITS_DATA_HIDING369 344 m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); 370 345 m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold); 371 #endif 372 373 #if LCU_SYNTAX_ALF 346 374 347 if(uiTilesCount > 1) 375 348 { … … 379 352 m_acTEncTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); 380 353 m_acTEncTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); 381 #endif382 354 383 355 //====== Depth tools ======== … … 435 407 m_acTEncDepthTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); 436 408 m_acTEncDepthTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); 437 #if PIC_CROPPING438 409 m_acTEncDepthTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); 439 410 m_acTEncDepthTopList[iViewIdx]->setCropLeft ( m_cropLeft ); … … 441 412 m_acTEncDepthTopList[iViewIdx]->setCropTop ( m_cropTop ); 442 413 m_acTEncDepthTopList[iViewIdx]->setCropBottom ( m_cropBottom ); 443 #endif444 414 m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); 445 415 m_acTEncDepthTopList[iViewIdx]->setViewId ( iViewIdx ); … … 470 440 m_acTEncDepthTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); 471 441 m_acTEncDepthTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); 472 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER473 442 for(Int i = 0; i < MAX_TLAYER; i++) 474 443 { … … 476 445 m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); 477 446 } 478 #else479 m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames );480 m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures );481 #endif482 447 for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) 483 448 { … … 489 454 m_acTEncDepthTopList[iViewIdx]->setPad ( m_aiPad ); 490 455 491 #if H0566_TLA492 456 m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); 493 #else494 m_acTEncDepthTopList[iViewIdx]->setTLayering ( m_bTLayering );495 m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag );496 #endif497 457 498 458 m_acTEncDepthTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); … … 508 468 m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); 509 469 m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 510 #if DBL_CONTROL511 470 m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 512 #endif513 471 514 472 //====== Motion search ======== … … 550 508 m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQPdepth ); 551 509 m_acTEncDepthTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[1] ); 552 #if !PIC_CROPPING553 m_acTEncDepthTopList[iViewIdx]->setUsePAD ( m_bUsePAD );554 #endif555 510 m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 556 511 m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 559 514 m_acTEncDepthTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); 560 515 m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); 561 #if FAST_DECISION_FOR_MRG_RD_COST562 516 m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 563 #endif564 517 m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); 565 518 #if HHI_INTERVIEW_SKIP … … 595 548 m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration ( 0 ); 596 549 #endif 597 #if H HI_INTER_VIEW_MOTION_PRED550 #if H3D_IVMP 598 551 m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode ( 0 ); 599 552 m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode ( 0 ); 600 553 m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( 0.0 ); 601 554 #endif 602 #if H HI_INTER_VIEW_RESIDUAL_PRED555 #if H3D_IVRP 603 556 m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); 604 557 #endif … … 623 576 m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 624 577 } 625 #if FIXED_NUMBER_OF_TILES_SLICE_MODE626 578 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) 627 579 { 628 580 m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 629 581 } 630 #endif631 582 m_acTEncDepthTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); 632 583 if(m_iSliceMode == 0 ) … … 639 590 m_acTEncDepthTopList[iViewIdx]->setUseIC ( false ); 640 591 #endif 641 #if SAO_UNIT_INTERLEAVING 592 #if INTER_VIEW_VECTOR_SCALING_C0115 593 m_acTEncDepthTopList[iViewIdx]->setUseIVS ( m_bUseIVS ); 594 #endif 642 595 m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 643 596 m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); 644 #endif645 597 m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 646 598 m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); … … 650 602 m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); 651 603 m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); 652 #if !REMOVE_TILE_DEPENDENCE653 m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );654 #endif655 604 m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); 656 605 m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); … … 669 618 m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); 670 619 m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); 671 #if !REMOVE_TILE_DEPENDENCE672 if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1)673 #else674 620 if(uiTilesCount == 1) 675 #endif676 621 { 677 622 m_bLFCrossTileBoundaryFlag = true; … … 688 633 m_acTEncDepthTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); 689 634 m_acTEncDepthTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); 690 #if MULTIBITS_DATA_HIDING691 635 m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); 692 636 m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold); 693 #endif 694 695 #if LCU_SYNTAX_ALF 637 696 638 if(uiTilesCount > 1) 697 639 { … … 701 643 m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); 702 644 m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); 703 #endif704 645 705 646 //====== Depth tools ======== … … 728 669 } 729 670 730 #if H HI_INTER_VIEW_MOTION_PRED671 #if H3D_IVMP 731 672 else if( m_uiMultiviewMvRegMode ) 732 673 { … … 815 756 m_acTEncDepthTopList[iViewIdx]->create(); 816 757 } 817 #if H HI_INTER_VIEW_MOTION_PRED758 #if H3D_IVMP 818 759 else if( m_uiMultiviewMvRegMode ) 819 760 { … … 931 872 TComPicYuv* pcPicYuvRec = NULL; 932 873 TComPicYuv* pcDepthPicYuvRec = NULL; 933 874 934 875 // initialize internal class & member variables 935 876 xInitLibCfg(); … … 962 903 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 963 904 964 #if H HI_INTER_VIEW_MOTION_PRED905 #if H3D_IVMP 965 906 if( m_uiMultiviewMvRegMode ) 966 907 { … … 982 923 m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ); 983 924 984 #if H HI_INTER_VIEW_MOTION_PRED925 #if H3D_IVMP 985 926 if( m_uiMultiviewMvRegMode && iViewIdx ) 986 927 { … … 989 930 #endif 990 931 991 #if H HI_INTER_VIEW_MOTION_PRED932 #if H3D_IVMP 992 933 m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg, ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); 993 934 #else … … 1033 974 if ( iNextPoc < m_iFrameToBeEncoded ) 1034 975 { 1035 m_cCameraData.update( iNextPoc );976 m_cCameraData.update( iNextPoc ); 1036 977 } 1037 978 #endif … … 1096 1037 #endif 1097 1038 iNumEncoded = 0; 1039 1040 #if MERL_VSP_C0152 1041 Int iCurPoc = m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId); 1042 if( iCurPoc < m_acTEncDepthTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 ) 1043 { 1044 TComPic* pcBaseTxtPic = getPicFromView( 0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), false ); //get base view reconstructed texture 1045 TComPic* pcBaseDepthPic = getPicFromView( 0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), true ); //get base view reconstructed depth 1046 TEncSlice* pEncSlice = m_acTEncTopList[iViewIdx]->getSliceEncoder(); 1047 pEncSlice->setRefPicBaseTxt(pcBaseTxtPic); 1048 pEncSlice->setRefPicBaseDepth(pcBaseDepthPic); 1049 } 1050 setBWVSPLUT( iViewIdx, gopId, false); 1051 #endif 1098 1052 // call encoding function for one frame 1099 1053 m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); … … 1103 1057 { 1104 1058 Int iNumDepthEncoded = 0; 1059 #if MERL_VSP_C0152 1060 Int iCurPocDepth = m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId); 1061 if( iCurPocDepth < m_acTEncDepthTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 ) 1062 { 1063 TComPic* pcBaseDepthPic = getPicFromView( 0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), true ); 1064 TEncSlice* pcSlice = (TEncSlice*) m_acTEncDepthTopList[iViewIdx]->getSliceEncoder(); 1065 pcSlice->setRefPicBaseDepth(pcBaseDepthPic); 1066 } 1067 setBWVSPLUT( iViewIdx, gopId, true); 1068 #endif 1069 1105 1070 // call encoding function for one depth frame 1106 1071 m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId ); … … 1114 1079 #endif 1115 1080 1116 #if HHI_INTERVIEW_SKIP || H HI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED1081 #if HHI_INTERVIEW_SKIP || H3D_IVMP || H3D_IVRP 1117 1082 for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 1118 1083 { … … 1147 1112 1148 1113 #if !QC_MVHEVC_B0046 1149 #if FIX_DEL_NULLPTR1150 1114 if ( pcPdmDepthOrg != NULL && m_uiMultiviewMvRegMode ) 1151 #else1152 if ( pcPdmDepthOrg != NULL )1153 #endif1154 1115 { 1155 1116 pcPdmDepthOrg->destroy(); … … 1292 1253 if (m_pchReconFileList[iViewIdx]) 1293 1254 { 1294 #if PIC_CROPPING1295 1255 m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); 1296 #else1297 m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad );1298 #endif1299 1256 } 1300 1257 } … … 1303 1260 if (m_pchDepthReconFileList[iViewIdx]) 1304 1261 { 1305 #if PIC_CROPPING1306 1262 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); 1307 #else1308 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad );1309 #endif1310 1263 } 1311 1264 } … … 1360 1313 { 1361 1314 case NAL_UNIT_CODED_SLICE: 1362 #if H0566_TLA1363 1315 #if !QC_REM_IDV_B0046 1364 1316 case NAL_UNIT_CODED_SLICE_IDV: … … 1366 1318 case NAL_UNIT_CODED_SLICE_TLA: 1367 1319 case NAL_UNIT_CODED_SLICE_CRA: 1368 #else1369 case NAL_UNIT_CODED_SLICE_DATAPART_A:1370 case NAL_UNIT_CODED_SLICE_DATAPART_B:1371 case NAL_UNIT_CODED_SLICE_CDR:1372 #endif1373 1320 case NAL_UNIT_CODED_SLICE_IDR: 1374 1321 case NAL_UNIT_SPS: … … 1634 1581 #endif 1635 1582 1583 #if MERL_VSP_C0152 1584 Void TAppEncTop::setBWVSPLUT(Int iCodedViewIdx, Int gopId, Bool isDepth) 1585 { 1586 //first view does not have VSP 1587 if((iCodedViewIdx == 0)) return; 1588 1589 AOT( iCodedViewIdx <= 0); 1590 AOT( iCodedViewIdx >= m_iNumberOfViews ); 1591 1592 Int iNeighborViewId = 0; 1593 //setting look-up table 1594 Int* piShiftLUT = m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0]; 1595 1596 if(isDepth) 1597 { 1598 TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncDepthTopList[iCodedViewIdx]->getSliceEncoder(); 1599 pcEncSlice->setBWVSPLUTParam( piShiftLUT, LOG2_DISP_PREC_LUT ); 1600 } 1601 else 1602 { 1603 TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncTopList[iCodedViewIdx]->getSliceEncoder(); 1604 pcEncSlice->setBWVSPLUTParam( piShiftLUT, LOG2_DISP_PREC_LUT ); 1605 } 1606 1607 } 1608 #endif 1609 1636 1610 //! \} -
trunk/source/App/TAppEncoder/TAppEncTop.h
r210 r296 99 99 TRenTop m_cUsedPelsRenderer; ///< renderer for used pels map 100 100 #endif 101 101 102 protected: 102 103 // initialization … … 165 166 #endif 166 167 168 #if MERL_VSP_C0152 169 Void setBWVSPLUT( Int iCodedViewIdx, Int gopId, Bool isDepth); 170 #endif 167 171 };// END CLASS DEFINITION TAppEncTop 168 172 -
trunk/source/App/TAppRenderer/TAppRendererTop.cpp
r210 r296 429 429 // Write Output 430 430 431 #if PIC_CROPPING432 431 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 ); 433 #else434 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, aiPad );435 #endif436 432 } 437 433 iFrame++; … … 665 661 666 662 // Write Output 667 #if PIC_CROPPING668 663 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, 0 ,0 ,0, 0 ); 669 #else670 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, aiPad );671 #endif672 664 } 673 665 } … … 867 859 868 860 // Write Output 869 #if PIC_CROPPING870 861 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 ); 871 #else872 m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, aiPad );873 #endif874 862 } 875 863 iFrame++; … … 998 986 999 987 // Write Output 1000 #if PIC_CROPPING1001 988 m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, 0, 0, 0 ); 1002 #else1003 m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, aiPad );1004 #endif1005 989 1006 990 } -
trunk/source/Lib/TAppCommon/TAppComCamPara.cpp
r106 r296 89 89 } 90 90 91 92 91 Void 93 92 TAppComCamPara::xCreate2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray ) … … 928 927 } 929 928 930 931 929 Void 932 930 TAppComCamPara::xSetShiftParametersAndLUT( UInt uiFrame ) -
trunk/source/Lib/TAppCommon/TAppComCamPara.h
r102 r296 107 107 Int**** m_aiSynthViewShiftLUT; ///< Disparity LUT 108 108 109 110 109 protected: 111 110 // create and delete arrays … … 143 142 Void xSetShiftParametersAndLUT ( UInt uiNumViewDim1, UInt uiNumViewDim2, UInt uiFrame, Bool bExternalReference, Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams ); 144 143 Void xSetShiftParametersAndLUT ( UInt uiFrame ); 145 146 144 147 145 // getting conversion parameters for disparity to virtual depth conversion -
trunk/source/Lib/TLibCommon/CommonDef.h
r211 r296 128 128 #define MAX_VIEW_NUM 10 129 129 130 #if ( H HI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED)130 #if ( H3D_IVMP || H3D_IVRP ) 131 131 #define DEPTH_MAP_GENERATION 1 132 132 #define PDM_REMOVE_DEPENDENCE 1 //bug-fix for DMDV JCT2-A0095 … … 140 140 #define PDM_MERGE_POS 0 // position of pdm in merge list (0..4) 141 141 142 #if QC_MRG_CANS_B0048 143 #if OL_DISMV_POS_B0069 142 #if H3D_IVMP 144 143 #define DMV_MERGE_POS 4 145 144 #else 146 145 #define DMV_MERGE_POS 1 147 146 #endif 148 #endif 149 150 #if SAIT_IMPROV_MOTION_PRED_M24829&!QC_MULTI_DIS_CAN_A0097 147 148 #if H3D_IVMP&!H3D_NBDV 151 149 #define PDM_AMVP_POS 0 // position of pdm in amvp list (0..3) 152 150 #else … … 424 422 // AMVP: advanced motion vector prediction 425 423 #define AMVP_MAX_NUM_CANDS 2 ///< max number of final candidates 426 #if H HI_INTER_VIEW_MOTION_PRED424 #if H3D_IVMP 427 425 #define AMVP_MAX_NUM_CANDS_MEM 4 ///< max number of candidates 428 426 #else … … 431 429 // MERGE 432 430 #define MRG_MAX_NUM_CANDS 5 433 #if H HI_INTER_VIEW_MOTION_PRED431 #if H3D_IVMP 434 432 #define MRG_MAX_NUM_CANDS_MEM (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction 435 433 #endif … … 439 437 440 438 // Explicit temporal layer QP offset 441 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER442 439 #define MAX_TLAYER 8 ///< max number of temporal layer 443 #else444 #define MAX_TLAYER 4 ///< max number of temporal layer445 #endif446 440 #define HB_LAMBDA_FOR_LDC 1 ///< use of B-style lambda for non-key pictures in low-delay mode 447 441 … … 468 462 #define MAX_NUM_REF_PICS 16 469 463 470 #if !NAL_REF_FLAG471 enum NalRefIdc472 {473 NAL_REF_IDC_PRIORITY_LOWEST = 0,474 NAL_REF_IDC_PRIORITY_LOW,475 NAL_REF_IDC_PRIORITY_HIGH,476 NAL_REF_IDC_PRIORITY_HIGHEST477 };478 #endif479 464 480 465 enum NalUnitType … … 482 467 NAL_UNIT_UNSPECIFIED_0 = 0, 483 468 NAL_UNIT_CODED_SLICE, 484 #if H0566_TLA485 469 #if QC_REM_IDV_B0046 486 470 NAL_UNIT_RESERVED, … … 490 474 NAL_UNIT_CODED_SLICE_TLA, 491 475 NAL_UNIT_CODED_SLICE_CRA, 492 #else493 NAL_UNIT_CODED_SLICE_DATAPART_A,494 NAL_UNIT_CODED_SLICE_DATAPART_B,495 NAL_UNIT_CODED_SLICE_CDR,496 #endif497 476 NAL_UNIT_CODED_SLICE_IDR, 498 477 NAL_UNIT_SEI, -
trunk/source/Lib/TLibCommon/ContextModel.cpp
r56 r296 56 56 Void ContextModel::init( Int qp, Int initValue ) 57 57 { 58 #if H0736_AVC_STYLE_QP_RANGE59 58 qp = Clip3(0, 51, qp); 60 #endif61 59 62 #if CABAC_LINEAR_INIT63 60 Int slope = (initValue>>4)*5 - 45; 64 61 Int offset = ((initValue&15)<<3)-16; … … 66 63 UInt mpState = (initState >= 64 ); 67 64 m_ucState = ( (mpState? (initState - 64):(63 - initState)) <<1) + mpState; 68 #else69 Int m = m_slopes[initValue>>4];70 Int n = initValue & 15;71 72 Int val = max( 0, min( 3839, (n<<8) + m * (qp-26) + 128 ) );73 val -= 1920;74 Int valMps = val >= 0;75 val = ( val ^ (val>>11) ) + 128;76 Int segmentIdx = val >> 8;77 Int pStateIdx = m_accumulatedSegOffset[segmentIdx] + ( (val&255) * m_segOffset[segmentIdx] >> 8);78 79 m_ucState = (pStateIdx<<1) + valMps;80 #endif81 65 } 82 66 … … 143 127 #endif 144 128 }; 145 #if !CABAC_LINEAR_INIT146 const Int ContextModel::m_slopes[16] = { -239, -143, -85, -51, -31, -19, -11, 0, 11, 19, 31, 51, 85, 143, 239, 399 };147 const Int ContextModel::m_segOffset[8] = { 6, 7, 5, 7, 10, 14, 16, 1 };148 const Int ContextModel::m_accumulatedSegOffset[8] = { -3, 3, 10, 15, 22, 32, 46, 62 };149 #endif150 129 //! \} -
trunk/source/Lib/TLibCommon/ContextModel.h
r56 r296 103 103 static UChar m_nextState[128][2]; 104 104 #endif 105 #if !CABAC_LINEAR_INIT106 static const Int m_slopes[16];107 static const Int m_segOffset[8];108 static const Int m_accumulatedSegOffset[8];109 #endif110 105 #if CABAC_INIT_FLAG 111 106 UInt m_binsCoded; -
trunk/source/Lib/TLibCommon/ContextTables.h
r189 r296 57 57 58 58 #define NUM_MERGE_FLAG_EXT_CTX 1 ///< number of context models for merge flag of merge extended 59 #if MRG_IDX_CTX_RED60 59 #define NUM_MERGE_IDX_EXT_CTX 1 ///< number of context models for merge index of merge extended 61 #else 62 #define NUM_MERGE_IDX_EXT_CTX 4 ///< number of context models for merge index of merge extended 63 #endif 64 65 #if HHI_INTER_VIEW_RESIDUAL_PRED 60 61 #if H3D_IVRP 66 62 #define NUM_RES_PRED_FLAG_CTX 4 ///< number of context for residual prediction flag 67 63 #endif … … 69 65 #define NUM_ALF_CTRL_FLAG_CTX 1 ///< number of context models for ALF control flag 70 66 #define NUM_PART_SIZE_CTX 4 ///< number of context models for partition size 71 #if AMP_CTX72 67 #define NUM_CU_AMP_CTX 1 ///< number of context models for partition size (AMP) 73 #else74 #define NUM_CU_X_POS_CTX 2 ///< number of context models for partition size (AMP)75 #define NUM_CU_Y_POS_CTX 2 ///< number of context models for partition size (AMP)76 #endif77 68 #define NUM_PRED_MODE_CTX 1 ///< number of context models for prediction mode 78 69 … … 95 86 #define NUM_SIG_FLAG_CTX_LUMA 27 ///< number of context models for luma sig flag 96 87 #define NUM_SIG_FLAG_CTX_CHROMA 21 ///< number of context models for chroma sig flag 97 #if LAST_CTX_REDUCTION98 88 #define NUM_CTX_LAST_FLAG_XY 15 ///< number of context models for last coefficient position 99 #else 100 #define NUM_CTX_LAST_FLAG_XY 18 ///< number of context models for last coefficient position 101 #endif 102 103 #if LEVEL_CTX_LUMA_RED 89 104 90 #define NUM_ONE_FLAG_CTX 24 ///< number of context models for greater than 1 flag 105 91 #define NUM_ONE_FLAG_CTX_LUMA 16 ///< number of context models for greater than 1 flag of luma 106 92 #define NUM_ONE_FLAG_CTX_CHROMA 8 ///< number of context models for greater than 1 flag of chroma 107 #if RESTRICT_GR1GR2FLAG_NUMBER108 93 #define NUM_ABS_FLAG_CTX 6 ///< number of context models for greater than 2 flag 109 94 #define NUM_ABS_FLAG_CTX_LUMA 4 ///< number of context models for greater than 2 flag of luma 110 95 #define NUM_ABS_FLAG_CTX_CHROMA 2 ///< number of context models for greater than 2 flag of chroma 111 #else112 #define NUM_ABS_FLAG_CTX 18 ///< number of context models for greater than 2 flag113 #define NUM_ABS_FLAG_CTX_LUMA 12 ///< number of context models for greater than 2 flag of luma114 #define NUM_ABS_FLAG_CTX_CHROMA 6 ///< number of context models for greater than 2 flag of chroma115 #endif116 #else117 #define NUM_ONE_FLAG_CTX 32 ///< number of context models for greater than 1 flag118 #define NUM_ONE_FLAG_CTX_LUMA 24 ///< number of context models for greater than 1 flag of luma119 #define NUM_ONE_FLAG_CTX_CHROMA 8 ///< number of context models for greater than 1 flag of chroma120 #if RESTRICT_GR1GR2FLAG_NUMBER121 #define NUM_ABS_FLAG_CTX 8 ///< number of context models for greater than 2 flag122 #define NUM_ABS_FLAG_CTX_LUMA 6 ///< number of context models for greater than 2 flag of luma123 #define NUM_ABS_FLAG_CTX_CHROMA 2 ///< number of context models for greater than 2 flag of chroma124 #else125 #define NUM_ABS_FLAG_CTX 24 ///< number of context models for greater than 2 flag126 #define NUM_ABS_FLAG_CTX_LUMA 18 ///< number of context models for greater than 2 flag of luma127 #define NUM_ABS_FLAG_CTX_CHROMA 6 ///< number of context models for greater than 2 flag of chroma128 #endif129 #endif130 96 131 97 #define NUM_MVP_IDX_CTX 2 ///< number of context models for MVP index … … 138 104 #define NUM_SAO_UVLC_CTX 2 ///< number of context models for SAO UVLC 139 105 #define NUM_SAO_SVLC_CTX 3 ///< number of context models for SAO SVLC 140 #if SAO_UNIT_INTERLEAVING141 106 #define NUM_SAO_RUN_CTX 3 ///< number of context models for AO SVLC (filter coeff.) 142 107 #define NUM_SAO_MERGE_LEFT_FLAG_CTX 3 ///< number of context models for AO SVLC (filter coeff.) 143 108 #define NUM_SAO_MERGE_UP_FLAG_CTX 1 ///< number of context models for AO SVLC (filter coeff.) 144 109 #define NUM_SAO_TYPE_IDX_CTX 2 ///< number of context models for AO SVLC (filter coeff.) 145 #endif146 #if CABAC_LINEAR_INIT147 110 #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' 148 #else149 #define CNU 119 ///< dummy initialization value for unused context models 'Context model Not Used'150 #endif151 111 152 112 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 153 113 #define NUM_DMM_FLAG_CTX 1 ///< number of context models for DMM flag 154 114 #define NUM_DMM_MODE_CTX 1 ///< number of context models for DMM mode 115 #if LGE_DMM3_SIMP_C0044 116 #define NUM_DMM_DATA_CTX 4 ///< number of context models for DMM data 117 #else 155 118 #define NUM_DMM_DATA_CTX 3 ///< number of context models for DMM data 119 #endif 156 120 #endif 157 121 … … 177 141 178 142 // initial probability for split flag 179 #if CABAC_LINEAR_INIT180 143 static const UChar 181 144 INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] = … … 223 186 INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] = 224 187 { 225 #if MRG_IDX_CTX_RED226 188 { CNU, }, 227 189 { 122, }, 228 190 { 137, }, 229 #else 230 { CNU, CNU, CNU, CNU, }, 231 { 122, 138, 153, 182, }, 232 { 137, 139, 154, 139, }, 233 #endif 234 }; 235 236 #if HHI_INTER_VIEW_RESIDUAL_PRED 191 }; 192 193 #if H3D_IVRP 237 194 static const UChar 238 195 INIT_RES_PRED_FLAG[3][NUM_RES_PRED_FLAG_CTX] = … … 252 209 }; 253 210 254 #if AMP_CTX255 211 static const UChar 256 212 INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] = … … 260 216 { 154, }, 261 217 }; 262 #else263 static const UChar264 INIT_CU_X_POS[3][NUM_CU_X_POS_CTX] =265 {266 { CNU, CNU, },267 { 154, 139, },268 { 154, 139, },269 };270 271 static const UChar272 INIT_CU_Y_POS[3][NUM_CU_Y_POS_CTX] =273 {274 { CNU, CNU, },275 { 154, 154, },276 { 154, 139, },277 };278 #endif279 218 280 219 static const UChar … … 354 293 }; 355 294 356 #if LAST_CTX_REDUCTION357 295 static const UChar 358 296 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] = … … 368 306 }, 369 307 }; 370 #else371 static const UChar372 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] =373 {374 { 110, 110, 124, 110, 140, 111, 124, 125, 111, 127, 111, 138, 111, 156, 127, 127, 111, 94,375 108, 123, 63, 63, 139, 124, 93, 108, 125, 111, 110, 63, CNU, CNU, CNU, CNU, CNU, CNU,376 },377 { 125, 110, 124, 110, 125, 110, 153, 125, 111, 111, 110, 153, 139, 111, 111, 111, 125, 139,378 108, 123, 108, 152, 124, 94, 123, 137, 139, 110, 110, 154, CNU, CNU, CNU, CNU, CNU, CNU,379 },380 { 125, 110, 124, 110, 125, 110, 153, 125, 111, 111, 110, 153, 139, 111, 111, 111, 125, 139,381 108, 123, 93, 152, 124, 94, 123, 152, 139, 110, 110, 154, CNU, CNU, CNU, CNU, CNU, CNU,382 },383 };384 #endif385 308 386 309 static const UChar … … 406 329 }; 407 330 408 #if LEVEL_CTX_LUMA_RED409 331 static const UChar 410 332 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] = … … 415 337 }; 416 338 417 #if RESTRICT_GR1GR2FLAG_NUMBER418 339 static const UChar 419 340 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = … … 423 344 { 107, 167, 91, 107, 107, 167, }, 424 345 }; 425 #else426 static const UChar427 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =428 {429 { 138, 139, 111, 153, 139, 111, 136, 167, 139, 167, 153, 139, 152, 139, 140, 152, 184, 141, },430 { 107, 153, 125, 167, 153, 140, 91, 137, 153, 122, 167, 139, 107, 153, 140, 167, 183, 140, },431 { 107, 153, 125, 167, 153, 140, 91, 137, 153, 107, 167, 139, 107, 153, 140, 167, 183, 140, },432 };433 #endif434 #else435 static const UChar436 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =437 {438 { 140, 92, 137, 138, 140, 152, 138, 139, 126, 168, 139, 139, 153, 74, 149, 92, 139, 107, 122, 152, 110, 93, 152, 138, 140, 179, 166, 182, 140, 227, 122, 197, },439 { 154, 196, 196, 167, 154, 152, 167, 182, 155, 139, 139, 139, 182, 134, 149, 136, 153, 121, 136, 137, 139, 122, 152, 167, 169, 194, 166, 167, 154, 167, 137, 182, },440 { 154, 196, 167, 167, 154, 152, 167, 182, 155, 139, 139, 139, 182, 134, 149, 136, 153, 121, 136, 122, 139, 107, 152, 152, 169, 208, 166, 167, 154, 152, 167, 182, },441 };442 443 #if RESTRICT_GR1GR2FLAG_NUMBER444 static const UChar445 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =446 {447 { 138, 153, 139, 136, 167, 153, 152, 152, },448 { 107, 167, 139, 91, 122, 152, 107, 167, },449 { 107, 167, 139, 91, 107, 93, 107, 167, },450 };451 #else452 static const UChar453 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =454 {455 { 138, 139, 111, 153, 139, 111, 139, 125, 111, 136, 167, 139, 167, 153, 139, 153, 139, 110, 152, 139, 140, 152, 184, 141, },456 { 107, 153, 125, 167, 153, 140, 139, 154, 155, 91, 137, 153, 122, 167, 139, 152, 138, 139, 107, 153, 140, 167, 183, 140, },457 { 107, 153, 125, 167, 153, 140, 139, 154, 155, 91, 137, 153, 107, 167, 139, 93, 138, 139, 107, 153, 140, 167, 183, 140, },458 };459 #endif460 #endif461 346 462 347 static const UChar … … 516 401 }; 517 402 518 #if SAO_UNIT_INTERLEAVING519 403 static const UChar 520 404 INIT_SAO_MERGE_LEFT_FLAG[3][NUM_SAO_MERGE_LEFT_FLAG_CTX] = … … 540 424 { 200, 140, }, 541 425 }; 542 #endif543 426 544 427 static const UChar … … 549 432 { CNU, 153, 138, 138, CNU, CNU, CNU, CNU, CNU, CNU, }, 550 433 }; 434 435 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 436 #if FIX_DMM_CTX_INIT_C0034 437 static const UChar 551 438 #else 439 static const Short 440 #endif 441 INIT_DMM_FLAG[3][NUM_DMM_FLAG_CTX] = 442 { 443 { 444 CNU 445 }, 446 { 447 CNU 448 }, 449 { 450 CNU 451 } 452 }; 453 454 #if FIX_DMM_CTX_INIT_C0034 552 455 static const UChar 553 INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] = 554 { 555 { 556 87, 74, 107, 557 558 },559 {560 84, 103, 105,561 562 },563 {564 84, 103, 105,565 566 } ,567 }; 568 569 // initial probability for skip flag 456 #else 457 static const Short 458 #endif 459 INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] = 460 { 461 { 462 CNU 463 }, 464 { 465 CNU 466 }, 467 { 468 CNU 469 } 470 }; 471 472 #if FIX_DMM_CTX_INIT_C0034 570 473 static const UChar 571 INIT_SKIP_FLAG[3][NUM_SKIP_FLAG_CTX] =572 {573 {574 CNU, CNU, CNU,575 576 },577 {578 165, 168, 154,579 580 },581 {582 165, 168, 154,583 584 },585 };586 587 // initial probability for skip flag588 static const UChar589 INIT_ALF_CTRL_FLAG[3][NUM_ALF_CTRL_FLAG_CTX] =590 {591 {592 153,593 594 },595 {596 87,597 598 },599 {600 135,601 602 },603 };604 605 // initial probability for merge flag606 static const UChar607 INIT_MERGE_FLAG_EXT[3][NUM_MERGE_FLAG_EXT_CTX] =608 {609 {610 CNU,611 612 },613 {614 72,615 616 },617 {618 119,619 620 },621 };622 623 static const UChar624 INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] =625 {626 #if MRG_IDX_CTX_RED627 {628 CNU,629 630 },631 {632 100,633 634 },635 {636 116,637 },638 474 #else 639 { 640 CNU, CNU, CNU, CNU, 641 642 }, 643 { 644 100, 86, 102, 133, 645 646 }, 647 { 648 116, 87, 119, 103, 649 650 }, 651 #endif 652 }; 653 654 // initial probability for PU size 655 static const UChar 656 INIT_PART_SIZE[3][NUM_PART_SIZE_CTX] = 657 { 658 { 659 167, CNU, CNU, CNU, 660 661 }, 662 { 663 119, 87, CNU, CNU, 664 665 }, 666 { 667 119, 87, CNU, CNU, 668 669 }, 670 }; 671 #if AMP_CTX 672 static const UChar 673 INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] = 674 { 675 { 676 CNU, 677 }, 678 { 679 119, 680 }, 681 { 682 119, 683 }, 684 }; 475 static const Short 476 #endif 477 INIT_DMM_DATA[3][NUM_DMM_DATA_CTX] = 478 { 479 #if LGE_DMM3_SIMP_C0044 480 { 481 CNU, CNU, CNU, CNU 482 }, 483 { 484 CNU, CNU, CNU, CNU 485 }, 486 { 487 CNU, CNU, CNU, CNU 488 } 685 489 #else 686 // initial probability for AMP split position (X)687 static const UChar688 INIT_CU_X_POS[3][NUM_CU_X_POS_CTX] =689 {690 {691 CNU, CNU,692 693 },694 {695 119, 103,696 697 },698 {699 119, 103,700 701 },702 };703 704 // initial probability for AMP split position (Y)705 static const UChar706 INIT_CU_Y_POS[3][NUM_CU_Y_POS_CTX] =707 {708 {709 CNU, CNU,710 711 },712 {713 119, 119,714 715 },716 {717 119, 103,718 719 },720 };721 #endif722 // initial probability for prediction mode723 static const UChar724 INIT_PRED_MODE[3][NUM_PRED_MODE_CTX] =725 {726 {727 CNU,728 729 },730 {731 114,732 733 },734 {735 98,736 737 },738 };739 740 // initial probability for intra direction of luma741 static const UChar742 INIT_INTRA_PRED_MODE[3][NUM_ADI_CTX] =743 {744 {745 167,746 747 },748 {749 119,750 751 },752 {753 150,754 755 },756 };757 758 // initial probability for intra direction of chroma759 static const UChar760 INIT_CHROMA_PRED_MODE[3][NUM_CHROMA_PRED_CTX] =761 {762 {763 53, 103,764 765 },766 {767 85, 87,768 769 },770 {771 101, 87,772 773 },774 };775 776 // initial probability for temporal direction777 static const UChar778 INIT_INTER_DIR[3][NUM_INTER_DIR_CTX] =779 {780 {781 CNU, CNU, CNU, CNU,782 783 },784 {785 CNU, CNU, CNU, CNU,786 787 },788 {789 41, 39, 38, 36,790 791 },792 };793 794 // initial probability for motion vector difference795 static const UChar796 INIT_MVD[3][NUM_MV_RES_CTX] =797 {798 {799 CNU, CNU,800 801 },802 {803 120, 166,804 805 },806 {807 135, 166,808 809 },810 };811 812 // initial probability for reference frame index813 static const UChar814 INIT_REF_PIC[3][NUM_REF_NO_CTX] =815 {816 {817 CNU, CNU, CNU, CNU,818 819 },820 {821 102, 118, 103, CNU,822 823 },824 {825 118, 118, 134, CNU,826 827 },828 };829 830 // initial probability for dQP831 static const UChar832 INIT_DQP[3][NUM_DELTA_QP_CTX] =833 {834 {835 CNU, CNU, CNU,836 837 },838 {839 CNU, CNU, CNU,840 841 },842 {843 CNU, CNU, CNU,844 845 },846 };847 848 static const UChar849 INIT_QT_CBF[3][2*NUM_QT_CBF_CTX] =850 {851 {852 73, 74, CNU, CNU, CNU,853 55, 86, 133, CNU, CNU,854 855 },856 {857 102, 89, CNU, CNU, CNU,858 114, 84, 117, CNU, CNU,859 860 },861 {862 102, 89, CNU, CNU, CNU,863 114, 68, 117, CNU, CNU,864 865 },866 };867 868 static const UChar869 INIT_QT_ROOT_CBF[3][NUM_QT_ROOT_CBF_CTX] =870 {871 {872 CNU,873 874 },875 {876 39,877 878 },879 {880 39,881 882 },883 };884 885 #if LAST_CTX_REDUCTION886 static const UChar887 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] =888 {889 {890 72, 72, 71, 72, 104, 89, 88, 89, 59, 73, 89, 106, 60, 59, 43,891 54, 70, 53, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU,892 },893 {894 57, 72, 55, 72, 57, 72, 88, 73, 73, 72, 103, 73, 89, 73, 57,895 54, 70, 54, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU,896 },897 {898 88, 72, 71, 72, 57, 72, 88, 73, 73, 72, 103, 73, 89, 73, 57,899 54, 70, 69, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU,900 },901 };902 #else903 static const UChar904 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] =905 {906 {907 72, 72, 71, 72, 104, 89, 71, 88, 89, 59, 73, 86, 89, 106, 60, 59, 43, 55,908 54, 70, 53, 53, 87, 71, 69, 54, 88, 73, 72, 53, CNU, CNU, CNU, CNU, CNU, CNU,909 910 },911 {912 57, 72, 71, 72, 57, 72, 102, 88, 73, 73, 72, 102, 103, 73, 89, 73, 57, 87,913 54, 70, 54, 101, 71, 55, 70, 116, 103, 72, 72, 119, CNU, CNU, CNU, CNU, CNU, CNU,914 915 },916 {917 88, 72, 71, 72, 57, 72, 102, 88, 73, 73, 72, 118, 103, 73, 89, 73, 57, 87,918 54, 70, 69, 85, 71, 55, 70, 85, 103, 72, 72, 119, CNU, CNU, CNU, CNU, CNU, CNU,919 920 },921 };922 #endif923 924 static const UChar925 INIT_SIG_CG_FLAG[3][2 * NUM_SIG_CG_FLAG_CTX] =926 {927 {928 83, 122,929 98, 121,930 931 },932 {933 99, 120,934 67, 119,935 936 },937 {938 99, 120,939 67, 119,940 941 },942 };943 944 static const UChar945 INIT_SIG_FLAG[3][NUM_SIG_FLAG_CTX] =946 {947 {948 74, 73, 88, 72, 72, 55, 71, 54, 71, 88, 103, 71, 53, 87, 134, 86, 84, 70, 68, 89, 90, 84, 88, 74, 130, 118, 88,949 120, 87, 149, 70, 52, 118, 133, 116, 114, 129, 132, 162, 115, 51, 115, 66, 120, 74, 115, 87, 89,950 },951 {952 152, 119, 103, 118, 87, 70, 70, 53, 118, 134, 118, 101, 68, 85, 101, 116, 100, 68, 67, 136, 168, 147, 150, 120, 115, 118, 119,953 136, 102, 70, 53, 67, 117, 102, 117, 115, 114, 84, 115, 99, 100, 83, 114, 152, 168, 131, 150, 120,954 },955 {956 152, 119, 103, 118, 87, 70, 70, 53, 71, 103, 118, 101, 68, 85, 101, 116, 116, 68, 67, 152, 168, 147, 150, 120, 115, 118, 119,957 136, 102, 86, 84, 67, 117, 102, 117, 115, 99, 100, 115, 99, 100, 83, 114, 152, 152, 131, 150, 120,958 },959 };960 961 #if LEVEL_CTX_LUMA_RED962 static const UChar963 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =964 {965 {966 104, 68, 116, 86, 104, 132, 86, 87, 102, 66, 114, 68, 87, 84, 100, 101,967 104, 130, 147, 149, 104, 196, 100, 165,968 },969 {970 119, 179, 179, 164, 119, 85, 117, 149, 133, 98, 114, 115, 118, 99, 115, 116,971 135, 146, 147, 164, 119, 148, 116, 133,972 },973 {974 119, 179, 148, 164, 119, 85, 117, 149, 133, 98, 114, 115, 118, 99, 115, 100,975 135, 177, 147, 164, 119, 132, 148, 149,976 },977 };978 979 #if RESTRICT_GR1GR2FLAG_NUMBER980 static const UChar981 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =982 {983 {984 86, 102, 115, 117, 101, 101,985 },986 {987 84, 117, 83, 100, 84, 117,988 },989 {990 84, 117, 83, 84, 84, 117,991 },992 };993 #else994 static const UChar995 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =996 {997 {998 86, 103, 73, 102, 103, 73, 115, 117, 103, 117, 118, 103,999 101, 103, 104, 101, 167, 121,1000 },1001 {1002 84, 102, 88, 117, 118, 104, 83, 116, 118, 100, 117, 87,1003 84, 118, 120, 117, 150, 120,1004 },1005 {1006 84, 102, 88, 117, 118, 104, 83, 116, 118, 84, 117, 87,1007 84, 118, 120, 117, 150, 120,1008 },1009 };1010 #endif1011 #else1012 static const UChar1013 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =1014 {1015 {1016 104, 68, 116, 86, 104, 132, 86, 87, 105, 134, 87, 103, 102, 66, 114, 68, 87, 84, 100, 101, 72, 69, 101, 86,1017 104, 130, 147, 149, 104, 196, 100, 165,1018 },1019 {1020 119, 179, 179, 164, 119, 85, 117, 149, 136, 103, 103, 103, 133, 98, 114, 115, 118, 99, 115, 116, 87, 100, 85, 117,1021 135, 146, 147, 164, 119, 148, 116, 133,1022 },1023 {1024 119, 179, 148, 164, 119, 85, 117, 149, 136, 87, 103, 103, 133, 98, 114, 115, 118, 99, 115, 100, 87, 84, 85, 85,1025 135, 177, 147, 164, 119, 132, 148, 149,1026 },1027 };1028 1029 #if RESTRICT_GR1GR2FLAG_NUMBER1030 static const UChar1031 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =1032 {1033 {1034 86, 102, 103, 115, 117, 102, 101, 101,1035 },1036 {1037 84, 117, 103, 83, 100, 85, 84, 117,1038 },1039 {1040 84, 117, 87, 83, 84, 69, 84, 117,1041 },1042 };1043 #else1044 static const UChar1045 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =1046 {1047 {1048 86, 103, 73, 102, 103, 73, 103, 88, 89, 115, 117, 103, 117, 118, 103, 102, 103, 72,1049 101, 103, 104, 101, 167, 121,1050 },1051 {1052 84, 102, 88, 117, 118, 104, 103, 119, 136, 83, 116, 118, 100, 117, 87, 85, 86, 103,1053 84, 118, 120, 117, 150, 120,1054 },1055 {1056 84, 102, 88, 117, 118, 104, 87, 119, 136, 83, 116, 118, 84, 117, 87, 69, 86, 87,1057 84, 118, 120, 117, 150, 120,1058 },1059 };1060 #endif1061 #endif1062 // initial probability for motion vector predictor index1063 static const UChar1064 INIT_MVP_IDX[3][NUM_MVP_IDX_CTX] =1065 {1066 {1067 CNU, CNU,1068 1069 },1070 {1071 134, CNU,1072 1073 },1074 {1075 134, CNU,1076 1077 },1078 };1079 1080 // initial probability for ALF flag1081 static const UChar1082 INIT_ALF_FLAG[3][NUM_ALF_FLAG_CTX] =1083 {1084 {1085 118,1086 1087 },1088 {1089 102,1090 1091 },1092 {1093 102,1094 1095 },1096 };1097 1098 // initial probability for ALF side information (unsigned)1099 static const UChar1100 INIT_ALF_UVLC[3][NUM_ALF_UVLC_CTX] =1101 {1102 {1103 120, 119,1104 1105 },1106 {1107 119, 119,1108 1109 },1110 {1111 119, 119,1112 1113 },1114 };1115 1116 // initial probability for ALF side information (signed)1117 static const UChar1118 INIT_ALF_SVLC[3][NUM_ALF_SVLC_CTX] =1119 {1120 {1121 139, 119, 124,1122 1123 },1124 {1125 90, 119, 140,1126 1127 },1128 {1129 90, 119, 124,1130 1131 },1132 };1133 1134 // initial probability for SAO flag1135 static const UChar1136 INIT_SAO_FLAG[3][NUM_SAO_FLAG_CTX] =1137 {1138 {1139 119,1140 1141 },1142 {1143 102,1144 1145 },1146 {1147 102,1148 1149 },1150 };1151 1152 // initial probability for SAO side information (unsigned)1153 static const UChar1154 INIT_SAO_UVLC[3][NUM_SAO_UVLC_CTX] =1155 {1156 {1157 61, 104,1158 1159 },1160 {1161 168, 120,1162 1163 },1164 {1165 184, 120,1166 1167 },1168 };1169 1170 // initial probability for SAO side information (signed)1171 static const UChar1172 INIT_SAO_SVLC[3][NUM_SAO_SVLC_CTX] =1173 {1174 {1175 171, 119, 199,1176 1177 },1178 {1179 169, 119, 151,1180 1181 },1182 {1183 169, 119, 151,1184 1185 },1186 };1187 1188 #if SAO_UNIT_INTERLEAVING1189 static const UChar1190 INIT_SAO_MERGE_LEFT_FLAG[3][NUM_SAO_MERGE_LEFT_FLAG_CTX] =1191 {1192 {1193 118, 118, 118,1194 },1195 {1196 102, 102, 102,1197 },1198 {1199 102, 102, 102,1200 },1201 };1202 1203 static const UChar1204 INIT_SAO_MERGE_UP_FLAG[3][NUM_SAO_MERGE_UP_FLAG_CTX] =1205 {1206 {1207 109,1208 },1209 {1210 102,1211 },1212 {1213 102,1214 },1215 };1216 static const UChar1217 INIT_SAO_TYPE_IDX[3][NUM_SAO_TYPE_IDX_CTX] =1218 {1219 {1220 64, 1041221 },1222 {1223 168, 1201224 },1225 {1226 184, 1201227 },1228 };1229 static const Short1230 INIT_SAO_RUN[3][NUM_SAO_RUN_CTX][2] =1231 {1232 {1233 { 11, 57 }, { -1, 62 }, { 0, 64 }1234 },1235 {1236 { 6, 66 }, { -1, 64 }, { 0, 64 }1237 },1238 {1239 { 1, 73 }, { 2, 61 }, { 0, 64 }1240 }1241 };1242 #endif1243 1244 static const UChar1245 INIT_TRANS_SUBDIV_FLAG[3][NUM_TRANS_SUBDIV_FLAG_CTX] =1246 {1247 {1248 CNU, 162, 148, 100, CNU, CNU, CNU, CNU, CNU, CNU,1249 1250 },1251 {1252 CNU, 71, 86, 55, CNU, CNU, CNU, CNU, CNU, CNU,1253 1254 },1255 {1256 CNU, 102, 86, 86, CNU, CNU, CNU, CNU, CNU, CNU,1257 1258 },1259 };1260 #endif1261 1262 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX1263 static const Short1264 INIT_DMM_FLAG[3][NUM_DMM_FLAG_CTX] =1265 {1266 {1267 CNU1268 },1269 {1270 CNU1271 },1272 {1273 CNU1274 }1275 };1276 1277 static const Short1278 INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] =1279 {1280 {1281 CNU1282 },1283 {1284 CNU1285 },1286 {1287 CNU1288 }1289 };1290 1291 static const Short1292 INIT_DMM_DATA[3][NUM_DMM_DATA_CTX] =1293 {1294 490 { 1295 491 CNU, CNU, CNU … … 1301 497 CNU, CNU, CNU 1302 498 } 499 #endif 1303 500 }; 1304 501 -
trunk/source/Lib/TLibCommon/NAL.h
r210 r296 46 46 { 47 47 NalUnitType m_nalUnitType; ///< nal_unit_type 48 #if NAL_REF_FLAG49 48 Bool m_nalRefFlag; ///< nal_ref_flag 50 #else51 NalRefIdc m_nalRefIDC; ///< nal_ref_idc52 #endif53 49 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 54 50 unsigned m_layerId; … … 58 54 Bool m_isDepth; ///< is_depth 59 55 unsigned m_temporalId; ///< temporal_id 60 #if !H038861 bool m_OutputFlag; ///< output_flag62 #endif63 56 #endif 64 57 65 58 /** construct an NALunit structure with given header values. */ 66 #if H038867 #if NAL_REF_FLAG68 59 NALUnit( 69 60 NalUnitType nalUnitType, … … 86 77 ,m_temporalId (temporalId) 87 78 {} 88 #else89 NALUnit(90 NalUnitType nalUnitType,91 NalRefIdc nalRefIDC,92 Int viewId,93 Bool isDepth,94 unsigned temporalID = 0)95 {96 m_nalUnitType = nalUnitType;97 m_nalRefIDC = nalRefIDC;98 #if !VIDYO_VPS_INTEGRATION99 m_viewId = viewId;100 m_isDepth = isDepth;101 #else102 m_layerId = layerId;103 #endif104 m_temporalId = temporalID;105 }106 #endif107 #else108 NALUnit(109 NalUnitType nalUnitType,110 NalRefIdc nalRefIDC,111 #if !VIDYO_VPS_INTEGRATION112 Int viewId,113 Bool isDepth,114 #else115 unsigned layerId,116 #endif117 unsigned temporalID = 0,118 bool outputFlag = true)119 {120 m_nalUnitType = nalUnitType;121 m_nalRefIDC = nalRefIDC;122 #if !VIDYO_VPS_INTEGRATION123 m_viewId = viewId;124 m_isDepth = isDepth;125 #else126 m_layerId = layerId;127 #endif128 m_temporalId = temporalID;129 m_OutputFlag = outputFlag;130 }131 #endif132 79 133 80 /** default constructor - no initialization; must be perfomed by user */ … … 138 85 { 139 86 return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 140 #if H0566_TLA141 87 #if !QC_REM_IDV_B0046 142 88 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV … … 144 90 || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA 145 91 || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA 146 #else147 || m_nalUnitType == NAL_UNIT_CODED_SLICE_CDR148 #endif149 92 || m_nalUnitType == NAL_UNIT_CODED_SLICE; 150 93 } -
trunk/source/Lib/TLibCommon/TComAdaptiveLoopFilter.cpp
r56 r296 46 46 47 47 48 #if !LCU_SYNTAX_ALF49 ALFParam::~ALFParam()50 {51 if (coeff_chroma != NULL)52 {53 delete[] coeff_chroma;54 }55 if (coeffmulti)56 {57 for (Int i=0; i<NO_VAR_BINS; i++)58 {59 if (coeffmulti[i] != NULL)60 {61 delete[] coeffmulti[i];62 }63 }64 delete[] coeffmulti;65 }66 67 if (nbSPred != NULL)68 {69 delete[] nbSPred;70 }71 if (filterPattern != NULL)72 {73 delete[] filterPattern;74 }75 }76 #endif77 48 78 49 // ==================================================================================================================== … … 80 51 // ==================================================================================================================== 81 52 82 #if ALF_SINGLE_FILTER_SHAPE83 53 Int TComAdaptiveLoopFilter::weightsShape1Sym[ALF_MAX_NUM_COEF+1] = 84 54 { … … 109 79 depthIntShape1Sym 110 80 }; 111 #else 112 //Shape0: Star5x5 113 Int TComAdaptiveLoopFilter::weightsShape0Sym[10] = 114 { 115 2, 2, 2, 116 2, 2, 2, 117 2, 2, 1, 1 118 }; 119 120 121 //Shape1: Cross9x9 122 Int TComAdaptiveLoopFilter::weightsShape1Sym[10] = 123 { 124 2, 125 2, 126 2, 127 2, 128 2, 2, 2, 2, 1, 129 1 130 }; 131 132 133 Int* TComAdaptiveLoopFilter::weightsTabShapes[NUM_ALF_FILTER_SHAPE] = 134 { 135 weightsShape0Sym, weightsShape1Sym 136 }; 137 138 Int TComAdaptiveLoopFilter::m_sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE] = 139 { 140 9, 9 141 }; 142 143 // Shape0 144 Int depthIntShape0Sym[10] = 145 { 146 1, 3, 1, 147 3, 4, 3, 148 3, 4, 5, 5 149 }; 150 // Shape1 151 Int depthIntShape1Sym[10] = 152 { 153 5, 154 6, 155 7, 156 8, 157 5, 6, 7, 8, 9, 158 9 159 }; 160 161 162 Int* pDepthIntTabShapes[NUM_ALF_FILTER_SHAPE] = 163 { 164 depthIntShape0Sym, depthIntShape1Sym 165 }; 166 #endif 167 168 #if LCU_SYNTAX_ALF 81 169 82 Int kTableShape1[ALF_MAX_NUM_COEF+1] = 170 83 { … … 179 92 kTableShape1 180 93 }; 181 #endif182 94 183 95 // ==================================================================================================================== … … 194 106 } 195 107 196 #if LCU_SYNTAX_ALF197 108 /// AlfCUCtrlInfo 198 109 Void AlfCUCtrlInfo::reset() … … 530 441 } 531 442 532 #endif533 443 534 444 … … 543 453 m_pvpAlfLCU = NULL; 544 454 m_pvpSliceTileAlfLCU = NULL; 545 #if LCU_SYNTAX_ALF546 455 for(Int c=0; c< NUM_ALF_COMPONENT; c++) 547 456 { … … 550 459 m_varImg = NULL; 551 460 m_filterCoeffSym = NULL; 552 #endif553 461 554 462 } … … 755 663 Void TComAdaptiveLoopFilter::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth ) 756 664 { 757 #if LCU_SYNTAX_ALF758 665 destroy(); 759 #endif760 666 if ( !m_pcTempPicYuv ) 761 667 { … … 765 671 m_img_height = iPicHeight; 766 672 m_img_width = iPicWidth; 767 #if LCU_SYNTAX_ALF768 673 initMatrix_Pel(&(m_varImg), m_img_height, m_img_width); 769 #else770 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)771 {772 initMatrix_Pel(&(m_varImgMethods[i]), m_img_height, m_img_width);773 }774 #endif775 674 initMatrix_int(&m_filterCoeffSym, NO_VAR_BINS, ALF_MAX_NUM_COEF); 776 675 UInt uiNumLCUsInWidth = m_img_width / uiMaxCUWidth; … … 782 681 m_uiNumCUsInFrame = uiNumLCUsInWidth* uiNumLCUsInHeight; 783 682 784 #if LCU_SYNTAX_ALF785 683 m_numLCUInPicWidth = uiNumLCUsInWidth; 786 684 m_numLCUInPicHeight= uiNumLCUsInHeight; 787 685 m_lcuHeight = uiMaxCUHeight; 788 #if ALF_SINGLE_FILTER_SHAPE789 686 m_lineIdxPadBot = m_lcuHeight - 4 - 3; // DFRegion, Vertical Taps 790 #else791 m_lineIdxPadBot = m_lcuHeight - 4 - 4; // DFRegion, Vertical Taps792 #endif793 687 m_lineIdxPadTop = m_lcuHeight - 4; // DFRegion 794 688 795 689 m_lcuHeightChroma = m_lcuHeight>>1; 796 #if ALF_SINGLE_FILTER_SHAPE797 690 m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps 798 #else799 m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps800 #endif801 691 m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ; // DFRegion 802 692 803 693 createLCUAlfInfo(); 804 #else805 createRegionIndexMap(m_varImgMethods[ALF_RA], m_img_width, m_img_height);806 #endif807 694 } 808 695 … … 813 700 m_pcTempPicYuv->destroy(); 814 701 delete m_pcTempPicYuv; 815 #if LCU_SYNTAX_ALF816 702 m_pcTempPicYuv = NULL; 817 #endif 818 } 819 #if LCU_SYNTAX_ALF 703 } 820 704 if(m_varImg != NULL) 821 705 { … … 828 712 m_filterCoeffSym = NULL; 829 713 } 830 #else831 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)832 {833 destroyMatrix_Pel(m_varImgMethods[i]);834 }835 destroyMatrix_int(m_filterCoeffSym);836 #endif837 #if LCU_SYNTAX_ALF838 714 destroyLCUAlfInfo(); 839 #endif 840 841 } 842 843 #if !LCU_SYNTAX_ALF 844 // -------------------------------------------------------------------------------------------------------------------- 845 // allocate / free / copy functions 846 // -------------------------------------------------------------------------------------------------------------------- 847 Void TComAdaptiveLoopFilter::allocALFParam(ALFParam* pAlfParam) 848 { 849 pAlfParam->alf_flag = 0; 850 pAlfParam->coeff_chroma = new Int[ALF_MAX_NUM_COEF]; 851 ::memset(pAlfParam->coeff_chroma, 0, sizeof(Int)*ALF_MAX_NUM_COEF ); 852 pAlfParam->coeffmulti = new Int*[NO_VAR_BINS]; 853 for (int i=0; i<NO_VAR_BINS; i++) 854 { 855 pAlfParam->coeffmulti[i] = new Int[ALF_MAX_NUM_COEF]; 856 ::memset(pAlfParam->coeffmulti[i], 0, sizeof(Int)*ALF_MAX_NUM_COEF ); 857 } 858 pAlfParam->nbSPred = new Int[NO_VAR_BINS]; 859 ::memset(pAlfParam->nbSPred, 0, sizeof(Int)*NO_VAR_BINS); 860 pAlfParam->filterPattern = new Int[NO_VAR_BINS]; 861 ::memset(pAlfParam->filterPattern, 0, sizeof(Int)*NO_VAR_BINS); 862 pAlfParam->alf_pcr_region_flag = 0; 863 } 864 865 Void TComAdaptiveLoopFilter::freeALFParam(ALFParam* pAlfParam) 866 { 867 assert(pAlfParam != NULL); 868 if (pAlfParam->coeff_chroma != NULL) 869 { 870 delete[] pAlfParam->coeff_chroma; 871 pAlfParam->coeff_chroma = NULL; 872 } 873 for (int i=0; i<NO_VAR_BINS; i++) 874 { 875 delete[] pAlfParam->coeffmulti[i]; 876 pAlfParam->coeffmulti[i] = NULL; 877 } 878 delete[] pAlfParam->coeffmulti; 879 pAlfParam->coeffmulti = NULL; 880 881 delete[] pAlfParam->nbSPred; 882 pAlfParam->nbSPred = NULL; 883 884 delete[] pAlfParam->filterPattern; 885 pAlfParam->filterPattern = NULL; 886 } 887 888 889 Void TComAdaptiveLoopFilter::copyALFParam(ALFParam* pDesAlfParam, ALFParam* pSrcAlfParam) 890 { 891 pDesAlfParam->alf_flag = pSrcAlfParam->alf_flag; 892 pDesAlfParam->chroma_idc = pSrcAlfParam->chroma_idc; 893 pDesAlfParam->num_coeff = pSrcAlfParam->num_coeff; 894 pDesAlfParam->filter_shape_chroma = pSrcAlfParam->filter_shape_chroma; 895 pDesAlfParam->num_coeff_chroma = pSrcAlfParam->num_coeff_chroma; 896 pDesAlfParam->alf_pcr_region_flag = pSrcAlfParam->alf_pcr_region_flag; 897 ::memcpy(pDesAlfParam->coeff_chroma, pSrcAlfParam->coeff_chroma, sizeof(Int)*ALF_MAX_NUM_COEF); 898 pDesAlfParam->filter_shape = pSrcAlfParam->filter_shape; 899 ::memcpy(pDesAlfParam->filterPattern, pSrcAlfParam->filterPattern, sizeof(Int)*NO_VAR_BINS); 900 pDesAlfParam->startSecondFilter = pSrcAlfParam->startSecondFilter; 901 902 //Coeff send related 903 pDesAlfParam->filters_per_group = pSrcAlfParam->filters_per_group; //this can be updated using codedVarBins 904 pDesAlfParam->predMethod = pSrcAlfParam->predMethod; 905 ::memcpy(pDesAlfParam->nbSPred, pSrcAlfParam->nbSPred, sizeof(Int)*NO_VAR_BINS); 906 for (int i=0; i<NO_VAR_BINS; i++) 907 { 908 ::memcpy(pDesAlfParam->coeffmulti[i], pSrcAlfParam->coeffmulti[i], sizeof(Int)*ALF_MAX_NUM_COEF); 909 } 910 } 911 // -------------------------------------------------------------------------------------------------------------------- 912 // prediction of filter coefficients 913 // -------------------------------------------------------------------------------------------------------------------- 914 915 Void TComAdaptiveLoopFilter::predictALFCoeffChroma( ALFParam* pAlfParam ) 916 { 917 Int i, sum, pred, N; 918 const Int* pFiltMag = NULL; 919 pFiltMag = weightsTabShapes[pAlfParam->filter_shape_chroma]; 920 N = pAlfParam->num_coeff_chroma; 921 sum=0; 922 for(i=0; i<N;i++) 923 { 924 sum+=pFiltMag[i]*pAlfParam->coeff_chroma[i]; 925 } 926 pred=(1<<ALF_NUM_BIT_SHIFT)-(sum-pAlfParam->coeff_chroma[N-1]); 927 #if ALF_CHROMA_COEF_PRED_HARMONIZATION 928 pAlfParam->coeff_chroma[N-1]=pAlfParam->coeff_chroma[N-1] - pred; 929 #else 930 pAlfParam->coeff_chroma[N-1]=pred-pAlfParam->coeff_chroma[N-1]; 931 #endif 932 } 933 934 #if ALF_CHROMA_COEF_PRED_HARMONIZATION 935 Void TComAdaptiveLoopFilter::reconstructALFCoeffChroma( ALFParam* pAlfParam ) 936 { 937 Int i, sum, pred, N; 938 const Int* pFiltMag = NULL; 939 pFiltMag = weightsTabShapes[pAlfParam->filter_shape_chroma]; 940 N = pAlfParam->num_coeff_chroma; 941 sum=0; 942 for(i=0; i<N;i++) 943 { 944 sum+=pFiltMag[i]*pAlfParam->coeff_chroma[i]; 945 } 946 pred=(1<<ALF_NUM_BIT_SHIFT)-(sum-pAlfParam->coeff_chroma[N-1]); 947 pAlfParam->coeff_chroma[N-1]=pred+ pAlfParam->coeff_chroma[N-1]; 948 } 949 #endif 950 #endif 715 716 } 717 951 718 952 719 // -------------------------------------------------------------------------------------------------------------------- … … 954 721 // -------------------------------------------------------------------------------------------------------------------- 955 722 956 #if LCU_SYNTAX_ALF957 723 /** ALF reconstruction process for one picture 958 724 * \param [in, out] pcPic the decoded/filtered picture (input: decoded picture; output filtered picture) … … 1113 879 } 1114 880 1115 #else1116 1117 /**1118 \param [in, out] pcPic picture (TComPic) class (input/output)1119 \param [in] pcAlfParam ALF parameter1120 \param [in,out] vAlfCUCtrlParam ALF CU control parameters1121 \todo for temporal buffer, it uses residual picture buffer, which may not be safe. Make it be safer.1122 */1123 Void TComAdaptiveLoopFilter::ALFProcess(TComPic* pcPic, ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)1124 {1125 assert(m_uiNumSlicesInPic == vAlfCUCtrlParam.size());1126 if(!pcAlfParam->alf_flag)1127 {1128 return;1129 }1130 1131 m_lcuHeight = pcPic->getSlice(0)->getSPS()->getMaxCUHeight();1132 #if ALF_SINGLE_FILTER_SHAPE1133 m_lineIdxPadBot = m_lcuHeight - 4 - 3; // DFRegion, Vertical Taps1134 #else1135 m_lineIdxPadBot = m_lcuHeight - 4 - 4; // DFRegion, Vertical Taps1136 #endif1137 m_lineIdxPadTop = m_lcuHeight - 4; // DFRegion1138 1139 m_lcuHeightChroma = m_lcuHeight>>1;1140 #if ALF_SINGLE_FILTER_SHAPE1141 m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps1142 #else1143 m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps1144 #endif1145 m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ; // DFRegion1146 1147 TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();1148 TComPicYuv* pcPicYuvExtRec = m_pcTempPicYuv;1149 pcPicYuvRec ->copyToPic ( pcPicYuvExtRec );1150 pcPicYuvExtRec->setBorderExtension ( false );1151 pcPicYuvExtRec->extendPicBorder ();1152 1153 if(m_uiNumSlicesInPic == 1)1154 {1155 AlfCUCtrlInfo* pcAlfCtrlParam = &(vAlfCUCtrlParam[0]);1156 if(pcAlfCtrlParam->cu_control_flag)1157 {1158 UInt idx = 0;1159 for(UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame(); uiCUAddr++)1160 {1161 TComDataCU *pcCU = pcPic->getCU(uiCUAddr);1162 setAlfCtrlFlags(pcAlfCtrlParam, pcCU, 0, 0, idx);1163 }1164 }1165 }1166 else1167 {1168 transferCtrlFlagsFromAlfParam(vAlfCUCtrlParam);1169 }1170 xALFLuma(pcPic, pcAlfParam, vAlfCUCtrlParam, pcPicYuvExtRec, pcPicYuvRec);1171 if(pcAlfParam->chroma_idc)1172 {1173 #if ALF_CHROMA_COEF_PRED_HARMONIZATION1174 reconstructALFCoeffChroma(pcAlfParam);1175 #else1176 predictALFCoeffChroma(pcAlfParam);1177 #endif1178 checkFilterCoeffValue(pcAlfParam->coeff_chroma, pcAlfParam->num_coeff_chroma, true );1179 1180 xALFChroma( pcAlfParam, pcPicYuvExtRec, pcPicYuvRec);1181 }1182 }1183 #endif1184 881 // ==================================================================================================================== 1185 882 // Protected member functions … … 1216 913 } 1217 914 1218 #if !LCU_SYNTAX_ALF1219 1220 Void TComAdaptiveLoopFilter::xALFLuma(TComPic* pcPic, ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam,TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)1221 {1222 Int LumaStride = pcPicDec->getStride();1223 Pel* pDec = pcPicDec->getLumaAddr();1224 Pel* pRest = pcPicRest->getLumaAddr();1225 1226 decodeFilterSet(pcAlfParam, m_varIndTab, m_filterCoeffSym);1227 1228 m_uiVarGenMethod = pcAlfParam->alf_pcr_region_flag;1229 m_varImg = m_varImgMethods[m_uiVarGenMethod];1230 calcVar(m_varImg, pRest, LumaStride, pcAlfParam->alf_pcr_region_flag);1231 1232 if(!m_bUseNonCrossALF)1233 {1234 Bool bCUCtrlEnabled = false;1235 for(UInt s=0; s< m_uiNumSlicesInPic; s++)1236 {1237 if(!pcPic->getValidSlice(s))1238 {1239 continue;1240 }1241 if( vAlfCUCtrlParam[s].cu_control_flag == 1)1242 {1243 bCUCtrlEnabled = true;1244 }1245 }1246 1247 if(bCUCtrlEnabled)1248 {1249 xCUAdaptive(pcPic, pcAlfParam->filter_shape, pRest, pDec, LumaStride);1250 }1251 else1252 {1253 filterLuma(pRest, pDec, LumaStride, 0, m_img_height-1, 0, m_img_width-1, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);1254 }1255 }1256 else1257 {1258 Pel* pTemp = m_pcSliceYuvTmp->getLumaAddr();1259 for(UInt s=0; s< m_uiNumSlicesInPic; s++)1260 {1261 if(!pcPic->getValidSlice(s))1262 {1263 continue;1264 }1265 std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];1266 1267 for(Int t=0; t< (Int)vpSliceTileAlfLCU.size(); t++)1268 {1269 std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];1270 1271 copyRegion(vpAlfLCU, pTemp, pDec, LumaStride);1272 extendRegionBorder(vpAlfLCU, pTemp, LumaStride);1273 if(vAlfCUCtrlParam[s].cu_control_flag == 1)1274 {1275 xCUAdaptiveRegion(vpAlfLCU, pTemp, pRest, LumaStride, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);1276 }1277 else1278 {1279 filterLumaRegion(vpAlfLCU, pTemp, pRest, LumaStride, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);1280 }1281 }1282 }1283 }1284 }1285 1286 Void TComAdaptiveLoopFilter::decodeFilterSet(ALFParam* pcAlfParam, Int* varIndTab, Int** filterCoeff)1287 {1288 // reconstruct merge table1289 memset(m_varIndTab, 0, NO_VAR_BINS * sizeof(Int));1290 if(pcAlfParam->filters_per_group > 1)1291 {1292 for(Int i = 1; i < NO_VAR_BINS; ++i)1293 {1294 if(pcAlfParam->filterPattern[i])1295 {1296 varIndTab[i] = varIndTab[i-1] + 1;1297 }1298 else1299 {1300 varIndTab[i] = varIndTab[i-1];1301 }1302 }1303 }1304 predictALFCoeffLuma( pcAlfParam);1305 // reconstruct filter sets1306 reconstructFilterCoeffs( pcAlfParam, filterCoeff);1307 1308 }1309 1310 1311 Void TComAdaptiveLoopFilter::filterLuma(Pel *pImgRes, Pel *pImgPad, Int stride,1312 Int ypos, Int yposEnd, Int xpos, Int xposEnd,1313 Int filtNo, Int** filterSet, Int* mergeTable, Pel** ppVarImg)1314 {1315 static Int numBitsMinus1= (Int)ALF_NUM_BIT_SHIFT;1316 static Int offset = (1<<( (Int)ALF_NUM_BIT_SHIFT-1));1317 static Int shiftHeight = (Int)(log((double)VAR_SIZE_H)/log(2.0));1318 static Int shiftWidth = (Int)(log((double)VAR_SIZE_W)/log(2.0));1319 1320 Pel *pImgPad1,*pImgPad2,*pImgPad3,*pImgPad4;1321 Pel *pVar;1322 Int i, j, pixelInt;1323 Int *coef = NULL;1324 1325 pImgPad += (ypos*stride);1326 pImgRes += (ypos*stride);1327 1328 Int yLineInLCU;1329 Int paddingLine;1330 #if !ALF_SINGLE_FILTER_SHAPE1331 Int varInd = 0;1332 #endif1333 Int newCenterCoeff[4][NO_VAR_BINS];1334 1335 for(i=0; i< 4; i++)1336 {1337 ::memset(&(newCenterCoeff[i][0]), 0, sizeof(Int)*NO_VAR_BINS);1338 }1339 1340 #if ALF_SINGLE_FILTER_SHAPE1341 if(filtNo == ALF_CROSS9x7_SQUARE3x3)1342 #else1343 if(filtNo == ALF_CROSS9x9)1344 #endif1345 {1346 for (i=0; i<NO_VAR_BINS; i++)1347 {1348 coef = filterSet[i];1349 //VB line 11350 newCenterCoeff[0][i] = coef[8] + ((coef[0] + coef[1] + coef[2] + coef[3])<<1);1351 //VB line 21352 newCenterCoeff[1][i] = coef[8] + ((coef[0] + coef[1] + coef[2])<<1);1353 //VB line 31354 newCenterCoeff[2][i] = coef[8] + ((coef[0] + coef[1])<<1);1355 //VB line 41356 newCenterCoeff[3][i] = coef[8] + ((coef[0])<<1);1357 }1358 }1359 1360 1361 switch(filtNo)1362 {1363 #if !ALF_SINGLE_FILTER_SHAPE1364 case ALF_STAR5x5:1365 {1366 for(i= ypos; i<= yposEnd; i++)1367 {1368 1369 yLineInLCU = i % m_lcuHeight;1370 1371 if (yLineInLCU<m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height)1372 {1373 pImgPad1 = pImgPad + stride;1374 pImgPad2 = pImgPad - stride;1375 pImgPad3 = pImgPad + 2*stride;1376 pImgPad4 = pImgPad - 2*stride;1377 }1378 else if (yLineInLCU<m_lineIdxPadTop)1379 {1380 paddingLine = - yLineInLCU + m_lineIdxPadTop - 1;1381 pImgPad1 = pImgPad + min(paddingLine, 1)*stride;1382 pImgPad2 = pImgPad - stride;1383 pImgPad3 = pImgPad + min(paddingLine, 2)*stride;1384 pImgPad4 = pImgPad - 2*stride;1385 }1386 else1387 {1388 paddingLine = yLineInLCU - m_lineIdxPadTop ;1389 pImgPad1 = pImgPad + stride;1390 pImgPad2 = pImgPad - min(paddingLine, 1)*stride;1391 pImgPad3 = pImgPad + 2*stride;1392 pImgPad4 = pImgPad - min(paddingLine, 2)*stride;1393 }1394 1395 pVar = ppVarImg[i>>shiftHeight] + (xpos>>shiftWidth);1396 1397 if ( (yLineInLCU == m_lineIdxPadTop || yLineInLCU == m_lineIdxPadTop-1) && i-yLineInLCU+m_lcuHeight < m_img_height )1398 {1399 for(j= xpos; j<= xposEnd; j++)1400 {1401 pImgRes[j] = pImgPad[j];1402 }1403 }1404 else if ( (yLineInLCU == m_lineIdxPadTop+1 || yLineInLCU == m_lineIdxPadTop-2) && i-yLineInLCU+m_lcuHeight < m_img_height )1405 {1406 for(j= xpos; j<= xposEnd ; j++)1407 {1408 if (j % VAR_SIZE_W==0)1409 {1410 coef = filterSet[mergeTable[*(pVar++)]];1411 }1412 1413 pixelInt = 0;1414 1415 pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);1416 pixelInt += coef[1]* (pImgPad3[j ]+pImgPad4[j ]);1417 pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);1418 1419 pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);1420 pixelInt += coef[4]* (pImgPad1[j ]+pImgPad2[j ]);1421 pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);1422 1423 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);1424 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);1425 pixelInt += coef[8]* (pImgPad[j ]);1426 1427 pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);1428 pImgRes[j] = ( Clip( pixelInt ) + pImgPad[j] ) >> 1;1429 }1430 }1431 else1432 {1433 1434 for(j= xpos; j<= xposEnd ; j++)1435 {1436 if (j % VAR_SIZE_W==0)1437 {1438 coef = filterSet[mergeTable[*(pVar++)]];1439 }1440 1441 pixelInt = 0;1442 1443 pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);1444 pixelInt += coef[1]* (pImgPad3[j ]+pImgPad4[j ]);1445 pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);1446 1447 pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);1448 pixelInt += coef[4]* (pImgPad1[j ]+pImgPad2[j ]);1449 pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);1450 1451 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);1452 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);1453 pixelInt += coef[8]* (pImgPad[j ]);1454 1455 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);1456 pImgRes[j] = Clip( pixelInt );1457 }1458 1459 }1460 1461 pImgPad += stride;1462 pImgRes += stride;1463 }1464 }1465 break;1466 case ALF_CROSS9x9:1467 {1468 Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8;1469 #else1470 case ALF_CROSS9x7_SQUARE3x3:1471 {1472 Pel *pImgPad5, *pImgPad6;1473 #endif1474 for(i= ypos; i<= yposEnd; i++)1475 {1476 yLineInLCU = i % m_lcuHeight;1477 1478 if (yLineInLCU<m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height)1479 {1480 pImgPad1 = pImgPad + stride;1481 pImgPad2 = pImgPad - stride;1482 pImgPad3 = pImgPad + 2*stride;1483 pImgPad4 = pImgPad - 2*stride;1484 pImgPad5 = pImgPad + 3*stride;1485 pImgPad6 = pImgPad - 3*stride;1486 #if !ALF_SINGLE_FILTER_SHAPE1487 pImgPad7 = pImgPad + 4*stride;1488 pImgPad8 = pImgPad - 4*stride;1489 #endif1490 }1491 else if (yLineInLCU<m_lineIdxPadTop)1492 {1493 paddingLine = - yLineInLCU + m_lineIdxPadTop - 1;1494 #if ALF_SINGLE_FILTER_SHAPE1495 pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad + min(paddingLine, 1)*stride;1496 pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad - stride;1497 pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + min(paddingLine, 2)*stride;1498 pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - 2*stride;1499 pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + min(paddingLine, 3)*stride;1500 pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - 3*stride;1501 #else1502 pImgPad1 = pImgPad + min(paddingLine, 1)*stride;1503 pImgPad2 = pImgPad - stride;1504 pImgPad3 = pImgPad + min(paddingLine, 2)*stride;1505 pImgPad4 = pImgPad - 2*stride;1506 pImgPad5 = pImgPad + min(paddingLine, 3)*stride;1507 pImgPad6 = pImgPad - 3*stride;1508 pImgPad7 = pImgPad + min(paddingLine, 4)*stride;1509 pImgPad8 = pImgPad - 4*stride;1510 #endif1511 }1512 else1513 {1514 paddingLine = yLineInLCU - m_lineIdxPadTop ;1515 #if ALF_SINGLE_FILTER_SHAPE1516 pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad + stride;1517 pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad - min(paddingLine, 1)*stride;1518 pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + 2*stride;1519 pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - min(paddingLine, 2)*stride;1520 pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + 3*stride;1521 pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - min(paddingLine, 3)*stride;1522 #else1523 pImgPad1 = pImgPad + stride;1524 pImgPad2 = pImgPad - min(paddingLine, 1)*stride;1525 pImgPad3 = pImgPad + 2*stride;1526 pImgPad4 = pImgPad - min(paddingLine, 2)*stride;1527 pImgPad5 = pImgPad + 3*stride;1528 pImgPad6 = pImgPad - min(paddingLine, 3)*stride;1529 pImgPad7 = pImgPad + 4*stride;1530 pImgPad8 = pImgPad - min(paddingLine, 4)*stride;1531 #endif1532 }1533 1534 pVar = ppVarImg[i>>shiftHeight] + (xpos>>shiftWidth);1535 1536 #if ALF_SINGLE_FILTER_SHAPE1537 {1538 for(j= xpos; j<= xposEnd ; j++)1539 {1540 if (j % VAR_SIZE_W==0)1541 {1542 coef = filterSet[mergeTable[*(pVar++)]];1543 }1544 1545 pixelInt = 0;1546 1547 pixelInt += coef[0]* (pImgPad5[j]+pImgPad6[j]);1548 pixelInt += coef[1]* (pImgPad3[j]+pImgPad4[j]);1549 pixelInt += coef[2]* (pImgPad1[j-1]+pImgPad2[j+1]);1550 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);1551 pixelInt += coef[4]* (pImgPad1[j+1]+pImgPad2[j-1]);1552 pixelInt += coef[5]* (pImgPad[j+4]+pImgPad[j-4]);1553 pixelInt += coef[6]* (pImgPad[j+3]+pImgPad[j-3]);1554 pixelInt += coef[7]* (pImgPad[j+2]+pImgPad[j-2]);1555 pixelInt += coef[8]* (pImgPad[j+1]+pImgPad[j-1]);1556 pixelInt += coef[9]* (pImgPad[j ]);1557 1558 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);1559 pImgRes[j] = Clip( pixelInt );1560 }1561 }1562 #else1563 if ( (yLineInLCU == m_lineIdxPadTop || yLineInLCU == m_lineIdxPadTop-1) && i-yLineInLCU+m_lcuHeight < m_img_height )1564 {1565 for(j= xpos; j<= xposEnd ; j++)1566 {1567 if (j % VAR_SIZE_W==0)1568 {1569 varInd = *(pVar++);1570 coef = filterSet[mergeTable[varInd]];1571 }1572 1573 pixelInt = 0;1574 1575 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);1576 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);1577 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);1578 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);1579 pixelInt += newCenterCoeff[0][mergeTable[varInd]]* (pImgPad[j]);1580 1581 pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);1582 pImgRes[j] = Clip( pixelInt );1583 }1584 }1585 else if ( (yLineInLCU == m_lineIdxPadTop+1 || yLineInLCU == m_lineIdxPadTop-2) && i-yLineInLCU+m_lcuHeight < m_img_height )1586 {1587 for(j= xpos; j<= xposEnd ; j++)1588 {1589 if (j % VAR_SIZE_W==0)1590 {1591 varInd = *(pVar++);1592 coef = filterSet[mergeTable[varInd]];1593 }1594 1595 pixelInt = 0;1596 1597 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);1598 1599 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);1600 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);1601 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);1602 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);1603 pixelInt += newCenterCoeff[1][mergeTable[varInd]]* (pImgPad[j]);1604 1605 pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);1606 pImgRes[j] = Clip( pixelInt );1607 }1608 }1609 else if ( (yLineInLCU == m_lineIdxPadTop+2 || yLineInLCU == m_lineIdxPadTop-3) && i-yLineInLCU+m_lcuHeight < m_img_height )1610 {1611 for(j= xpos; j<= xposEnd ; j++)1612 {1613 if (j % VAR_SIZE_W==0)1614 {1615 varInd = *(pVar++);1616 coef = filterSet[mergeTable[varInd]];1617 }1618 1619 pixelInt = 0;1620 1621 pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);1622 1623 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);1624 1625 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);1626 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);1627 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);1628 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);1629 pixelInt += newCenterCoeff[2][mergeTable[varInd]]* (pImgPad[j ]);1630 1631 pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);1632 pImgRes[j] = Clip( pixelInt );1633 }1634 }1635 else if ( (yLineInLCU == m_lineIdxPadTop+3 || yLineInLCU == m_lineIdxPadTop-4) && i-yLineInLCU+m_lcuHeight < m_img_height )1636 {1637 for(j= xpos; j<= xposEnd ; j++)1638 {1639 if (j % VAR_SIZE_W==0)1640 {1641 varInd = *(pVar++);1642 coef = filterSet[mergeTable[varInd]];1643 }1644 1645 pixelInt = 0;1646 1647 pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);1648 1649 pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);1650 1651 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);1652 1653 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);1654 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);1655 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);1656 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);1657 pixelInt += newCenterCoeff[3][mergeTable[varInd]]* (pImgPad[j ]);1658 1659 pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);1660 pImgRes[j] = Clip( pixelInt );1661 }1662 }1663 else1664 {1665 for(j= xpos; j<= xposEnd ; j++)1666 {1667 if (j % VAR_SIZE_W==0)1668 {1669 coef = filterSet[mergeTable[*(pVar++)]];1670 }1671 1672 pixelInt = 0;1673 1674 pixelInt += coef[0]* (pImgPad7[j]+pImgPad8[j]);1675 1676 pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);1677 1678 pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);1679 1680 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);1681 1682 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);1683 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);1684 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);1685 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);1686 pixelInt += coef[8]* (pImgPad[j ]);1687 1688 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);1689 pImgRes[j] = Clip( pixelInt );1690 }1691 }1692 #endif1693 pImgPad += stride;1694 pImgRes += stride;1695 }1696 }1697 break;1698 default:1699 {1700 printf("Not a supported filter shape\n");1701 assert(0);1702 exit(1);1703 }1704 }1705 }1706 1707 1708 1709 Void TComAdaptiveLoopFilter::xCUAdaptive(TComPic* pcPic, Int filtNo, Pel *imgYFilt, Pel *imgYRec, Int Stride)1710 {1711 // for every CU, call CU-adaptive ALF process1712 for( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame() ; uiCUAddr++ )1713 {1714 TComDataCU* pcCU = pcPic->getCU( uiCUAddr );1715 xSubCUAdaptive(pcCU, filtNo, imgYFilt, imgYRec, 0, 0, Stride);1716 }1717 }1718 1719 Void TComAdaptiveLoopFilter::xSubCUAdaptive(TComDataCU* pcCU, Int filtNo, Pel *imgYFilt, Pel *imgYRec, UInt uiAbsPartIdx, UInt uiDepth, Int Stride)1720 {1721 TComPic* pcPic = pcCU->getPic();1722 1723 if(pcPic==NULL)1724 {1725 return;1726 }1727 Bool bBoundary = false;1728 UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];1729 UInt uiRPelX = uiLPelX + (g_uiMaxCUWidth>>uiDepth) - 1;1730 UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];1731 UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;1732 1733 // check picture boundary1734 if ( ( uiRPelX >= m_img_width ) || ( uiBPelY >= m_img_height ) )1735 {1736 bBoundary = true;1737 }1738 1739 if ( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < (g_uiMaxCUDepth-g_uiAddCUDepth) ) ) || bBoundary )1740 {1741 UInt uiQNumParts = ( pcPic->getNumPartInCU() >> (uiDepth<<1) )>>2;1742 for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++, uiAbsPartIdx+=uiQNumParts )1743 {1744 uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];1745 uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];1746 1747 if( ( uiLPelX < m_img_width ) && ( uiTPelY < m_img_height ) )1748 xSubCUAdaptive(pcCU, filtNo, imgYFilt, imgYRec, uiAbsPartIdx, uiDepth+1, Stride);1749 }1750 return;1751 }1752 1753 if ( pcCU->getAlfCtrlFlag(uiAbsPartIdx) )1754 {1755 filterLuma(imgYFilt, imgYRec, Stride, uiTPelY, min(uiBPelY,(unsigned int)(m_img_height-1)), uiLPelX, min(uiRPelX,(unsigned int)(m_img_width-1))1756 ,filtNo, m_filterCoeffSym, m_varIndTab, m_varImg);1757 }1758 }1759 1760 /** Predict ALF luma filter coefficients. Centre coefficient is always predicted. Left neighbour is predicted according to flag.1761 */1762 Void TComAdaptiveLoopFilter::predictALFCoeffLuma(ALFParam* pcAlfParam)1763 {1764 Int sum, coeffPred, ind;1765 const Int* pFiltMag = NULL;1766 pFiltMag = weightsTabShapes[pcAlfParam->filter_shape];1767 for(ind = 0; ind < pcAlfParam->filters_per_group; ++ind)1768 {1769 sum = 0;1770 for(Int i = 0; i < pcAlfParam->num_coeff-2; i++)1771 {1772 sum += pFiltMag[i]*pcAlfParam->coeffmulti[ind][i];1773 }1774 if(pcAlfParam->nbSPred[ind]==0)1775 {1776 if((pcAlfParam->predMethod==0)|(ind==0))1777 {1778 coeffPred = ((1<<ALF_NUM_BIT_SHIFT)-sum) >> 2;1779 }1780 else1781 {1782 coeffPred = (0-sum) >> 2;1783 }1784 pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-2] = coeffPred + pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-2];1785 }1786 sum += pFiltMag[pcAlfParam->num_coeff-2]*pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-2];1787 if((pcAlfParam->predMethod==0)|(ind==0))1788 {1789 coeffPred = (1<<ALF_NUM_BIT_SHIFT)-sum;1790 }1791 else1792 {1793 coeffPred = -sum;1794 }1795 pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-1] = coeffPred + pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-1];1796 }1797 }1798 1799 Void TComAdaptiveLoopFilter::reconstructFilterCoeffs(ALFParam* pcAlfParam,int **pfilterCoeffSym)1800 {1801 int i, ind;1802 1803 // Copy non zero filters in filterCoeffTmp1804 for(ind = 0; ind < pcAlfParam->filters_per_group; ++ind)1805 {1806 for(i = 0; i < pcAlfParam->num_coeff; i++)1807 {1808 pfilterCoeffSym[ind][i] = pcAlfParam->coeffmulti[ind][i];1809 }1810 }1811 // Undo prediction1812 for(ind = 1; ind < pcAlfParam->filters_per_group; ++ind)1813 {1814 if(pcAlfParam->predMethod)1815 {1816 // Prediction1817 for(i = 0; i < pcAlfParam->num_coeff; ++i)1818 {1819 pfilterCoeffSym[ind][i] = (int)(pfilterCoeffSym[ind][i] + pfilterCoeffSym[ind - 1][i]);1820 }1821 }1822 }1823 1824 for(ind = 0; ind < pcAlfParam->filters_per_group; ind++)1825 {1826 checkFilterCoeffValue(pfilterCoeffSym[ind], pcAlfParam->num_coeff, false );1827 }1828 }1829 1830 1831 #endif1832 915 1833 916 static Pel Clip_post(int high, int val) … … 1836 919 } 1837 920 1838 #if !LCU_SYNTAX_ALF1839 1840 /** Calculate ALF grouping indices for block-based (BA) mode1841 * \param [out] imgYvar grouping indices buffer1842 * \param [in] imgYpad picture buffer1843 * \param [in] stride picture stride size1844 * \param [in] adaptationMode ALF_BA or ALF_RA mode1845 */1846 Void TComAdaptiveLoopFilter::calcVar(Pel **imgYvar, Pel *imgYpad, Int stride, Int adaptationMode)1847 {1848 if(adaptationMode == ALF_RA)1849 {1850 return;1851 }1852 static Int shiftH = (Int)(log((double)VAR_SIZE_H)/log(2.0));1853 static Int shiftW = (Int)(log((double)VAR_SIZE_W)/log(2.0));1854 static Int varmax = (Int)NO_VAR_BINS-1;1855 #if ALF_16_BA_GROUPS1856 static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};1857 static Int avgVarTab[3][6] = { {0, 1, 2, 3, 4, 5,},1858 {0, 6, 7, 8, 9, 10,},1859 {0, 11, 12, 13, 14, 15} };1860 #else1861 static Int step1 = (Int)((Int)(NO_VAR_BINS)/3) - 1;1862 static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4};1863 #endif1864 Int i, j, avgvar, vertical, horizontal,direction, yoffset;1865 Pel *pimgYpad, *pimgYpadup, *pimgYpaddown;1866 1867 for(i = 0; i < m_img_height - 3; i=i+4)1868 {1869 yoffset = ((i)*stride) + stride;1870 pimgYpad = &imgYpad [yoffset];1871 pimgYpadup = &imgYpad [yoffset + stride];1872 pimgYpaddown = &imgYpad [yoffset - stride];1873 1874 for(j = 0; j < m_img_width - 3 ; j=j+4)1875 {1876 // Compute at sub-sample by 21877 vertical = abs((pimgYpad[j+1]<<1 ) - pimgYpaddown[j+1] - pimgYpadup[j+1]);1878 horizontal = abs((pimgYpad[j+1]<<1 ) - pimgYpad [j+2] - pimgYpad [j ]);1879 1880 vertical += abs((pimgYpad[j+2]<<1 ) - pimgYpaddown[j+2] - pimgYpadup[j+2]);1881 horizontal += abs((pimgYpad[j+2]<<1 ) - pimgYpad [j+3] - pimgYpad [j+1]);1882 1883 vertical += abs((pimgYpad[j+1+stride]<<1) - pimgYpaddown[j+1+stride] - pimgYpadup[j+1+stride]);1884 horizontal += abs((pimgYpad[j+1+stride]<<1) - pimgYpad [j+2+stride] - pimgYpad [j+stride ]);1885 1886 vertical += abs((pimgYpad[j+2+stride]<<1) - pimgYpaddown[j+2+stride] - pimgYpadup[j+2+stride]);1887 horizontal += abs((pimgYpad[j+2+stride]<<1) - pimgYpad [j+3+stride] - pimgYpad [j+1+stride]);1888 1889 direction = 0;1890 if (vertical > 2*horizontal)1891 {1892 direction = 1; //vertical1893 }1894 if (horizontal > 2*vertical)1895 {1896 direction = 2; //horizontal1897 }1898 1899 avgvar = (vertical + horizontal) >> 2;1900 avgvar = (Pel) Clip_post(varmax, avgvar >>(g_uiBitIncrement+1));1901 avgvar = th[avgvar];1902 #if ALF_16_BA_GROUPS1903 avgvar = avgVarTab[direction][avgvar];1904 #else1905 avgvar = Clip_post(step1, (Int) avgvar ) + (step1+1)*direction;1906 #endif1907 imgYvar[(i )>>shiftH][(j)>>shiftW] = avgvar;1908 }1909 }1910 }1911 1912 Void TComAdaptiveLoopFilter::createRegionIndexMap(Pel **imgYVar, Int imgWidth, Int imgHeight)1913 {1914 int varStepSizeWidth = VAR_SIZE_W;1915 int varStepSizeHeight = VAR_SIZE_H;1916 int shiftHeight = (int)(log((double)varStepSizeHeight)/log(2.0));1917 int shiftWidth = (int)(log((double)varStepSizeWidth)/log(2.0));1918 1919 int i, j;1920 int regionTable[NO_VAR_BINS] = {0, 1, 4, 5, 15, 2, 3, 6, 14, 11, 10, 7, 13, 12, 9, 8};1921 int xInterval;1922 int yInterval;1923 int yIndex;1924 int yIndexOffset;1925 int yStartLine;1926 int yEndLine;1927 1928 xInterval = ((( (imgWidth+63)/64) + 1) / 4 * 64)>>shiftWidth;1929 yInterval = ((((imgHeight+63)/64) + 1) / 4 * 64)>>shiftHeight;1930 1931 for (yIndex = 0; yIndex < 4 ; yIndex++)1932 {1933 yIndexOffset = yIndex * 4;1934 yStartLine = yIndex * yInterval;1935 yEndLine = (yIndex == 3) ? imgHeight>>shiftHeight : (yStartLine+yInterval);1936 1937 for(i = yStartLine; i < yEndLine ; i++)1938 {1939 for(j = 0; j < xInterval ; j++)1940 {1941 imgYVar[i][j] = regionTable[yIndexOffset+0];1942 }1943 1944 for(j = xInterval; j < xInterval*2 ; j++)1945 {1946 imgYVar[i][j] = regionTable[yIndexOffset+1];1947 }1948 1949 for(j = xInterval*2; j < xInterval*3 ; j++)1950 {1951 imgYVar[i][j] = regionTable[yIndexOffset+2];1952 }1953 1954 for(j = xInterval*3; j < imgWidth>>shiftWidth ; j++)1955 {1956 imgYVar[i][j] = regionTable[yIndexOffset+3];1957 }1958 }1959 }1960 1961 }1962 1963 // --------------------------------------------------------------------------------------------------------------------1964 // ALF for chroma1965 // --------------------------------------------------------------------------------------------------------------------1966 1967 /**1968 \param pcPicDec picture before ALF1969 \param pcPicRest picture after ALF1970 \param qh filter coefficient1971 \param iTap filter tap1972 \param iColor 0 for Cb and 1 for Cr1973 */1974 Void TComAdaptiveLoopFilter::filterChroma(Pel *pImgRes, Pel *pImgPad, Int stride,1975 Int ypos, Int yposEnd, Int xpos, Int xposEnd,1976 Int filtNo, Int* coef)1977 {1978 static Int numBitsMinus1= (Int)ALF_NUM_BIT_SHIFT;1979 static Int offset = (1<<( (Int)ALF_NUM_BIT_SHIFT-1));1980 1981 Pel *pImgPad1,*pImgPad2,*pImgPad3,*pImgPad4;1982 Int i, j, pixelInt;1983 1984 pImgPad += (ypos*stride);1985 pImgRes += (ypos*stride);1986 1987 Int imgHeightChroma = m_img_height>>1;1988 Int yLineInLCU;1989 Int paddingline;1990 Int newCenterCoeff[4];1991 1992 ::memset(newCenterCoeff, 0, sizeof(Int)*4);1993 #if ALF_SINGLE_FILTER_SHAPE1994 if(filtNo == ALF_CROSS9x7_SQUARE3x3)1995 #else1996 if (filtNo == ALF_CROSS9x9)1997 #endif1998 {1999 //VB line 12000 newCenterCoeff[0] = coef[8] + ((coef[0] + coef[1] + coef[2] + coef[3])<<1);2001 //VB line 22002 newCenterCoeff[1] = coef[8] + ((coef[0] + coef[1] + coef[2])<<1);2003 //VB line 32004 newCenterCoeff[2] = coef[8] + ((coef[0] + coef[1])<<1);2005 //VB line 42006 newCenterCoeff[3] = coef[8] + ((coef[0])<<1);2007 }2008 2009 switch(filtNo)2010 {2011 #if !ALF_SINGLE_FILTER_SHAPE2012 case ALF_STAR5x5:2013 {2014 for(i= ypos; i<= yposEnd; i++)2015 {2016 yLineInLCU = i % m_lcuHeightChroma;2017 2018 if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )2019 {2020 pImgPad1 = pImgPad + stride;2021 pImgPad2 = pImgPad - stride;2022 pImgPad3 = pImgPad + 2*stride;2023 pImgPad4 = pImgPad - 2*stride;2024 }2025 else if (yLineInLCU < m_lineIdxPadTopChroma)2026 {2027 paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;2028 pImgPad1 = pImgPad + min(paddingline, 1)*stride;2029 pImgPad2 = pImgPad - stride;2030 pImgPad3 = pImgPad + min(paddingline, 2)*stride;2031 pImgPad4 = pImgPad - 2*stride;2032 }2033 else2034 {2035 paddingline = yLineInLCU - m_lineIdxPadTopChroma ;2036 pImgPad1 = pImgPad + stride;2037 pImgPad2 = pImgPad - min(paddingline, 1)*stride;2038 pImgPad3 = pImgPad + 2*stride;2039 pImgPad4 = pImgPad - min(paddingline, 2)*stride;2040 }2041 2042 if ( (yLineInLCU == m_lineIdxPadTopChroma || yLineInLCU == m_lineIdxPadTopChroma-1) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )2043 {2044 for(j= xpos; j<= xposEnd ; j++)2045 {2046 pImgRes[j] = pImgPad[j];2047 }2048 }2049 else if ( (yLineInLCU == m_lineIdxPadTopChroma+1 || yLineInLCU == m_lineIdxPadTopChroma-2) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )2050 {2051 for(j= xpos; j<= xposEnd ; j++)2052 {2053 pixelInt = 0;2054 2055 pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);2056 pixelInt += coef[1]* (pImgPad3[j ]+pImgPad4[j ]);2057 pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);2058 2059 pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);2060 pixelInt += coef[4]* (pImgPad1[j ]+pImgPad2[j ]);2061 pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);2062 2063 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);2064 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);2065 pixelInt += coef[8]* (pImgPad[j ]);2066 2067 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2068 2069 pImgRes[j] = (Clip( pixelInt ) + pImgPad[j]) >> 1;2070 }2071 }2072 else2073 {2074 2075 for(j= xpos; j<= xposEnd ; j++)2076 {2077 pixelInt = 0;2078 2079 pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);2080 pixelInt += coef[1]* (pImgPad3[j ]+pImgPad4[j ]);2081 pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);2082 2083 pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);2084 pixelInt += coef[4]* (pImgPad1[j ]+pImgPad2[j ]);2085 pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);2086 2087 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);2088 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);2089 pixelInt += coef[8]* (pImgPad[j ]);2090 2091 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2092 2093 pImgRes[j] = Clip( pixelInt );2094 }2095 2096 }2097 pImgPad += stride;2098 pImgRes += stride;2099 }2100 }2101 break;2102 case ALF_CROSS9x9:2103 {2104 Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8;2105 #else2106 case ALF_CROSS9x7_SQUARE3x3:2107 {2108 Pel *pImgPad5, *pImgPad6;2109 #endif2110 for(i= ypos; i<= yposEnd; i++)2111 {2112 yLineInLCU = i % m_lcuHeightChroma;2113 #if ALF_SINGLE_FILTER_SHAPE2114 if (yLineInLCU<2 && i> 2)2115 #else2116 if (yLineInLCU<2)2117 #endif2118 {2119 paddingline = yLineInLCU + 2 ;2120 pImgPad1 = pImgPad + stride;2121 pImgPad2 = pImgPad - stride;2122 pImgPad3 = pImgPad + 2*stride;2123 pImgPad4 = pImgPad - 2*stride;2124 #if ALF_SINGLE_FILTER_SHAPE2125 pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*stride;2126 pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*stride;2127 #else2128 pImgPad5 = pImgPad + 3*stride;2129 pImgPad6 = pImgPad - min(paddingline, 3)*stride;2130 pImgPad7 = pImgPad + 4*stride;2131 pImgPad8 = pImgPad - min(paddingline, 4)*stride;2132 #endif2133 }2134 else if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )2135 {2136 pImgPad1 = pImgPad + stride;2137 pImgPad2 = pImgPad - stride;2138 pImgPad3 = pImgPad + 2*stride;2139 pImgPad4 = pImgPad - 2*stride;2140 pImgPad5 = pImgPad + 3*stride;2141 pImgPad6 = pImgPad - 3*stride;2142 #if !ALF_SINGLE_FILTER_SHAPE2143 pImgPad7 = pImgPad + 4*stride;2144 pImgPad8 = pImgPad - 4*stride;2145 #endif2146 }2147 else if (yLineInLCU < m_lineIdxPadTopChroma)2148 {2149 paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;2150 #if ALF_SINGLE_FILTER_SHAPE2151 pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad + min(paddingline, 1)*stride;2152 pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad - stride;2153 pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + min(paddingline, 2)*stride;2154 pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - 2*stride;2155 pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + min(paddingline, 3)*stride;2156 pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - 3*stride;2157 #else2158 pImgPad1 = pImgPad + min(paddingline, 1)*stride;2159 pImgPad2 = pImgPad - stride;2160 pImgPad3 = pImgPad + min(paddingline, 2)*stride;2161 pImgPad4 = pImgPad - 2*stride;2162 pImgPad5 = pImgPad + min(paddingline, 3)*stride;2163 pImgPad6 = pImgPad - 3*stride;2164 pImgPad7 = pImgPad + min(paddingline, 4)*stride;2165 pImgPad8 = pImgPad - 4*stride;2166 #endif2167 }2168 else2169 {2170 paddingline = yLineInLCU - m_lineIdxPadTopChroma ;2171 #if ALF_SINGLE_FILTER_SHAPE2172 pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad + stride;2173 pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad - min(paddingline, 1)*stride;2174 pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + 2*stride;2175 pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - min(paddingline, 2)*stride;2176 pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*stride;2177 pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*stride;2178 #else2179 pImgPad1 = pImgPad + stride;2180 pImgPad2 = pImgPad - min(paddingline, 1)*stride;2181 pImgPad3 = pImgPad + 2*stride;2182 pImgPad4 = pImgPad - min(paddingline, 2)*stride;2183 pImgPad5 = pImgPad + 3*stride;2184 pImgPad6 = pImgPad - min(paddingline, 3)*stride;2185 pImgPad7 = pImgPad + 4*stride;2186 pImgPad8 = pImgPad - min(paddingline, 4)*stride;2187 #endif2188 }2189 2190 #if ALF_SINGLE_FILTER_SHAPE2191 for(j= xpos; j<= xposEnd ; j++)2192 {2193 pixelInt = 0;2194 2195 pixelInt += coef[0]* (pImgPad5[j]+pImgPad6[j]);2196 pixelInt += coef[1]* (pImgPad3[j]+pImgPad4[j]);2197 pixelInt += coef[2]* (pImgPad1[j-1]+pImgPad2[j+1]);2198 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);2199 pixelInt += coef[4]* (pImgPad1[j+1]+pImgPad2[j-1]);2200 pixelInt += coef[5]* (pImgPad[j+4]+pImgPad[j-4]);2201 pixelInt += coef[6]* (pImgPad[j+3]+pImgPad[j-3]);2202 pixelInt += coef[7]* (pImgPad[j+2]+pImgPad[j-2]);2203 pixelInt += coef[8]* (pImgPad[j+1]+pImgPad[j-1]);2204 pixelInt += coef[9]* (pImgPad[j ]);2205 2206 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2207 2208 pImgRes[j] = Clip( pixelInt );2209 }2210 #else2211 if ( (yLineInLCU == m_lineIdxPadTopChroma || yLineInLCU == m_lineIdxPadTopChroma-1) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )2212 {2213 for(j= xpos; j<= xposEnd ; j++)2214 {2215 pixelInt = 0;2216 2217 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);2218 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);2219 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);2220 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);2221 pixelInt += newCenterCoeff[0]* (pImgPad[j ]);2222 2223 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2224 2225 pImgRes[j] = Clip( pixelInt );2226 }2227 }2228 else if ( (yLineInLCU == m_lineIdxPadTopChroma+1 || yLineInLCU == m_lineIdxPadTopChroma-2) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )2229 {2230 for(j= xpos; j<= xposEnd ; j++)2231 {2232 pixelInt = 0;2233 2234 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);2235 2236 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);2237 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);2238 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);2239 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);2240 pixelInt += newCenterCoeff[1]* (pImgPad[j ]);2241 2242 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2243 2244 pImgRes[j] = Clip( pixelInt );2245 }2246 }2247 else if ( (yLineInLCU == 0 && i>0) || (yLineInLCU == m_lineIdxPadTopChroma-3 && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma) )2248 {2249 for(j= xpos; j<= xposEnd ; j++)2250 {2251 pixelInt = 0;2252 2253 pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);2254 2255 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);2256 2257 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);2258 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);2259 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);2260 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);2261 pixelInt += newCenterCoeff[2]* (pImgPad[j ]);2262 2263 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2264 2265 pImgRes[j] = Clip( pixelInt );2266 }2267 }2268 else if ( (yLineInLCU == 1 && i>1) || (yLineInLCU == m_lineIdxPadTopChroma-4 && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma) )2269 {2270 for(j= xpos; j<= xposEnd ; j++)2271 {2272 pixelInt = 0;2273 2274 pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);2275 2276 pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);2277 2278 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);2279 2280 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);2281 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);2282 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);2283 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);2284 pixelInt += newCenterCoeff[3]* (pImgPad[j ]);2285 2286 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2287 2288 pImgRes[j] = Clip( pixelInt );2289 }2290 }2291 else2292 {2293 for(j= xpos; j<= xposEnd ; j++)2294 {2295 pixelInt = 0;2296 2297 pixelInt += coef[0]* (pImgPad7[j]+pImgPad8[j]);2298 2299 pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);2300 2301 pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);2302 2303 pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);2304 2305 pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);2306 pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);2307 pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);2308 pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);2309 pixelInt += coef[8]* (pImgPad[j ]);2310 2311 pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);2312 2313 pImgRes[j] = Clip( pixelInt );2314 }2315 }2316 #endif2317 pImgPad += stride;2318 pImgRes += stride;2319 2320 }2321 }2322 2323 break;2324 default:2325 {2326 printf("Not a supported filter shape\n");2327 assert(0);2328 exit(1);2329 }2330 }2331 2332 }2333 2334 /** Chroma filtering for multi-slice picture2335 * \param componentID slice parameters2336 * \param pcPicDecYuv original picture2337 * \param pcPicRestYuv picture before filtering2338 * \param coeff filter coefficients2339 * \param filtNo filter shape2340 * \param chromaFormatShift size adjustment for chroma (1 for 4:2:0 format)2341 */2342 Void TComAdaptiveLoopFilter::xFilterChromaSlices(Int componentID, TComPicYuv* pcPicDecYuv, TComPicYuv* pcPicRestYuv, Int *coeff, Int filtNo, Int chromaFormatShift)2343 {2344 Pel* pPicDec = (componentID == ALF_Cb)?( pcPicDecYuv->getCbAddr()):( pcPicDecYuv->getCrAddr());2345 Pel* pPicSlice = (componentID == ALF_Cb)?(m_pcSliceYuvTmp->getCbAddr()):(m_pcSliceYuvTmp->getCrAddr());2346 Pel* pRest = (componentID == ALF_Cb)?( pcPicRestYuv->getCbAddr()):( pcPicRestYuv->getCrAddr());2347 Int stride = pcPicDecYuv->getCStride();2348 2349 for(UInt s=0; s< m_uiNumSlicesInPic; s++)2350 {2351 if(!m_pcPic->getValidSlice(s))2352 {2353 continue;2354 }2355 std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];2356 2357 for(Int t=0; t< (Int)vpSliceTileAlfLCU.size(); t++)2358 {2359 std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];2360 2361 copyRegion(vpAlfLCU, pPicSlice, pPicDec, stride, chromaFormatShift);2362 extendRegionBorder(vpAlfLCU, pPicSlice, stride, chromaFormatShift);2363 filterChromaRegion(vpAlfLCU, pPicSlice, pRest, stride, coeff, filtNo, chromaFormatShift);2364 }2365 }2366 }2367 2368 /** Chroma filtering for one component in multi-slice picture2369 * \param componentID slice parameters2370 * \param pcPicDecYuv original picture2371 * \param pcPicRestYuv picture before filtering2372 * \param shape filter shape2373 * \param pCoeff filter coefficients2374 */2375 Void TComAdaptiveLoopFilter::xFilterChromaOneCmp(Int componentID, TComPicYuv *pDecYuv, TComPicYuv *pRestYuv, Int shape, Int *pCoeff)2376 {2377 Int chromaFormatShift = 1;2378 if(!m_bUseNonCrossALF)2379 {2380 Pel* pDec = (componentID == ALF_Cb)?(pDecYuv->getCbAddr()): (pDecYuv->getCrAddr());2381 Pel* pRest = (componentID == ALF_Cb)?(pRestYuv->getCbAddr()):(pRestYuv->getCrAddr());2382 Int iStride = pDecYuv->getCStride();2383 filterChroma(pRest, pDec, iStride, 0, (Int)(m_img_height>>1) -1, 0, (Int)(m_img_width>>1)-1, shape, pCoeff);2384 }2385 else2386 {2387 xFilterChromaSlices(componentID, pDecYuv, pRestYuv, pCoeff, shape, chromaFormatShift);2388 }2389 }2390 2391 /** Chroma filtering for multi-slice picture2392 * \param pcAlfParam ALF parameters2393 * \param pcPicDec to-be-filtered picture buffer2394 * \param pcPicRest filtered picture buffer2395 */2396 Void TComAdaptiveLoopFilter::xALFChroma(ALFParam* pcAlfParam, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)2397 {2398 if((pcAlfParam->chroma_idc>>1)&0x01)2399 {2400 xFilterChromaOneCmp(ALF_Cb, pcPicDec, pcPicRest, pcAlfParam->filter_shape_chroma, pcAlfParam->coeff_chroma);2401 }2402 2403 if(pcAlfParam->chroma_idc&0x01)2404 {2405 xFilterChromaOneCmp(ALF_Cr, pcPicDec, pcPicRest, pcAlfParam->filter_shape_chroma, pcAlfParam->coeff_chroma);2406 }2407 }2408 2409 #endif2410 921 2411 922 Void TComAdaptiveLoopFilter::setAlfCtrlFlags(AlfCUCtrlInfo* pAlfParam, TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt &idx) … … 2498 1009 * \param numSlicesInPic number of slices in picture 2499 1010 */ 2500 #if LCU_SYNTAX_ALF2501 1011 Void TComAdaptiveLoopFilter::createPicAlfInfo(TComPic* pcPic, Int numSlicesInPic, Int alfQP) 2502 #else2503 Void TComAdaptiveLoopFilter::createPicAlfInfo(TComPic* pcPic, Int numSlicesInPic)2504 #endif2505 1012 { 2506 1013 m_uiNumSlicesInPic = numSlicesInPic; … … 2510 1017 m_pcPic = pcPic; 2511 1018 2512 #if LCU_SYNTAX_ALF2513 1019 m_isNonCrossSlice = pcPic->getIndependentSliceBoundaryForNDBFilter(); 2514 1020 m_suWidth = pcPic->getMinCUWidth(); 2515 1021 m_suHeight= pcPic->getMinCUHeight(); 2516 1022 m_alfQP = alfQP; 2517 #endif2518 #if !LCU_SYNTAX_ALF2519 if(m_uiNumSlicesInPic > 1 || m_bUseNonCrossALF)2520 {2521 #endif2522 1023 m_ppSliceAlfLCUs = new AlfLCUInfo*[m_uiNumSlicesInPic]; 2523 1024 m_pvpAlfLCU = new std::vector< AlfLCUInfo* >[m_uiNumSlicesInPic]; … … 2584 1085 m_pcSliceYuvTmp = pcPic->getYuvPicBufferForIndependentBoundaryProcessing(); 2585 1086 } 2586 #if !LCU_SYNTAX_ALF2587 }2588 #endif2589 1087 2590 1088 } … … 2594 1092 Void TComAdaptiveLoopFilter::destroyPicAlfInfo() 2595 1093 { 2596 #if !LCU_SYNTAX_ALF2597 if(m_bUseNonCrossALF)2598 {2599 #endif2600 1094 for(Int s=0; s< m_uiNumSlicesInPic; s++) 2601 1095 { … … 2614 1108 delete[] m_pvpSliceTileAlfLCU; 2615 1109 m_pvpSliceTileAlfLCU = NULL; 2616 #if !LCU_SYNTAX_ALF 2617 } 2618 #endif 2619 } 2620 2621 #if !LCU_SYNTAX_ALF 2622 /** ALF for cu-on/off-controlled region 2623 * \param vpAlfLCU ALF LCU information container 2624 * \param imgDec to-be-filtered picture buffer 2625 * \param imgRest filtered picture buffer 2626 * \param stride picture buffer stride size 2627 * \param filtNo filter shape 2628 * \param filterCoeff filter coefficients 2629 * \param mergeTable merge table for filter set 2630 * \param varImg BA index 2631 */ 2632 Void TComAdaptiveLoopFilter::xCUAdaptiveRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* imgDec, Pel* imgRest, Int stride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg) 2633 { 2634 UInt SUWidth = m_pcPic->getMinCUWidth(); 2635 UInt SUHeight = m_pcPic->getMinCUHeight(); 2636 UInt idx, startSU, endSU, currSU, LCUX, LCUY, LPelX, TPelY; 2637 TComDataCU* pcCU; 2638 2639 for(idx=0; idx< vpAlfLCU.size(); idx++) 2640 { 2641 AlfLCUInfo& rAlfLCU = *(vpAlfLCU[idx]); 2642 pcCU = rAlfLCU.pcCU; 2643 startSU = rAlfLCU.startSU; 2644 endSU = rAlfLCU.endSU; 2645 LCUX = pcCU->getCUPelX(); 2646 LCUY = pcCU->getCUPelY(); 2647 2648 for(currSU= startSU; currSU<= endSU; currSU++) 2649 { 2650 LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ]; 2651 TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ]; 2652 if( !( LPelX < m_img_width ) || !( TPelY < m_img_height ) ) 2653 { 2654 continue; 2655 } 2656 if(pcCU->getAlfCtrlFlag(currSU)) 2657 { 2658 filterLuma(imgRest, imgDec, stride, TPelY, TPelY+ SUHeight-1, LPelX, LPelX+ SUWidth-1, filtNo, m_filterCoeffSym, m_varIndTab, m_varImg); 2659 } 2660 } 2661 } 2662 2663 } 2664 2665 /** ALF for "non" cu-on/off-controlled region 2666 * \param vpAlfLCU ALF LCU information container 2667 * \param imgDec to-be-filtered picture buffer 2668 * \param imgRest filtered picture buffer 2669 * \param stride picture buffer stride size 2670 * \param filtNo filter shape 2671 * \param filterCoeff filter coefficients 2672 * \param mergeTable merge table for filter set 2673 * \param varImg BA index 2674 */ 2675 Void TComAdaptiveLoopFilter::filterLumaRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* imgDec, Pel* imgRest, Int stride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg) 2676 { 2677 2678 Int height, width; 2679 Int ypos, xpos; 2680 2681 for(Int i=0; i< vpAlfLCU.size(); i++) 2682 { 2683 AlfLCUInfo& rAlfLCU = *(vpAlfLCU[i]); 2684 for(UInt j=0; j< rAlfLCU.numSGU; j++) 2685 { 2686 ypos = (Int)(rAlfLCU[j].posY ); 2687 xpos = (Int)(rAlfLCU[j].posX ); 2688 height = (Int)(rAlfLCU[j].height); 2689 width = (Int)(rAlfLCU[j].width ); 2690 2691 filterLuma(imgRest, imgDec, stride, ypos, ypos+ height-1, xpos, xpos+ width-1, filtNo, filterCoeff, mergeTable, varImg); 2692 } 2693 } 2694 } 2695 2696 2697 /** Perform ALF for one chroma region 2698 * \param vpAlfLCU ALF LCU data container 2699 * \param pDec to-be-filtered picture buffer 2700 * \param pRest filtered picture buffer 2701 * \param stride picture buffer stride 2702 * \param coeff filter coefficients 2703 * \param filtNo filter shape 2704 * \param chromaFormatShift chroma component size adjustment (1 for 4:2:0) 2705 */ 2706 Void TComAdaptiveLoopFilter::filterChromaRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* pDec, Pel* pRest, Int stride, Int *coeff, Int filtNo, Int chromaFormatShift) 2707 { 2708 Int height, width; 2709 Int ypos, xpos; 2710 2711 for(Int i=0; i< vpAlfLCU.size(); i++) 2712 { 2713 AlfLCUInfo& cAlfLCU = *(vpAlfLCU[i]); 2714 for(Int j=0; j< cAlfLCU.numSGU; j++) 2715 { 2716 ypos = (Int)(cAlfLCU[j].posY >> chromaFormatShift); 2717 xpos = (Int)(cAlfLCU[j].posX >> chromaFormatShift); 2718 height = (Int)(cAlfLCU[j].height >> chromaFormatShift); 2719 width = (Int)(cAlfLCU[j].width >> chromaFormatShift); 2720 2721 filterChroma(pRest, pDec, stride, ypos, ypos+ height -1, xpos, xpos+ width-1, filtNo, coeff); 2722 } 2723 } 2724 } 2725 2726 #endif 1110 } 1111 2727 1112 2728 1113 /** Copy ALF CU control flags from ALF parameters for slices … … 2846 1231 { 2847 1232 NDBFBlockInfo& rSGU = rAlfLCU[n]; 2848 #if LCU_SYNTAX_ALF2849 1233 if(rSGU.allBordersAvailable) 2850 1234 { 2851 1235 continue; 2852 1236 } 2853 #endif2854 1237 posX = rSGU.posX >> formatShift; 2855 1238 posY = rSGU.posY >> formatShift; … … 3127 1510 } 3128 1511 3129 #if LCU_SYNTAX_ALF3130 1512 /** reconstruct ALF luma coefficient 3131 1513 * \param [in] alfLCUParam ALF parameters … … 3232 1614 coeffPred = (1<<ALF_NUM_BIT_SHIFT) - sum; 3233 1615 #endif 3234 #if ALF_CHROMA_COEF_PRED_HARMONIZATION3235 1616 filterCoeff[0][alfLCUParam->num_coeff-1] = coeffPred + alfLCUParam->coeffmulti[0][alfLCUParam->num_coeff-1]; 3236 #else3237 filterCoeff[0][alfLCUParam->num_coeff-1] = coeffPred - alfLCUParam->coeffmulti[0][alfLCUParam->num_coeff-1];3238 #endif3239 1617 } 3240 1618 … … 3444 1822 Int pred = (1<<ALF_NUM_BIT_SHIFT) - (sum); 3445 1823 #endif 3446 #if ALF_CHROMA_COEF_PRED_HARMONIZATION3447 1824 coeff[numCoef-1] = coeff[numCoef-1] - pred; 3448 #else 3449 coeff[numCoef-1] = pred- coeff[numCoef-1]; 3450 #endif 3451 } 3452 3453 #if ALF_SINGLE_FILTER_SHAPE 1825 } 1826 3454 1827 /** filtering pixels 3455 1828 * \param [out] imgRes filtered picture … … 3576 1949 } 3577 1950 } 3578 #endif3579 1951 3580 1952 #if LCUALF_QP_DEPENDENT_BITS … … 3623 1995 static Int shiftW = (Int)(log((double)VAR_SIZE_W)/log(2.0)); 3624 1996 static Int varMax = (Int)NO_VAR_BINS-1; 3625 #if ALF_16_BA_GROUPS3626 1997 static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}; 3627 1998 static Int avgVarTab[3][6] = { {0, 1, 2, 3, 4, 5,}, 3628 1999 {0, 6, 7, 8, 9, 10,}, 3629 2000 {0, 11, 12, 13, 14, 15} }; 3630 #else3631 static Int step = (Int)((Int)(NO_VAR_BINS)/3) - 1;3632 static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4};3633 #endif3634 2001 3635 2002 Int i, j, avgVar, vertical, horizontal, direction, yOffset; … … 3683 2050 avgVar = (Pel) Clip_post( varMax, avgVar>>(g_uiBitIncrement+1) ); 3684 2051 avgVar = th[avgVar]; 3685 #if ALF_16_BA_GROUPS3686 2052 avgVar = avgVarTab[direction][avgVar]; 3687 #else3688 avgVar = Clip_post(step, (Int)avgVar) + (step+1)*direction;3689 #endif3690 2053 imgYvar[i>>shiftH][j>>shiftW] = avgVar; 3691 2054 } … … 3767 2130 return pBuf; 3768 2131 } 3769 #endif3770 2132 3771 2133 -
trunk/source/Lib/TLibCommon/TComAdaptiveLoopFilter.h
r56 r296 49 49 // ==================================================================================================================== 50 50 51 #if LCU_SYNTAX_ALF52 51 #define LCUALF_QP_DEPENDENT_BITS 1 53 #endif 54 55 #if ALF_SINGLE_FILTER_SHAPE 52 56 53 #define ALF_FILTER_LEN 10 57 54 #define ALF_MAX_NUM_COEF ALF_FILTER_LEN //!< maximum number of filter coefficients 58 #else59 #define ALF_MAX_NUM_COEF 9 //!< maximum number of filter coefficients60 #endif61 55 #define MAX_SQR_FILT_LENGTH 41 //!< ((max_horizontal_tap * max_vertical_tap) / 2 + 1) = ((11 * 5) / 2 + 1) 62 56 63 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS57 #if LCUALF_QP_DEPENDENT_BITS 64 58 #define ALF_QP1 28 65 59 #define ALF_QP2 34 … … 78 72 79 73 80 #if LCU_SYNTAX_ALF81 74 /// Luma/Chroma component ID 82 75 enum ALFComponentID … … 96 89 NUM_ALF_MERGE_TYPE 97 90 }; 98 #else99 ///100 /// Chroma component ID101 ///102 enum AlfChromaID103 {104 ALF_Cb = 0,105 ALF_Cr = 1106 };107 108 109 ///110 /// Adaptation mode ID111 ///112 enum ALFClassficationMethod113 {114 ALF_BA =0,115 ALF_RA,116 NUM_ALF_CLASS_METHOD117 };118 #endif119 91 /// 120 92 /// Filter shape … … 122 94 enum ALFFilterShape 123 95 { 124 #if ALF_SINGLE_FILTER_SHAPE125 96 ALF_CROSS9x7_SQUARE3x3 = 0, 126 #else127 ALF_STAR5x5 = 0,128 ALF_CROSS9x9,129 #endif130 97 NUM_ALF_FILTER_SHAPE 131 98 }; 132 99 133 #if LCU_SYNTAX_ALF134 100 extern Int* kTableTabShapes[NUM_ALF_FILTER_SHAPE]; 135 #endif136 #if ALF_SINGLE_FILTER_SHAPE137 101 extern Int depthIntShape1Sym[ALF_MAX_NUM_COEF+1]; 138 #else139 extern Int depthIntShape0Sym[10];140 extern Int depthIntShape1Sym[10];141 #endif142 102 extern Int *pDepthIntTabShapes[NUM_ALF_FILTER_SHAPE]; 143 103 … … 156 116 const AlfCUCtrlInfo& operator= (const AlfCUCtrlInfo& src); //!< "=" operator 157 117 AlfCUCtrlInfo():cu_control_flag(0), num_alf_cu_flag(0), alf_max_depth(0) {} //!< constructor 158 #if LCU_SYNTAX_ALF159 118 Void reset(); 160 #endif161 119 }; 162 120 … … 190 148 191 149 // filter shape information 192 #if ALF_SINGLE_FILTER_SHAPE193 150 static Int weightsShape1Sym[ALF_MAX_NUM_COEF+1]; 194 #else195 static Int weightsShape0Sym[10];196 static Int weightsShape1Sym[10];197 #endif198 151 static Int *weightsTabShapes[NUM_ALF_FILTER_SHAPE]; 199 152 static Int m_sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE]; … … 209 162 //classification 210 163 Int m_varIndTab[NO_VAR_BINS]; 211 #if !LCU_SYNTAX_ALF212 UInt m_uiVarGenMethod;213 Pel** m_varImgMethods[NUM_ALF_CLASS_METHOD];214 #endif215 164 Pel** m_varImg; 216 165 … … 237 186 std::vector< std::vector< AlfLCUInfo* > > *m_pvpSliceTileAlfLCU; 238 187 239 #if LCU_SYNTAX_ALF240 188 Int m_suWidth; 241 189 Int m_suHeight; … … 245 193 Bool m_isNonCrossSlice; 246 194 Int m_alfQP; 247 #endif248 195 249 196 private: //private member variables … … 252 199 protected: //protected methods 253 200 254 #if LCU_SYNTAX_ALF255 201 Void createLCUAlfInfo(); 256 202 Void destroyLCUAlfInfo(); … … 266 212 Bool isEnabledComponent(ALFParam** alfLCUParam); 267 213 Int getAlfPrecisionBit(Int qp); 268 #if ALF_SINGLE_FILTER_SHAPE269 214 Void filterOneCompRegion(Pel *imgRes, Pel *imgPad, Int stride, Bool isChroma, Int yPos, Int yPosEnd, Int xPos, Int xPosEnd, Int** filterSet, Int* mergeTable, Pel** varImg); 270 #endif271 215 Void calcOneRegionVar(Pel **imgYvar, Pel *imgYpad, Int stride, Bool isOnlyOneGroup, Int yPos, Int yPosEnd, Int xPos, Int xPosEnd); 272 #endif273 216 274 217 275 218 Void InitAlfLCUInfo(AlfLCUInfo& rAlfLCU, Int sliceID, Int tileID, TComDataCU* pcCU, UInt maxNumSUInLCU); 276 #if !LCU_SYNTAX_ALF277 Void createRegionIndexMap(Pel **imgY_var, Int img_width, Int img_height); //!< create RA index for regions278 Void calcVar(Pel **imgYvar, Pel *imgYpad, Int stride, Int adaptationMode); //!< Calculate ALF grouping indices for block-based (BA) mode279 Void filterLuma(Pel *pImgYRes, Pel *pImgYPad, Int stride, Int ypos, Int yposEnd, Int xpos, Int xposEnd, Int filtNo, Int** filterSet, Int* mergeTable, Pel** ppVarImg); //!< filtering operation for luma region280 Void filterChroma(Pel *pImgRes, Pel *pImgPad, Int stride, Int ypos, Int yposEnd, Int xpos, Int xposEnd, Int filtNo, Int* coef);281 Void filterChromaRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* pDec, Pel* pRest, Int stride, Int *coeff, Int filtNo, Int chromaFormatShift); //!< filtering operation for chroma region282 Void xCUAdaptive (TComPic* pcPic, Int filtNo, Pel *imgYFilt, Pel *imgYRec, Int Stride);283 Void xSubCUAdaptive(TComDataCU* pcCU, Int filtNo, Pel *imgYFilt, Pel *imgYRec, UInt uiAbsPartIdx, UInt uiDepth, Int Stride);284 Void reconstructFilterCoeffs(ALFParam* pcAlfParam,int **pfilterCoeffSym);285 Void predictALFCoeffLuma ( ALFParam* pAlfParam ); //!< prediction of luma ALF coefficients286 #endif287 219 Void checkFilterCoeffValue( Int *filter, Int filterLength, Bool isChroma ); 288 #if !LCU_SYNTAX_ALF289 Void decodeFilterSet(ALFParam* pcAlfParam, Int* varIndTab, Int** filterCoeff);290 Void xALFChroma ( ALFParam* pcAlfParam, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest );291 Void xFilterChromaSlices(Int componentID, TComPicYuv* pcPicDecYuv, TComPicYuv* pcPicRestYuv, Int *coeff, Int filtNo, Int chromaFormatShift);292 Void xFilterChromaOneCmp(Int componentID, TComPicYuv *pDecYuv, TComPicYuv *pRestYuv, Int shape, Int *pCoeff);293 Void xALFLuma( TComPic* pcPic, ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest );294 #endif295 220 Void setAlfCtrlFlags(AlfCUCtrlInfo* pAlfParam, TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt &idx); 296 221 Void transferCtrlFlagsFromAlfParam(std::vector<AlfCUCtrlInfo>& vAlfParamSlices); //!< Copy ALF CU control flags from ALF parameters for slices … … 299 224 Void copyRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* pPicDst, Pel* pPicSrc, Int stride, Int formatShift = 0); 300 225 Void extendRegionBorder(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* pPelSrc, Int stride, Int formatShift = 0); 301 #if !LCU_SYNTAX_ALF302 Void filterLumaRegion (std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* imgDec, Pel* imgRest, Int stride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg);303 Void xCUAdaptiveRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* imgDec, Pel* imgRest, Int stride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg);304 #endif305 226 Int getCtrlFlagsFromAlfParam(AlfLCUInfo* pcAlfLCU, Int iAlfDepth, UInt* puiFlags); 306 227 … … 317 238 Void destroy (); 318 239 319 #if LCU_SYNTAX_ALF320 240 Void ALFProcess (TComPic* pcPic, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam, Bool isAlfCoefInSlice); 321 241 Void resetLCUAlfInfo (); … … 324 244 325 245 ALFParam*** getAlfLCUParam() {return m_alfFiltInfo;} 326 #else327 Void predictALFCoeffChroma ( ALFParam* pAlfParam ); //!< prediction of chroma ALF coefficients328 #if ALF_CHROMA_COEF_PRED_HARMONIZATION329 Void reconstructALFCoeffChroma( ALFParam* pAlfParam );330 #endif331 Void ALFProcess ( TComPic* pcPic, ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam ); ///< interface function for ALF process332 333 Void allocALFParam ( ALFParam* pAlfParam ); //!< allocate ALF parameters334 Void freeALFParam ( ALFParam* pAlfParam ); //!< free ALF parameters335 Void copyALFParam ( ALFParam* pDesAlfParam, ALFParam* pSrcAlfParam ); //!< copy ALF parameters336 #endif337 246 Int getNumCUsInPic() {return m_uiNumCUsInFrame;} //!< get number of LCU in picture for ALF process 338 #if LCU_SYNTAX_ALF339 247 Void createPicAlfInfo (TComPic* pcPic, Int uiNumSlicesInPic = 1, Int alfQP = 26); 340 #else341 Void createPicAlfInfo (TComPic* pcPic, Int numSlicesInPic = 1);342 #endif343 248 Void destroyPicAlfInfo(); 344 249 -
trunk/source/Lib/TLibCommon/TComBitStream.cpp
r56 r296 73 73 m_puiTileMarkerLocation = new UInt[MAX_MARKER_PER_NALU]; 74 74 m_uiTileMarkerLocationCount = 0; 75 #if TILES_WPP_ENTRY_POINT_SIGNALLING76 75 m_numBitsRead = 0; 77 #endif78 76 } 79 77 … … 212 210 assert( uiNumberOfBits <= 32 ); 213 211 214 #if TILES_WPP_ENTRY_POINT_SIGNALLING215 212 m_numBitsRead += uiNumberOfBits; 216 #endif217 213 218 214 /* NB, bits are extracted from the MSB of each byte. */ … … 334 330 buf->push_back(uiByte); 335 331 } 336 #if OL_FLUSH &&!OL_FLUSH_ALIGN332 #if !OL_FLUSH_ALIGN 337 333 buf->push_back(0); // The final chunk might not start byte aligned. 338 334 #endif -
trunk/source/Lib/TLibCommon/TComBitStream.h
r56 r296 176 176 UInt m_uiTileMarkerLocationCount; 177 177 UInt *m_puiTileMarkerLocation; 178 #if TILES_WPP_ENTRY_POINT_SIGNALLING179 178 UInt m_numBitsRead; 180 #endif181 179 182 180 public: … … 192 190 Void pseudoRead ( UInt uiNumberOfBits, UInt& ruiBits ); 193 191 Void read ( UInt uiNumberOfBits, UInt& ruiBits ); 194 #if OL_FLUSH &&!OL_FLUSH_ALIGN192 #if !OL_FLUSH_ALIGN 195 193 Void readByte ( UInt &ruiBits ) 196 194 { … … 228 226 Void backupByte() { m_fifo_idx--; } 229 227 #endif 230 #if TILES_WPP_ENTRY_POINT_SIGNALLING231 228 UInt getNumBitsRead() { return m_numBitsRead; } 229 }; 230 231 //! \} 232 232 233 #endif 233 };234 235 //! \}236 237 #endif -
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r210 r296 51 51 #endif 52 52 53 #if MERL_VSP_C0152 54 55 #define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] ) 56 57 inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) 58 { 59 Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx); 60 if( vspIdx != 0 ) 61 { 62 Int idx = vspIdx - 1; 63 bVspMvZeroDone[idx] = true; 64 iVSPIndexTrue [idx] = iCount; 65 66 // no need to reset Inter Dir 67 68 // set MV using checked disparity 69 if (vspIdx < 4) 70 { 71 pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCand[0], NOT_VALID ); 72 if ( pcCURef->getSlice()->isInterB() ) 73 { 74 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCand[0], NOT_VALID ); 75 } 76 } 77 } 78 } 79 80 inline Bool TComDataCU::xAddVspMergeCand( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount, 81 UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo ) 82 { 83 if( ucVspMergePos == VSP_MERGE_POS ) 84 { 85 Int idx = vspIdx - 1; 86 { 87 if( getSlice()->getSPS()->getViewId() != 0 && bVspMvZeroDone[idx] == false ) 88 { 89 { 90 abCandIsInter [iCount] = true; 91 bVspMvZeroDone[idx] = true; 92 93 // get Inter Dir 94 Int iInterDir = ((getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 && getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 0) ? 3 : 95 (getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2)); 96 puhInterDirNeighbours[iCount] = iInterDir; // The direction information does not matter 97 // get Mv using checked disparity vector 98 if (vspIdx < 4) // spatial 99 { 100 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID ); 101 if ( getSlice()->isInterB() ) 102 { 103 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], NOT_VALID ); 104 } 105 } 106 iVSPIndexTrue[idx] = iCount; 107 if ( mrgCandIdx == iCount ) 108 { 109 return false; 110 } 111 iCount ++; 112 } 113 } 114 } 115 } 116 return true; 117 } 118 #endif 119 53 120 // ==================================================================================================================== 54 121 // Constructor / destructor / create / destroy … … 79 146 #endif 80 147 m_puhMergeIndex = NULL; 148 #if MERL_VSP_C0152 149 m_piVSPIndex = NULL; 150 #endif 81 151 m_puhLumaIntraDir = NULL; 82 152 m_puhChromaIntraDir = NULL; … … 135 205 #if HHI_DMM_PRED_TEX 136 206 m_puiWedgePredTexTabIdx = NULL; 207 #if LGE_DMM3_SIMP_C0044 208 m_puiWedgePredTexIntraTabIdx = NULL; 209 #endif 137 210 m_piWedgePredTexDeltaDC1 = NULL; 138 211 m_piWedgePredTexDeltaDC2 = NULL; … … 141 214 m_piContourPredTexDeltaDC2 = NULL; 142 215 #endif 143 #if H HI_INTER_VIEW_RESIDUAL_PRED216 #if H3D_IVRP 144 217 m_pbResPredAvailable = NULL; 145 218 m_pbResPredFlag = NULL; … … 182 255 if ( !bDecSubCu ) 183 256 { 184 #if H0736_AVC_STYLE_QP_RANGE185 257 m_phQP = (Char* )xMalloc(Char, uiNumPartition); 186 #else187 m_phQP = (UChar* )xMalloc(UChar, uiNumPartition);188 #endif189 258 m_puhDepth = (UChar* )xMalloc(UChar, uiNumPartition); 190 259 #if HHI_MPI … … 213 282 #endif 214 283 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 215 #if HHI_INTER_VIEW_RESIDUAL_PRED 284 #if MERL_VSP_C0152 285 m_piVSPIndex = (Char* )xMalloc(Char, uiNumPartition); 286 #endif 287 #if H3D_IVRP 216 288 m_pbResPredAvailable = (Bool* )xMalloc(Bool, uiNumPartition); 217 289 m_pbResPredFlag = (Bool* )xMalloc(Bool, uiNumPartition); … … 283 355 #if HHI_DMM_PRED_TEX 284 356 m_puiWedgePredTexTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); 357 #if LGE_DMM3_SIMP_C0044 358 m_puiWedgePredTexIntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); 359 #endif 285 360 m_piWedgePredTexDeltaDC1 = (Int* )xMalloc(Int, uiNumPartition); 286 361 m_piWedgePredTexDeltaDC2 = (Int* )xMalloc(Int, uiNumPartition); … … 364 439 if ( m_pbICFlag ) { xFree(m_pbICFlag); m_pbICFlag = NULL; } 365 440 #endif 441 #if MERL_VSP_C0152 442 if ( m_piVSPIndex ) { xFree(m_piVSPIndex); m_piVSPIndex = NULL; } 443 #endif 366 444 if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } 367 #if H HI_INTER_VIEW_RESIDUAL_PRED445 #if H3D_IVRP 368 446 if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable); m_pbResPredAvailable= NULL; } 369 447 if ( m_pbResPredFlag ) { xFree(m_pbResPredFlag); m_pbResPredFlag = NULL; } … … 408 486 #if HHI_DMM_PRED_TEX 409 487 if ( m_puiWedgePredTexTabIdx ) { xFree(m_puiWedgePredTexTabIdx ); m_puiWedgePredTexTabIdx = NULL; } 488 #if LGE_DMM3_SIMP_C0044 489 if ( m_puiWedgePredTexIntraTabIdx ) { xFree(m_puiWedgePredTexIntraTabIdx); m_puiWedgePredTexIntraTabIdx = NULL; } 490 #endif 410 491 if ( m_piWedgePredTexDeltaDC1 ) { xFree(m_piWedgePredTexDeltaDC1 ); m_piWedgePredTexDeltaDC1 = NULL; } 411 492 if ( m_piWedgePredTexDeltaDC2 ) { xFree(m_piWedgePredTexDeltaDC2 ); m_piWedgePredTexDeltaDC2 = NULL; } … … 463 544 this->height = src.height; 464 545 ::memcpy(this->isBorderAvailable, src.isBorderAvailable, sizeof(Bool)*((Int)NUM_SGU_BORDER)); 465 #if LCU_SYNTAX_ALF466 546 this->allBordersAvailable = src.allBordersAvailable; 467 #endif468 547 469 548 return *this; … … 500 579 m_uiTotalBins = 0; 501 580 m_uiNumPartition = pcPic->getNumPartInCU(); 502 #if BURST_IPCM503 581 m_numSucIPCM = 0; 504 582 m_lastCUSucIPCMFlag = false; 505 #endif506 583 507 584 for(int i=0; i<pcPic->getNumPartInCU(); i++) … … 558 635 #endif 559 636 m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui]; 637 #if MERL_VSP_C0152 638 m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui]; 639 #endif 560 640 m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; 561 641 m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui]; … … 598 678 #endif 599 679 memset( m_puhMergeIndex + firstElement, 0, numElements * sizeof( *m_puhMergeIndex ) ); 680 #if MERL_VSP_C0152 681 memset( m_piVSPIndex + firstElement, 0, numElements * sizeof( *m_piVSPIndex ) ); 682 #endif 600 683 memset( m_puhLumaIntraDir + firstElement, 2, numElements * sizeof( *m_puhLumaIntraDir ) ); 601 684 memset( m_puhChromaIntraDir + firstElement, 0, numElements * sizeof( *m_puhChromaIntraDir ) ); … … 618 701 #if HHI_DMM_PRED_TEX 619 702 memset( m_puiWedgePredTexTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); 703 #if LGE_DMM3_SIMP_C0044 704 memset( m_puiWedgePredTexIntraTabIdx + firstElement, 0, sizeof( UInt ) * numElements ); 705 #endif 620 706 memset( m_piWedgePredTexDeltaDC1 + firstElement, 0, sizeof( Int ) * numElements ); 621 707 memset( m_piWedgePredTexDeltaDC2 + firstElement, 0, sizeof( Int ) * numElements ); … … 627 713 memset (m_pbRenderable + firstElement, false, sizeof( Bool ) * numElements) ; 628 714 #endif 629 #if H HI_INTER_VIEW_RESIDUAL_PRED715 #if H3D_IVRP 630 716 memset( m_pbResPredAvailable + firstElement, 0 , sizeof( Bool ) * numElements ); 631 717 memset( m_pbResPredFlag + firstElement, 0 , sizeof( Bool ) * numElements ); … … 720 806 } 721 807 722 #if H0736_AVC_STYLE_QP_RANGE723 808 /** initialize prediction data with enabling sub-LCU-level delta QP 724 809 *\param uiDepth depth of the current CU … … 729 814 */ 730 815 Void TComDataCU::initEstData( UInt uiDepth, Int qp ) 731 #else732 /** initialize prediction data with enabling sub-LCU-level delta QP733 *\param uiDepth depth of the current CU734 *\param uiQP QP for the current CU735 *- set CU width and CU height according to depth736 *- set QP value according to input QP737 *- set last-coded QP value according to input last-coded QP738 */739 Void TComDataCU::initEstData( UInt uiDepth, UInt uiQP )740 #endif741 816 { 742 817 m_dTotalCost = MAX_DOUBLE; … … 770 845 m_pePredMode[ui] = MODE_NONE; 771 846 m_pbIPCMFlag[ui] = 0; 772 #if H0736_AVC_STYLE_QP_RANGE773 847 m_phQP[ui] = qp; 774 #else775 m_phQP[ui] = uiQP;776 #endif777 848 m_puiAlfCtrlFlag[ui]= false; 778 849 m_pbMergeFlag[ui] = 0; … … 781 852 #endif 782 853 m_puhMergeIndex[ui] = 0; 783 #if HHI_INTER_VIEW_RESIDUAL_PRED 854 #if MERL_VSP_C0152 855 m_piVSPIndex[ui] = 0; 856 #endif 857 #if H3D_IVRP 784 858 m_pbResPredAvailable[ui] = 0; 785 859 m_pbResPredFlag[ui] = 0; … … 803 877 #if HHI_DMM_PRED_TEX 804 878 m_puiWedgePredTexTabIdx [ui] = 0; 879 #if LGE_DMM3_SIMP_C0044 880 m_puiWedgePredTexIntraTabIdx [ui] = 0; 881 #endif 805 882 m_piWedgePredTexDeltaDC1 [ui] = 0; 806 883 m_piWedgePredTexDeltaDC2 [ui] = 0; … … 845 922 846 923 // initialize Sub partition 847 #if H0736_AVC_STYLE_QP_RANGE848 924 Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ) 849 #else850 Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP )851 #endif852 925 { 853 926 assert( uiPartUnitIdx<4 ); … … 869 942 m_uiNumPartition = pcCU->getTotalNumPart() >> 2; 870 943 871 #if BURST_IPCM872 944 m_numSucIPCM = 0; 873 945 m_lastCUSucIPCMFlag = false; 874 #endif875 946 876 947 Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; 877 948 Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; 878 879 #if H0736_AVC_STYLE_QP_RANGE 949 #if MERL_VSP_C0152 950 Int iSizeInChar = sizeof( Char ) * m_uiNumPartition; 951 #endif 952 880 953 Int sizeInChar = sizeof( Char ) * m_uiNumPartition; 881 954 memset( m_phQP, qp, sizeInChar ); 882 #else883 memset( m_phQP, uiQP, iSizeInUchar );884 #endif885 955 886 956 memset( m_puiAlfCtrlFlag, 0, iSizeInBool ); … … 893 963 #endif 894 964 memset( m_puhMergeIndex, 0, iSizeInUchar ); 895 #if HHI_INTER_VIEW_RESIDUAL_PRED 965 #if MERL_VSP_C0152 966 memset( m_piVSPIndex, 0, iSizeInChar ); 967 #endif 968 #if H3D_IVRP 896 969 memset( m_pbResPredAvailable, 0, iSizeInBool ); 897 970 memset( m_pbResPredFlag, 0, iSizeInBool ); … … 921 994 #if HHI_DMM_PRED_TEX 922 995 memset( m_puiWedgePredTexTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); 996 #if LGE_DMM3_SIMP_C0044 997 memset( m_puiWedgePredTexIntraTabIdx, 0, sizeof( UInt ) * m_uiNumPartition ); 998 #endif 923 999 memset( m_piWedgePredTexDeltaDC1, 0, sizeof( Int ) * m_uiNumPartition ); 924 1000 memset( m_piWedgePredTexDeltaDC2, 0, sizeof( Int ) * m_uiNumPartition ); … … 973 1049 #endif 974 1050 m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui]; 1051 #if MERL_VSP_C0152 1052 m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui]; 1053 #endif 975 1054 m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; 976 1055 m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; … … 992 1071 #if HHI_DMM_PRED_TEX 993 1072 m_puiWedgePredTexTabIdx [ui]=pcCU->getWedgePredTexTabIdx (uiPartOffset+ui); 1073 #if LGE_DMM3_SIMP_C0044 1074 m_puiWedgePredTexIntraTabIdx [ui]=pcCU->getWedgePredTexIntraTabIdx (uiPartOffset+ui); 1075 #endif 994 1076 m_piWedgePredTexDeltaDC1 [ui]=pcCU->getWedgePredTexDeltaDC1 (uiPartOffset+ui); 995 1077 m_piWedgePredTexDeltaDC2 [ui]=pcCU->getWedgePredTexDeltaDC2 (uiPartOffset+ui); … … 998 1080 m_piContourPredTexDeltaDC2[ui]=pcCU->getContourPredTexDeltaDC2(uiPartOffset+ui); 999 1081 #endif 1000 #if H HI_INTER_VIEW_RESIDUAL_PRED1082 #if H3D_IVRP 1001 1083 m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ]; 1002 1084 m_pbResPredFlag [ui] = pcCU->m_pbResPredFlag [ uiPartOffset + ui ]; … … 1117 1199 #endif 1118 1200 m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; 1119 #if HHI_INTER_VIEW_RESIDUAL_PRED 1201 #if MERL_VSP_C0152 1202 m_piVSPIndex = pcCU->getVSPIndex() + uiPart; 1203 #endif 1204 #if H3D_IVRP 1120 1205 m_pbResPredAvailable = pcCU->getResPredAvail() + uiPart; 1121 1206 m_pbResPredFlag = pcCU->getResPredFlag () + uiPart; … … 1193 1278 #if HHI_DMM_PRED_TEX 1194 1279 m_puiWedgePredTexTabIdx = pcCU->getWedgePredTexTabIdx() + uiPart; 1280 #if LGE_DMM3_SIMP_C0044 1281 m_puiWedgePredTexIntraTabIdx = pcCU->getWedgePredTexIntraTabIdx() + uiPart; 1282 #endif 1195 1283 m_piWedgePredTexDeltaDC1 = pcCU->getWedgePredTexDeltaDC1() + uiPart; 1196 1284 m_piWedgePredTexDeltaDC2 = pcCU->getWedgePredTexDeltaDC2() + uiPart; … … 1227 1315 m_uiCUAddr = pcCU->getAddr(); 1228 1316 m_uiAbsIdxInLCU = uiAbsPartIdx; 1229 1317 1230 1318 Int iRastPartIdx = g_auiZscanToRaster[uiAbsPartIdx]; 1231 1319 m_uiCUPelX = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() ); … … 1257 1345 #endif 1258 1346 m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; 1259 #if HHI_INTER_VIEW_RESIDUAL_PRED 1347 #if MERL_VSP_C0152 1348 m_piVSPIndex = pcCU->getVSPIndex() + uiAbsPartIdx; 1349 #endif 1350 #if H3D_IVRP 1260 1351 m_pbResPredAvailable = pcCU->getResPredAvail() + uiAbsPartIdx; 1261 1352 m_pbResPredFlag = pcCU->getResPredFlag () + uiAbsPartIdx; … … 1288 1379 Int iSizeInUchar = sizeof( UChar ) * uiNumPartition; 1289 1380 Int iSizeInBool = sizeof( Bool ) * uiNumPartition; 1290 1291 #if H0736_AVC_STYLE_QP_RANGE 1381 #if MERL_VSP_C0152 1382 Int iSizeInChar = sizeof( Char ) * uiNumPartition; 1383 #endif 1384 1292 1385 Int sizeInChar = sizeof( Char ) * uiNumPartition; 1293 1386 memcpy( m_phQP + uiOffset, pcCU->getQP(), sizeInChar ); 1294 #else1295 memcpy( m_phQP + uiOffset, pcCU->getQP(), iSizeInUchar );1296 #endif1297 1387 memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(), sizeof( *m_pePartSize ) * uiNumPartition ); 1298 1388 memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition ); … … 1306 1396 #endif 1307 1397 memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); 1308 #if HHI_INTER_VIEW_RESIDUAL_PRED 1398 #if MERL_VSP_C0152 1399 memcpy( m_piVSPIndex + uiOffset, pcCU->getVSPIndex(), iSizeInChar ); 1400 #endif 1401 #if H3D_IVRP 1309 1402 memcpy( m_pbResPredAvailable + uiOffset, pcCU->getResPredAvail(), iSizeInBool ); 1310 1403 memcpy( m_pbResPredFlag + uiOffset, pcCU->getResPredFlag(), iSizeInBool ); … … 1375 1468 #if HHI_DMM_PRED_TEX 1376 1469 memcpy( m_puiWedgePredTexTabIdx + uiOffset, pcCU->getWedgePredTexTabIdx(), sizeof( UInt ) * uiNumPartition ); 1470 #if LGE_DMM3_SIMP_C0044 1471 memcpy( m_puiWedgePredTexIntraTabIdx + uiOffset, pcCU->getWedgePredTexIntraTabIdx(), sizeof( UInt ) * uiNumPartition ); 1472 #endif 1377 1473 memcpy( m_piWedgePredTexDeltaDC1 + uiOffset, pcCU->getWedgePredTexDeltaDC1(), sizeof( Int ) * uiNumPartition ); 1378 1474 memcpy( m_piWedgePredTexDeltaDC2 + uiOffset, pcCU->getWedgePredTexDeltaDC2(), sizeof( Int ) * uiNumPartition ); … … 1419 1515 Int iSizeInUchar = sizeof( UChar ) * m_uiNumPartition; 1420 1516 Int iSizeInBool = sizeof( Bool ) * m_uiNumPartition; 1421 1422 #if H0736_AVC_STYLE_QP_RANGE 1517 #if MERL_VSP_C0152 1518 Int iSizeInChar = sizeof( Char ) * m_uiNumPartition; 1519 #endif 1520 1423 1521 Int sizeInChar = sizeof( Char ) * m_uiNumPartition; 1424 1522 memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar ); 1425 #else1426 memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, iSizeInUchar );1427 #endif1428 1523 1429 1524 memcpy( rpcCU->getPartitionSize() + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition ); … … 1440 1535 #endif 1441 1536 memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); 1442 #if HHI_INTER_VIEW_RESIDUAL_PRED 1537 #if MERL_VSP_C0152 1538 memcpy( rpcCU->getVSPIndex() + m_uiAbsIdxInLCU, m_piVSPIndex, iSizeInChar ); 1539 #endif 1540 #if H3D_IVRP 1443 1541 memcpy( rpcCU->getResPredAvail() + m_uiAbsIdxInLCU, m_pbResPredAvailable, iSizeInBool ); 1444 1542 memcpy( rpcCU->getResPredFlag() + m_uiAbsIdxInLCU, m_pbResPredFlag, iSizeInBool ); … … 1501 1599 #if HHI_DMM_PRED_TEX 1502 1600 memcpy( rpcCU->getWedgePredTexTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredTexTabIdx, sizeof( UInt ) * m_uiNumPartition ); 1601 #if LGE_DMM3_SIMP_C0044 1602 memcpy( rpcCU->getWedgePredTexIntraTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredTexIntraTabIdx, sizeof( UInt ) * m_uiNumPartition ); 1603 #endif 1503 1604 memcpy( rpcCU->getWedgePredTexDeltaDC1() + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC1, sizeof( Int ) * m_uiNumPartition ); 1504 1605 memcpy( rpcCU->getWedgePredTexDeltaDC2() + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC2, sizeof( Int ) * m_uiNumPartition ); … … 1547 1648 Int iSizeInUchar = sizeof( UChar ) * uiQNumPart; 1548 1649 Int iSizeInBool = sizeof( Bool ) * uiQNumPart; 1549 1550 #if H0736_AVC_STYLE_QP_RANGE 1650 #if MERL_VSP_C0152 1651 Int iSizeInChar = sizeof( Char ) * uiQNumPart; 1652 #endif 1653 1551 1654 Int sizeInChar = sizeof( Char ) * uiQNumPart; 1552 1655 memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar ); 1553 #else1554 memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, iSizeInUchar );1555 #endif1556 1656 memcpy( rpcCU->getPartitionSize() + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart ); 1557 1657 #if HHI_INTERVIEW_SKIP … … 1566 1666 #endif 1567 1667 memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); 1568 #if HHI_INTER_VIEW_RESIDUAL_PRED 1668 #if MERL_VSP_C0152 1669 memcpy( rpcCU->getVSPIndex() + uiPartOffset, m_piVSPIndex, iSizeInChar ); 1670 #endif 1671 #if H3D_IVRP 1569 1672 memcpy( rpcCU->getResPredAvail() + uiPartOffset, m_pbResPredAvailable, iSizeInBool ); 1570 1673 memcpy( rpcCU->getResPredFlag() + uiPartOffset, m_pbResPredFlag, iSizeInBool ); … … 1628 1731 #if HHI_DMM_PRED_TEX 1629 1732 memcpy( rpcCU->getWedgePredTexTabIdx() + uiPartOffset, m_puiWedgePredTexTabIdx, sizeof( UInt ) * uiQNumPart ); 1733 #if LGE_DMM3_SIMP_C0044 1734 memcpy( rpcCU->getWedgePredTexIntraTabIdx() + uiPartOffset, m_puiWedgePredTexIntraTabIdx, sizeof( UInt ) * uiQNumPart ); 1735 #endif 1630 1736 memcpy( rpcCU->getWedgePredTexDeltaDC1() + uiPartOffset, m_piWedgePredTexDeltaDC1, sizeof( Int ) * uiQNumPart ); 1631 1737 memcpy( rpcCU->getWedgePredTexDeltaDC2() + uiPartOffset, m_piWedgePredTexDeltaDC2, sizeof( Int ) * uiQNumPart ); … … 1704 1810 (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx))) 1705 1811 || 1706 #if !REMOVE_TILE_DEPENDENCE1707 (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) ) )1708 #else1709 1812 (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) ) ) 1710 #endif1711 1813 ) 1712 1814 { … … 1766 1868 (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx))) 1767 1869 || 1768 #if !REMOVE_TILE_DEPENDENCE1769 (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))1770 #else1771 1870 (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())))) 1772 #endif1773 1871 ) 1774 1872 { … … 1817 1915 if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 1818 1916 m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 1819 #if !REMOVE_TILE_DEPENDENCE1820 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1821 #else1822 1917 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1823 #endif1824 1918 ))|| 1825 1919 (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 1826 1920 m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 1827 #if !REMOVE_TILE_DEPENDENCE1828 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1829 #else1830 1921 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1831 #endif1832 1922 )) 1833 1923 ) … … 1843 1933 if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 1844 1934 m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 1845 #if !REMOVE_TILE_DEPENDENCE1846 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1847 #else1848 1935 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1849 #endif1850 1936 ))|| 1851 1937 (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 1852 1938 m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 1853 #if !REMOVE_TILE_DEPENDENCE1854 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1855 #else1856 1939 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1857 #endif1858 1940 )) 1859 1941 ) … … 1871 1953 if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL || 1872 1954 m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 1873 #if !REMOVE_TILE_DEPENDENCE1874 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1875 #else1876 1955 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1877 #endif1878 1956 ))|| 1879 1957 (bEnforceEntropySliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL || 1880 1958 m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 1881 #if !REMOVE_TILE_DEPENDENCE1882 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1883 #else1884 1959 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1885 #endif1886 1960 )) 1887 1961 ) … … 1943 2017 if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 1944 2018 m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 1945 #if !REMOVE_TILE_DEPENDENCE1946 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1947 #else1948 2019 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1949 #endif1950 2020 ))|| 1951 2021 (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 1952 2022 m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 1953 #if !REMOVE_TILE_DEPENDENCE1954 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1955 #else1956 2023 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1957 #endif1958 2024 )) 1959 2025 ) … … 1978 2044 m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || 1979 2045 m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 1980 #if !REMOVE_TILE_DEPENDENCE1981 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1982 #else1983 2046 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1984 #endif1985 2047 ))|| 1986 2048 (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || 1987 2049 m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || 1988 2050 m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 1989 #if !REMOVE_TILE_DEPENDENCE1990 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))1991 #else1992 2051 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 1993 #endif1994 2052 )) 1995 2053 ) … … 2046 2104 if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 2047 2105 m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 2048 #if !REMOVE_TILE_DEPENDENCE2049 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2050 #else2051 2106 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2052 #endif2053 2107 ))|| 2054 2108 (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 2055 2109 m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 2056 #if !REMOVE_TILE_DEPENDENCE2057 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2058 #else2059 2110 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2060 #endif2061 2111 )) 2062 2112 ) … … 2117 2167 if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 2118 2168 m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 2119 #if !REMOVE_TILE_DEPENDENCE2120 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2121 #else2122 2169 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2123 #endif2124 2170 ))|| 2125 2171 (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 2126 2172 m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 2127 #if !REMOVE_TILE_DEPENDENCE2128 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2129 #else2130 2173 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2131 #endif2132 2174 )) 2133 2175 ) … … 2189 2231 if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 2190 2232 m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 2191 #if !REMOVE_TILE_DEPENDENCE2192 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2193 #else2194 2233 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2195 #endif2196 2234 ))|| 2197 2235 (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 2198 2236 m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 2199 #if !REMOVE_TILE_DEPENDENCE2200 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2201 #else2202 2237 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2203 #endif2204 2238 )) 2205 2239 ) … … 2220 2254 m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || 2221 2255 m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)|| 2222 #if !REMOVE_TILE_DEPENDENCE2223 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2224 #else2225 2256 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2226 #endif2227 2257 ))|| 2228 2258 (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL || 2229 2259 m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) || 2230 2260 m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)|| 2231 #if !REMOVE_TILE_DEPENDENCE2232 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2233 #else2234 2261 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2235 #endif2236 2262 )) 2237 2263 ) … … 2280 2306 if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 2281 2307 m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiAbsZorderQpMinCUIdx)|| 2282 #if !REMOVE_TILE_DEPENDENCE2283 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2284 #else2285 2308 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2286 #endif2287 2309 ))|| 2288 2310 (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || 2289 2311 m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)|| 2290 #if !REMOVE_TILE_DEPENDENCE2291 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2292 #else2293 2312 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2294 #endif2295 2313 )) 2296 2314 ) … … 2299 2317 } 2300 2318 2301 #if H0204_QP_PREDICTION2302 2319 if ( m_pcCULeft && m_pcCULeft->getAddr() != getAddr() ) 2303 2320 { 2304 2321 return NULL; 2305 2322 } 2306 #endif2307 2323 2308 2324 return m_pcCULeft; 2309 2325 } 2310 2326 2311 #if H0204_QP_PREDICTION2312 2327 /** Get Above QpMinCu 2313 2328 *\param aPartUnitIdx … … 2347 2362 if ( (enforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 2348 2363 m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(absZorderQpMinCUIdx)|| 2349 #if !REMOVE_TILE_DEPENDENCE2350 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2351 #else2352 2364 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2353 #endif2354 2365 ))|| 2355 2366 (enforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || 2356 2367 m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)|| 2357 #if !REMOVE_TILE_DEPENDENCE2358 (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))2359 #else2360 2368 (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr())) 2361 #endif2362 2369 )) 2363 2370 ) … … 2373 2380 return m_pcCUAbove; 2374 2381 } 2375 #endif 2376 2377 #if H0736_AVC_STYLE_QP_RANGE 2382 2378 2383 /** Get reference QP from left QpMinCu or latest coded QP 2379 2384 *\param uiCurrAbsIdxInLCU … … 2381 2386 */ 2382 2387 Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU ) 2383 #else 2384 /** Get reference QP from left QpMinCu or latest coded QP 2385 *\param uiCurrAbsIdxInLCU 2386 *\returns UChar reference QP value 2387 */ 2388 UChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU ) 2389 #endif 2390 { 2391 #if H0204_QP_PREDICTION 2388 { 2392 2389 UInt lPartIdx, aPartIdx; 2393 2390 lPartIdx = 0; … … 2396 2393 TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU ); 2397 2394 return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1); 2398 #else2399 // Left CU2400 TComDataCU* pcCULeft;2401 UInt uiLPartIdx;2402 pcCULeft = getQpMinCuLeft( uiLPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );2403 if ( pcCULeft )2404 {2405 return pcCULeft->getQP(uiLPartIdx);2406 }2407 // Last QP2408 return getLastCodedQP( uiCurrAbsIdxInLCU );2409 #endif2410 2395 } 2411 2396 … … 2422 2407 } 2423 2408 2424 #if H0736_AVC_STYLE_QP_RANGE2425 2409 Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx ) 2426 #else2427 UChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )2428 #endif2429 2410 { 2430 2411 UInt uiQUPartIdxMask = ~((1<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))-1); … … 2463 2444 Bool TComDataCU::isLosslessCoded(UInt absPartIdx) 2464 2445 { 2465 #if H0736_AVC_STYLE_QP_RANGE2466 2446 return ( getSlice()->getSPS()->getUseLossless() && ((getQP(absPartIdx) + getSlice()->getSPS()->getQpBDOffsetY()) == 0) ); 2467 #else2468 return ( getSlice()->getSPS()->getUseLossless() && (getQP(absPartPIdx) == 0) );2469 #endif2470 2447 } 2471 2448 #endif … … 2480 2457 { 2481 2458 uiModeList[0] = PLANAR_IDX; 2482 #if LOGI_INTRA_NAME_3MPM2483 2459 uiModeList[1] = VER_IDX; 2484 2460 uiModeList[2] = HOR_IDX; 2485 #else2486 uiModeList[1] = 1;2487 uiModeList[2] = 2;2488 #endif2489 2461 uiModeList[3] = DC_IDX; 2490 2462 uiModeList[4] = LM_CHROMA_IDX; … … 2500 2472 if( uiLumaMode == uiModeList[i] ) 2501 2473 { 2502 #if LOGI_INTRA_NAME_3MPM2503 2474 uiModeList[i] = 34; // VER+8 mode 2504 #else2505 uiModeList[i] = 7; // VER+8 mode2506 #endif2507 2475 break; 2508 2476 } … … 2526 2494 pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); 2527 2495 2528 #if DEFAULT_DC2529 2496 iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; 2530 #else2531 iLeftIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;2532 #endif2533 2497 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2534 2498 mapDMMtoIntraMode( iLeftIntraDir ); … … 2541 2505 pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true, false, true ); 2542 2506 2543 #if DEFAULT_DC2544 2507 iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX; 2545 #else2546 iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;2547 #endif2548 2508 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2549 2509 mapDMMtoIntraMode( iAboveIntraDir ); … … 2553 2513 #endif 2554 2514 2555 #if LOGI_INTRA_NAME_3MPM2556 2515 uiPredNum = 3; 2557 2516 if(iLeftIntraDir == iAboveIntraDir) … … 2593 2552 } 2594 2553 } 2595 #else2596 Int iIdx = getIntraSizeIdx(uiAbsPartIdx);2597 2598 2599 if ( iLeftIntraDir >= g_aucIntraModeNumAng[iIdx] )2600 {2601 iLeftIntraDir = PLANAR_IDX;2602 }2603 2604 2605 if ( iAboveIntraDir >= g_aucIntraModeNumAng[iIdx] )2606 {2607 iAboveIntraDir = PLANAR_IDX;2608 }2609 2610 if(iLeftIntraDir == iAboveIntraDir)2611 {2612 uiPredNum = 2;2613 2614 if( piMode )2615 {2616 *piMode = iLeftIntraDir;2617 }2618 2619 iAboveIntraDir = iLeftIntraDir == PLANAR_IDX ? DC_IDX : PLANAR_IDX; // DC or Planar2620 2621 assert( iLeftIntraDir != iAboveIntraDir );2622 2623 uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);2624 uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);2625 }2626 else2627 {2628 uiPredNum = 2;2629 uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);2630 uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);2631 }2632 #endif2633 2554 2634 2555 return uiPredNum; … … 2680 2601 UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter(); 2681 2602 Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0; 2682 #if G519_TU_AMP_NSQT_HARMONIZATION2683 2603 Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) ); 2684 #else2685 Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize == SIZE_Nx2N || partSize == SIZE_2NxN) );2686 #endif2687 2604 2688 2605 UInt log2MinTUSizeInCU = 0; … … 2706 2623 2707 2624 2708 #if H HI_INTER_VIEW_RESIDUAL_PRED2625 #if H3D_IVRP 2709 2626 UInt 2710 2627 TComDataCU::getCtxResPredFlag( UInt uiAbsPartIdx ) … … 2853 2770 } 2854 2771 2855 #if H0736_AVC_STYLE_QP_RANGE2856 2772 Void TComDataCU::setQPSubParts( Int qp, UInt uiAbsPartIdx, UInt uiDepth ) 2857 #else2858 Void TComDataCU::setQPSubParts( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth )2859 #endif2860 2773 { 2861 2774 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); … … 2866 2779 if( m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiSCUIdx+getZorderIdxInCU()) == pcSlice->getEntropySliceCurStartCUAddr() ) 2867 2780 { 2868 #if H0736_AVC_STYLE_QP_RANGE2869 2781 m_phQP[uiSCUIdx] = qp; 2870 #else2871 m_phQP[uiSCUIdx] = uiQP;2872 #endif2873 2782 } 2874 2783 } … … 3033 2942 } 3034 2943 3035 #if HHI_INTER_VIEW_RESIDUAL_PRED 2944 #if MERL_VSP_C0152 2945 Void TComDataCU::setVSPIndexSubParts ( Char iVSPIdx, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2946 { 2947 setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); 2948 } 2949 #endif 2950 2951 #if H3D_IVRP 3036 2952 Void TComDataCU::setResPredAvailSubParts( Bool bResPredAvailable, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 3037 2953 { … … 3063 2979 } 3064 2980 2981 #if LGE_ILLUCOMP_DEPTH_C0046 2982 //This modification is not needed after integrating JCT3V-C0137 2983 Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx, UInt uiDepth) 2984 { 2985 UInt uiPartAddr; 2986 UInt iNumbPart; 2987 2988 if(!getSlice()->getIsDepth()) 2989 { 2990 Int iWidth, iHeight; 2991 2992 iNumbPart = ( getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ? 1 : (getPartitionSize(uiAbsPartIdx) == SIZE_NxN ? 4 : 2) ); 2993 2994 for(UInt i = 0; i < iNumbPart; i++) 2995 { 2996 getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true); 2997 uiPartAddr += uiAbsPartIdx; 2998 2999 for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) 3000 { 3001 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 3002 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); 3003 3004 if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx)) 3005 { 3006 return true; 3007 } 3008 } 3009 } 3010 } 3011 else 3012 { 3013 iNumbPart = getPic()->getNumPartInCU() >> (uiDepth << 1); 3014 3015 for(UInt i = 0; i < iNumbPart; i++) 3016 { 3017 uiPartAddr = uiAbsPartIdx + i; 3018 3019 for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) 3020 { 3021 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 3022 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); 3023 3024 if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx)) 3025 { 3026 return true; 3027 } 3028 } 3029 } 3030 } 3031 3032 return false; 3033 } 3034 #else 3065 3035 Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx) 3066 3036 { … … 3086 3056 { 3087 3057 return true; 3088 }3089 }3058 } 3059 } 3090 3060 } 3091 3061 return false; 3092 3062 } 3063 #endif 3093 3064 #endif 3094 3065 … … 3272 3243 #endif 3273 3244 3274 #if LG_RESTRICTEDRESPRED_M24766 3245 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 3275 3246 Int TComDataCU::getResiPredMode(UInt uiPartAddr) 3276 3247 { … … 3617 3588 * \param numValidMergeCand 3618 3589 */ 3619 #if SIMP_MRG_PRUN 3590 #if MERL_VSP_C0152 3591 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx ) 3592 #else 3620 3593 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 3594 #endif 3595 { 3596 #if H3D_IVMP 3597 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 3598 const Int extraMergeCand = ( ( getSlice()->getIsDepth() || getSlice()->getSPS()->getMultiviewMvPredMode() )? 1 : 0 ); 3621 3599 #else 3622 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand )3623 #endif3624 {3625 #if HHI_INTER_VIEW_MOTION_PRED3626 3600 const Int extraMergeCand = ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 3601 #endif 3627 3602 #endif 3628 3603 3629 3604 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 3630 3605 UInt uiIdx = 1; 3631 #if H HI_INTER_VIEW_MOTION_PRED3632 bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];3606 #if H3D_IVMP 3607 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; 3633 3608 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) 3634 3609 #else 3635 bool abCandIsInter[ MRG_MAX_NUM_CANDS ];3610 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 3636 3611 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) 3637 3612 #endif … … 3640 3615 } 3641 3616 // compute the location of the current PU 3642 #if PARALLEL_MERGE3643 3617 Int xP, yP, nPSW, nPSH; 3644 3618 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 3645 #endif 3646 3619 3620 #if MERL_VSP_C0152 3621 Bool bVspMvZeroDone[3] = {false, false, false}; 3622 #endif 3623 3647 3624 Int iCount = 0; 3648 3625 … … 3652 3629 deriveLeftBottomIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 3653 3630 3654 #if H HI_INTER_VIEW_MOTION_PRED3631 #if H3D_IVMP 3655 3632 Bool bNoPdmMerge = ( m_pcSlice->getSPS()->getViewId() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE ); 3656 3633 3657 3634 //===== add merge with predicted depth maps ===== 3658 #if QC_MRG_CANS_B00483659 3635 TComMv acPdmMv [4]; 3660 3636 Int aiPdmRefIdx [4] = {-1, -1, -1, -1}; 3661 3637 Bool bLeftAvai = false; 3662 #if OL_DISMV_POS_B00693663 3638 Int iPosLeftAbove[2] = {-1, -1}; 3664 #endif 3665 #else 3666 TComMv acPdmMv [2]; 3667 Int aiPdmRefIdx [2] = {-1, -1}; 3668 #endif 3669 3670 #if LGE_DVMCP_A0126 3671 #if QC_MRG_CANS_B0048 3639 3640 #if H3D_NBDV 3672 3641 acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = acPdmMv[2].m_bDvMcp = acPdmMv[3].m_bDvMcp = false; 3673 #else 3674 acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = false; 3675 #endif 3676 #endif 3677 3678 #if QC_MULTI_DIS_CAN_A0097 3642 #endif //H3D_NBDV 3643 3644 #if MTK_MDIVRP_C0138 3645 Bool bDVAvail = true; 3646 #endif 3647 3648 #if H3D_NBDV 3679 3649 DisInfo cDisInfo; 3680 3650 cDisInfo.iN = 0; 3681 3651 if(!bNoPdmMerge) 3682 3652 { 3683 #if LGE_DVMCP_A0126 3684 #if LGE_IVMP_PARALLEL_MERGE_B0136 && !QC_SIMPLE_NBDV_B0047 3685 getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo, true, REF_PIC_LIST_X, -1, true ); 3686 #else 3687 getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo 3688 #if LGE_IVMP_PARALLEL_MERGE_B0136==QC_SIMPLE_NBDV_B0047 3689 , 3690 true 3653 getDisMvpCandNBDV(uiPUIdx, uiAbsPartIdx, &cDisInfo , true 3654 #if MERL_VSP_C0152 3655 , true 3691 3656 #endif 3692 3657 ); 3693 #endif3694 #else3695 getDisMvpCand (uiPUIdx, uiAbsPartIdx, &cDisInfo );3696 #endif3697 3658 } 3698 3659 if(cDisInfo.iN==0) … … 3702 3663 cDisInfo.m_acMvCand[0].setVer(0); 3703 3664 cDisInfo.m_aVIdxCan[0] = 0; 3704 } 3705 #if QC_MRG_CANS_B0048 3665 #if MTK_MDIVRP_C0138 3666 bDVAvail = false; 3667 #endif 3668 } 3669 3670 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 3671 if( m_pcSlice->getIsDepth()) 3672 { 3673 UInt uiPartIdxCenter; 3674 xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter ); 3675 TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() ); 3676 if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) ) 3677 { 3678 abCandIsInter[iCount] = true; 3679 puhInterDirNeighbours[iCount] = pcTextureCU->getInterDir( uiPartIdxCenter ); 3680 if( ( puhInterDirNeighbours[iCount] & 1 ) == 1 ) 3681 { 3682 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3683 TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv(); 3684 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 3685 cMvPred+=cAdd; 3686 cMvPred>>=2; 3687 clipMv(cMvPred); 3688 pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx()); 3689 } 3690 if ( getSlice()->isInterB() ) 3691 { 3692 if( ( puhInterDirNeighbours[iCount] & 2 ) == 2 ) 3693 { 3694 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3695 TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv(); 3696 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 3697 cMvPred+=cAdd; 3698 cMvPred>>=2; 3699 clipMv(cMvPred); 3700 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()); 3701 } 3702 } 3703 #if MERL_VSP_C0152 3704 xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 3705 #endif 3706 if ( mrgCandIdx == iCount ) 3707 { 3708 return; 3709 } 3710 iCount ++; 3711 } 3712 } 3713 #endif 3714 3706 3715 Int iPdmDir[2] = {0, 0}; 3707 #endif 3708 Int iPdmInterDir = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo 3709 #if QC_MRG_CANS_B0048 3710 , iPdmDir 3711 #endif 3712 ); 3716 #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 3717 getUnifiedMvPredCan(uiPUIdx, REF_PIC_LIST_0, 0, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir, true); 3718 Int iPdmInterDir; 3713 3719 #else 3720 Int iPdmInterDir = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir ); 3721 #endif 3722 #else // H3D_NBDV 3723 Int iPdmDir[2] = {0, 0}; 3714 3724 Int iPdmInterDir = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv ); 3715 #endif 3716 #if QC_MRG_CANS_B0048 3725 iPdmDir[0] = iPdmInterDir; 3726 iPdmDir[1] = iPdmInterDir; 3727 #endif // H3D_NBDV 3728 #if MTK_MDIVRP_C0138 3729 if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail) 3730 { 3731 setResPredAvailSubParts(true, 0, 0, uiDepth); 3732 } 3733 #endif 3734 3717 3735 if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 0 ) 3718 #else3719 if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 )3720 #endif3721 3736 { 3722 3737 abCandIsInter [ iCount ] = true; 3723 #if QC_MRG_CANS_B00483724 3738 puhInterDirNeighbours[ iCount ] = iPdmDir[0]; 3725 3739 iPdmInterDir = iPdmDir[0]; 3726 #else 3727 puhInterDirNeighbours[ iCount ] = iPdmInterDir; 3728 #endif 3740 3729 3741 if( ( iPdmInterDir & 1 ) == 1 ) 3730 3742 { … … 3747 3759 } 3748 3760 #endif 3749 #if SIMP_MRG_PRUN3750 3761 if ( mrgCandIdx == iCount ) 3751 3762 { 3752 3763 return; 3753 3764 } 3754 #endif3755 3765 iCount ++; 3756 3766 } 3757 #endif 3758 3759 #if QC_MRG_CANS_B0048 3767 3760 3768 if(extraMergeCand) 3761 3769 { … … 3773 3781 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] ); 3774 3782 } 3775 #if LGE_DVMCP_A01263783 #if H3D_NBDV 3776 3784 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 3777 3785 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 3778 3786 #endif 3779 #if SIMP_MRG_PRUN3780 3787 if ( mrgCandIdx == iCount ) 3781 3788 return; 3782 #endif3783 3789 iCount ++; 3784 3790 } 3785 3791 } 3786 #endif 3792 #endif // H3D_IVMP 3793 3794 #if MERL_VSP_COMPENSATION_C0152 3795 //===== vsp 0 ===== 3796 if( iCount < 4 + extraMergeCand ) 3797 if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 3798 return; 3799 #endif 3800 3787 3801 //left 3788 3802 UInt uiLeftPartIdx = 0; 3789 3803 TComDataCU* pcCULeft = 0; 3790 #if MVP_AT_ENTROPYSLICE_BOUNDARY3791 3804 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB, true, false ); 3792 #else3793 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );3794 #endif3795 #if PARALLEL_MERGE3796 3805 if (pcCULeft) 3797 3806 { … … 3801 3810 } 3802 3811 } 3803 #endif3804 3812 PartSize partSize = getPartitionSize( uiAbsPartIdx ); 3805 3813 if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N))) 3806 3814 { 3807 if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) ) 3815 if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) 3816 #if MERL_VSP_C0152 3817 CHECK_ADD_YET(pcCULeft, uiLeftPartIdx, 1) 3818 #endif 3819 ) 3820 { 3821 abCandIsInter[iCount] = true; 3822 // get Inter Dir 3823 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 3824 // get Mv from Left 3825 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3826 if ( getSlice()->isInterB() ) 3827 { 3828 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3829 } 3830 #if FIX_CU_BASED_MRG_CAND_LIST_B0136 3831 else 3832 { 3833 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID ); 3834 } 3835 #endif 3836 3837 #if H3D_IVMP 3838 Bool bRemoveSpa = false; //pruning to inter-view candidates 3839 Int iCnloop = iCount - 1; 3840 for(; iCnloop >= 0; iCnloop --) 3841 { 3842 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 3843 { 3844 bRemoveSpa = true; 3845 abCandIsInter [ iCount ] = false; 3846 3847 //reset to the default value for IC, MC 3848 puhInterDirNeighbours[iCount] = 0; 3849 TComMv cZeroMv; 3850 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 3851 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 3852 break; 3853 } 3854 } 3855 if(!bRemoveSpa) 3856 { 3857 bLeftAvai = true; 3858 iPosLeftAbove[0] = iCount; 3859 #endif // H3D_IVMP 3860 #if H3D_NBDV 3861 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 3862 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 3863 #endif 3864 #if MERL_VSP_C0152 3865 xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 3866 #endif 3867 if ( mrgCandIdx == iCount ) 3868 { 3869 return; 3870 } 3871 iCount ++; 3872 #if H3D_IVMP 3873 } 3874 #endif 3875 } 3876 } 3877 3878 #if H3D_IVMP 3879 if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 1 ) 3880 { 3881 abCandIsInter [ iCount ] = true; 3882 puhInterDirNeighbours[ iCount ] = iPdmInterDir; 3883 if( ( iPdmInterDir & 1 ) == 1 ) 3884 { 3885 pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); 3886 } 3887 #if FIX_CU_BASED_MRG_CAND_LIST_B0136 3888 else 3889 { 3890 pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID ); 3891 } 3892 #endif 3893 if( ( iPdmInterDir & 2 ) == 2 ) 3894 { 3895 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); 3896 } 3897 #if FIX_CU_BASED_MRG_CAND_LIST_B0136 3898 else 3899 { 3900 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID ); 3901 } 3902 #endif 3903 if ( mrgCandIdx == iCount ) 3904 { 3905 return; 3906 } 3907 iCount ++; 3908 } 3909 #endif // H3D_IVMP 3910 3911 #if MERL_VSP_COMPENSATION_C0152 3912 //===== vsp 1 ===== 3913 if( iCount < 4 + extraMergeCand ) 3914 if ( !xAddVspMergeCand(1, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 3915 return; 3916 #endif 3917 3918 // above 3919 UInt uiAbovePartIdx = 0; 3920 TComDataCU* pcCUAbove = 0; 3921 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true ); 3922 if (pcCUAbove) 3923 { 3924 if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP)) 3925 { 3926 pcCUAbove = NULL; 3927 } 3928 } 3929 if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) 3930 #if MERL_VSP_C0152 3931 CHECK_ADD_YET(pcCUAbove, uiAbovePartIdx, 1) 3932 #endif 3933 && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD)) 3934 && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 3808 3935 { 3809 3936 abCandIsInter[iCount] = true; 3810 3937 // get Inter Dir 3811 puhInterDirNeighbours[iCount] = pcCU Left->getInterDir( uiLeftPartIdx );3938 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 3812 3939 // get Mv from Left 3813 pcCU Left->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );3940 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3814 3941 if ( getSlice()->isInterB() ) 3815 3942 { 3816 pcCU Left->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );3943 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3817 3944 } 3818 3945 #if FIX_CU_BASED_MRG_CAND_LIST_B0136 … … 3822 3949 } 3823 3950 #endif 3824 #if QC_MRG_CANS_B00483825 Bool bRemoveSpa = false; //pruni gnto inter-view candidates3826 Int iCnloop = iCount - 1;3951 #if H3D_IVMP 3952 Bool bRemoveSpa = false; //pruning to inter-view candidates 3953 Int iCnloop = bLeftAvai? (iCount-2): (iCount-1); 3827 3954 for(; iCnloop >= 0; iCnloop --) 3828 3955 { … … 3831 3958 bRemoveSpa = true; 3832 3959 abCandIsInter [ iCount ] = false; 3833 #if FIX_MISUSE_REFINDEX 3960 3834 3961 //reset to the default value for IC, MC 3835 3962 puhInterDirNeighbours[iCount] = 0; … … 3838 3965 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 3839 3966 break; 3840 #endif3841 3967 } 3842 3968 } 3843 3969 if(!bRemoveSpa) 3844 3970 { 3845 bLeftAvai = true; 3846 #if OL_DISMV_POS_B0069 3847 iPosLeftAbove[0] = iCount; 3848 #endif 3849 #endif 3850 #if LGE_DVMCP_A0126 3971 iPosLeftAbove[1] = iCount; 3972 #endif // H3D_IVMP 3973 #if H3D_NBDV 3851 3974 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 3852 3975 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 3853 3976 #endif 3854 #if SIMP_MRG_PRUN 3977 #if MERL_VSP_C0152 3978 xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 3979 #endif 3855 3980 if ( mrgCandIdx == iCount ) 3856 3981 { 3857 3982 return; 3858 3983 } 3859 #endif3860 3984 iCount ++; 3861 #if QC_MRG_CANS_B0048 3862 } 3863 #endif 3864 } 3865 } 3866 3867 #if HHI_INTER_VIEW_MOTION_PRED 3868 #if QC_MRG_CANS_B0048 3869 if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 1 ) 3870 #else 3871 if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 1 ) 3872 #endif 3985 #if H3D_IVMP 3986 } 3987 #endif 3988 } 3989 3990 #if H3D_IVMP 3991 if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 2 ) 3873 3992 { 3874 3993 abCandIsInter [ iCount ] = true; … … 3894 4013 } 3895 4014 #endif 3896 #if SIMP_MRG_PRUN3897 4015 if ( mrgCandIdx == iCount ) 3898 4016 { 3899 4017 return; 3900 4018 } 3901 #endif3902 4019 iCount ++; 3903 4020 } 3904 #endif 3905 3906 // above 3907 #if !SIMP_MRG_PRUN 3908 partSize = getPartitionSize( uiAbsPartIdx ); 3909 if (!(uiPUIdx == 1 && (partSize == SIZE_2NxN || partSize == SIZE_2NxnU || partSize == SIZE_2NxnD))) 3910 { 3911 #endif 3912 UInt uiAbovePartIdx = 0; 3913 TComDataCU* pcCUAbove = 0; 3914 #if MVP_AT_ENTROPYSLICE_BOUNDARY 3915 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true ); 3916 #else 3917 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, true, true ); 3918 #endif 3919 #if PARALLEL_MERGE 3920 if (pcCUAbove) 3921 { 3922 if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP)) 3923 { 3924 pcCUAbove = NULL; 3925 } 3926 } 3927 #endif 3928 #if SIMP_MRG_PRUN 3929 if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) 3930 && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD)) 3931 && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 3932 #else 3933 if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) ) 3934 #endif 3935 { 3936 abCandIsInter[iCount] = true; 3937 // get Inter Dir 3938 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 3939 // get Mv from Left 3940 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3941 if ( getSlice()->isInterB() ) 3942 { 3943 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3944 } 3945 #if FIX_CU_BASED_MRG_CAND_LIST_B0136 3946 else 3947 { 3948 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID ); 3949 } 3950 #endif 3951 #if QC_MRG_CANS_B0048 3952 Bool bRemoveSpa = false; //prunign to inter-view candidates 3953 Int iCnloop = bLeftAvai? (iCount-2): (iCount-1); 3954 for(; iCnloop >= 0; iCnloop --) 3955 { 3956 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 3957 { 3958 bRemoveSpa = true; 3959 abCandIsInter [ iCount ] = false; 3960 #if FIX_MISUSE_REFINDEX 3961 //reset to the default value for IC, MC 3962 puhInterDirNeighbours[iCount] = 0; 3963 TComMv cZeroMv; 3964 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 3965 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 3966 break; 3967 #endif 3968 } 3969 } 3970 if(!bRemoveSpa) 3971 { 3972 #if OL_DISMV_POS_B0069 3973 iPosLeftAbove[1] = iCount; 3974 #endif 3975 #endif 3976 #if LGE_DVMCP_A0126 3977 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 3978 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 3979 #endif 3980 #if SIMP_MRG_PRUN 3981 if ( mrgCandIdx == iCount ) 3982 { 4021 #endif // H3D_IVMP 4022 4023 #if MERL_VSP_COMPENSATION_C0152 4024 //===== vsp 2 ===== 4025 if( iCount < 4 + extraMergeCand ) 4026 if ( !xAddVspMergeCand(2, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 3983 4027 return; 3984 }3985 #endif3986 iCount ++;3987 #if QC_MRG_CANS_B00483988 }3989 #endif3990 }3991 #if !SIMP_MRG_PRUN3992 }3993 #endif3994 3995 #if HHI_INTER_VIEW_MOTION_PRED3996 #if QC_MRG_CANS_B00483997 if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 2 )3998 #else3999 if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 2 )4000 #endif4001 {4002 abCandIsInter [ iCount ] = true;4003 puhInterDirNeighbours[ iCount ] = iPdmInterDir;4004 if( ( iPdmInterDir & 1 ) == 1 )4005 {4006 pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );4007 }4008 #if FIX_CU_BASED_MRG_CAND_LIST_B01364009 else4010 {4011 pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );4012 }4013 #endif4014 if( ( iPdmInterDir & 2 ) == 2 )4015 {4016 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );4017 }4018 #if FIX_CU_BASED_MRG_CAND_LIST_B01364019 else4020 {4021 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );4022 }4023 #endif4024 #if SIMP_MRG_PRUN4025 if ( mrgCandIdx == iCount )4026 {4027 return;4028 }4029 #endif4030 iCount ++;4031 }4032 4028 #endif 4033 4029 … … 4035 4031 UInt uiAboveRightPartIdx = 0; 4036 4032 TComDataCU* pcCUAboveRight = 0; 4037 #if MVP_AT_ENTROPYSLICE_BOUNDARY4038 4033 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, false, true ); 4039 #else4040 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, true, true);4041 #endif4042 #if PARALLEL_MERGE4043 4034 if (pcCUAboveRight) 4044 4035 { … … 4048 4039 } 4049 4040 } 4050 #endif 4051 #if SIMP_MRG_PRUN 4052 if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 4053 #else 4054 if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) ) 4055 #endif 4041 if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) 4042 #if MERL_VSP_C0152 4043 CHECK_ADD_YET(pcCUAboveRight, uiAboveRightPartIdx, 1) 4044 #endif 4045 && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 4056 4046 { 4057 4047 abCandIsInter[iCount] = true; … … 4070 4060 } 4071 4061 #endif 4072 #if LGE_DVMCP_A01264062 #if H3D_NBDV 4073 4063 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 4074 4064 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 4075 4065 #endif 4076 #if SIMP_MRG_PRUN 4066 #if MERL_VSP_C0152 4067 xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4068 #endif 4077 4069 if ( mrgCandIdx == iCount ) 4078 4070 { 4079 4071 return; 4080 4072 } 4081 #endif4082 4073 iCount ++; 4083 4074 } 4084 4075 4085 #if HHI_INTER_VIEW_MOTION_PRED 4086 #if QC_MRG_CANS_B0048 4076 #if H3D_IVMP 4087 4077 if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 3 ) 4088 #else4089 if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 3 )4090 #endif4091 4078 { 4092 4079 abCandIsInter [ iCount ] = true; … … 4112 4099 } 4113 4100 #endif 4114 #if SIMP_MRG_PRUN4115 4101 if ( mrgCandIdx == iCount ) 4116 4102 { 4117 4103 return; 4118 4104 } 4119 #endif4120 4105 iCount ++; 4121 4106 } 4122 #endif 4123 4124 #if OL_DISMV_POS_B0069 4107 4125 4108 if(extraMergeCand) 4126 4109 { … … 4128 4111 { 4129 4112 assert(iCount < MRG_MAX_NUM_CANDS_MEM); 4130 Bool bRemoveSpa = false; //pruni gnto A1, B14113 Bool bRemoveSpa = false; //pruning to A1, B1 4131 4114 abCandIsInter [ iCount ] = true; 4132 4115 puhInterDirNeighbours[ iCount ] = iPdmDir[1]; … … 4148 4131 bRemoveSpa = true; 4149 4132 abCandIsInter [ iCount ] = false; 4150 #if FIX_MISUSE_REFINDEX4151 4133 //reset to the default value for IC, MC 4152 4134 puhInterDirNeighbours[iCount] = 0; … … 4155 4137 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4156 4138 break; 4157 #endif4158 4139 } 4159 4140 } 4160 4141 if(!bRemoveSpa) 4161 4142 { 4162 #if LGE_DVMCP_A01264143 #if H3D_NBDV 4163 4144 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 4164 4145 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 4165 4146 #endif 4166 #if SIMP_MRG_PRUN4167 4147 if ( mrgCandIdx == iCount ) 4168 4148 return; 4169 #endif4170 4149 iCount ++; 4171 4150 } 4172 4151 } 4173 4152 } 4174 #endif 4153 #endif // H3D_IVMP 4154 4155 #if MERL_VSP_COMPENSATION_C0152 4156 //===== vsp 3 ===== 4157 if( iCount < 4 + extraMergeCand ) 4158 if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 4159 return; 4160 #endif 4161 4162 #if MERL_VSP_C0152 4163 #if VSP_MERGE_POS < 4 4164 #if H3D_IVMP 4165 if( iCount < 4 + extraMergeCand ) 4166 #else 4167 if( iCount < 4 ) 4168 #endif 4169 { 4170 #endif 4171 #endif 4172 4175 4173 //left bottom 4176 4174 UInt uiLeftBottomPartIdx = 0; 4177 4175 TComDataCU* pcCULeftBottom = 0; 4178 #if MVP_AT_ENTROPYSLICE_BOUNDARY4179 4176 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB, true, false ); 4180 #else4181 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );4182 #endif4183 #if PARALLEL_MERGE4184 4177 if (pcCULeftBottom) 4185 4178 { … … 4189 4182 } 4190 4183 } 4191 #endif 4192 #if SIMP_MRG_PRUN 4193 if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 4194 #else 4195 if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ) 4196 #endif 4184 if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) 4185 #if MERL_VSP_C0152 4186 CHECK_ADD_YET(pcCULeftBottom, uiLeftBottomPartIdx, 1) 4187 #endif 4188 && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 4197 4189 { 4198 4190 abCandIsInter[iCount] = true; … … 4211 4203 } 4212 4204 #endif 4213 #if LGE_DVMCP_A01264205 #if H3D_NBDV 4214 4206 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 4215 4207 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 4216 4208 #endif 4217 #if SIMP_MRG_PRUN 4209 #if MERL_VSP_C0152 4210 xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4211 #endif 4218 4212 if ( mrgCandIdx == iCount ) 4219 4213 { 4220 4214 return; 4221 4215 } 4222 #endif4223 4216 iCount ++; 4224 4217 } 4225 4226 #if HHI_INTER_VIEW_MOTION_PRED 4227 #if QC_MRG_CANS_B0048 4218 #if MERL_VSP_C0152 4219 #if VSP_MERGE_POS < 4 4220 } 4221 #endif 4222 #endif 4223 4224 #if H3D_IVMP 4228 4225 if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 4 ) 4229 #else4230 if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 4 )4231 #endif4232 4226 { 4233 4227 abCandIsInter [ iCount ] = true; … … 4253 4247 } 4254 4248 #endif 4255 #if SIMP_MRG_PRUN4256 4249 if ( mrgCandIdx == iCount ) 4257 4250 { 4258 4251 return; 4259 4252 } 4260 #endif4261 4253 iCount ++; 4262 4254 } 4263 #endif 4264 4265 // above left 4266 #if HHI_INTER_VIEW_MOTION_PRED 4255 #endif // H3D_IVMP 4256 4257 #if MERL_VSP_COMPENSATION_C0152 4258 //===== vsp 4 ===== 4259 if( iCount < 4 + extraMergeCand ) 4260 if ( !xAddVspMergeCand(4, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 4261 return; 4262 #endif 4263 4264 // above left 4265 #if H3D_IVMP 4267 4266 if( iCount < 4 + extraMergeCand ) 4268 4267 #else … … 4272 4271 UInt uiAboveLeftPartIdx = 0; 4273 4272 TComDataCU* pcCUAboveLeft = 0; 4274 #if MVP_AT_ENTROPYSLICE_BOUNDARY4275 4273 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, false, true ); 4276 #else4277 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, true, true );4278 #endif4279 #if PARALLEL_MERGE4280 4274 if (pcCUAboveLeft) 4281 4275 { … … 4285 4279 } 4286 4280 } 4287 #endif4288 #if SIMP_MRG_PRUN4289 4281 if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) 4282 #if MERL_VSP_C0152 4283 CHECK_ADD_YET(pcCUAboveLeft, uiAboveLeftPartIdx, 1) 4284 #endif 4290 4285 && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 4291 4286 && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 4292 4287 ) 4293 #else4294 if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) )4295 #endif4296 4288 { 4297 4289 abCandIsInter[iCount] = true; … … 4310 4302 } 4311 4303 #endif 4312 #if LGE_DVMCP_A01264304 #if H3D_NBDV 4313 4305 pcMvFieldNeighbours[iCount<<1 ].getMv().m_bDvMcp = false; 4314 4306 pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false; 4315 4307 #endif 4316 #if SIMP_MRG_PRUN 4308 #if MERL_VSP_C0152 4309 xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4310 #endif 4317 4311 if ( mrgCandIdx == iCount ) 4318 4312 { 4319 4313 return; 4320 4314 } 4321 #endif4322 4315 iCount ++; 4323 4316 } 4324 4317 } 4325 4318 4319 #if MERL_VSP_COMPENSATION_C0152 4320 //===== vsp 5 ===== 4321 if( iCount < 4 + extraMergeCand ) 4322 if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 4323 return; 4324 #endif 4325 4326 4326 if ( getSlice()->getPPS()->getEnableTMVPFlag() 4327 #if QC_MRG_CANS_B00484327 #if H3D_IVMP 4328 4328 && iCount < (MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand) 4329 4329 #endif … … 4336 4336 { 4337 4337 RefPicList eRefPicList = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4338 #if SET_MERGE_TMVP_REFIDX4339 4338 Int iRefIdxTmp; 4340 4339 if ( uiPUIdx != 0 ) … … 4346 4345 iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1; 4347 4346 } 4348 #else4349 Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1;4350 #endif4351 4347 iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0; 4352 4348 } … … 4356 4352 Int uiLCUIdx = getAddr(); 4357 4353 PartSize eCUMode = getPartitionSize( 0 ); 4354 4355 #if MERL_VSP_C0152 // Potential bug, not related to BW_VSP 4356 if (eCUMode==SIZE_NxN) 4357 { 4358 printf("Size NxN ???"); 4359 assert(0); 4360 } 4361 #endif 4358 4362 4359 4363 deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); … … 4409 4413 UInt uiCurLCUIdx = getAddr(); 4410 4414 xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter ); 4411 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); 4415 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx 4416 #if QC_TMVP_MRG_REFIDX_C0047 4417 , 1 4418 #endif 4419 ); 4412 4420 if( bExistMV == false ) 4413 4421 { 4414 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 4422 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx 4423 #if QC_TMVP_MRG_REFIDX_C0047 4424 , 1 4425 #endif 4426 ); 4415 4427 } 4416 4428 if( bExistMV ) … … 4427 4439 iRefIdx = 0; 4428 4440 #endif 4429 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); 4441 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx 4442 #if QC_TMVP_MRG_REFIDX_C0047 4443 , 1 4444 #endif 4445 ); 4430 4446 if( bExistMV == false ) 4431 4447 { 4432 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 4448 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx 4449 #if QC_TMVP_MRG_REFIDX_C0047 4450 , 1 4451 #endif 4452 ); 4433 4453 } 4434 4454 if( bExistMV ) … … 4452 4472 #endif 4453 4473 } 4454 #if LGE_DVMCP_A01264474 #if H3D_NBDV 4455 4475 pcMvFieldNeighbours[uiArrayAddr<<1 ].getMv().m_bDvMcp = false; 4456 4476 pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv().m_bDvMcp = false; 4457 4477 #endif 4458 #if SIMP_MRG_PRUN4459 4478 if ( mrgCandIdx == iCount ) 4460 4479 { … … 4462 4481 } 4463 4482 iCount++; 4464 #endif4465 4483 } 4466 4484 uiIdx++; … … 4468 4486 } 4469 4487 4470 #if SIMP_MRG_PRUN4471 4488 UInt uiArrayAddr = iCount; 4472 #else4473 #if HHI_INTER_VIEW_MOTION_PRED4474 for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS_MEM; uiOuter++ )4475 #else4476 for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ )4477 #endif4478 {4479 if( abCandIsInter[ uiOuter ] )4480 {4481 #if HHI_INTER_VIEW_MOTION_PRED4482 for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS_MEM; uiIter++ )4483 #else4484 for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ )4485 #endif4486 {4487 UInt uiMvFieldNeighIdxCurr = uiOuter << 1;4488 UInt uiMvFieldNeighIdxComp = uiIter << 1;4489 if( getSlice()->isInterB() )4490 {4491 if( puhInterDirNeighbours[ uiOuter ] == 3 )4492 {4493 if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&4494 pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&4495 puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )4496 {4497 abCandIsInter[ uiIter ] = false;4498 }4499 }4500 else if( puhInterDirNeighbours[ uiOuter ] == 2 )4501 {4502 if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&4503 pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&4504 puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )4505 {4506 abCandIsInter[ uiIter ] = false;4507 }4508 }4509 else4510 {4511 if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&4512 pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() &&4513 puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )4514 {4515 abCandIsInter[ uiIter ] = false;4516 }4517 }4518 }4519 else4520 {4521 if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&4522 pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() )4523 {4524 assert( puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] );4525 abCandIsInter[ uiIter ] = false;4526 }4527 }4528 }4529 }4530 }4531 4532 #if HHI_INTER_VIEW_MOTION_PRED4533 bool abCandIsInterFlag[MRG_MAX_NUM_CANDS_MEM];4534 for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)4535 #else4536 bool abCandIsInterFlag[MRG_MAX_NUM_CANDS];4537 for (int i=0; i<MRG_MAX_NUM_CANDS; i++)4538 #endif4539 {4540 abCandIsInterFlag[i] = abCandIsInter[ i ];4541 abCandIsInter[ i ] = false;4542 }4543 4544 UInt uiArrayAddr = 0;4545 4546 #if HHI_INTER_VIEW_MOTION_PRED4547 for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)4548 #else4549 for (int i=0; i<MRG_MAX_NUM_CANDS; i++)4550 #endif4551 {4552 if (abCandIsInterFlag[i])4553 {4554 abCandIsInter[uiArrayAddr] = true;4555 puhInterDirNeighbours[uiArrayAddr] = puhInterDirNeighbours[i];4556 pcMvFieldNeighbours[uiArrayAddr<<1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());4557 pcMvFieldNeighbours[(uiArrayAddr<<1)+1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());4558 ++uiArrayAddr;4559 }4560 }4561 4562 #if HHI_INTER_VIEW_MOTION_PRED4563 for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS_MEM; i++)4564 #else4565 for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS; i++)4566 #endif4567 {4568 puhInterDirNeighbours[i] = (getSlice()->isInterB()) ? 3 : 1;4569 abCandIsInter[i] = false;4570 TComMv tmpMv;4571 tmpMv.set(0,0);4572 pcMvFieldNeighbours[i<<1].setMvField(tmpMv, 0);4573 if ( getSlice()->isInterB() )4574 {4575 pcMvFieldNeighbours[(i<<1)+1].setMvField(tmpMv, 0);4576 }4577 }4578 #endif4579 4489 UInt uiCutoff = uiArrayAddr; 4580 4490 4581 4491 if ( getSlice()->isInterB() ) 4582 4492 { 4583 #if H HI_INTER_VIEW_MOTION_PRED4493 #if H3D_IVMP 4584 4494 Int iCombinedCount = 0; 4585 4495 Int iMaxCombCount = ( extraMergeCand ? 6 : 5 ); … … 4598 4508 { 4599 4509 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 4600 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 4510 #if MERL_VSP_C0152 4511 Bool bValid = true; 4512 if (pcMvFieldNeighbours[i<<1].getRefIdx() < 0 || pcMvFieldNeighbours[(j<<1)+1].getRefIdx() < 0) // NOT_VALID 4513 bValid = false; 4514 #endif 4515 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2) 4516 #if MERL_VSP_C0152 4517 && bValid 4518 #endif 4519 ) 4601 4520 { 4602 4521 abCandIsInter[uiArrayAddr] = true; … … 4622 4541 } 4623 4542 } 4624 #if !REMOVE_NON_SCALED4625 Int iScaledCount = 0;4626 #if HHI_INTER_VIEW_MOTION_PRED4627 for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; i++)4628 #else4629 for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; i++)4630 #endif4631 {4632 #if HHI_INTER_VIEW_MOTION_PRED4633 for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; j++)4634 #else4635 for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; j++)4636 #endif4637 {4638 if (abCandIsInter[i] && pcMvFieldNeighbours[(i<<1)+j].getRefIdx()>=0 && pcMvFieldNeighbours[(i<<1)+j].getRefIdx() < m_pcSlice->getNumRefIdx((j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0))4639 {4640 Int iCurrPOC = m_pcSlice->getPOC();4641 Int iCurrRefPOC1 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );4642 Int iCurrRefPOC2 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_0:REF_PIC_LIST_1, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );4643 4644 if (iCurrRefPOC1 != iCurrRefPOC2 && abs(iCurrPOC-iCurrRefPOC1) == abs(iCurrPOC-iCurrRefPOC2))4645 {4646 abCandIsInter[uiArrayAddr] = true;4647 puhInterDirNeighbours[uiArrayAddr] = 3;4648 4649 TComMv cMvPred = pcMvFieldNeighbours[(i<<1)+j].getMv();4650 TComMv rcMv;4651 4652 rcMv.set(-1*cMvPred.getHor(), -1*cMvPred.getVer());4653 4654 if (j==0)4655 {4656 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[(i<<1)].getMv(), pcMvFieldNeighbours[(i<<1)].getRefIdx());4657 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)].getRefIdx());4658 }4659 else4660 {4661 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)+1].getRefIdx());4662 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());4663 }4664 4665 uiArrayAddr++;4666 iScaledCount++;4667 }4668 }4669 }4670 }4671 #endif4672 4543 } 4673 4544 4674 4545 Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0); 4675 #if H HI_INTER_VIEW_MOTION_PRED4546 #if H3D_IVMP 4676 4547 for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM; r++) 4677 4548 #else … … 4696 4567 uiArrayAddr++; 4697 4568 } 4698 #if H HI_INTER_VIEW_MOTION_PRED4569 #if H3D_IVMP 4699 4570 if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand ) 4700 4571 { … … 4770 4641 if( uiIter == 0 ) 4771 4642 { 4772 if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) 4643 if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) 4644 #if MERL_VSP_C0152 4645 && !pcCorner->getVSPIndex( uiCornerPUIdx ) 4646 #endif 4647 ) 4773 4648 { 4774 4649 rbValidCand = true; … … 4805 4680 else 4806 4681 { 4807 if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) ) 4682 if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) 4683 #if MERL_VSP_C0152 4684 && !pcCorner->getVSPIndex( uiCornerPUIdx ) 4685 #endif 4686 ) 4808 4687 { 4809 4688 rbValidCand = true; … … 4839 4718 } 4840 4719 } 4841 #if PARALLEL_MERGE4842 4720 /** Check whether the current PU and a spatial neighboring PU are in a same ME region. 4843 4721 * \param xN, xN location of the upper-left corner pixel of a neighboring PU … … 4926 4804 } 4927 4805 4928 #endif4929 4806 AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx) 4930 4807 { 4931 4808 return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]); 4932 4809 } 4933 #if QC_MULTI_DIS_CAN_A00974810 #if H3D_NBDV 4934 4811 /** construct a list of disparity motion vectors from the neighbouring PUs **/ 4935 4812 Void TComDataCU::getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo ) … … 4948 4825 4949 4826 UInt uiIdx = 0; 4950 #if MVP_AT_ENTROPYSLICE_BOUNDARY4951 4827 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); 4952 #else4953 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);4954 #endif4955 4828 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 4829 #if MERL_VSP_C0152 4830 if(! pcTmpCU->getVSPIndex(uiIdx)) 4831 #endif 4956 4832 { 4957 4833 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) … … 4973 4849 } 4974 4850 } 4975 #if MVP_AT_ENTROPYSLICE_BOUNDARY4976 4851 pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true); 4977 #else4978 pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);4979 #endif4980 4852 4981 4853 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 4854 #if MERL_VSP_C0152 4855 if(! pcTmpCU->getVSPIndex(uiIdx)) 4856 #endif 4982 4857 { 4983 4858 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) … … 5000 4875 } 5001 4876 5002 #if MVP_AT_ENTROPYSLICE_BOUNDARY5003 4877 pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true); 5004 #else5005 pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);5006 #endif5007 4878 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 4879 #if MERL_VSP_C0152 4880 if(! pcTmpCU->getVSPIndex(uiIdx)) 4881 #endif 5008 4882 { 5009 4883 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) … … 5025 4899 } 5026 4900 } 5027 #if MVP_AT_ENTROPYSLICE_BOUNDARY5028 4901 pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false); 5029 #else5030 pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);5031 #endif5032 4902 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 4903 #if MERL_VSP_C0152 4904 if(! pcTmpCU->getVSPIndex(uiIdx)) 4905 #endif 5033 4906 { 5034 4907 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) … … 5052 4925 5053 4926 // Above predictor search 5054 #if MVP_AT_ENTROPYSLICE_BOUNDARY5055 4927 pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true); 5056 4928 assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr)); 5057 #else5058 pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);5059 #endif5060 4929 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 4930 #if MERL_VSP_C0152 4931 if(! pcTmpCU->getVSPIndex(uiIdx)) 4932 #endif 5061 4933 { 5062 4934 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) … … 5257 5129 } 5258 5130 5259 #if LGE_DVMCP_A0126 5260 #if QC_SIMPLE_NBDV_B0047 5261 Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo 5262 #if LGE_IVMP_PARALLEL_MERGE_B0136 5263 , Bool bParMerge 5264 #endif 5131 #if MERL_VSP_C0152 5132 #if LGE_SIMP_DVP_REFINE_C0112 5133 Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine) 5265 5134 #else 5266 Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo, Bool bMerge, RefPicList eRefPicList0, Int iRefIdx0 5267 #if LGE_IVMP_PARALLEL_MERGE_B0136 5268 , Bool bParMerge 5269 #endif 5135 Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec) 5136 #endif 5137 { 5138 Int depStride = pcBaseViewDepthPicYuv->getStride(); 5139 5140 Int width = pcBaseViewDepthPicYuv->getWidth(); 5141 Int height = pcBaseViewDepthPicYuv->getHeight(); 5142 5143 Int depthPosX = Clip3(0, width - iWidth - 1, iBlkX + (mv->getHor()>>2)); 5144 Int depthPosY = Clip3(0, height- iHeight - 1, iBlkY + (mv->getVer()>>2)); 5145 5146 Pel *depth = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride; 5147 Pel maxDepth = 0; 5148 #if LGE_SIMP_DVP_REFINE_C0112 5149 if ( bSimpleDvpRefine ) 5150 { 5151 Int depthStartPosX = Clip3(0, width - iWidth - 1, iBlkX + (mv->getHor()>>2)); 5152 Int depthStartPosY = Clip3(0, height- iHeight - 1, iBlkY + (mv->getVer()>>2)); 5153 Int depthEndPosX = Clip3(0, width - iWidth - 1, iBlkX + iWidth + (mv->getHor()>>2)); 5154 Int depthEndPosY = Clip3(0, height- iHeight - 1, iBlkY + iHeight + (mv->getVer()>>2)); 5155 Int iCenterX = (depthStartPosX + depthEndPosX) >> 1; 5156 Int iCenterY = (depthStartPosY + depthEndPosY) >> 1; 5157 5158 Pel *depthTL = pcBaseViewDepthPicYuv->getLumaAddr(); 5159 Int aiDepth[5]; 5160 aiDepth[0] = depthTL[ (depthStartPosY) * depStride + depthStartPosX ]; // Left Top 5161 aiDepth[1] = depthTL[ (depthEndPosY) * depStride + depthStartPosX ]; // Left Bottom 5162 aiDepth[2] = depthTL[ (depthStartPosY) * depStride + depthEndPosX ]; // Right Top 5163 aiDepth[3] = depthTL[ (depthEndPosY) * depStride + depthEndPosX ]; // Right Bottom 5164 aiDepth[4] = depthTL[ (iCenterY) * depStride + iCenterX ]; // Center 5165 for (Int i = 0; i < 5; i++) 5166 { 5167 if (maxDepth < aiDepth[i]) 5168 maxDepth = aiDepth[i]; 5169 } 5170 } 5171 else 5172 { 5173 for (Int j = 0; j < iHeight; j++) 5174 { 5175 for (Int i = 0; i < iWidth; i++) 5176 { 5177 if (maxDepth < depth[i]) 5178 maxDepth = depth[i]; 5179 } 5180 depth += depStride; 5181 } 5182 } 5183 #else 5184 for (Int j = 0; j < iHeight; j++) 5185 { 5186 for (Int i = 0; i < iWidth; i++) 5187 { 5188 if (maxDepth < depth[i]) 5189 maxDepth = depth[i]; 5190 } 5191 depth += depStride; 5192 } 5193 #endif 5194 Int disparity = aiShiftLUT[ maxDepth ] << iShiftPrec; 5195 5196 return disparity; 5197 } 5198 #if LGE_SIMP_DVP_REFINE_C0112 5199 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine) 5200 #else 5201 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred) 5202 #endif 5203 { 5204 if (picDepth) 5205 { 5206 UInt uiAbsPartAddrCurrCU = m_uiAbsIdxInLCU + uiPartAddr; 5207 Int iWidth, iHeight; 5208 getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); // The modified value of uiPartAddr won't be used any more 5209 5210 TComPicYuv* pcBaseViewDepthPicYuv = picDepth->getPicYuvRec(); 5211 Int iBlkX = ( getAddr() % picDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ]; 5212 Int iBlkY = ( getAddr() / picDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ]; 5213 Int* aiShiftLUT; 5214 Int iShiftPrec; 5215 getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec); 5216 #if LGE_SIMP_DVP_REFINE_C0112 5217 Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine ); 5218 #else 5219 Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec); 5220 #endif 5221 cMvPred->setHor(x); 5222 clipMv(*cMvPred); 5223 } 5224 } 5225 #endif 5226 5227 #if H3D_NBDV 5228 Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo , Bool bParMerge 5229 #if MERL_VSP_C0152 5230 , Bool bDepthRefine 5270 5231 #endif 5271 5232 ) … … 5273 5234 PartSize eCUMode = getPartitionSize( uiPartAddr ); 5274 5235 TComDataCU* pcTmpCU = NULL; 5275 #if !QC_SIMPLE_NBDV_B00475276 TComDataCU* pcCULeft = NULL;5277 #endif5278 5236 pDInfo->iN = 0; 5279 5237 … … 5283 5241 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 5284 5242 5285 #if QC_SIMPLE_NBDV_B00475286 5243 const Int iNumofDvMCP = 7; 5244 #if MTK_RELEASE_DV_CONSTRAINT_C0129 5245 Int aiDvMcpDvCandX[2][iNumofDvMCP] = {{0,}, {0,}}; // dummy, 5 spatial + 1 temporal 5246 Int aiDvMcpDvCandY[2][iNumofDvMCP] = {{0,}, {0,}}; // dummy, 5 spatial + 1 temporal 5247 #else 5287 5248 Int aiDvMcpDvCand[2][iNumofDvMCP] = {{0,}, {0,}}; // dummy, 5 spatial + 1 temporal 5249 #endif 5288 5250 Bool abDvMcpFlag [2][iNumofDvMCP] = {{false,},{false,}}; 5289 #else5290 Int aiDvMcpDvCand[2][7] = {{0,}, {0,}}; // dummy, 5 spatial + 1 temporal5291 Bool abDvMcpFlag [2][7] = {{false,},{false,}};5292 //Int aiRefPOC [2][7] = {{-1,},{-1}}; // debug5293 #endif5294 5251 TComMv cTmpMvPred, cMv; 5295 5252 Bool bTmpIsSkipped = false; 5296 5253 Bool bDvMcpIsFound = false; 5297 #if LGE_DVMCP_MEM_REDUCTION_B0135 5298 Int iLCUAddrDiff = 0; 5299 #endif 5300 5301 #if LGE_IVMP_PARALLEL_MERGE_B0136 5254 Int iLCUAddrDiff = 0; 5255 5302 5256 Int xP, yP, nPSW, nPSH; 5303 5257 if( bParMerge) 5304 5258 this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH); 5305 #endif5306 5259 5307 5260 deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT ); 5308 5261 deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB ); 5309 5262 5310 UInt uiIdx = 0; 5311 #if MVP_AT_ENTROPYSLICE_BOUNDARY 5312 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); 5313 #else 5314 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB); 5315 #endif 5316 #if DV_DERIVATION_PARALLEL_B0096 5317 if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) ) 5318 { 5319 pcTmpCU = NULL; 5320 } 5321 #endif 5322 #if LGE_IVMP_PARALLEL_MERGE_B0136 5323 if (pcTmpCU && bParMerge) 5324 { 5325 if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP)) 5326 { 5327 pcTmpCU = NULL; 5328 } 5329 } 5330 #endif 5331 5332 #if !QC_SIMPLE_NBDV_B0047 5333 pcCULeft = pcTmpCU; 5334 UInt uiLeftPartIdx = uiIdx; 5335 #endif 5336 5337 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 5338 { 5339 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5340 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5341 { 5342 eRefPicList = RefPicList(iList); 5343 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5344 if( refId >= 0) 5345 { 5346 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5347 if (refViewIdx!= m_pcSlice->getViewId()) // DCP 5348 { 5349 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5350 clipMv(cMvPred); 5351 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5352 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5353 return; 5354 } 5355 else // MCP 5356 { 5357 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5358 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5359 { 5360 aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX; 5361 abDvMcpFlag [iList][DVFROM_LEFT] = true; 5362 bDvMcpIsFound = true; 5363 } 5364 } 5365 } 5366 } 5367 } 5368 5369 #if MVP_AT_ENTROPYSLICE_BOUNDARY 5370 pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true); 5371 #else 5372 pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT); 5373 #endif 5374 #if DV_DERIVATION_PARALLEL_B0096 5375 if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) ) 5376 { 5377 pcTmpCU = NULL; 5378 } 5379 #endif 5380 #if LGE_IVMP_PARALLEL_MERGE_B0136 5381 if (pcTmpCU && bParMerge) 5382 { 5383 if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP)) 5384 { 5385 pcTmpCU = NULL; 5386 } 5387 } 5388 #endif 5389 5390 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 5391 { 5392 #if LGE_DVMCP_MEM_REDUCTION_B0135 5393 iLCUAddrDiff = getAddr() - pcTmpCU->getAddr(); 5394 #endif 5395 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5396 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5397 { 5398 eRefPicList = RefPicList(iList); 5399 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5400 if( refId >= 0) 5401 { 5402 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5403 if (refViewIdx!= m_pcSlice->getViewId()) 5404 { 5405 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5406 clipMv(cMvPred); 5407 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5408 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5409 return; 5410 } 5411 #if LGE_DVMCP_MEM_REDUCTION_B0135 5412 else if(iLCUAddrDiff == 0) //MCP, within same LCU 5413 #else 5414 else // MCP 5415 #endif 5416 { 5417 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5418 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5419 { 5420 aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX; 5421 abDvMcpFlag [iList][DVFROM_ABOVE] = true; 5422 bDvMcpIsFound = true; 5423 } 5424 } 5425 } 5426 } 5427 } 5428 5429 #if MVP_AT_ENTROPYSLICE_BOUNDARY 5430 pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true); 5431 #else 5432 pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true); 5433 #endif 5434 #if LGE_IVMP_PARALLEL_MERGE_B0136 5435 if (pcTmpCU && bParMerge) 5436 { 5437 if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP)) 5438 { 5439 pcTmpCU = NULL; 5440 } 5441 } 5442 #endif 5443 5444 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 5445 { 5446 #if LGE_DVMCP_MEM_REDUCTION_B0135 5447 iLCUAddrDiff = getAddr() - pcTmpCU->getAddr(); 5448 #endif 5449 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5450 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5451 { 5452 eRefPicList = RefPicList(iList); 5453 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5454 if( refId >= 0) 5455 { 5456 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5457 if (refViewIdx!= m_pcSlice->getViewId()) 5458 { 5459 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5460 clipMv(cMvPred); 5461 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5462 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5463 return; 5464 } 5465 #if LGE_DVMCP_MEM_REDUCTION_B0135 5466 else if(iLCUAddrDiff == 0) 5467 #else 5468 else // MCP 5469 #endif 5470 { 5471 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5472 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5473 { 5474 aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX; 5475 abDvMcpFlag [iList][DVFROM_ABOVERIGHT] = true; 5476 bDvMcpIsFound = true; 5477 } 5478 } 5479 } 5480 } 5481 } 5482 5483 #if MVP_AT_ENTROPYSLICE_BOUNDARY 5484 pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false); 5485 #else 5486 pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB); 5487 #endif 5488 #if LGE_IVMP_PARALLEL_MERGE_B0136 5489 if (pcTmpCU && bParMerge) 5490 { 5491 if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP)) 5492 { 5493 pcTmpCU = NULL; 5494 } 5495 } 5496 #endif 5497 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 5498 { 5499 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5500 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5501 { 5502 eRefPicList = RefPicList(iList); 5503 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5504 if( refId >= 0) 5505 { 5506 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5507 if (refViewIdx!= m_pcSlice->getViewId()) 5508 { 5509 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5510 clipMv(cMvPred); 5511 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5512 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5513 return; 5514 } 5515 else // MCP 5516 { 5517 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5518 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5519 { 5520 aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX; 5521 abDvMcpFlag [iList][DVFROM_LEFTBELOW] = true; 5522 bDvMcpIsFound = true; 5523 } 5524 } 5525 } 5526 } 5527 } 5528 5529 // Above predictor search 5530 #if MVP_AT_ENTROPYSLICE_BOUNDARY 5531 pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true); 5532 assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr)); 5533 #else 5534 pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true); 5535 #endif 5536 #if LGE_IVMP_PARALLEL_MERGE_B0136 5537 if (pcTmpCU && bParMerge) 5538 { 5539 if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP)) 5540 { 5541 pcTmpCU = NULL; 5542 } 5543 } 5544 #endif 5545 5546 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 5547 { 5548 #if LGE_DVMCP_MEM_REDUCTION_B0135 5549 iLCUAddrDiff = getAddr() - pcTmpCU->getAddr(); 5550 #endif 5551 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5552 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5553 { 5554 eRefPicList = RefPicList(iList); 5555 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5556 if( refId >= 0) 5557 { 5558 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5559 if (refViewIdx!= m_pcSlice->getViewId()) 5560 { 5561 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5562 clipMv(cMvPred); 5563 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5564 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5565 return; 5566 } 5567 #if LGE_DVMCP_MEM_REDUCTION_B0135 5568 else if(iLCUAddrDiff <= 1) 5569 #else 5570 else // MCP 5571 #endif 5572 { 5573 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5574 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5575 { 5576 aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX; 5577 abDvMcpFlag [iList][DVFROM_ABOVELEFT] = true; 5578 bDvMcpIsFound = true; 5579 } 5580 } 5581 } 5582 } 5583 } 5584 5263 #if MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097 5585 5264 // copied from getInterMergeCand() 5586 5265 if ( getSlice()->getPPS()->getEnableTMVPFlag() ) 5587 5266 { 5588 #if !QC_SIMPLE_NBDV_B00475589 UInt uiPUIdx = uiPartIdx;5590 UInt uiAbsPartAddr = uiPartAddr;5591 5592 // col [2]5593 Int iRefIdxSkip[2] = {-1, -1};5594 if( !bMerge )5595 {5596 iRefIdxSkip[ eRefPicList0 ] = iRefIdx0;5597 }5598 else5599 {5600 for (Int i=0; i<2; i++)5601 {5602 RefPicList eRefPicList1 = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );5603 #if SET_MERGE_TMVP_REFIDX5604 Int iRefIdxTmp;5605 if ( uiPUIdx != 0 )5606 {5607 iRefIdxTmp = 0;5608 }5609 else5610 {5611 iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;5612 }5613 #else5614 Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;5615 #endif5616 iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;5617 }5618 }5619 5620 //>> MTK colocated-RightBottom5621 UInt uiPartIdxRB;5622 Int uiLCUIdx = getAddr();5623 eCUMode = getPartitionSize( 0 );5624 5625 deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB );5626 5627 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];5628 //UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();5629 5630 TComMv cColMv;5631 Int iRefIdx;5632 5633 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check5634 {5635 uiLCUIdx = -1;5636 }5637 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )5638 {5639 uiLCUIdx = -1;5640 }5641 else5642 {5643 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU5644 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU5645 {5646 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];5647 uiLCUIdx = getAddr();5648 }5649 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU5650 {5651 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];5652 uiLCUIdx = -1 ;5653 }5654 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU5655 {5656 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];5657 uiLCUIdx = getAddr() + 1;5658 }5659 else //is the right bottom corner of LCU5660 {5661 uiAbsPartAddr = 0;5662 uiLCUIdx = -1 ;5663 }5664 }5665 5666 Bool bExistMV = false;5667 UInt uiPartIdxCenter;5668 UInt uiCurLCUIdx = getAddr();5669 xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );5670 5671 Int iTargetView, iStartView;5672 if( !bMerge ) // AMVP5673 {5674 bExistMV = uiLCUIdx >= 0 && xGetColDisMV( eRefPicList0, iRefIdx0, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );5675 if( bExistMV == false )5676 {5677 bExistMV = xGetColDisMV( eRefPicList0, iRefIdx0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );5678 }5679 if( bExistMV ) // DV is found5680 {5681 if( cColMv.m_bDvMcp == false ) //=> DCP, if true => DV-MCP5682 {5683 clipMv(cColMv);5684 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;5685 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;5686 return;5687 }5688 else // DV-MCP5689 {5690 aiDvMcpDvCand[eRefPicList0][DVFROM_COL] = cColMv.getHor();5691 abDvMcpFlag [eRefPicList0][DVFROM_COL] = true;5692 bDvMcpIsFound = true;5693 }5694 }5695 }5696 else // MERGE5697 {5698 iRefIdx = iRefIdxSkip[0];5699 bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );5700 if( bExistMV == false )5701 {5702 bExistMV = xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );5703 }5704 if( bExistMV )5705 {5706 if( cColMv.m_bDvMcp == false ) // DCP5707 {5708 clipMv(cColMv);5709 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;5710 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;5711 return;5712 }5713 else { // // DV-MCP5714 aiDvMcpDvCand[0][DVFROM_COL] = cColMv.getHor();5715 abDvMcpFlag [0][DVFROM_COL] = true;5716 bDvMcpIsFound = true;5717 };5718 5719 if ( getSlice()->isInterB() )5720 {5721 iRefIdx = iRefIdxSkip[1];5722 bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );5723 if( bExistMV == false )5724 {5725 bExistMV = xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );5726 }5727 if( bExistMV )5728 {5729 if( cColMv.m_bDvMcp == false ) // DCP5730 {5731 clipMv(cColMv);5732 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;5733 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;5734 return;5735 }5736 else // DV-MCP5737 {5738 aiDvMcpDvCand[1][DVFROM_COL] = cColMv.getHor();5739 abDvMcpFlag [1][DVFROM_COL] = true;5740 bDvMcpIsFound = true;5741 };5742 }5743 }5744 }5745 }5746 #else5747 5267 TComMv cColMv; 5748 5268 Int iTargetViewIdx = 0; 5749 5269 Int iTStartViewIdx = 0; 5750 5270 UInt uiPartIdxRB, uiBRIdx; 5271 #if !MTK_SIMPLIFY_DVTC_C0135 5751 5272 Int uiViewIdxCurr= getSlice()->getViewId(); 5273 #endif 5752 5274 UInt uiPartIdxCenter; 5753 5275 xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); … … 5759 5281 uiBRIdx = uiPartIdxLT; 5760 5282 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 5283 #if MTK_SIMPLIFY_DVTC_C0135 5284 if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) 5285 { 5286 uiLCUnew = -1; 5287 } 5288 else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 5289 { 5290 uiLCUnew = -1; 5291 } 5292 else 5293 #else 5761 5294 if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() )) // image boundary check 5295 #endif 5762 5296 { 5763 5297 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU … … 5769 5303 { 5770 5304 uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 5305 #if MTK_SIMPLIFY_DVTC_C0135 5306 uiLCUnew = -1; 5307 #else 5771 5308 uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU(); 5309 #endif 5772 5310 } 5773 5311 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU … … 5779 5317 { 5780 5318 uiBRIdx = 0; 5319 #if MTK_SIMPLIFY_DVTC_C0135 5320 uiLCUnew = -1; 5321 #else 5781 5322 uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1; 5323 #endif 5782 5324 } 5783 5325 } … … 5805 5347 if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() ) 5806 5348 { 5349 #if !MTK_SIMPLIFY_DVTC_C0135 5807 5350 if (uiViewIdxCurr > 1) 5808 5351 { 5352 #endif 5809 5353 if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) 5810 5354 { 5811 5355 clipMv(cColMv); 5812 pDInfo->m_acMvCand[pDInfo->iN] = cColMv; 5813 pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; 5356 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5357 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5358 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5359 #else 5360 { 5361 TComPic* picDepth = NULL; 5362 picDepth = getSlice()->getRefPicBaseDepth(); 5363 if (picDepth && bDepthRefine) 5364 #if LGE_SIMP_DVP_REFINE_C0112 5365 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5366 #else 5367 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv); 5368 #endif 5369 5370 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5371 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5372 } 5373 #endif 5814 5374 return ; 5815 5375 } 5376 #if !MTK_SIMPLIFY_DVTC_C0135 5816 5377 } 5817 5378 #endif 5818 5379 if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter, cColMv, iTargetViewIdx, iTStartViewIdx )) 5819 5380 { 5820 5381 clipMv(cColMv); 5821 pDInfo->m_acMvCand[pDInfo->iN] = cColMv; 5822 pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; 5382 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5383 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5384 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5385 #else 5386 { 5387 TComPic* picDepth = NULL; 5388 picDepth = getSlice()->getRefPicBaseDepth(); 5389 if (picDepth && bDepthRefine) 5390 #if LGE_SIMP_DVP_REFINE_C0112 5391 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5392 #else 5393 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv); 5394 #endif 5395 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5396 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5397 } 5398 #endif 5823 5399 return ; 5824 5400 } 5401 #if !MTK_SIMPLIFY_DVTC_C0135 5825 5402 if(uiViewIdxCurr == 1) 5826 5403 { … … 5828 5405 { 5829 5406 clipMv(cColMv); 5830 pDInfo->m_acMvCand[pDInfo->iN] = cColMv; 5831 pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx; 5407 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5408 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5409 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5410 #else 5411 { 5412 TComPic* picDepth = NULL; 5413 picDepth = getSlice()->getRefPicBaseDepth(); 5414 if (picDepth && bDepthRefine) 5415 #if LGE_SIMP_DVP_REFINE_C0112 5416 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5417 #else 5418 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv); 5419 #endif 5420 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5421 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5422 } 5423 #endif 5832 5424 return ; 5833 5425 } 5834 5426 } 5835 } 5836 }5837 #endif 5427 #endif 5428 } 5429 } 5838 5430 } // if TMVP Flag 5431 #endif 5432 UInt uiIdx = 0; 5433 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); 5434 if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) ) 5435 { 5436 pcTmpCU = NULL; 5437 } 5438 5439 if (pcTmpCU && bParMerge) 5440 { 5441 if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP)) 5442 { 5443 pcTmpCU = NULL; 5444 } 5445 } 5446 5447 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 5448 { 5449 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5450 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5451 { 5452 eRefPicList = RefPicList(iList); 5453 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5454 if( refId >= 0) 5455 { 5456 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5457 if (refViewIdx != m_pcSlice->getViewId()) // DCP 5458 { 5459 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5460 clipMv(cMvPred); 5461 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5462 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5463 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5464 #else 5465 { 5466 TComPic* picDepth = NULL; 5467 picDepth = getSlice()->getRefPicBaseDepth(); 5468 if (picDepth && bDepthRefine) 5469 #if LGE_SIMP_DVP_REFINE_C0112 5470 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true); 5471 #else 5472 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred); 5473 #endif 5474 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5475 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5476 } 5477 #endif 5478 return; 5479 } 5480 else // MCP 5481 { 5482 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5483 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5484 { 5485 #if MTK_RELEASE_DV_CONSTRAINT_C0129 5486 aiDvMcpDvCandX[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX; 5487 aiDvMcpDvCandY[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispY; 5488 #else 5489 aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX; 5490 #endif 5491 abDvMcpFlag [iList][DVFROM_LEFT] = true; 5492 bDvMcpIsFound = true; 5493 } 5494 } 5495 } 5496 #if MERL_VSP_C0152 5497 else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP 5498 { 5499 TComPic* picDepth = NULL; 5500 TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx ); 5501 picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth(); 5502 if (picDepth && bDepthRefine) 5503 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv); 5504 myMv.setVer(0); 5505 5506 pDInfo->m_acMvCand[ pDInfo->iN] = myMv; 5507 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx; 5508 return; 5509 } 5510 #endif 5511 } 5512 } 5513 5514 pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true); 5515 if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) ) 5516 { 5517 pcTmpCU = NULL; 5518 } 5519 5520 if (pcTmpCU && bParMerge) 5521 { 5522 if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP)) 5523 { 5524 pcTmpCU = NULL; 5525 } 5526 } 5527 5528 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 5529 { 5530 iLCUAddrDiff = getAddr() - pcTmpCU->getAddr(); 5531 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5532 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5533 { 5534 eRefPicList = RefPicList(iList); 5535 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5536 if( refId >= 0) 5537 { 5538 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5539 if (refViewIdx!= m_pcSlice->getViewId()) 5540 { 5541 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5542 clipMv(cMvPred); 5543 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5544 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5545 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5546 #else 5547 { 5548 TComPic* picDepth = NULL; 5549 picDepth = getSlice()->getRefPicBaseDepth(); 5550 if (picDepth && bDepthRefine) 5551 #if LGE_SIMP_DVP_REFINE_C0112 5552 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true); 5553 #else 5554 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred); 5555 #endif 5556 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5557 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5558 } 5559 #endif 5560 return; 5561 } 5562 else if(iLCUAddrDiff == 0) //MCP, within same LCU 5563 { 5564 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5565 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5566 { 5567 #if MTK_RELEASE_DV_CONSTRAINT_C0129 5568 aiDvMcpDvCandX[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX; 5569 aiDvMcpDvCandY[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispY; 5570 #else 5571 aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX; 5572 #endif 5573 abDvMcpFlag [iList][DVFROM_ABOVE] = true; 5574 bDvMcpIsFound = true; 5575 } 5576 } 5577 } 5578 #if MERL_VSP_C0152 5579 else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP 5580 { 5581 TComPic* picDepth = NULL; 5582 TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx ); 5583 picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth(); 5584 if (picDepth && bDepthRefine) 5585 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv); 5586 myMv.setVer(0); 5587 5588 pDInfo->m_acMvCand[ pDInfo->iN] = myMv; 5589 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx; 5590 return; 5591 } 5592 #endif 5593 } 5594 } 5595 5596 pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true); 5597 5598 if (pcTmpCU && bParMerge) 5599 { 5600 if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP)) 5601 { 5602 pcTmpCU = NULL; 5603 } 5604 } 5605 5606 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 5607 { 5608 iLCUAddrDiff = getAddr() - pcTmpCU->getAddr(); 5609 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5610 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5611 { 5612 eRefPicList = RefPicList(iList); 5613 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5614 if( refId >= 0) 5615 { 5616 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5617 if (refViewIdx!= m_pcSlice->getViewId()) 5618 { 5619 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5620 clipMv(cMvPred); 5621 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5622 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5623 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5624 #else 5625 { 5626 TComPic* picDepth = NULL; 5627 picDepth = getSlice()->getRefPicBaseDepth(); 5628 if (picDepth && bDepthRefine) 5629 #if LGE_SIMP_DVP_REFINE_C0112 5630 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true); 5631 #else 5632 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred); 5633 #endif 5634 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5635 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5636 } 5637 #endif 5638 return; 5639 } 5640 else if(iLCUAddrDiff == 0) 5641 { 5642 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5643 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5644 { 5645 #if MTK_RELEASE_DV_CONSTRAINT_C0129 5646 aiDvMcpDvCandX[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX; 5647 aiDvMcpDvCandY[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispY; 5648 #else 5649 aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX; 5650 #endif 5651 abDvMcpFlag [iList][DVFROM_ABOVERIGHT] = true; 5652 bDvMcpIsFound = true; 5653 } 5654 } 5655 } 5656 #if MERL_VSP_C0152 5657 else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP 5658 { 5659 TComPic* picDepth = NULL; 5660 TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx ); 5661 picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth(); 5662 if (picDepth && bDepthRefine) 5663 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv); 5664 myMv.setVer(0); 5665 5666 pDInfo->m_acMvCand[ pDInfo->iN] = myMv; 5667 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx; 5668 return; 5669 } 5670 #endif 5671 } 5672 } 5673 5674 pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false); 5675 5676 if (pcTmpCU && bParMerge) 5677 { 5678 if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP)) 5679 { 5680 pcTmpCU = NULL; 5681 } 5682 } 5683 5684 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 5685 { 5686 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5687 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5688 { 5689 eRefPicList = RefPicList(iList); 5690 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5691 if( refId >= 0) 5692 { 5693 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5694 if (refViewIdx!= m_pcSlice->getViewId()) 5695 { 5696 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5697 clipMv(cMvPred); 5698 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5699 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5700 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5701 #else 5702 { 5703 TComPic* picDepth = NULL; 5704 picDepth = getSlice()->getRefPicBaseDepth(); 5705 if (picDepth && bDepthRefine) 5706 #if LGE_SIMP_DVP_REFINE_C0112 5707 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true); 5708 #else 5709 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred); 5710 #endif 5711 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5712 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5713 } 5714 #endif 5715 return; 5716 } 5717 else // MCP 5718 { 5719 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5720 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5721 { 5722 #if MTK_RELEASE_DV_CONSTRAINT_C0129 5723 aiDvMcpDvCandX[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX; 5724 aiDvMcpDvCandY[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispY; 5725 #else 5726 aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX; 5727 #endif 5728 abDvMcpFlag [iList][DVFROM_LEFTBELOW] = true; 5729 bDvMcpIsFound = true; 5730 } 5731 } 5732 } 5733 #if MERL_VSP_C0152 5734 else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP 5735 { 5736 TComPic* picDepth = NULL; 5737 TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx ); 5738 picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth(); 5739 if (picDepth && bDepthRefine) 5740 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv); 5741 myMv.setVer(0); 5742 5743 pDInfo->m_acMvCand[ pDInfo->iN] = myMv; 5744 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx; 5745 return; 5746 } 5747 #endif 5748 } 5749 } 5750 5751 // Above predictor search 5752 pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true); 5753 assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr)); 5754 5755 if (pcTmpCU && bParMerge) 5756 { 5757 if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP)) 5758 { 5759 pcTmpCU = NULL; 5760 } 5761 } 5762 5763 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 5764 { 5765 iLCUAddrDiff = getAddr() - pcTmpCU->getAddr(); 5766 5767 bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx ); 5768 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) 5769 { 5770 eRefPicList = RefPicList(iList); 5771 Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ; 5772 if( refId >= 0) 5773 { 5774 Int refViewIdx = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId); 5775 if (refViewIdx!= m_pcSlice->getViewId()) 5776 { 5777 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5778 clipMv(cMvPred); 5779 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5780 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5781 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5782 #else 5783 { 5784 TComPic* picDepth = NULL; 5785 picDepth = getSlice()->getRefPicBaseDepth(); 5786 if (picDepth && bDepthRefine) 5787 #if LGE_SIMP_DVP_REFINE_C0112 5788 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true); 5789 #else 5790 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred); 5791 #endif 5792 pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 5793 pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx; 5794 } 5795 #endif 5796 return; 5797 } 5798 else if(iLCUAddrDiff <= 1) 5799 { 5800 cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 5801 if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped ) 5802 { 5803 #if MTK_RELEASE_DV_CONSTRAINT_C0129 5804 aiDvMcpDvCandX[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX; 5805 aiDvMcpDvCandY[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispY; 5806 #else 5807 aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX; 5808 #endif 5809 abDvMcpFlag [iList][DVFROM_ABOVELEFT] = true; 5810 bDvMcpIsFound = true; 5811 } 5812 } 5813 } 5814 #if MERL_VSP_C0152 5815 else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP 5816 { 5817 TComPic* picDepth = NULL; 5818 TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx ); 5819 picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth(); 5820 if (picDepth && bDepthRefine) 5821 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv); 5822 myMv.setVer(0); 5823 5824 pDInfo->m_acMvCand[ pDInfo->iN] = myMv; 5825 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx; 5826 return; 5827 } 5828 #endif 5829 } 5830 } 5831 #if !MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097 5832 // copied from getInterMergeCand() 5833 if ( getSlice()->getPPS()->getEnableTMVPFlag() ) 5834 { 5835 TComMv cColMv; 5836 Int iTargetViewIdx = 0; 5837 Int iTStartViewIdx = 0; 5838 UInt uiPartIdxRB, uiBRIdx; 5839 #if !MTK_SIMPLIFY_DVTC_C0135 5840 Int uiViewIdxCurr= getSlice()->getViewId(); 5841 #endif 5842 UInt uiPartIdxCenter; 5843 xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter ); 5844 5845 Int uiLCUIdx = getAddr(); 5846 Int uiLCUnew = uiLCUIdx; 5847 eCUMode = getPartitionSize( 0 ); 5848 deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 5849 uiBRIdx = uiPartIdxLT; 5850 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 5851 #if MTK_SIMPLIFY_DVTC_C0135 5852 if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) 5853 { 5854 uiLCUnew = -1; 5855 } 5856 else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 5857 { 5858 uiLCUnew = -1; 5859 } 5860 else 5861 #else 5862 if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() )) // image boundary check 5863 #endif 5864 { 5865 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 5866 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 5867 { 5868 uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 5869 } 5870 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 5871 { 5872 uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 5873 #if MTK_SIMPLIFY_DVTC_C0135 5874 uiLCUnew = -1; 5875 #else 5876 uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU(); 5877 #endif 5878 } 5879 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 5880 { 5881 uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 5882 uiLCUnew = uiLCUIdx + 1; 5883 } 5884 else //is the right bottom corner of LCU 5885 { 5886 uiBRIdx = 0; 5887 #if MTK_SIMPLIFY_DVTC_C0135 5888 uiLCUnew = -1; 5889 #else 5890 uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1; 5891 #endif 5892 } 5893 } 5894 const Int iNumofCandPic = 2; 5895 for(Int i =0; i < iNumofCandPic; i++) 5896 { 5897 Int lpRef=0; 5898 if(i == 0) 5899 { //check the col-located picture 5900 eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0); 5901 #if COLLOCATED_REF_IDX 5902 lpRef = getSlice()->getColRefIdx(); 5903 #else 5904 Int lpRef = 0; 5905 #endif 5906 } 5907 else 5908 { 5909 if(!(getPic()->getRapbCheck())) 5910 break; 5911 eRefPicList=getPic()->getRapRefList(); 5912 lpRef=getPic()->getRapRefIdx(); 5913 } 5914 5915 if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() ) 5916 { 5917 #if !MTK_SIMPLIFY_DVTC_C0135 5918 if (uiViewIdxCurr > 1) 5919 { 5920 #endif 5921 if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) 5922 { 5923 clipMv(cColMv); 5924 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5925 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5926 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5927 #else 5928 { 5929 TComPic* picDepth = NULL; 5930 picDepth = getSlice()->getRefPicBaseDepth(); 5931 if (picDepth && bDepthRefine) 5932 #if LGE_SIMP_DVP_REFINE_C0112 5933 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5934 #else 5935 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv); 5936 #endif 5937 5938 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5939 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5940 } 5941 #endif 5942 return ; 5943 } 5944 #if !MTK_SIMPLIFY_DVTC_C0135 5945 } 5946 #endif 5947 if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter, cColMv, iTargetViewIdx, iTStartViewIdx )) 5948 { 5949 clipMv(cColMv); 5950 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5951 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5952 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5953 #else 5954 { 5955 TComPic* picDepth = NULL; 5956 picDepth = getSlice()->getRefPicBaseDepth(); 5957 if (picDepth && bDepthRefine) 5958 #if LGE_SIMP_DVP_REFINE_C0112 5959 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5960 #else 5961 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv); 5962 #endif 5963 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5964 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5965 } 5966 #endif 5967 return ; 5968 } 5969 #if !MTK_SIMPLIFY_DVTC_C0135 5970 if(uiViewIdxCurr == 1) 5971 { 5972 if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) 5973 { 5974 clipMv(cColMv); 5975 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 5976 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5977 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5978 #else 5979 { 5980 TComPic* picDepth = NULL; 5981 picDepth = getSlice()->getRefPicBaseDepth(); 5982 if (picDepth && bDepthRefine) 5983 #if LGE_SIMP_DVP_REFINE_C0112 5984 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5985 #else 5986 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv); 5987 #endif 5988 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5989 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5990 } 5991 #endif 5992 return ; 5993 } 5994 } 5995 #endif 5996 } 5997 } 5998 } // if TMVP Flag 5999 #endif 5839 6000 5840 6001 if( bDvMcpIsFound ) // skip dvmcp 5841 6002 { 5842 #if QC_SIMPLE_NBDV_B00475843 6003 for( Int i=1 ; i<iNumofDvMCP-1 ; i++ ) // 5 spatial 5844 #else5845 for( Int i=1 ; i<7 ; i++ ) // 5 spatial + 1 temporal5846 #endif5847 6004 { 5848 6005 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++) … … 5850 6007 if( abDvMcpFlag[iList][i]==true ) 5851 6008 { 6009 #if MTK_RELEASE_DV_CONSTRAINT_C0129 6010 TComMv dv( aiDvMcpDvCandX[iList][ i ], aiDvMcpDvCandY[iList][ i ] ); 6011 #else 5852 6012 TComMv dv( aiDvMcpDvCand[iList][ i ], 0 ); 6013 #endif 5853 6014 clipMv( dv ); 5854 pDInfo->m_acMvCand[ pDInfo->iN ] = dv; 5855 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; 6015 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131 6016 pDInfo->m_acMvCand[ pDInfo->iN] = dv; 6017 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; 6018 #else 6019 { 6020 TComPic* picDepth = NULL; 6021 picDepth = getSlice()->getRefPicBaseDepth(); 6022 if (picDepth && bDepthRefine) 6023 #if LGE_SIMP_DVP_REFINE_C0112 6024 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv, true); 6025 #else 6026 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv); 6027 #endif 6028 pDInfo->m_acMvCand[ pDInfo->iN] = dv; 6029 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; 6030 } 6031 #endif 5856 6032 return; 5857 6033 } … … 5863 6039 } 5864 6040 #endif 6041 5865 6042 #endif 5866 6043 … … 5872 6049 * \param pInfo 5873 6050 */ 5874 #if SHARP_INTERVIEW_DECOUPLE_B01116051 #if H3D_IVMP 5875 6052 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx) 5876 6053 { … … 5898 6075 if (iMVPIdx<=0) 5899 6076 { 5900 // extention part 6077 #if H3D_NBDV 6078 // Extension part 5901 6079 DisInfo cDisInfo; 5902 6080 cDisInfo.iN = 0; 5903 #if LGE_DVMCP_A0126 5904 #if QC_SIMPLE_NBDV_B0047 5905 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136 5906 getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false); 5907 #else 5908 getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo); 5909 #endif 5910 #else 5911 getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false, eRefPicList, iRefIdx ); 5912 #endif 5913 #else 5914 getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo ); 5915 #endif 6081 getDisMvpCandNBDV(uiPartIdx, uiPartAddr, &cDisInfo, false 6082 #if MERL_VSP_C0152 6083 , true 6084 #endif 6085 ); 5916 6086 if(cDisInfo.iN==0) 5917 6087 { … … 5921 6091 cDisInfo.m_aVIdxCan[0] = 0; 5922 6092 } 6093 #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 6094 Int paiPdmRefIdx[4] = {-1, -1, -1, -1}; 6095 Int iPdmDir[4] = {-1, -1, -1, -1}; 6096 #if QC_C0051_FIXED_BY_MTK 6097 TComMv cPdmMvPred[4]; 6098 #else 6099 TComMv cPdmMvPred[2]; 6100 #endif 6101 cPdmMvPred[0].m_bDvMcp = cPdmMvPred[1].m_bDvMcp = false; 6102 if(getUnifiedMvPredCan(uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, cPdmMvPred, &cDisInfo, iPdmDir, false)) 6103 #else // QC_AMVP_MRG_UNIFY_IVCAN_C0051 5923 6104 TComMv cPdmMvPred; 5924 #if QC_MULTI_DIS_CAN_A00975925 6105 if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) ) 6106 #endif // QC_AMVP_MRG_UNIFY_IVCAN_C0051 6107 #else // H3D_NBDV 6108 if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) 6109 #endif 6110 6111 #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 6112 { 6113 clipMv( cPdmMvPred[0] ); 6114 pInfo->m_acMvCand[0] = cPdmMvPred[0]; 6115 } 6116 else 6117 { 6118 pInfo->m_acMvCand[0].set(0,0); 6119 } 5926 6120 #else 5927 if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )5928 #endif5929 6121 { 5930 6122 clipMv( cPdmMvPred ); … … 5935 6127 pInfo->m_acMvCand[0].set(0,0); 5936 6128 } 6129 #endif 5937 6130 } 5938 6131 } … … 5941 6134 5942 6135 Void TComDataCU::fillMvpCandBase( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) 5943 #else 6136 #else // H3D_IVMP 5944 6137 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ) 5945 #endif 6138 #endif // H3D_IVMP 5946 6139 { 5947 6140 PartSize eCUMode = getPartitionSize( 0 ); … … 5955 6148 return; 5956 6149 } 5957 5958 #if QC_MULTI_DIS_CAN_A0097 && !SHARP_INTERVIEW_DECOUPLE_B01115959 DisInfo cDisInfo;5960 cDisInfo.iN = 0;5961 if(m_pcSlice->getSPS()->getViewId() && m_pcSlice->getSPS()->getMultiviewMvPredMode())5962 {5963 #if LGE_DVMCP_A01265964 #if QC_SIMPLE_NBDV_B00475965 #if FIX_LGE_IVMP_PARALLEL_MERGE_B01365966 getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false);5967 #else5968 getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo);5969 #endif5970 #else5971 getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false, eRefPicList, iRefIdx );5972 #endif5973 #else5974 getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo );5975 #endif5976 }5977 if(cDisInfo.iN==0)5978 {5979 cDisInfo.iN = 1;5980 cDisInfo.m_acMvCand[0].setHor(0);5981 cDisInfo.m_acMvCand[0].setVer(0);5982 cDisInfo.m_aVIdxCan[0] = 0;5983 }5984 #endif5985 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B01115986 #if ( PDM_AMVP_POS == 0 )5987 // get inter-view mv predictor (at position 0)5988 TComMv cPdmMvPred;5989 #if QC_MULTI_DIS_CAN_A00975990 if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )5991 #else5992 if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )5993 #endif5994 {5995 clipMv( cPdmMvPred );5996 pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;5997 }5998 #endif5999 #endif6000 6150 6001 6151 //-- Get Spatial MV … … 6009 6159 TComDataCU* tmpCU = NULL; 6010 6160 UInt idx; 6011 #if MVP_AT_ENTROPYSLICE_BOUNDARY6012 6161 tmpCU = getPUBelowLeft(idx, uiPartIdxLB, true, false); 6013 #else6014 tmpCU = getPUBelowLeft(idx, uiPartIdxLB);6015 #endif6016 6162 bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); 6017 6163 6018 6164 if (!bAddedSmvp) 6019 6165 { 6020 #if MVP_AT_ENTROPYSLICE_BOUNDARY6021 6166 tmpCU = getPULeft(idx, uiPartIdxLB, true, false); 6022 #else6023 tmpCU = getPULeft(idx, uiPartIdxLB);6024 #endif6025 6167 bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA); 6026 6168 } … … 6042 6184 } 6043 6185 6044 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B01116045 #if ( PDM_AMVP_POS == 1 )6046 // get inter-view mv predictor (at position 1)6047 TComMv cPdmMvPred;6048 #if QC_MULTI_DIS_CAN_A00976049 if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )6050 #else6051 if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )6052 #endif6053 {6054 clipMv( cPdmMvPred );6055 pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;6056 }6057 #endif6058 #endif6059 6060 6186 // Above predictor search 6061 6187 bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT); … … 6094 6220 } 6095 6221 6096 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111 6097 #if ( PDM_AMVP_POS == 2 ) 6098 // get inter-view mv predictor (at position 2) 6099 TComMv cPdmMvPred; 6100 #if QC_MULTI_DIS_CAN_A0097 6101 if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) ) 6102 #else 6103 if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) 6104 #endif 6105 { 6106 clipMv( cPdmMvPred ); 6107 pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; 6108 } 6109 #endif 6110 #endif 6111 6112 #if AMVP_PRUNING_SIMPLIFICATION 6222 6113 6223 if ( pInfo->iN == 2 ) 6114 6224 { … … 6116 6226 { 6117 6227 pInfo->iN = 1; 6118 #if FIX_MISUSE_REFINDEX6228 #if QC_MRG_CANS_B0048 6119 6229 pInfo->m_acMvCand[ 1 ].set(0, 0); 6120 6230 #endif 6121 6231 } 6122 6232 } 6123 #if QC_MULTI_DIS_CAN_A0097 && !SHARP_INTERVIEW_DECOUPLE_B01116124 if ( getSlice()->getViewId()!=0 && pInfo->iN == 3 )6125 {6126 if ( pInfo->m_acMvCand[ 1 ] == pInfo->m_acMvCand[ 2 ] )6127 {6128 pInfo->iN = 2;6129 if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )6130 pInfo->iN = 1;6131 }6132 else6133 {6134 if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )6135 {6136 pInfo->m_acMvCand[1 ] = pInfo->m_acMvCand[ 2 ];6137 pInfo->iN = 2;6138 }6139 else if (pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 2 ])6140 {6141 pInfo->iN = 2;6142 }6143 }6144 }6145 #endif6146 #endif6147 6233 6148 6234 if ( getSlice()->getPPS()->getEnableTMVPFlag() ) … … 6195 6281 if ( uiLCUIdx >= 0 && xGetColMVP( eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col ) ) 6196 6282 { 6197 #if FIX_LGE_DVMCP_B01336283 #if H3D_NBDV 6198 6284 cColMv.m_bDvMcp = false; 6199 6285 #endif … … 6207 6293 if (xGetColMVP( eRefPicList, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx_Col )) 6208 6294 { 6209 #if FIX_LGE_DVMCP_B01336295 #if H3D_NBDV 6210 6296 cColMv.m_bDvMcp = false; 6211 6297 #endif … … 6216 6302 } 6217 6303 6218 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111 6219 #if ( PDM_AMVP_POS == 3 ) 6220 // get inter-view mv predictor (at position 3) 6221 TComMv cPdmMvPred; 6222 #if QC_MULTI_DIS_CAN_A0097 6223 if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) ) 6224 #else 6225 if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) ) 6226 #endif 6227 { 6228 clipMv( cPdmMvPred ); 6229 pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred; 6230 } 6231 #endif 6232 #endif 6233 6234 #if !AMVP_PRUNING_SIMPLIFICATION 6235 // Check No MV Candidate 6236 xUniqueMVPCand( pInfo ); 6237 #endif 6238 6239 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111 6240 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 6241 if (pInfo->iN > iNumAMVPCands) 6242 { 6243 pInfo->iN = iNumAMVPCands; 6244 } 6245 else if (pInfo->iN < iNumAMVPCands) 6246 #else 6304 6247 6305 if (pInfo->iN > AMVP_MAX_NUM_CANDS) 6248 6306 { … … 6250 6308 } 6251 6309 else if (pInfo->iN < AMVP_MAX_NUM_CANDS) 6252 #endif 6253 { 6254 #if !AMVP_ZERO_CHECKING_REMOVAL 6255 int j; 6256 for (j=0; j<pInfo->iN; j++) 6257 { 6258 if (pInfo->m_acMvCand[j].getHor() == 0 && pInfo->m_acMvCand[j].getVer() == 0) 6259 { 6260 break; 6261 } 6262 } 6263 if (j == pInfo->iN) 6264 { 6265 #endif 6310 { 6266 6311 pInfo->m_acMvCand[pInfo->iN].set(0,0); 6267 6312 pInfo->iN++; 6268 #if !AMVP_ZERO_CHECKING_REMOVAL6269 }6270 #endif6271 6313 } 6272 6314 return ; … … 6358 6400 case MD_LEFT: 6359 6401 { 6360 #if MVP_AT_ENTROPYSLICE_BOUNDARY6361 6402 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); 6362 #else6363 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);6364 #endif6365 6403 break; 6366 6404 } 6367 6405 case MD_ABOVE: 6368 6406 { 6369 #if MVP_AT_ENTROPYSLICE_BOUNDARY6370 6407 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); 6371 #else6372 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);6373 #endif6374 6408 break; 6375 6409 } 6376 6410 case MD_ABOVE_RIGHT: 6377 6411 { 6378 #if MVP_AT_ENTROPYSLICE_BOUNDARY6379 6412 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); 6380 #else6381 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);6382 #endif6383 6413 break; 6384 6414 } 6385 6415 case MD_BELOW_LEFT: 6386 6416 { 6387 #if MVP_AT_ENTROPYSLICE_BOUNDARY6388 6417 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); 6389 #else6390 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);6391 #endif6392 6418 break; 6393 6419 } 6394 6420 case MD_ABOVE_LEFT: 6395 6421 { 6396 #if MVP_AT_ENTROPYSLICE_BOUNDARY6397 6422 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); 6398 #else6399 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);6400 #endif6401 6423 break; 6402 6424 } … … 6407 6429 } 6408 6430 6431 #if MERL_VSP_C0152 6432 if(pcTmpCU != NULL && pcTmpCU->getVSPIndex(uiIdx)) 6433 { 6434 return false; 6435 } 6436 #endif 6437 6409 6438 if ( pcTmpCU != NULL && m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) ) 6410 6439 { 6411 6440 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 6412 #if LGE_DVMCP_A01266441 #if H3D_NBDV 6413 6442 cMvPred.m_bDvMcp = false; 6414 6443 #endif … … 6454 6483 { 6455 6484 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 6456 #if LGE_DVMCP_A01266485 #if H3D_NBDV 6457 6486 cMvPred.m_bDvMcp = false; 6458 6487 #endif … … 6464 6493 } 6465 6494 6466 #if !AMVP_PRUNING_SIMPLIFICATION6467 /**6468 * Reduce list of motion vector predictors to a set of unique predictors6469 * \param pInfo list of motion vector predictors6470 */6471 Void TComDataCU::xUniqueMVPCand(AMVPInfo* pInfo)6472 {6473 Int n = 1;6474 if ( pInfo->iN == 0 )6475 {6476 #if AMVP_ZERO_CHECKING_REMOVAL6477 return;6478 #else6479 // Add a zero candidate is none is available6480 pInfo->m_acMvCand[ 0 ].setZero();6481 #endif6482 }6483 else6484 {6485 for (Int i = 1; i < pInfo->iN; i++)6486 {6487 Int j;6488 for (j = n - 1; j >= 0; j--)6489 {6490 if ( pInfo->m_acMvCand[ i ] == pInfo->m_acMvCand[ j ] )6491 {6492 break;6493 }6494 }6495 if ( j < 0 )6496 {6497 pInfo->m_acMvCand[ n++ ] = pInfo->m_acMvCand[ i ];6498 }6499 }6500 }6501 pInfo->iN = n;6502 }6503 #endif6504 6495 6505 6496 /** … … 6515 6506 TComDataCU* pcTmpCU = NULL; 6516 6507 UInt uiIdx; 6508 6517 6509 switch( eDir ) 6518 6510 { 6519 6511 case MD_LEFT: 6520 6512 { 6521 #if MVP_AT_ENTROPYSLICE_BOUNDARY6522 6513 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false); 6523 #else6524 pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);6525 #endif6526 6514 break; 6527 6515 } 6528 6516 case MD_ABOVE: 6529 6517 { 6530 #if MVP_AT_ENTROPYSLICE_BOUNDARY6531 6518 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true); 6532 #else6533 pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);6534 #endif6535 6519 break; 6536 6520 } 6537 6521 case MD_ABOVE_RIGHT: 6538 6522 { 6539 #if MVP_AT_ENTROPYSLICE_BOUNDARY6540 6523 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true); 6541 #else6542 pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);6543 #endif6544 6524 break; 6545 6525 } 6546 6526 case MD_BELOW_LEFT: 6547 6527 { 6548 #if MVP_AT_ENTROPYSLICE_BOUNDARY6549 6528 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false); 6550 #else6551 pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);6552 #endif6553 6529 break; 6554 6530 } 6555 6531 case MD_ABOVE_LEFT: 6556 6532 { 6557 #if MVP_AT_ENTROPYSLICE_BOUNDARY6558 6533 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true); 6559 #else6560 pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);6561 #endif6562 6534 break; 6563 6535 } … … 6572 6544 return false; 6573 6545 } 6574 6546 6547 #if MERL_VSP_C0152 6548 if(pcTmpCU->getVSPIndex(uiIdx)) 6549 { 6550 return false; 6551 } 6552 #endif 6575 6553 RefPicList eRefPicList2nd = REF_PIC_LIST_0; 6576 6554 if( eRefPicList == REF_PIC_LIST_0 ) … … 6587 6565 Int iNeibPOC = iCurrPOC; 6588 6566 Int iNeibRefPOC; 6589 6567 #if INTER_VIEW_VECTOR_SCALING_C0116 6568 Int iCurrViewId = m_pcSlice->getViewOrderIdx(); // will be changed to view_id 6569 Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getViewOrderIdx(); // will be changed to view_id 6570 Int iNeibViewId = iCurrViewId; 6571 Int iNeibRefViewId; 6572 #endif 6590 6573 #if QC_IV_AS_LT_B0046 6591 6574 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm(); … … 6595 6578 { 6596 6579 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 6580 #if INTER_VIEW_VECTOR_SCALING_C0116 6581 iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id 6582 #endif 6597 6583 #if QC_IV_AS_LT_B0046 6598 6584 bIsNeibRefLongTerm = m_pcSlice->getRefPic( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getIsLongTerm() ; 6585 #if INTER_VIEW_VECTOR_SCALING_C0116 6586 if ( (bIsCurrRefLongTerm == bIsNeibRefLongTerm) && ((iNeibRefPOC == iCurrRefPOC) && (iNeibRefViewId == iCurrRefViewId))) 6587 #else 6599 6588 if ( (bIsCurrRefLongTerm == bIsNeibRefLongTerm) && (iNeibRefPOC == iCurrRefPOC) ) 6589 #endif 6600 6590 #else 6601 6591 if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) ) … … 6605 6595 { 6606 6596 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 6607 #if LGE_DVMCP_A01266597 #if H3D_NBDV 6608 6598 cMvPred.m_bDvMcp = false; 6609 6599 #endif … … 6618 6608 { 6619 6609 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ); 6610 #if INTER_VIEW_VECTOR_SCALING_C0116 6611 iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id 6612 #endif 6620 6613 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); 6621 6614 TComMv rcMv; … … 6630 6623 } 6631 6624 #endif 6625 #if INTER_VIEW_VECTOR_SCALING_C0116 6626 Int iScale = 4096; 6627 if((iCurrRefPOC != iNeibRefPOC) ) // inter & inter 6628 iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 6629 else if(m_pcSlice->getIVScalingFlag()) // inter-view & inter-view 6630 iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iNeibViewId, iNeibRefViewId ); 6631 #else 6632 6632 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 6633 #endif 6633 6634 if ( iScale == 4096 ) 6634 6635 { … … 6639 6640 rcMv = cMvPred.scaleMv( iScale ); 6640 6641 } 6641 #if LGE_DVMCP_A01266642 #if H3D_NBDV 6642 6643 rcMv.m_bDvMcp = false; 6643 6644 #endif … … 6652 6653 { 6653 6654 iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ); 6655 #if INTER_VIEW_VECTOR_SCALING_C0116 6656 iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id 6657 #endif 6654 6658 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx); 6655 6659 TComMv rcMv; … … 6664 6668 } 6665 6669 #endif 6670 #if INTER_VIEW_VECTOR_SCALING_C0116 6671 Int iScale = 4096; 6672 if((iCurrRefPOC != iNeibRefPOC)) // inter & inter 6673 iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 6674 else if(m_pcSlice->getIVScalingFlag()) // inter-view & inter-view 6675 iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iNeibViewId, iNeibRefViewId ); 6676 #else 6666 6677 Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC ); 6678 #endif 6667 6679 if ( iScale == 4096 ) 6668 6680 { … … 6673 6685 rcMv = cMvPred.scaleMv( iScale ); 6674 6686 } 6675 #if LGE_DVMCP_A01266687 #if H3D_NBDV 6676 6688 rcMv.m_bDvMcp = false; 6677 6689 #endif … … 6686 6698 } 6687 6699 6688 #if QC_MULTI_DIS_CAN_A00976700 #if H3D_NBDV 6689 6701 Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx ) 6690 6702 { 6691 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B00476692 Int iDvMcpDispX[2] = {-1,};6693 Bool bDvMcpFlag [2] = { false, };6694 Int iCurrViewIdx = m_pcSlice->getViewId();6695 #endif6696 6697 6703 UInt uiAbsPartAddr = uiPartUnitIdx; 6698 6704 … … 6702 6708 TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); 6703 6709 iColViewIdx = pColCU->getSlice()->getViewId(); 6704 6710 #if MERL_VSP_C0152 6711 //TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); 6712 if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0) 6713 { 6714 return false; 6715 } 6716 #endif 6705 6717 6706 6718 if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr)) … … 6708 6720 return false; 6709 6721 } 6710 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B00476711 Bool bColIsSkipped = pColCU->isSkipped( uiAbsPartAddr );6712 #endif6713 6722 for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++) 6714 6723 { 6715 6724 if(pColCU->getSlice()->isInterB()) 6716 6725 { 6726 #if !QC_NBDV_LDB_FIX_C0055 6717 6727 if(ilist == 0 ) 6718 6728 eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir()); 6719 6729 else 6720 6730 eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir()); 6731 #else 6732 eColRefPicList = RefPicList(ilist); 6733 #endif 6721 6734 } 6722 6735 … … 6732 6745 if ( iColViewIdx == iColRefViewIdx ) // temporal vector 6733 6746 { 6734 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B00476735 if( iColViewIdx >0 )6736 {6737 TComMv tmpMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);6738 if( tmpMv.m_bDvMcp && bColIsSkipped ) // DV-MCP SKIP6739 {6740 iDvMcpDispX[ilist] = tmpMv.m_iDvMcpDispX;6741 bDvMcpFlag [ilist] = true;6742 iTargetViewIdx = 0; //iColRefViewIdx ;6743 iStartViewIdx = 0; //iCurrViewIdx; //iColViewIdx ;6744 }6745 }6746 #endif6747 6747 continue; 6748 6748 } … … 6750 6750 { 6751 6751 rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); 6752 #if LGE_DVMCP_A01266753 6752 rcMv.m_bDvMcp = false; 6754 #endif6755 6753 iTargetViewIdx = iColRefViewIdx ; 6756 6754 iStartViewIdx = iColViewIdx ; … … 6758 6756 } 6759 6757 } 6760 6761 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B00476762 for( Int ilist=0 ; ilist<2 ; ilist++ )6763 {6764 if( bDvMcpFlag[ilist] )6765 {6766 rcMv.setHor( iDvMcpDispX[ilist] );6767 rcMv.setVer( 0 );6768 rcMv.m_bDvMcp = true;6769 iTargetViewIdx = 0; //iColRefViewIdx ;6770 iStartViewIdx = iCurrViewIdx; //iColViewIdx ;6771 return true;6772 }6773 }6774 #endif6775 6758 6776 6759 return false; … … 6784 6767 * \returns Bool 6785 6768 */ 6786 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ) 6769 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx 6770 #if QC_TMVP_MRG_REFIDX_C0047 6771 , 6772 Bool bMRG 6773 #endif 6774 ) 6787 6775 { 6788 6776 UInt uiAbsPartAddr = uiPartUnitIdx; … … 6790 6778 RefPicList eColRefPicList; 6791 6779 Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale; 6792 #if SONY_COLPIC_AVAILABILITY6793 #if QC_IV_AS_LT_B00466794 Int iColViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx;6795 #else6796 Int iColViewOrderIdx, iColRefViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx;6797 #endif6798 #endif6799 6780 TComMv cColMv; 6800 6801 #if SONY_COLPIC_AVAILABILITY 6802 iCurrViewOrderIdx = m_pcSlice->getViewOrderIdx(); 6803 iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); 6804 #endif 6781 #if INTER_VIEW_VECTOR_SCALING_C0115 6782 Int iColViewId, iColRefViewId, iCurrViewId, iCurrRefViewId; 6783 #endif 6784 6805 6785 // use coldir. 6806 6786 #if COLLOCATED_REF_IDX … … 6817 6797 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 6818 6798 iColPOC = pColCU->getSlice()->getPOC(); 6819 #if SONY_COLPIC_AVAILABILITY 6820 iColViewOrderIdx = pColCU->getSlice()->getViewOrderIdx(); 6799 #if INTER_VIEW_VECTOR_SCALING_C0115 6800 iCurrViewId = m_pcSlice->getViewOrderIdx(); // will be changed to view_id 6801 iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); // will be changed to view_id 6802 iColViewId = pColCU->getSlice()->getViewOrderIdx(); // will be changed to view_id 6821 6803 #endif 6822 6804 … … 6826 6808 } 6827 6809 6828 #if ! SONY_COLPIC_AVAILABILITY&!QC_IV_AS_LT_B00466810 #if !INTER_VIEW_VECTOR_SCALING_C0115&!QC_IV_AS_LT_B0046 6829 6811 if( m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId() != m_pcSlice->getViewId() ) 6830 6812 return false; … … 6853 6835 // Scale the vector. 6854 6836 iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, iColRefIdx); 6855 6837 #if INTER_VIEW_VECTOR_SCALING_C0115 6838 iColRefViewId = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx(); // will be changed to view_id 6839 #endif 6856 6840 #if !QC_IV_AS_LT_B0046 6857 #if SONY_COLPIC_AVAILABILITY6858 iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx();6859 #else6860 6841 if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != pColCU->getSlice()->getViewId() ) 6861 6842 { 6862 6843 return false; 6863 6844 } 6864 #endif6865 6845 #else 6866 6846 Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm(); … … 6868 6848 if(bIsCurrRefLongTerm != bIsColRefLongTerm) 6869 6849 { 6850 #if QC_TMVP_MRG_REFIDX_C0047 6851 cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr); 6852 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 6853 if(bMRG ) 6854 { 6855 Int iUpdRefIdx = m_pcSlice->getNewRefIdx(eRefPicList); 6856 if(iUpdRefIdx > 0 ) 6857 { 6858 riRefIdx = iUpdRefIdx; 6859 bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm(); 6860 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC(); 6861 #if INTER_VIEW_VECTOR_SCALING_C0115 6862 iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); // will be changed to view_id 6863 #endif 6864 } 6865 else 6866 return false; 6867 }else 6868 { 6869 #endif 6870 6870 assert( ((iColPOC == iColRefPOC)&&(iCurrPOC != iCurrRefPOC))||((iColPOC != iColRefPOC)&&(iCurrPOC == iCurrRefPOC))); 6871 6871 return false; 6872 #if QC_TMVP_MRG_REFIDX_C0047 6873 } 6874 #endif 6872 6875 } 6873 6876 #endif … … 6890 6893 } 6891 6894 }else 6892 #if QC_MVHEVC_B0046 6893 rcMv = cColMv; //inter-view 6895 #if INTER_VIEW_VECTOR_SCALING_C0115 6896 { 6897 if((iCurrPOC == iCurrRefPOC) && m_pcSlice->getIVScalingFlag()) // inter-view & inter-view 6898 iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId ); 6899 else 6900 iScale = 4096; // inter & inter 6901 if ( iScale == 4096 ) 6902 { 6903 rcMv = cColMv; 6904 } 6905 else 6906 { 6907 rcMv = cColMv.scaleMv( iScale ); 6908 } 6909 } 6894 6910 #else 6895 { 6896 #if SONY_COLPIC_AVAILABILITY 6897 Int iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx(); 6898 iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx); 6899 if ( iScale == 4096 ) 6900 { 6901 rcMv = cColMv; 6902 } 6903 else 6904 { 6905 rcMv = cColMv.scaleMv( iScale ); 6906 } 6907 #else 6908 return false; 6909 #endif 6910 } 6911 #endif 6912 } 6913 #else 6914 #if SONY_COLPIC_AVAILABILITY 6915 iScale = 0; 6916 iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); 6917 if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC)) 6918 iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); 6919 else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC)) 6920 iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx); 6921 else 6922 return false; 6923 6924 #else 6925 iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC); 6926 #endif 6927 if ( iScale == 4096 ) 6928 { 6929 rcMv = cColMv; 6930 } 6931 else 6932 { 6933 rcMv = cColMv.scaleMv( iScale ); 6934 } 6935 #endif 6911 rcMv = cColMv; //inter-view 6912 #endif 6913 } 6914 #endif 6915 6936 6916 return true; 6937 6917 } … … 7026 7006 return false; 7027 7007 } 7028 7008 7029 7009 if( m_pcSlice->getRefPic( eRefPicList, iRefIdx )->getViewId() != m_pcSlice->getViewId() ) 7030 7010 { … … 7071 7051 } 7072 7052 } 7053 7054 #if MERL_VSP_C0152 // Preventive 7055 if (pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartIdxCenter) < 0) // NOT_VALID 7056 return false; 7057 #endif 7073 7058 7074 7059 // Scale the vector. … … 7107 7092 UInt TComDataCU::getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra) 7108 7093 { 7109 #if !LOGI_INTRA_NAME_3MPM7110 static const UChar aucIntraDirToScanIdx[MAX_CU_DEPTH][NUM_INTRA_MODE] =7111 {7112 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 07113 },7114 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 07115 },7116 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 07117 },7118 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 07119 },7120 {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 07121 },7122 {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 07123 },7124 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 07125 },7126 };7127 #endif7128 7094 7129 7095 UInt uiCTXIdx; … … 7155 7121 #endif 7156 7122 7157 #if LOGI_INTRA_NAME_3MPM7158 7123 uiScanIdx = SCAN_ZIGZAG; 7159 7124 if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for PU size … … 7161 7126 uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); 7162 7127 } 7163 #else7164 uiScanIdx = aucIntraDirToScanIdx[uiCTXIdx][uiDirMode];7165 #endif7166 7128 } 7167 7129 else … … 7180 7142 #endif 7181 7143 } 7182 #if LOGI_INTRA_NAME_3MPM7183 7144 uiScanIdx = SCAN_ZIGZAG; 7184 7145 if (uiCTXIdx >4 && uiCTXIdx < 7) //if multiple scans supported for PU size … … 7186 7147 uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0); 7187 7148 } 7188 #else7189 uiScanIdx = aucIntraDirToScanIdx[max<Int>(uiCTXIdx-1,0)][uiDirMode];7190 #endif7191 7149 } 7192 7150 … … 7680 7638 } 7681 7639 } 7682 #if LCU_SYNTAX_ALF7683 7640 rSGU.allBordersAvailable = true; 7684 7641 for(Int b=0; b< NUM_SGU_BORDER; b++) … … 7690 7647 } 7691 7648 } 7692 #endif7693 7649 7694 7650 } … … 7786 7742 } 7787 7743 7744 #if LGE_DMM3_SIMP_C0044 7745 Void TComDataCU::setWedgePredTexIntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) 7746 { 7747 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 7748 7749 for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 7750 { 7751 m_puiWedgePredTexIntraTabIdx[uiAbsPartIdx+ui] = uiTIdx; 7752 } 7753 } 7754 #endif 7755 7788 7756 Void TComDataCU::setWedgePredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ) 7789 7757 { … … 7845 7813 memcpy( m_pePredMode + uiAbsPartIdxDst, pcCU->getPredictionMode() + uiAbsPartIdxSrc, sizeof( m_pePredMode[0] ) * uiNumPartition ); 7846 7814 memcpy( m_puhInterDir + uiAbsPartIdxDst, pcCU->getInterDir() + uiAbsPartIdxSrc, sizeof( m_puhInterDir[0] ) * uiNumPartition ); 7815 7816 #if MERL_VSP_C0152 && MTK_UNCONSTRAINED_MVI_B0083 7817 memcpy( m_piVSPIndex + uiAbsPartIdxDst, pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition ); 7818 #endif 7847 7819 7848 7820 #if !MTK_UNCONSTRAINED_MVI_B0083 … … 7880 7852 // public functions for Multi-view tools 7881 7853 // ------------------------------------------------------------------------------------------------------------------- 7882 #if H HI_INTER_VIEW_MOTION_PRED7883 #if ! QC_MULTI_DIS_CAN_A00977854 #if H3D_IVMP 7855 #if !H3D_NBDV 7884 7856 Int 7885 7857 TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ) … … 7898 7870 return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge ); 7899 7871 } 7872 #else //H3D_NBDV 7873 #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 7874 Bool 7875 TComDataCU::getUnifiedMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ) 7876 { 7877 TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); 7878 ROFRS( pcDepthMapGenerator, false ); 7879 if (pDInfo->iN > 0 && pcDepthMapGenerator->getPdmCandidate(this, uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm, bMerge)) 7880 return true; 7881 return false; 7882 } 7900 7883 #else 7901 7884 Int 7902 TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo 7903 #if QC_MRG_CANS_B0048 7904 , Int* iPdm 7905 #endif 7906 ) 7885 TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm ) 7907 7886 { 7908 7887 TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); 7909 7888 ROFRS( pcDepthMapGenerator, 0 ); 7910 return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo 7911 #if QC_MRG_CANS_B0048 7912 , iPdm 7913 #endif 7914 ); 7889 return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm ); 7915 7890 } 7916 7891 Bool … … 7924 7899 } 7925 7900 #endif 7926 7901 #endif //H3D_NBDV 7927 7902 7928 7903 Bool … … 7935 7910 #endif 7936 7911 7937 #if H HI_INTER_VIEW_RESIDUAL_PRED7912 #if H3D_IVRP 7938 7913 Bool 7939 TComDataCU::getResidualSamples( UInt uiPartIdx, 7940 #if QC_SIMPLIFIEDIVRP_M24938 7941 Bool bRecon , 7942 #endif 7943 TComYuv* pcYuv ) 7914 TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv ) 7944 7915 { 7945 7916 TComResidualGenerator* pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator(); 7946 7917 ROFRS( pcResidualGenerator, false ); 7947 #if QC_MULTI_DIS_CAN_A00977918 #if H3D_NBDV 7948 7919 DisInfo cDisInfo; 7949 7920 cDisInfo.iN = 0; 7950 7921 PartSize m_peSaved = getPartitionSize( 0 ); 7951 7922 m_pePartSize[0] = SIZE_2Nx2N; 7952 #if LGE_DVMCP_A0126 7953 #if QC_SIMPLE_NBDV_B0047 7954 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136 7955 getDisMvpCand2( 0, 0, &cDisInfo, false); 7956 #else 7957 getDisMvpCand2( 0, 0, &cDisInfo); 7958 #endif 7959 #else 7960 getDisMvpCand2( 0, 0, &cDisInfo, true ); 7961 #endif 7962 #else 7963 getDisMvpCand ( 0, 0, &cDisInfo ); 7964 #endif 7923 getDisMvpCandNBDV( 0, 0, &cDisInfo, false ); 7965 7924 if( cDisInfo.iN == 0) 7966 7925 { … … 7970 7929 else 7971 7930 { 7972 Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor() 7973 #if QC_SIMPLIFIEDIVRP_M24938 7974 , bRecon 7975 #endif 7976 ); 7931 #if MTK_RELEASE_DV_CONSTRAINT_C0129 7932 Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon ); 7933 #else 7934 Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor(), bRecon ); 7935 #endif 7977 7936 m_pePartSize[0] = m_peSaved; 7978 7937 return bAvailable; 7979 7938 } 7980 7939 #else 7981 return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv 7982 #if QC_SIMPLIFIEDIVRP_M24938 7983 , bRecon 7984 #endif 7985 ); 7940 return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon ); 7986 7941 #endif 7987 7942 } -
trunk/source/Lib/TLibCommon/TComDataCU.h
r189 r296 49 49 #include "TComPattern.h" 50 50 51 #if H HI_INTER_VIEW_RESIDUAL_PRED51 #if H3D_IVRP 52 52 #include "TComYuv.h" 53 53 #endif … … 91 91 UInt height; //!< number of pixels in height 92 92 Bool isBorderAvailable[NUM_SGU_BORDER]; //!< the border availabilities 93 #if LCU_SYNTAX_ALF94 93 Bool allBordersAvailable; 95 #endif96 94 97 95 NDBFBlockInfo():tileID(0), sliceID(0), startSU(0), endSU(0) {} //!< constructor … … 143 141 #endif 144 142 Char* m_pePredMode; ///< array of prediction modes 145 #if H0736_AVC_STYLE_QP_RANGE146 143 Char* m_phQP; ///< array of QP values 147 #else148 UChar* m_phQP; ///< array of QP values149 #endif150 144 UChar* m_puhTrIdx; ///< array of transform indices 151 145 UChar* m_nsqtPartIdx; ///< array of absPartIdx mapping table, map zigzag to NSQT … … 197 191 #endif 198 192 UChar* m_puhMergeIndex; ///< array of merge candidate indices 193 #if MERL_VSP_C0152 194 Char* m_piVSPIndex; ///< array of VSP flags to indicate the current block uses synthetic predictor or not 195 ///< value 0: non-VSP, value 1: VSP 196 #endif 199 197 #if AMP_MRG 200 198 Bool m_bIsMergeAMP; … … 210 208 Bool* m_pbIPCMFlag; ///< array of intra_pcm flags 211 209 212 #if BURST_IPCM213 210 Int m_numSucIPCM; ///< the number of succesive IPCM blocks associated with the current log2CUSize 214 211 Bool m_lastCUSucIPCMFlag; ///< True indicates that the last CU is IPCM and shares the same root as the current CU. 215 #endif 216 #if HHI_INTER_VIEW_RESIDUAL_PRED 212 #if H3D_IVRP 217 213 Bool* m_pbResPredAvailable; ///< array of residual prediction available flags 218 214 Bool* m_pbResPredFlag; ///< array of residual prediction flags … … 237 233 Bool m_bDecSubCu; ///< indicates decoder-mode 238 234 Double m_dTotalCost; ///< sum of partition RD costs 239 #if FIX_RDO_NEGDIST240 235 Dist m_uiTotalDistortion; ///< sum of partition distortion 241 #else242 UInt m_uiTotalDistortion; ///< sum of partition distortion243 #endif244 236 UInt m_uiTotalBits; ///< sum of partition bits 245 237 UInt m_uiTotalBins; ///< sum of partition bins … … 262 254 #if HHI_DMM_PRED_TEX 263 255 UInt* m_puiWedgePredTexTabIdx; 256 #if LGE_DMM3_SIMP_C0044 257 UInt* m_puiWedgePredTexIntraTabIdx; 258 #endif 264 259 Int* m_piWedgePredTexDeltaDC1; 265 260 Int* m_piWedgePredTexDeltaDC2; … … 279 274 Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 280 275 Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 281 276 #if MERL_VSP_C0152 277 inline Bool xAddVspMergeCand ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount, 278 UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo ); 279 inline Void xInheritVspMode ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ; 280 #endif 282 281 Void deriveRightBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ); 283 Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ); 284 #if QC_MULTI_DIS_CAN_A0097 282 Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx 283 #if QC_TMVP_MRG_REFIDX_C0047 284 , 285 Bool bMRG = 0 286 #endif 287 ); 288 #if H3D_NBDV 285 289 Bool xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); 286 290 #endif 287 291 288 #if !AMVP_PRUNING_SIMPLIFICATION289 /// remove redundant candidates290 Void xUniqueMVPCand ( AMVPInfo* pInfo );291 #endif292 292 293 293 Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand ); … … 304 304 Void xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr); 305 305 306 #if !BURST_IPCM307 Int getLastValidPartIdx ( Int iAbsPartIdx );308 #endif309 306 310 307 public: … … 324 321 325 322 Void initCU ( TComPic* pcPic, UInt uiCUAddr ); 326 #if H0736_AVC_STYLE_QP_RANGE327 323 Void initEstData ( UInt uiDepth, Int qp ); 328 324 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); 329 #else330 Void initEstData ( UInt uiDepth, UInt uiQP );331 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP );332 #endif333 325 Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); 334 326 … … 366 358 Void copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 ); 367 359 #endif 368 369 // -------------------------------------------------------------------------------------------------------------------360 361 // ------------------------------------------------------------------------------------------------------------------- 370 362 // member functions for CU data 371 363 // ------------------------------------------------------------------------------------------------------------------- … … 398 390 Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); 399 391 400 #if H0736_AVC_STYLE_QP_RANGE401 392 Char* getQP () { return m_phQP; } 402 393 Char getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } 403 394 Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } 404 395 Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); 405 #if BURST_IPCM406 396 Int getLastValidPartIdx ( Int iAbsPartIdx ); 407 #endif408 397 Char getLastCodedQP ( UInt uiAbsPartIdx ); 409 #else410 UChar* getQP () { return m_phQP; }411 UChar getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; }412 Void setQP ( UInt uiIdx, UChar uh ) { m_phQP[uiIdx] = uh; }413 Void setQPSubParts ( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth );414 #if BURST_IPCM415 Int getLastValidPartIdx ( Int iAbsPartIdx );416 #endif417 UChar getLastCodedQP ( UInt uiAbsPartIdx );418 #endif419 398 420 399 #if LOSSLESS_CODING … … 471 450 Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } 472 451 Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 452 453 #if MERL_VSP_C0152 454 Char* getVSPIndex () { return m_piVSPIndex; } 455 Char getVSPIndex ( UInt uiIdx ) { return m_piVSPIndex[uiIdx]; } 456 Void setVSPIndex ( UInt uiIdx, Int n ) { m_piVSPIndex[uiIdx] = n; } 457 Void setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 458 #endif 459 473 460 template <typename T> 474 461 Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); … … 479 466 Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } 480 467 Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 468 #if LGE_ILLUCOMP_DEPTH_C0046 469 Bool isICFlagRequired (UInt uiAbsPartIdx, UInt uiDepth); //This modification is not needed after integrating JCT3V-C0137 470 #else 481 471 Bool isICFlagRequired (UInt uiAbsPartIdx); 472 #endif 482 473 #endif 483 474 … … 517 508 Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); 518 509 519 #if BURST_IPCM520 510 Int getNumSucIPCM () { return m_numSucIPCM; } 521 511 Void setNumSucIPCM ( Int num ) { m_numSucIPCM = num; } 522 512 Bool getLastCUSucIPCMFlag () { return m_lastCUSucIPCMFlag; } 523 513 Void setLastCUSucIPCMFlag ( Bool flg ) { m_lastCUSucIPCMFlag = flg; } 524 #endif525 514 526 515 /// get slice ID for SU … … 539 528 ,Bool bIndependentTileBoundaryEnabled ); 540 529 541 #if HHI_INTER_VIEW_MOTION_PRED 542 #if !QC_MULTI_DIS_CAN_A0097 543 Int getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ); 544 Bool getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false ); 530 #if H3D_IVMP 531 #if !H3D_NBDV 532 Int getPdmMergeCandidate ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ); 533 Bool getPdmMvPred ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false ); 534 #else //!H3D_NBDV 535 #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 536 Bool getUnifiedMvPredCan ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ); 537 #else //QC_AMVP_MRG_UNIFY_IVCAN_C0051 538 Bool getPdmMvPredDisCan ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false ); 539 Int getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm ); 540 #endif //QC_AMVP_MRG_UNIFY_IVCAN_C0051 541 Void getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo ); 542 Void getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false 543 #if MERL_VSP_C0152 544 , Bool bDepthRefine = false 545 #endif //MERL_VSP_C0152 546 ); 547 #endif // !H3D_NBDV 548 549 550 551 #if MERL_VSP_C0152 552 #if LGE_SIMP_DVP_REFINE_C0112 553 Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false); 554 Void estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false); 545 555 #else 546 Bool getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false ); 547 Int getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo 548 #if QC_MRG_CANS_B0048 549 , Int* iPdm 550 #endif 551 ); 552 Void getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo ); 553 #if LGE_DVMCP_A0126 554 #if QC_SIMPLE_NBDV_B0047 555 Void getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo 556 #if LGE_IVMP_PARALLEL_MERGE_B0136 557 , Bool bParMerg = false 558 #endif 559 ); 560 #else 561 Void getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo, Bool bMerge=false, RefPicList eRefPicList=REF_PIC_LIST_X, Int iRefIdx=-1 562 #if LGE_IVMP_PARALLEL_MERGE_B0136 563 , Bool bParMerg = false 564 #endif 565 ); 566 #endif 567 #endif 568 556 Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec); 557 Void estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred); 558 #endif 569 559 #endif 570 560 Bool getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ); 571 #endif 572 #if H HI_INTER_VIEW_RESIDUAL_PRED561 #endif // H3D_IVMP 562 #if H3D_IVRP 573 563 Bool* getResPredAvail () { return m_pbResPredAvailable; } 574 564 Bool getResPredAvail ( UInt uiIdx ) { return m_pbResPredAvailable[uiIdx]; } … … 583 573 Void setResPredIndicator ( Bool bAv, Bool bRP ) { m_pbResPredAvailable[0] = bAv; m_pbResPredFlag[0] = bRP; } 584 574 #endif 585 #if HHI_INTER_VIEW_RESIDUAL_PRED 586 Bool getResidualSamples( UInt uiPartIdx, 587 #if QC_SIMPLIFIEDIVRP_M24938 588 Bool bRecon , 589 #endif 590 TComYuv* pcYuv = 0 ); 575 #if H3D_IVRP 576 Bool getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 ); 591 577 #endif 592 578 // ------------------------------------------------------------------------------------------------------------------- … … 598 584 Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); 599 585 #endif 600 #if LG_RESTRICTEDRESPRED_M24766 586 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 601 587 Int getResiPredMode(UInt uiPartAddr); 602 588 Void getPUResiPredShift (Int *iPUPredResiShift, UInt uiAbsPartIndex); … … 612 598 613 599 AMVP_MODE getAMVPMode ( UInt uiIdx ); 614 #if SHARP_INTERVIEW_DECOUPLE_B0111600 #if H3D_IVMP 615 601 Void fillMvpCandBase ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); 616 602 Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1); 617 #else 618 Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); 619 #endif 620 #if PARALLEL_MERGE 603 #endif 621 604 Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); 622 605 Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); 623 #endif624 606 Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } 625 607 Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } … … 665 647 666 648 TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); 667 #if H0204_QP_PREDICTION668 649 TComDataCU* getQpMinCuAbove ( UInt& aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceEntropySliceRestriction=true ); 669 #endif670 #if H0736_AVC_STYLE_QP_RANGE671 650 Char getRefQP ( UInt uiCurrAbsIdxInLCU ); 672 #else673 UChar getRefQP ( UInt uiCurrAbsIdxInLCU );674 #endif675 651 676 652 TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); … … 684 660 685 661 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 686 #if SIMP_MRG_PRUN687 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );662 #if MERL_VSP_C0152 663 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 ); 688 664 #else 689 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand);690 #endif 691 Void deriveLeftRightTopIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );692 Void deriveLeftBottomIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );665 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); 666 #endif 667 Void deriveLeftRightTopIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); 668 Void deriveLeftBottomIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); 693 669 694 670 … … 723 699 UInt getCtxInterDir ( UInt uiAbsPartIdx ); 724 700 725 #if H HI_INTER_VIEW_RESIDUAL_PRED701 #if H3D_IVRP 726 702 UInt getCtxResPredFlag ( UInt uiAbsPartIdx ); 727 703 #endif … … 740 716 741 717 Double& getTotalCost() { return m_dTotalCost; } 742 #if FIX_RDO_NEGDIST743 718 Dist& getTotalDistortion() { return m_uiTotalDistortion; } 744 #else745 UInt& getTotalDistortion() { return m_uiTotalDistortion; }746 #endif747 719 UInt& getTotalBits() { return m_uiTotalBits; } 748 720 UInt& getTotalNumPart() { return m_uiNumPartition; } … … 796 768 Void setWedgePredTexTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexTabIdx[uiIdx] = uh; } 797 769 Void setWedgePredTexTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); 770 #if LGE_DMM3_SIMP_C0044 771 UInt* getWedgePredTexIntraTabIdx () { return m_puiWedgePredTexIntraTabIdx; } 772 UInt getWedgePredTexIntraTabIdx ( UInt uiIdx ) { return m_puiWedgePredTexIntraTabIdx[uiIdx]; } 773 Void setWedgePredTexIntraTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexIntraTabIdx[uiIdx] = uh; } 774 Void setWedgePredTexIntraTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); 775 #endif 798 776 Int* getWedgePredTexDeltaDC1 () { return m_piWedgePredTexDeltaDC1; } 799 777 Int getWedgePredTexDeltaDC1 ( UInt uiIdx ) { return m_piWedgePredTexDeltaDC1[uiIdx]; } -
trunk/source/Lib/TLibCommon/TComDepthMapGenerator.cpp
r189 r296 46 46 #if DEPTH_MAP_GENERATION 47 47 48 49 48 TComDepthMapGenerator::TComDepthMapGenerator() 50 49 { … … 78 77 m_uiSubSampExpX = uiSubSampExpX; 79 78 m_uiSubSampExpY = uiSubSampExpY; 80 #if ! QC_MULTI_DIS_CAN_A009779 #if !H3D_NBDV 81 80 m_ppcYuv = new TComYuv* [ m_uiMaxDepth ]; 82 81 m_ppcCU = new TComDataCU* [ m_uiMaxDepth ]; … … 92 91 m_cTmpPic.create( uiPicWidth >> m_uiSubSampExpX, uiPicHeight >> m_uiSubSampExpY, uiMaxCUWidth >> m_uiSubSampExpX, uiMaxCUHeight >> m_uiSubSampExpY, uiMaxCUDepth ); 93 92 xSetChroma( &m_cTmpPic, ( 1 << uiOrgBitDepth ) >> 1 ); 94 #endif 93 #endif //!H3D_NBDV 95 94 m_bCreated = true; 96 95 } … … 102 101 { 103 102 m_bCreated = false; 104 #if ! QC_MULTI_DIS_CAN_A0097103 #if !H3D_NBDV 105 104 for( UInt uiDepth = 0; uiDepth < m_uiMaxDepth; uiDepth++ ) 106 105 { … … 117 116 delete [] m_ppcCU; m_ppcCU = 0; 118 117 m_cTmpPic.destroy(); 119 #endif 118 #endif //!H3D_NBDV 120 119 m_uiMaxDepth = 0; 121 120 m_uiOrgDepthBitDepth = 0; … … 377 376 } 378 377 379 #if ! QC_MULTI_DIS_CAN_A0097378 #if !H3D_NBDV 380 379 Bool 381 380 TComDepthMapGenerator::predictDepthMap( TComPic* pcPic ) … … 562 561 m_cTmpPic.dump( acFilename, ( pcPic->getPOC() != 0 ) ); 563 562 } 564 #endif 565 566 #if HHI_INTER_VIEW_MOTION_PRED 563 564 #endif //!H3D_NBDV 565 566 #if H3D_IVMP 567 567 Void 568 568 TComDepthMapGenerator::covertOrgDepthMap( TComPic* pcPic ) … … 604 604 605 605 606 #if HHI_INTER_VIEW_MOTION_PRED 607 #if QC_MULTI_DIS_CAN_A0097 608 Int 609 TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo 610 #if QC_MRG_CANS_B0048 611 , Int* iPdm 612 #endif 613 ) 614 #else 615 Int 616 TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ) 617 #endif 618 { 619 #if MTK_INTERVIEW_MERGE_A0049 606 #if H3D_IVMP 607 #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 608 Bool 609 TComDepthMapGenerator::getPdmCandidate(TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ) 610 { 620 611 AOF ( m_bCreated && m_bInit ); 621 622 #if !QC_MULTI_DIS_CAN_A0097623 ROFRS( m_bPDMAvailable, 0 );624 #endif625 626 612 TComSlice* pcSlice = pcCU->getSlice (); 627 613 TComSPS* pcSPS = pcSlice->getSPS(); 628 614 AOF ( pcSPS->getViewId() == m_uiCurrViewId ); 615 616 TComPic* pcRefPic = pcSlice->getRefPic( eRefPicList, iRefIdx ); 617 UInt uiRefViewId = pcRefPic->getSPS()->getViewId(); 618 Bool bInterview = ( uiRefViewId < m_uiCurrViewId ); 619 Bool bPdmIView = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_IVIEW ) == PDM_USE_FOR_IVIEW ); 620 Bool bPdmInter = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_INTER ) == PDM_USE_FOR_INTER ); 629 621 Bool bPdmMerge = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ); 630 ROTRS( !bPdmMerge, 0 ); 631 632 #if QC_MRG_CANS_B0048 622 if(!bMerge) 623 { 624 ROTRS( ( bInterview && !bMerge ) && !bPdmIView, false ); 625 ROTRS( (!bInterview && !bMerge ) && !bPdmInter, false ); 626 ROTRS( bMerge && !bPdmMerge, false ); 627 } 628 else 629 ROTRS( !bPdmMerge, 0 ); 630 631 633 632 Bool abPdmAvailable[4] = {false, false, false, false}; 634 #else635 Bool abPdmAvailable[2] = {false,false};636 #endif637 633 638 634 Int iValid = 0; … … 640 636 for( UInt uiBId = 0; uiBId < m_uiCurrViewId && iValid==0; uiBId++ ) 641 637 { 638 #if MTK_C0138_FIXED 639 UInt uiBaseId = uiBId; 640 #else 642 641 UInt uiBaseId = m_auiBaseIdList[ uiBId ]; 642 #endif 643 643 TComPic* pcBasePic = m_pcAUPicAccess->getPic( uiBaseId ); 644 644 for( Int iRefListId = 0; iRefListId < 2 && iValid==0; iRefListId++ ) … … 659 659 } 660 660 if (iValid == 0) 661 return 0;661 return false; 662 662 663 663 //--- get base CU/PU and check prediction mode --- 664 664 TComPic* pcBasePic = m_pcAUPicAccess->getPic( iViewId ); 665 665 TComPicYuv* pcBaseRec = pcBasePic->getPicYuvRec (); 666 667 #if QC_MULTI_DIS_CAN_A0097 666 if(bMerge || !bInterview) 667 { 668 #if H3D_NBDV 669 Int iCurrPosX, iCurrPosY; 670 UInt uiPartAddr; 671 Int iWidth; 672 Int iHeight; 673 674 pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); 675 pcBaseRec->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); 676 iCurrPosX += ( ( iWidth - 1 ) >> 1 ); 677 iCurrPosY += ( ( iHeight - 1 ) >> 1 ); 678 679 Int iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (pDInfo->m_acMvCand[0].getHor() + 2 ) >> 2 ) ); 680 Int iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (pDInfo->m_acMvCand[0].getVer() + 2 ) >> 2 )); 681 Int iBaseCUAddr; 682 Int iBaseAbsPartIdx; 683 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx ); 684 #else //H3D_NBDV 685 Int iPrdDepth, iCurrPosX, iCurrPosY; 686 Bool bAvailable = xGetPredDepth( pcCU, uiPartIdx, iPrdDepth, &iCurrPosX, &iCurrPosY ); 687 AOF( bAvailable ); 688 TComPicYuv* pcBasePdm = pcBasePic->getPredDepthMap(); 689 Int iDisparity = xGetDisparityFromVirtDepth( iViewId, iPrdDepth ); 690 Int iShiftX = m_uiSubSampExpX + 2; 691 Int iAddX = ( 1 << iShiftX ) >> 1; 692 Int iBasePosX = Clip3( 0, pcBasePdm->getWidth () - 1, iCurrPosX + ( ( iDisparity + iAddX ) >> iShiftX ) ); 693 Int iBasePosY = Clip3( 0, pcBasePdm->getHeight() - 1, iCurrPosY ); 694 Int iBaseCUAddr; 695 Int iBaseAbsPartIdx; 696 pcBaseRec->getCUAddrAndPartIdx( iBasePosX<< m_uiSubSampExpX , iBasePosY<< m_uiSubSampExpY , iBaseCUAddr, iBaseAbsPartIdx ); 697 #endif // H3D_NBDV 698 TComDataCU* pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 699 if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTER || pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_SKIP ) 700 { 701 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 702 { 703 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 704 if(!bMerge && eCurrRefPicList != eRefPicList) 705 continue; 706 Bool bLoop_stop = false; 707 for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop) 708 { 709 RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 710 TComMvField cBaseMvField; 711 pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField ); 712 Int iBaseRefIdx = cBaseMvField.getRefIdx(); 713 if (iBaseRefIdx >= 0) 714 { 715 Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx); 716 if (iBaseRefPOC != pcSlice->getPOC()) 717 { 718 for (Int iPdmRefIdx = (bMerge?0: iRefIdx); iPdmRefIdx < (bMerge? pcSlice->getNumRefIdx( eCurrRefPicList ): (iRefIdx+1)); iPdmRefIdx++) 719 { 720 if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 721 { 722 abPdmAvailable[ uiCurrRefListId ] = true; 723 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 724 #if H3D_NBDV 725 if( bMerge ) 726 { 727 cMv.m_bDvMcp = true; 728 cMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor(); 729 } 730 #endif 731 pcCU->clipMv( cMv ); 732 if(bMerge) 733 { 734 paiPdmRefIdx [ uiCurrRefListId ] = iPdmRefIdx; 735 pacPdmMv [ uiCurrRefListId ] = cMv; 736 bLoop_stop = true; 737 break; 738 }else 739 { 740 pacPdmMv [0] = cMv; 741 return true; 742 } 743 } 744 } 745 } 746 } 747 } 748 } 749 } 750 if( bMerge ) 751 iPdm[0] = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 ); 752 } 753 if(bMerge || bInterview) 754 { 755 for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ ) 756 { 757 RefPicList eRefPicListDMV = RefPicList( iRefListId ); 758 Int iNumRefPics = pcSlice->getNumRefIdx( eRefPicListDMV ); 759 for( Int iPdmRefIdx = (bMerge ? 0: iRefIdx); iPdmRefIdx < (bMerge ? iNumRefPics: (iRefIdx+1) ); iPdmRefIdx++ ) 760 { 761 if( pcSlice->getRefPOC( eRefPicListDMV, iPdmRefIdx ) == pcSlice->getPOC()) 762 { 763 abPdmAvailable[ iRefListId+2 ] = true; 764 paiPdmRefIdx [ iRefListId+2 ] = iPdmRefIdx; 765 #if H3D_NBDV 766 TComMv cMv = pDInfo->m_acMvCand[0]; 767 cMv.setVer(0); 768 #else 769 TComMv cMv(iDisparity, 0); 770 #endif 771 pcCU->clipMv( cMv ); 772 pacPdmMv [ iRefListId + 2] = cMv; 773 if(bMerge) 774 break; 775 else 776 { 777 pacPdmMv [0] = cMv; 778 return true; 779 } 780 } 781 } 782 } 783 iPdm[1] = ( abPdmAvailable[2] ? 1 : 0 ) + ( abPdmAvailable[3] ? 2 : 0 ); 784 } 785 return false; 786 } 787 #else // QC_AMVP_MRG_UNIFY_IVCAN_C0051 788 #if H3D_NBDV 789 Int 790 TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm ) 791 #else 792 Int 793 TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ) 794 #endif 795 { 796 AOF ( m_bCreated && m_bInit ); 797 798 #if !H3D_NBDV 799 ROFRS( m_bPDMAvailable, 0 ); 800 #endif 801 802 TComSlice* pcSlice = pcCU->getSlice (); 803 TComSPS* pcSPS = pcSlice->getSPS(); 804 AOF ( pcSPS->getViewId() == m_uiCurrViewId ); 805 Bool bPdmMerge = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ); 806 ROTRS( !bPdmMerge, 0 ); 807 808 Bool abPdmAvailable[4] = {false, false, false, false}; 809 810 Int iValid = 0; 811 Int iViewId = 0; 812 for( UInt uiBId = 0; uiBId < m_uiCurrViewId && iValid==0; uiBId++ ) 813 { 814 UInt uiBaseId = m_auiBaseIdList[ uiBId ]; 815 TComPic* pcBasePic = m_pcAUPicAccess->getPic( uiBaseId ); 816 for( Int iRefListId = 0; iRefListId < 2 && iValid==0; iRefListId++ ) 817 { 818 RefPicList eRefPicListTest = RefPicList( iRefListId ); 819 Int iNumRefPics = pcSlice->getNumRefIdx( eRefPicListTest ) ; 820 for( Int iRefIndex = 0; iRefIndex < iNumRefPics; iRefIndex++ ) 821 { 822 if(pcBasePic->getPOC() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getPOC() 823 && pcBasePic->getViewId() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getViewId()) 824 { 825 iValid=1; 826 iViewId = uiBaseId; 827 break; 828 } 829 } 830 } 831 } 832 if (iValid == 0) 833 return 0; 834 835 //--- get base CU/PU and check prediction mode --- 836 TComPic* pcBasePic = m_pcAUPicAccess->getPic( iViewId ); 837 TComPicYuv* pcBaseRec = pcBasePic->getPicYuvRec (); 838 839 #if H3D_NBDV 668 840 Int iCurrPosX, iCurrPosY; 669 841 UInt uiPartAddr; … … 719 891 paiPdmRefIdx [ uiBaseRefListId ] = iPdmRefIdx; 720 892 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 721 #if LGE_DVMCP_A0126893 #if H3D_NBDV 722 894 cMv.m_bDvMcp = true; 723 895 cMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor(); 724 #endif 896 #if MTK_RELEASE_DV_CONSTRAINT_C0129 897 cMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer(); 898 #endif 899 #endif //H3D_NBDV 725 900 pcCU->clipMv( cMv ); 726 901 pacPdmMv [ uiBaseRefListId ] = cMv; … … 733 908 } 734 909 Int iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 ); 735 #if QC_MRG_CANS_B0048 910 736 911 iPdm[0] = iPdmInterDir; 737 #else738 if (iPdmInterDir == 0)739 {740 #endif741 912 for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ ) 742 913 { … … 744 915 Int iNumRefPics = pcSlice->getNumRefIdx( eRefPicList ); 745 916 for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ ) 746 {917 { 747 918 if( pcSlice->getRefPOC( eRefPicList, iPdmRefIdx ) == pcSlice->getPOC()) 748 919 { 749 #if QC_MRG_CANS_B0048750 920 abPdmAvailable[ iRefListId+2 ] = true; 751 921 paiPdmRefIdx [ iRefListId+2 ] = iPdmRefIdx; 752 #else 753 abPdmAvailable[ iRefListId ] = true; 754 paiPdmRefIdx [ iRefListId ] = iPdmRefIdx; 755 #endif 756 #if QC_MULTI_DIS_CAN_A0097 922 #if H3D_NBDV 757 923 TComMv cMv = pDInfo->m_acMvCand[0]; 758 924 cMv.setVer(0); … … 761 927 #endif 762 928 pcCU->clipMv( cMv ); 763 #if QC_MRG_CANS_B0048764 929 pacPdmMv [ iRefListId + 2] = cMv; 765 #else766 pacPdmMv [ iRefListId ] = cMv;767 #endif768 930 break; 769 931 } 770 932 } 771 933 } 772 #if QC_MRG_CANS_B0048773 934 iPdmInterDir = ( abPdmAvailable[2] ? 1 : 0 ) + ( abPdmAvailable[3] ? 2 : 0 ) ; 774 935 iPdm[1] = iPdmInterDir; 775 #else776 iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 ) ;777 }778 #endif779 936 780 937 return iPdmInterDir; 781 782 #else 783 Int iMaxNumInterPics = 1; 784 Int iMaxNumAllPics = 2; 785 786 // inter-only 787 Bool abPdmAvailable[2] = {false,false}; 788 for( Int iRefListId = 0; iRefListId < 2; iRefListId++ ) 789 { 790 RefPicList eRefPicList = RefPicList( iRefListId ); 791 Int iNumRefPics = pcCU->getSlice()->getNumRefIdx( eRefPicList ); 792 TComMv cMv; 793 for( Int iPdmRefIdx = 0, iInterPics = 0; iPdmRefIdx < iNumRefPics && iInterPics < iMaxNumInterPics; iPdmRefIdx++ ) 794 { 795 if( pcCU->getSlice()->getRefPOC( eRefPicList, iPdmRefIdx ) != pcCU->getSlice()->getPOC() ) 796 { 797 #if QC_MULTI_DIS_CAN_A0097 798 if( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) ) 799 #else 800 if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) ) 801 #endif 802 { 803 pcCU->clipMv( cMv ); 804 abPdmAvailable[ iRefListId ] = true; 805 paiPdmRefIdx [ iRefListId ] = iPdmRefIdx; 806 pacPdmMv [ iRefListId ] = cMv; 807 break; 808 } 809 iInterPics++; 810 } 811 } 812 } 813 Int iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 ); 814 if( 0==iPdmInterDir ) 815 { // check all, including inter view references 816 for( Int iRefListId = 0; iRefListId < 2; iRefListId++ ) 817 { 818 RefPicList eRefPicList = RefPicList( iRefListId ); 819 Int iNumRefPics = Min( iMaxNumAllPics, pcCU->getSlice()->getNumRefIdx( eRefPicList ) ); 820 TComMv cMv; 821 for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ ) 822 { 823 #if QC_MULTI_DIS_CAN_A0097 824 if ( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) ) 825 #else 826 if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) ) 827 #endif 828 { 829 pcCU->clipMv( cMv ); 830 abPdmAvailable[ iRefListId ] = true; 831 paiPdmRefIdx [ iRefListId ] = iPdmRefIdx; 832 pacPdmMv [ iRefListId ] = cMv; 833 break; 834 } 835 } 836 } 837 iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 ); 838 } 839 return iPdmInterDir; 840 #endif 841 } 842 843 #if QC_MULTI_DIS_CAN_A0097 938 } 939 940 #if H3D_NBDV 844 941 Bool 845 942 TComDepthMapGenerator::getDisCanPdmMvPred ( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge ) 846 943 { 847 #if LGE_DVMCP_A0126848 944 rcMv.m_bDvMcp = false; 849 #endif850 945 AOF ( m_bCreated && m_bInit ); 851 946 AOF ( iRefIdx >= 0 ); 852 947 AOF ( pcCU ); 853 //ROFRS( m_bPDMAvailable, false );854 948 TComSlice* pcSlice = pcCU->getSlice (); 855 949 TComSPS* pcSPS = pcSlice->getSPS(); … … 878 972 for( UInt uiBId = 0; uiBId < m_uiCurrViewId; uiBId++ ) 879 973 { 880 UInt uiBaseId = uiBId; //m_auiBaseIdList[ uiBId ];974 UInt uiBaseId = uiBId; 881 975 882 976 if (m_uiCurrViewId >1 && uiBaseId ==1 ) … … 913 1007 { 914 1008 rcMv.set( cBaseMvField.getHor(), cBaseMvField.getVer() ); 915 #if LGE_DVMCP_A0126916 1009 // save disparity vector when a merge candidate for IVMP is set as DV-MCP 917 1010 if( bMerge ) … … 919 1012 rcMv.m_bDvMcp = true; 920 1013 rcMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor(); 1014 #if MTK_RELEASE_DV_CONSTRAINT_C0129 1015 rcMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer(); 1016 #endif 921 1017 } 922 1018 else { // AMVP ? 923 1019 rcMv.m_bDvMcp = false; 924 1020 } 925 #endif926 1021 return true; 927 1022 } … … 930 1025 return false; 931 1026 } 932 #else 1027 #else // H3D_NBDV 933 1028 Bool 934 1029 TComDepthMapGenerator::getPdmMvPred( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge ) … … 1014 1109 return false; 1015 1110 } 1016 #endif 1111 #endif // H3D_NBDV 1112 #endif // QC_AMVP_MRG_UNIFY_IVCAN_C0051 1017 1113 1018 1114 … … 1056 1152 return true; 1057 1153 } 1058 #endif 1059 1060 1061 1062 1063 1064 #if ! QC_MULTI_DIS_CAN_A00971154 #endif // H3D_IVMP 1155 1156 1157 1158 1159 1160 #if !H3D_NBDV 1065 1161 /*=======================================================* 1066 1162 *===== =====* … … 1856 1952 Int iCurrPosY; 1857 1953 pcPredDepthMap->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); 1858 #if SAIT_IMPROV_MOTION_PRED_M24829// max disparity within PU1954 #if H3D_IVMP // max disparity within PU 1859 1955 Int DiWidth = iCurrPosX+(iWidth >> m_uiSubSampExpX); 1860 1956 Int DiHeight = iCurrPosY+(iHeight >> m_uiSubSampExpY); … … 1889 1985 return true; 1890 1986 } 1891 #endif 1987 #endif // H3D_NBDV 1892 1988 1893 1989 #endif // DEPTH_MAP_GENERATION -
trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h
r210 r296 80 80 81 81 UInt getPdm () { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getPredDepthMapGeneration(); } return 0; } 82 #if H HI_INTER_VIEW_RESIDUAL_PRED82 #if H3D_IVRP 83 83 UInt getResPrd () { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getMultiviewResPredMode (); } return 0; } 84 84 #endif … … 136 136 137 137 Void initViewComponent ( TComPic* pcPic ); 138 #if ! QC_MULTI_DIS_CAN_A0097138 #if !H3D_NBDV 139 139 Bool predictDepthMap ( TComPic* pcPic ); 140 140 Void updateDepthMap ( TComPic* pcPic ); … … 142 142 #endif 143 143 144 #if H HI_INTER_VIEW_MOTION_PRED144 #if H3D_IVMP 145 145 Void covertOrgDepthMap ( TComPic* pcPic ); 146 146 #endif … … 150 150 UInt getSubSampExpY () { return m_uiSubSampExpY; } 151 151 Int getDisparity ( TComPic* pcPic, Int iPosX, Int iPosY, UInt uiRefViewId ); 152 #if HHI_INTER_VIEW_MOTION_PRED 153 #if QC_MULTI_DIS_CAN_A0097 154 Int getPdmMergeCandidate ( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo 155 #if QC_MRG_CANS_B0048 156 , Int* iPdm 157 #endif 158 ); 159 152 #if H3D_IVMP 153 #if H3D_NBDV 154 #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 155 Bool getPdmCandidate ( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ); 156 #else 157 Int getPdmMergeCandidate ( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm ); 160 158 Bool getPdmMvPredDisCan ( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge ); 161 159 Bool getDisCanPdmMvPred ( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge ); 160 #endif 162 161 #else 163 162 Int getPdmMergeCandidate ( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ); … … 176 175 private: 177 176 // picture operations 178 #if ! QC_MULTI_DIS_CAN_A0097177 #if !H3D_NBDV 179 178 Bool xConvertDepthMapCurr2Ref ( TComPic* pcRef, TComPic* pcCur ); 180 179 Bool xConvertDepthMapRef2Curr ( TComPic* pcCur, TComPic* pcRef ); -
trunk/source/Lib/TLibCommon/TComLoopFilter.cpp
r56 r296 85 85 // Public member functions 86 86 // ==================================================================================================================== 87 #if DBL_CONTROL88 87 Void TComLoopFilter::setCfg( Bool DeblockingFilterControlPresent, UInt uiDisableDblkIdc, Int iBetaOffset_div2, Int iTcOffset_div2, Bool bLFCrossTileBoundary) 89 #else 90 Void TComLoopFilter::setCfg( UInt uiDisableDblkIdc, Int iBetaOffset_div2, Int iTcOffset_div2, Bool bLFCrossTileBoundary) 91 #endif 92 { 93 #if !DBL_CONTROL 94 m_uiDisableDeblockingFilterIdc = uiDisableDblkIdc; 95 #endif 88 { 96 89 m_bLFCrossTileBoundary = bLFCrossTileBoundary; 97 90 98 #if DBL_CONTROL99 91 if (DeblockingFilterControlPresent) 100 92 { … … 109 101 m_tcOffsetDiv2 = 0; 110 102 } 111 #else112 m_betaOffsetDiv2 = iBetaOffset_div2;113 m_tcOffsetDiv2 = iTcOffset_div2;114 #endif115 103 } 116 104 … … 439 427 440 428 //-- Set BS for Intra MB : BS = 4 or 3 441 if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) ) 429 if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) 430 #if MERL_VSP_C0152 431 || pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ) 432 #endif 433 ) 442 434 { 443 435 uiBs = 2; … … 445 437 446 438 //-- Set BS for not Intra MB : BS = 2 or 1 or 0 447 if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) ) 448 { 449 #if NSQT_LFFIX 439 if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) 440 #if MERL_VSP_C0152 441 && !pcCUP->getVSPIndex(uiPartP) && !pcCUQ->getVSPIndex(uiPartQ) 442 #endif 443 ) 444 { 450 445 UInt nsPartQ = uiPartQ; 451 446 UInt nsPartP = uiPartP; … … 460 455 461 456 if ( m_aapucBS[iDir][uiAbsPartIdx] && (pcCUQ->getCbf( nsPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(nsPartQ)) != 0 || pcCUP->getCbf( nsPartP, TEXT_LUMA, pcCUP->getTransformIdx(nsPartP) ) != 0) ) 462 #else463 if ( m_aapucBS[iDir][uiAbsPartIdx] && (pcCUQ->getCbf( uiPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(uiPartQ)) != 0 || pcCUP->getCbf( uiPartP, TEXT_LUMA, pcCUP->getTransformIdx(uiPartP) ) != 0) )464 #endif465 457 { 466 458 uiBs = 1; … … 542 534 } // enf of "if( not Intra )" 543 535 536 #if MERL_VSP_C0152 537 if ( pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ)) 538 { 539 uiBs = 0; 540 } 541 #endif 542 544 543 m_aapucBS[iDir][uiAbsPartIdx] = uiBs; 545 544 } … … 559 558 560 559 UInt uiPelsInPart = g_uiMaxCUWidth >> g_uiMaxCUDepth; 561 #if !DBL_H0473_PART_1562 UInt PartIdxIncr = DEBLOCK_SMALLEST_BLOCK / uiPelsInPart ? DEBLOCK_SMALLEST_BLOCK / uiPelsInPart : 1;563 UInt uiBlocksInPart = uiPelsInPart / DEBLOCK_SMALLEST_BLOCK ? uiPelsInPart / DEBLOCK_SMALLEST_BLOCK : 1;564 #endif565 560 UInt uiBsAbsIdx = 0, uiBs = 0; 566 561 Int iOffset, iSrcStep; … … 587 582 } 588 583 589 #if !DBL_H0473_PART_1590 for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx+=PartIdxIncr )591 {592 uiBs = 0;593 for (UInt iIdxInside = 0; iIdxInside<PartIdxIncr; iIdxInside++)594 {595 uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx+iIdxInside);596 if (uiBs < m_aapucBS[iDir][uiBsAbsIdx])597 {598 uiBs = m_aapucBS[iDir][uiBsAbsIdx];599 }600 }601 602 #else603 584 for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ ) 604 585 { 605 586 uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx); 606 587 uiBs = m_aapucBS[iDir][uiBsAbsIdx]; 607 #endif608 588 if ( uiBs ) 609 589 { … … 643 623 644 624 645 #if !DBL_H0473_PART_1646 for (UInt iBlkIdx = 0; iBlkIdx< uiBlocksInPart; iBlkIdx ++)647 {648 Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0), iOffset);649 Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0), iOffset);650 Int dp3 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3), iOffset);651 Int dq3 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3), iOffset);652 Int d0 = dp0 + dq0;653 Int d3 = dp3 + dq3;654 655 Int dp4 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4), iOffset);656 Int dq4 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4), iOffset);657 Int dp7 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7), iOffset);658 Int dq7 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7), iOffset);659 Int d4 = dp4 + dq4;660 Int d7 = dp7 + dq7;661 #else662 625 Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0), iOffset); 663 626 Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0), iOffset); … … 670 633 Int dq = dq0 + dq3; 671 634 Int d = d0 + d3; 672 #endif673 635 674 636 if (bPCMFilter) … … 683 645 bPartQNoFilter = bPartQNoFilter || (pcCU->isLosslessCoded(uiAbsZorderIdx) ); 684 646 #endif 685 #if !DBL_H0473_PART_1686 if (d0+d3 < iBeta)687 {688 Bool bFilterP = (dp0+dp3 < iSideThreshold);689 Bool bFilterQ = (dq0+dq3 < iSideThreshold);690 691 Bool sw = xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0))692 && xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3));693 694 #else695 647 if (d < iBeta) 696 648 { … … 700 652 Bool sw = xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0)) 701 653 && xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+3)); 702 #endif703 654 704 655 for ( Int i = 0; i < DEBLOCK_SMALLEST_BLOCK/2; i++) 705 656 { 706 #if !DBL_H0473_PART_1707 xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+i), iOffset, d0+d3, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);708 #else709 657 xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+i), iOffset, d, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ); 710 #endif711 658 712 659 } 713 660 } 714 #if !DBL_H0473_PART_1715 if (d4+d7 < iBeta)716 {717 Bool bFilterP = (dp4+dp7 < iSideThreshold);718 Bool bFilterQ = (dq4+dq7 < iSideThreshold);719 720 Bool sw = xUseStrongFiltering( iOffset, 2*d4, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4))721 && xUseStrongFiltering( iOffset, 2*d7, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7));722 for ( Int i = DEBLOCK_SMALLEST_BLOCK/2; i < DEBLOCK_SMALLEST_BLOCK; i++)723 {724 xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+i), iOffset, d4+d7, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);725 }726 }727 }728 #endif729 661 } 730 662 } … … 878 810 if (sw) 879 811 { 880 #if DBL_STRONG_FILTER_CLIP881 812 piSrc[-iOffset] = Clip3(m3-2*tc, m3+2*tc, ((m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3)); 882 813 piSrc[0] = Clip3(m4-2*tc, m4+2*tc, ((m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3)); … … 885 816 piSrc[-iOffset*3] = Clip3(m1-2*tc, m1+2*tc, ((2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3)); 886 817 piSrc[ iOffset*2] = Clip3(m6-2*tc, m6+2*tc, ((m3 + m4 + m5 + 3*m6 + 2*m7 +4 )>>3)); 887 #else888 piSrc[-iOffset] = ( m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3;889 piSrc[0] = ( m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3;890 891 piSrc[-iOffset*2] = ( m1 + m2 + m3 + m4 + 2)>>2;892 piSrc[ iOffset] = ( m3 + m4 + m5 + m6 + 2)>>2;893 894 piSrc[-iOffset*3] = ( 2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3;895 piSrc[ iOffset*2] = ( m3 + m4 + m5 + 3*m6 + 2*m7 +4 )>>3;896 #endif897 818 } 898 819 else -
trunk/source/Lib/TLibCommon/TComLoopFilter.h
r56 r296 107 107 108 108 /// set configuration 109 #if DBL_CONTROL110 109 Void setCfg( Bool DeblockingFilterControlPresent, UInt uiDisableDblkIdc, Int betaOffsetDiv2, Int tcOffsetDiv2, Bool bLFCrossTileBoundary); 111 #else112 Void setCfg( UInt uiDisableDblkIdc, Int betaOffsetDiv2, Int tcOffsetDiv2, Bool bLFCrossTileBoundary);113 #endif114 110 115 111 /// picture-level deblocking filter -
trunk/source/Lib/TLibCommon/TComMotionInfo.cpp
r189 r296 378 378 379 379 #if MTK_UNCONSTRAINED_MVI_B0083 380 Void TComCUMvField::setUndefinedMv( Int iPartAddr, Int iNumPart, Char* pePredMode, UChar* puhInterDir, Int refIdx, Int InterDir ) 380 Void TComCUMvField::setUndefinedMv( Int iPartAddr, Int iNumPart, Char* pePredMode, UChar* puhInterDir, Int refIdx, Int InterDir 381 ) 381 382 { 382 383 PredMode predMode = MODE_INTRA; … … 386 387 { 387 388 predMode = static_cast<PredMode>( pePredMode[ iPartAddr+i ] ); 388 if( predMode ==MODE_INTRA)389 if( predMode == MODE_INTRA ) 389 390 { 390 391 m_pcMv[iPartAddr+i] = cMv; -
trunk/source/Lib/TLibCommon/TComMotionInfo.h
r189 r296 59 59 60 60 // ==================================================================================================================== 61 #if QC_MULTI_DIS_CAN_A009761 #if H3D_NBDV 62 62 typedef struct _DisCand 63 63 { … … 94 94 Int getHor () const { return m_acMv.getHor(); } 95 95 Int getVer () const { return m_acMv.getVer(); } 96 #if QC_MRG_CANS_B004896 #if H3D_IVMP 97 97 Bool operator== ( const TComMvField& rcMv ) const 98 98 { -
trunk/source/Lib/TLibCommon/TComMv.h
r189 r296 57 57 public: 58 58 59 #if LGE_DVMCP_A012659 #if H3D_NBDV 60 60 Bool m_bDvMcp; // is dv-mcp ? 61 61 Int m_iDvMcpDispX; // disparity for dv-mcp 62 #if MTK_RELEASE_DV_CONSTRAINT_C0129 63 Int m_iDvMcpDispY; // disparity for dv-mcp 64 #endif 62 65 #endif 63 66 … … 69 72 m_iHor(0), 70 73 m_iVer(0) 71 #if LGE_DVMCP_A012674 #if H3D_NBDV 72 75 , m_bDvMcp(false) 73 76 , m_iDvMcpDispX(0) 77 #if MTK_RELEASE_DV_CONSTRAINT_C0129 78 , m_iDvMcpDispY(0) 79 #endif 74 80 #endif 75 81 { … … 79 85 m_iHor(iHor), 80 86 m_iVer(iVer) 81 #if LGE_DVMCP_A012687 #if H3D_NBDV 82 88 , m_bDvMcp(false) 83 89 , m_iDvMcpDispX(0) 90 #if MTK_RELEASE_DV_CONSTRAINT_C0129 91 , m_iDvMcpDispY(0) 92 #endif 84 93 #endif 85 94 { … … 158 167 const TComMv scaleMv( Int iScale ) const 159 168 { 160 #if CLIPSCALEDMVP161 169 Int mvx = Clip3( -32768, 32767, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8 ); 162 170 Int mvy = Clip3( -32768, 32767, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8 ); 163 171 return TComMv( mvx, mvy ); 164 #else165 return TComMv( (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8);166 #endif167 172 } 168 173 };// END CLASS DEFINITION TComMV -
trunk/source/Lib/TLibCommon/TComPattern.cpp
r189 r296 47 47 // ==================================================================================================================== 48 48 49 #if LOGI_INTRA_NAME_3MPM50 49 const UChar TComPattern::m_aucIntraFilter[5] = 51 50 { … … 56 55 10, //64x64 57 56 }; 58 #else59 const UChar TComPattern::m_aucIntraFilter[5][NUM_INTRA_MODE] =60 {61 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 062 }, //4x463 {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 064 }, //8x865 {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 066 }, //16x1667 {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 068 }, //32x3269 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 070 }, //64x6471 };72 #endif73 57 74 58 // ==================================================================================================================== … … 682 666 mapDMMtoIntraMode( uiDirMode ); 683 667 #endif 684 #if LOGI_INTRA_NAME_3MPM685 668 Int diff = min<Int>(abs((Int) uiDirMode - HOR_IDX), abs((Int)uiDirMode - VER_IDX)); 686 669 UChar ucFiltIdx = diff > m_aucIntraFilter[log2BlkSize - 2] ? 1 : 0; … … 689 672 ucFiltIdx = 0; //no smoothing for DC or LM chroma 690 673 } 691 #else692 UChar ucFiltIdx = m_aucIntraFilter[log2BlkSize - 2][uiDirMode];693 #endif694 674 695 675 assert( ucFiltIdx <= 1 ); -
trunk/source/Lib/TLibCommon/TComPattern.h
r189 r296 115 115 #endif 116 116 117 #if LOGI_INTRA_NAME_3MPM118 117 static const UChar m_aucIntraFilter[5]; 119 #else120 static const UChar m_aucIntraFilter[5][NUM_INTRA_MODE];121 #endif122 118 123 119 public: -
trunk/source/Lib/TLibCommon/TComPic.cpp
r210 r296 59 59 #endif 60 60 #endif 61 #if H HI_INTER_VIEW_MOTION_PRED61 #if H3D_IVMP 62 62 m_pcOrgDepthMap = NULL; 63 63 #endif 64 #if H HI_INTER_VIEW_RESIDUAL_PRED64 #if H3D_IVRP 65 65 m_pcResidual = NULL; 66 66 #endif … … 76 76 m_pcUsedPelsMap = NULL; 77 77 #endif 78 #if SONY_COLPIC_AVAILABILITY79 m_iViewOrderIdx = 0; 78 #if INTER_VIEW_VECTOR_SCALING_C0115 79 m_iViewOrderIdx = 0; // will be changed to view_id 80 80 #endif 81 81 m_aaiCodedScale = 0; … … 84 84 m_bReduceBitsQTL = 0; 85 85 #endif 86 #if QC_SIMPLE_NBDV_B004786 #if H3D_NBDV 87 87 m_bRapCheck = false; 88 88 m_eRapRefList = REF_PIC_LIST_0; … … 157 157 #endif 158 158 #endif 159 #if H HI_INTER_VIEW_MOTION_PRED159 #if H3D_IVMP 160 160 if( m_pcOrgDepthMap ) 161 161 { … … 165 165 } 166 166 #endif 167 #if H HI_INTER_VIEW_RESIDUAL_PRED167 #if H3D_IVRP 168 168 if( m_pcResidual ) 169 169 { … … 206 206 #endif 207 207 208 #if H HI_INTER_VIEW_MOTION_PRED208 #if H3D_IVMP 209 209 Void 210 210 TComPic::addOrgDepthMapBuffer() … … 222 222 #endif 223 223 224 #if H HI_INTER_VIEW_RESIDUAL_PRED224 #if H3D_IVRP 225 225 Void 226 226 TComPic::addResidualBuffer() … … 259 259 #endif 260 260 261 #if H HI_INTER_VIEW_MOTION_PRED261 #if H3D_IVMP 262 262 Void 263 263 TComPic::removeOrgDepthMapBuffer() … … 272 272 #endif 273 273 274 #if H HI_INTER_VIEW_RESIDUAL_PRED274 #if H3D_IVRP 275 275 Void 276 276 TComPic::removeResidualBuffer() … … 316 316 m_pbValidSlice[s] = true; 317 317 } 318 #if !LCU_SYNTAX_ALF319 if( pSliceStartAddress == NULL || (numSlices == 1 && numTiles == 1) )320 {321 return;322 }323 #endif324 318 m_pSliceSUMap = new Int[maxNumSUInLCU * numLCUInPic]; 325 319 … … 489 483 } 490 484 } 491 #if QC_SIMPLE_NBDV_B0047485 #if H3D_NBDV 492 486 Bool TComPic::getDisCandRefPictures(Int iColPOC) 493 487 { -
trunk/source/Lib/TLibCommon/TComPic.h
r210 r296 77 77 #endif 78 78 79 #if H HI_INTER_VIEW_MOTION_PRED79 #if H3D_IVMP 80 80 TComPicYuv* m_pcOrgDepthMap; // original depth map 81 #if QC_MULTI_DIS_CAN_A0097 82 Bool m_checked; 83 #endif 84 #if QC_SIMPLE_NBDV_B0047 81 #if H3D_NBDV 82 Bool m_checked; 85 83 UInt m_uiRapRefIdx; 86 84 RefPicList m_eRapRefList; … … 88 86 #endif 89 87 #endif 90 #if H HI_INTER_VIEW_RESIDUAL_PRED88 #if H3D_IVRP 91 89 TComPicYuv* m_pcResidual; // residual buffer (coded or inter-view predicted residual) 92 90 #endif … … 112 110 TComPicYuv* m_pcUsedPelsMap; 113 111 #endif 114 #if SONY_COLPIC_AVAILABILITY115 Int m_iViewOrderIdx; 112 #if INTER_VIEW_VECTOR_SCALING_C0115 113 Int m_iViewOrderIdx; // will be changed to view_id 116 114 #endif 117 115 Int** m_aaiCodedScale; … … 167 165 168 166 #endif 169 #if H HI_INTER_VIEW_MOTION_PRED167 #if H3D_IVMP 170 168 TComPicYuv* getOrgDepthMap() { return m_pcOrgDepthMap; } 171 #if QC_MULTI_DIS_CAN_A0097169 #if H3D_NBDV 172 170 Void setCandPicCheckedFlag (Bool bchecked) { m_checked = bchecked; } 173 171 Bool getCandPicCheckedFlag () { return m_checked;} … … 175 173 #endif 176 174 177 #if H HI_INTER_VIEW_RESIDUAL_PRED175 #if H3D_IVRP 178 176 TComPicYuv* getResidual() { return m_pcResidual; } 179 177 #endif 180 #if QC_SIMPLE_NBDV_B0047178 #if H3D_NBDV 181 179 UInt getRapRefIdx() {return m_uiRapRefIdx;} 182 180 RefPicList getRapRefList() {return m_eRapRefList;} … … 188 186 #endif 189 187 190 #if SONY_COLPIC_AVAILABILITY191 Void setViewOrderIdx(Int i) { m_iViewOrderIdx = i; } 192 Int getViewOrderIdx() { return m_iViewOrderIdx; } 188 #if INTER_VIEW_VECTOR_SCALING_C0115 189 Void setViewOrderIdx(Int i) { m_iViewOrderIdx = i; } // will be changed to view_id 190 Int getViewOrderIdx() { return m_iViewOrderIdx; } // will be changed to view_id 193 191 #endif 194 192 … … 252 250 Void addPrdDepthMapBuffer ( UInt uiSubSampExpX, UInt uiSubSampExpY ); 253 251 #endif 254 #if H HI_INTER_VIEW_MOTION_PRED252 #if H3D_IVMP 255 253 Void addOrgDepthMapBuffer (); 256 254 #endif 257 #if H HI_INTER_VIEW_RESIDUAL_PRED255 #if H3D_IVRP 258 256 Void addResidualBuffer (); 259 257 #endif … … 261 259 Void removePrdDepthMapBuffer (); 262 260 #endif 263 #if H HI_INTER_VIEW_MOTION_PRED261 #if H3D_IVMP 264 262 Void removeOrgDepthMapBuffer (); 265 263 #endif 266 #if H HI_INTER_VIEW_RESIDUAL_PRED264 #if H3D_IVRP 267 265 Void removeResidualBuffer (); 268 266 #endif -
trunk/source/Lib/TLibCommon/TComPicSym.h
r56 r296 133 133 UInt getNumPartInWidth() { return m_uiNumPartInWidth; } 134 134 UInt getNumPartInHeight() { return m_uiNumPartInHeight; } 135 #if !REMOVE_TILE_DEPENDENCE136 Void setTileBoundaryIndependenceIdr( Int i ) { m_iTileBoundaryIndependenceIdr = i; }137 Int getTileBoundaryIndependenceIdr() { return m_iTileBoundaryIndependenceIdr; }138 #endif139 135 Void setNumColumnsMinus1( Int i ) { m_iNumColumnsMinus1 = i; } 140 136 Int getNumColumnsMinus1() { return m_iNumColumnsMinus1; } -
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r210 r296 54 54 { 55 55 m_piYuvExt = NULL; 56 #if MERL_VSP_C0152 57 m_pDepth = (Int*) malloc(64*64*sizeof(Int)); // TODO: Use a smart way to determine the size of the array 58 if (m_pDepth == NULL) 59 { 60 printf("ERROR: UKTGHU, No memory allocated.\n"); 61 } 62 #endif 56 63 } 57 64 … … 59 66 { 60 67 68 #if MERL_VSP_C0152 69 if (m_pDepth != NULL) 70 { 71 free(m_pDepth); 72 } 73 #endif 61 74 delete[] m_piYuvExt; 62 75 … … 190 203 191 204 // Map the mode index to main prediction direction and angle 192 #if LOGI_INTRA_NAME_3MPM193 205 assert( dirMode > 0 ); //no planar 194 206 Bool modeDC = dirMode < 2; … … 196 208 Bool modeVer = !modeDC && !modeHor; 197 209 Int intraPredAngle = modeVer ? (Int)dirMode - VER_IDX : modeHor ? -((Int)dirMode - HOR_IDX) : 0; 198 #else199 Bool modeDC = dirMode == 0;200 Bool modeVer = !modeDC && (dirMode < 18);201 Bool modeHor = !modeDC && !modeVer;202 Int intraPredAngle = modeVer ? dirMode - 9 : modeHor ? dirMode - 25 : 0;203 #endif204 210 Int absAng = abs(intraPredAngle); 205 211 Int signAng = intraPredAngle < 0 ? -1 : 1; … … 284 290 for (k=0;k<blkSize;k++) 285 291 { 286 #if REMOVE_DIV_OPERATION287 292 pDst[k*dstStride] = Clip ( pDst[k*dstStride] + (( refSide[k+1] - refSide[0] ) >> 1) ); 288 #else289 pDst[k*dstStride] = Clip ( pDst[k*dstStride] + ( refSide[k+1] - refSide[0] ) / 2 );290 #endif291 293 } 292 294 } … … 363 365 else 364 366 { 365 #if LOGI_INTRA_NAME_3MPM366 367 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, true ); 367 #else368 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, true );369 #endif370 368 371 369 if( (uiDirMode == DC_IDX ) && bAbove && bLeft ) … … 392 390 { 393 391 // Create the prediction 394 #if LOGI_INTRA_NAME_3MPM395 392 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, false ); 396 #else397 xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, false );398 #endif399 393 } 400 394 } … … 605 599 606 600 #if DEPTH_MAP_GENERATION 601 #if MERL_VSP_C0152 602 Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY ) 603 #else 607 604 Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY ) 605 #endif 606 #else 607 #if MERL_VSP_C0152 608 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx ) 608 609 #else 609 610 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx ) 611 #endif 610 612 #endif 611 613 { … … 635 637 { 636 638 #if DEPTH_MAP_GENERATION 639 #if MERL_VSP_C0152 640 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 641 #else 637 642 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 643 #endif 644 #else 645 #if MERL_VSP_C0152 646 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 638 647 #else 639 648 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 640 649 #endif 650 #endif 641 651 } 642 652 else 643 653 { 644 654 #if DEPTH_MAP_GENERATION 655 #if MERL_VSP_C0152 656 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 657 #else 645 658 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 659 #endif 660 #else 661 #if MERL_VSP_C0152 662 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 646 663 #else 647 664 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 665 #endif 648 666 #endif 649 667 } … … 666 684 { 667 685 #if DEPTH_MAP_GENERATION 686 #if MERL_VSP_C0152 687 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 688 #else 668 689 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 690 #endif 691 #else 692 #if MERL_VSP_C0152 693 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 669 694 #else 670 695 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 671 696 #endif 697 #endif 672 698 } 673 699 else 674 700 { 675 701 #if DEPTH_MAP_GENERATION 702 #if MERL_VSP_C0152 703 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 704 #else 676 705 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 706 #endif 707 #else 708 #if MERL_VSP_C0152 709 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 677 710 #else 678 711 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 712 #endif 679 713 #endif 680 714 } … … 704 738 { 705 739 #if DEPTH_MAP_GENERATION 740 #if MERL_VSP_C0152 741 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 742 #else 706 743 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 744 #endif 745 #else 746 #if MERL_VSP_C0152 747 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 707 748 #else 708 749 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true ); 709 #endif 710 } 711 else 712 { 750 #endif 751 #endif 752 } 753 else 754 { 713 755 #if DEPTH_MAP_GENERATION 756 #if MERL_VSP_C0152 757 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 758 #else 714 759 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 760 #endif 761 #else 762 #if MERL_VSP_C0152 763 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 715 764 #else 716 765 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 717 #endif 766 #endif 767 #endif 718 768 } 719 769 #if DEPTH_MAP_GENERATION 770 #if MERL_VSP_C0152 771 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 772 #else 720 773 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 774 #endif 775 #else 776 #if MERL_VSP_C0152 777 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 721 778 #else 722 779 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false ); 723 #endif 780 #endif 781 #endif 724 782 #if LGE_ILLUCOMP_B0045 725 783 if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr)) 726 784 #else 727 if ( pcCU->getSlice()->getPPS()->getUseWP())785 if( pcCU->getSlice()->getPPS()->getUseWP()) 728 786 #endif 729 787 { … … 736 794 { 737 795 #if DEPTH_MAP_GENERATION 796 #if MERL_VSP_C0152 797 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 798 #else 738 799 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 800 #endif 801 #else 802 #if MERL_VSP_C0152 803 xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 739 804 #else 740 805 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false ); 806 #endif 807 #endif 808 } 809 else 810 { 811 #if DEPTH_MAP_GENERATION 812 #if MERL_VSP_C0152 813 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 814 #else 815 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 816 #endif 817 #else 818 #if MERL_VSP_C0152 819 xPredInterBi (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 820 #else 821 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 741 822 #endif 742 } 743 else 744 { 823 #endif 824 } 825 } 826 } 827 return; 828 } 829 830 #if MTK_MDIVRP_C0138 831 Void TComPrediction::residualPrediction(TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred) 832 { 833 Int iWidth; 834 Int iHeight; 835 UInt uiPartAddr; 836 837 pcCU->getPartIndexAndSize( 0, uiPartAddr, iWidth, iHeight ); 838 839 Bool bResAvail = false; 840 841 bResAvail = pcCU->getResidualSamples( 0, true, pcYuvResPred ); 842 843 assert (bResAvail); 844 845 pcYuvPred->add(pcYuvResPred, iWidth, iHeight); 846 } 847 #endif 848 745 849 #if DEPTH_MAP_GENERATION 746 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap ); 747 #else 748 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx ); 749 #endif 750 } 751 } 752 } 753 return; 754 } 755 756 757 758 #if DEPTH_MAP_GENERATION 850 #if MERL_VSP_C0152 851 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi ) 852 #else 759 853 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi ) 854 #endif 855 #else 856 #if MERL_VSP_C0152 857 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi ) 760 858 #else 761 859 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi ) 762 860 #endif 763 { 861 #endif 862 { 863 #if MERL_VSP_C0152 864 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 865 Int vspIdx = pcCU->getVSPIndex(uiPartAddr); 866 if (vspIdx != 0) 867 { 868 if (iRefIdx >= 0) 869 { 870 printf("vspIdx = %d, iRefIdx = %d\n", vspIdx, iRefIdx); 871 } 872 assert (iRefIdx < 0); // assert (iRefIdx == NOT_VALID); 873 } 874 else 875 { 876 assert (iRefIdx >= 0); 877 } 878 #else 764 879 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); assert (iRefIdx >= 0); 765 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 880 #endif 881 882 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 766 883 pcCU->clipMv(cMv); 767 884 … … 784 901 if( pcCU->getSlice()->getSPS()->isDepth() ) 785 902 { 786 UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 ); 787 UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0; 903 #if MERL_VSP_C0152 904 if (vspIdx != 0) 905 { // depth, vsp 906 // get depth estimator here 907 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth(); 908 TComPicYuv* pcBaseViewDepthPicYuv = NULL; 909 if (vspIdx < 4) // spatial 910 { 911 pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 912 } 913 Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 914 Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 915 Int* pShiftLUT; 916 Int iShiftPrec; 917 pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec); 918 //using disparity to find the depth block of the base view as the depth block estimator of the current block 919 //using depth block estimator and base view texture to get Backward warping 920 xPredInterLumaBlkFromDM ( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 921 xPredInterChromaBlkFromDM( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 922 } 923 else 924 { 925 #endif 926 UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 ); 927 UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0; 928 #if LGE_ILLUCOMP_DEPTH_C0046 929 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 930 #endif 788 931 #if DEPTH_MAP_GENERATION 789 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset ); 790 #else 791 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset ); 792 #endif 932 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset 933 #if LGE_ILLUCOMP_DEPTH_C0046 934 , bICFlag 935 #endif 936 ); 937 #else 938 xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset ); 939 #endif 940 #if MERL_VSP_C0152 941 } 942 #endif// MERL_VSP_C0152 //else 793 943 } 794 944 else 795 945 { 796 946 #endif 947 #if MERL_VSP_C0152 948 if ( vspIdx != 0 ) 949 { // texture, vsp 950 TComPic* pRefPicBaseTxt = pcCU->getSlice()->getRefPicBaseTxt(); 951 TComPicYuv* pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); 952 TComPicYuv* pcBaseViewDepthPicYuv = NULL; 953 if (vspIdx < 4) // spatial 954 { 955 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth(); 956 pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 957 } 958 Int iBlkX = ( pcCU->getAddr() % pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 959 Int iBlkY = ( pcCU->getAddr() / pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 960 Int* pShiftLUT; 961 Int iShiftPrec; 962 pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec); 963 964 //using disparity to find the depth block of the base view as the depth block estimator of the current block 965 //using depth block estimator and base view texture to get Backward warping 966 xPredInterLumaBlkFromDM ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 967 xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 968 } 969 else//texture not VSP 970 { 971 #endif //MERL_VSP_C0152 797 972 #if LGE_ILLUCOMP_B0045 798 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 799 800 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag); 801 #else 802 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 803 #endif 973 Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId()); 974 975 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag); 976 #else 977 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 978 #endif 979 #if MERL_VSP_C0152 980 } //texture not VSP 981 #endif 804 982 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 805 983 } 984 #endif 985 986 #if MERL_VSP_C0152 987 if ( vspIdx == 0 )//Not VSP 988 { 806 989 #endif 807 990 #if LGE_ILLUCOMP_B0045 … … 812 995 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi ); 813 996 #endif 997 #if MERL_VSP_C0152 998 } 999 #endif 814 1000 } 815 1001 816 1002 817 1003 #if DEPTH_MAP_GENERATION 1004 #if MERL_VSP_C0152 1005 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ) 1006 #else 818 1007 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ) 1008 #endif 1009 #else 1010 #if MERL_VSP_C0152 1011 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx ) 819 1012 #else 820 1013 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx ) 1014 #endif 821 1015 #endif 822 1016 { … … 829 1023 iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 830 1024 1025 #if MERL_VSP_C0152 1026 if(!pcCU->getVSPIndex(uiPartAddr)) 1027 { 1028 if ( iRefIdx[iRefList] < 0 ) 1029 { 1030 continue; 1031 } 1032 } 1033 else 1034 { 1035 if ( iRefList== REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID 1036 { 1037 continue; 1038 } 1039 } 1040 #else 831 1041 if ( iRefIdx[iRefList] < 0 ) 832 1042 { 833 1043 continue; 834 1044 } 1045 #endif 835 1046 836 1047 assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) ); … … 840 1051 { 841 1052 #if DEPTH_MAP_GENERATION 1053 #if MERL_VSP_C0152 1054 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1055 #else 842 1056 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1057 #endif 1058 #else 1059 #if MERL_VSP_C0152 1060 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 843 1061 #else 844 1062 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 845 1063 #endif 1064 #endif 846 1065 } 847 1066 else … … 850 1069 { 851 1070 #if DEPTH_MAP_GENERATION 1071 #if MERL_VSP_C0152 1072 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1073 #else 852 1074 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true ); 1075 #endif 1076 #else 1077 #if MERL_VSP_C0152 1078 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 853 1079 #else 854 1080 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true ); 855 1081 #endif 1082 #endif 856 1083 } 857 1084 else 858 1085 { 859 1086 #if DEPTH_MAP_GENERATION 1087 #if MERL_VSP_C0152 1088 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 1089 #else 860 1090 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false ); 1091 #endif 1092 #else 1093 #if MERL_VSP_C0152 1094 xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false ); 861 1095 #else 862 1096 xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false ); 863 1097 #endif 1098 #endif 864 1099 } 865 1100 } … … 868 1103 if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() ) 869 1104 { 1105 #if MERL_VSP_C0152 1106 if(pcCU->getVSPIndex(uiPartAddr)) 1107 m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight ); 1108 else 1109 #endif 870 1110 xWeightedPredictionBi( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 871 1111 } … … 879 1119 else 880 1120 { 1121 #if MERL_VSP_C0152 1122 if(pcCU->getVSPIndex(uiPartAddr)) 1123 m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight ); 1124 else 1125 #endif 1126 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 1127 } 1128 #else 881 1129 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 882 } 883 #else 884 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 885 #endif 886 } 887 } 1130 #endif 1131 } 1132 } 1133 1134 888 1135 889 1136 Void 890 1137 #if DEPTH_MAP_GENERATION 891 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset ) 1138 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset 1139 #if LGE_ILLUCOMP_DEPTH_C0046 1140 , Bool bICFlag 1141 #endif 1142 ) 892 1143 #else 893 1144 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset ) … … 941 1192 } 942 1193 } 1194 1195 #if LGE_ILLUCOMP_DEPTH_C0046 1196 if(bICFlag) 1197 { 1198 Int a, b, iShift; 1199 TComMv tTmpMV(pcMv->getHor()<<2, pcMv->getVer()<<2); 1200 1201 piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 1202 piDstY = rpcYuv->getLumaAddr( uiPartAddr ); 1203 1204 xGetLLSICPrediction(pcCU, &tTmpMV, pcPicYuvRef, a, b, iShift); 1205 1206 for( Int y = 0; y < iHeight; y++, piDstY += iDstStride, piRefY += iRefStride ) 1207 { 1208 for( Int x = 0; x < iWidth; x++ ) 1209 { 1210 if(uiOffset) 1211 { 1212 Int iIFshift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement ); 1213 piDstY[ x ] = ( (a*piDstY[ x ]+a*IF_INTERNAL_OFFS) >> iShift ) + b*(1<<iIFshift) - IF_INTERNAL_OFFS; 1214 } 1215 else 1216 piDstY[ x ] = Clip( ( (a*piDstY[ x ]) >> iShift ) + b ); 1217 } 1218 } 1219 } 1220 #endif 943 1221 } 944 1222 … … 1119 1397 } 1120 1398 1399 #if MERL_VSP_C0152 1400 // Input: 1401 // refPic: Ref picture. Full picture, with padding 1402 // posX, posY: PU position, texture 1403 // size_x, size_y: PU size 1404 // partAddr: z-order index 1405 // mv: disparity vector. derived from neighboring blocks 1406 // 1407 // Output: dstPic, PU predictor 64x64 1408 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 1409 , TComYuv *&dstPic ) 1410 { 1411 Int widthLuma; 1412 Int heightLuma; 1413 1414 if (isDepth) 1415 { 1416 widthLuma = pPicBaseDepth->getWidth(); 1417 heightLuma = pPicBaseDepth->getHeight(); 1418 } 1419 else 1420 { 1421 widthLuma = refPic->getWidth(); 1422 heightLuma = refPic->getHeight(); 1423 } 1424 1425 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1426 Int widthDepth = pPicBaseDepth->getWidth(); 1427 Int heightDepth = pPicBaseDepth->getHeight(); 1428 #endif 1429 1430 Int nTxtPerDepthX = widthLuma / ( pPicBaseDepth->getWidth() ); // texture pixel # per depth pixel 1431 Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() ); 1432 1433 Int refStride = refPic->getStride(); 1434 Int dstStride = dstPic->getStride(); 1435 Int depStride = pPicBaseDepth->getStride(); 1436 1437 Int depthPosX = Clip3(0, widthLuma - size_x - 1, (posX/nTxtPerDepthX) + (mv->getHor()>>2)); 1438 Int depthPosY = Clip3(0, heightLuma- size_y - 1, (posY/nTxtPerDepthY) + (mv->getVer()>>2)); 1439 1440 Pel *ref = refPic->getLumaAddr() + posX + posY * refStride; 1441 Pel *dst = dstPic->getLumaAddr(partAddr); 1442 Pel *depth = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride; 1443 1444 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1445 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1446 Int dW = size_x>>1; 1447 Int dH = size_y>>1; 1448 #endif 1449 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1450 Int dW = size_x>>2; 1451 Int dH = size_y>>2; 1452 #endif 1453 { 1454 Pel* depthi = depth; 1455 for (Int j = 0; j < dH; j++) 1456 { 1457 for (Int i = 0; i < dW; i++) 1458 { 1459 Pel* depthTmp; 1460 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1461 if (depthPosX + (i<<1) < widthDepth) 1462 depthTmp = depthi + (i << 1); 1463 else 1464 depthTmp = depthi + (widthDepth - depthPosX - 1); 1465 #endif 1466 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1467 if (depthPosX + (i<<2) < widthDepth) 1468 depthTmp = depthi + (i << 2); 1469 else 1470 depthTmp = depthi + (widthDepth - depthPosX - 1); 1471 #endif 1472 Int maxV = 0; 1473 for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj++) 1474 { 1475 Int iX = 0; 1476 for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki++) 1477 { 1478 if (maxV < depthTmp[iX]) 1479 maxV = depthTmp[iX]; 1480 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1481 if (depthPosX + (i<<1) + blocki < widthDepth - 1) 1482 #else // MERL_VSP_BLOCKSIZE_C0152 == 4 1483 if (depthPosX + (i<<2) + blocki < widthDepth - 1) 1484 #endif 1485 iX++; 1486 } 1487 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1488 if (depthPosY + (j<<1) + blockj < heightDepth - 1) 1489 #else // MERL_VSP_BLOCKSIZE_C0152 == 4 1490 if (depthPosY + (j<<2) + blockj < heightDepth - 1) 1491 #endif 1492 depthTmp += depStride; 1493 } 1494 m_pDepth[i+j*dW] = maxV; 1495 } // end of i < dW 1496 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1497 if (depthPosY + ((j+1)<<1) < heightDepth) 1498 depthi += (depStride << 1); 1499 else 1500 depthi = depth + (heightDepth-depthPosY-1)*depStride; 1501 #endif 1502 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1503 if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1 1504 depthi += (depStride << 2); 1505 else 1506 depthi = depth + (heightDepth-depthPosY-1)*depStride; // the last line 1507 #endif 1508 } 1509 } 1510 #endif 1511 1512 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1513 Int yDepth = 0; 1514 #endif 1515 for ( Int yTxt = 0; yTxt < size_y; yTxt += nTxtPerDepthY ) 1516 { 1517 for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth++ ) 1518 { 1519 Pel rep_depth = 0; // to store the depth value used for warping 1520 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1521 rep_depth = depth[xDepth]; 1522 #endif 1523 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1524 rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW]; 1525 #endif 1526 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1527 rep_depth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW]; 1528 #endif 1529 1530 assert( rep_depth >= 0 && rep_depth <= 255 ); 1531 Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec; 1532 Int refOffset = xTxt + (disparity >> 2); 1533 Int xFrac = disparity & 0x3; 1534 Int absX = posX + refOffset; 1535 1536 if (xFrac == 0) 1537 absX = Clip3(0, widthLuma-1, absX); 1538 else 1539 absX = Clip3(4, widthLuma-5, absX); 1540 1541 refOffset = absX - posX; 1542 1543 assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 ); 1544 m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true ); 1545 } 1546 ref += refStride*nTxtPerDepthY; 1547 dst += dstStride*nTxtPerDepthY; 1548 depth += depStride; 1549 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1550 yDepth++; 1551 #endif 1552 } 1553 } 1554 1555 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 1556 , TComYuv *&dstPic ) 1557 { 1558 Int refStride = refPic->getCStride(); 1559 Int dstStride = dstPic->getCStride(); 1560 Int depStride = pPicBaseDepth->getStride(); 1561 1562 Int widthChroma, heightChroma; 1563 if( isDepth) 1564 { 1565 widthChroma = pPicBaseDepth->getWidth()>>1; 1566 heightChroma = pPicBaseDepth->getHeight()>>1; 1567 } 1568 else 1569 { 1570 widthChroma = refPic->getWidth()>>1; 1571 heightChroma = refPic->getHeight()>>1; 1572 } 1573 1574 // Below is only for Texture chroma component 1575 1576 Int widthDepth = pPicBaseDepth->getWidth(); 1577 Int heightDepth = pPicBaseDepth->getHeight(); 1578 1579 Int nTxtPerDepthX, nTxtPerDepthY; // Number of texture samples per one depth sample 1580 Int nDepthPerTxtX, nDepthPerTxtY; // Number of depth samples per one texture sample 1581 1582 Int depthPosX; // Starting position in depth image 1583 Int depthPosY; 1584 1585 if ( widthChroma > widthDepth ) 1586 { 1587 nTxtPerDepthX = widthChroma / widthDepth; 1588 nDepthPerTxtX = 1; 1589 depthPosX = posX / nTxtPerDepthX + (mv->getHor()>>2); //mv denotes the disparity for VSP 1590 } 1591 else 1592 { 1593 nTxtPerDepthX = 1; 1594 nDepthPerTxtX = widthDepth / widthChroma; 1595 depthPosX = posX * nDepthPerTxtX + (mv->getHor()>>2); //mv denotes the disparity for VSP 1596 } 1597 depthPosX = Clip3(0, widthDepth - (size_x<<1) - 1, depthPosX); 1598 1599 if ( heightChroma > heightDepth ) 1600 { 1601 nTxtPerDepthY = heightChroma / heightDepth; 1602 nDepthPerTxtY = 1; 1603 depthPosY = posY / nTxtPerDepthY + (mv->getVer()>>2); //mv denotes the disparity for VSP 1604 } 1605 else 1606 { 1607 nTxtPerDepthY = 1; 1608 nDepthPerTxtY = heightDepth / heightChroma; 1609 depthPosY = posY * nDepthPerTxtY + (mv->getVer()>>2); //mv denotes the disparity for VSP 1610 } 1611 depthPosY = Clip3(0, heightDepth - (size_y<<1) - 1, depthPosY); 1612 1613 Pel *refCb = refPic->getCbAddr() + posX + posY * refStride; 1614 Pel *refCr = refPic->getCrAddr() + posX + posY * refStride; 1615 Pel *dstCb = dstPic->getCbAddr(partAddr); 1616 Pel *dstCr = dstPic->getCrAddr(partAddr); 1617 Pel *depth = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride; // move the pointer to the current depth pixel position 1618 1619 Int refStrideBlock = refStride * nTxtPerDepthY; 1620 Int dstStrideBlock = dstStride * nTxtPerDepthY; 1621 Int depStrideBlock = depStride * nDepthPerTxtY; 1622 1623 if (isDepth) 1624 { 1625 // DT: Since the call for this function is redundant, .. 1626 for (Int y = 0; y < size_y; y++) 1627 { 1628 for (Int x = 0; x < size_x; x++) 1629 { 1630 dstCb[x] = 128; 1631 dstCr[x] = 128; 1632 } 1633 dstCb += dstStride; 1634 dstCr += dstStride; 1635 } 1636 return; 1637 } 1638 1639 if ( widthChroma > widthDepth ) // We assume 1640 { 1641 assert( heightChroma > heightDepth ); 1642 printf("This branch should never been reached.\n"); 1643 exit(0); 1644 } 1645 else 1646 { 1647 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1648 Int dW = size_x; 1649 Int dH = size_y; 1650 Int sW = 2; // search window size 1651 Int sH = 2; 1652 #endif 1653 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1654 Int dW = size_x; 1655 Int dH = size_y; 1656 Int sW = 2; // search window size 1657 Int sH = 2; 1658 #endif 1659 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1660 Int dW = size_x>>1; 1661 Int dH = size_y>>1; 1662 Int sW = 4; // search window size 1663 Int sH = 4; 1664 #endif 1665 1666 { 1667 Pel* depthi = depth; 1668 for (Int j = 0; j < dH; j++) 1669 { 1670 for (Int i = 0; i < dW; i++) 1671 { 1672 Pel* depthTmp; 1673 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1674 depthTmp = depthi + (i << 1); 1675 #endif 1676 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1677 if (depthPosX + (i<<1) < widthDepth) 1678 depthTmp = depthi + (i << 1); 1679 else 1680 depthTmp = depthi + (widthDepth - depthPosX - 1); 1681 #endif 1682 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1683 if (depthPosX + (i<<2) < widthDepth) 1684 depthTmp = depthi + (i << 2); 1685 else 1686 depthTmp = depthi + (widthDepth - depthPosX - 1); 1687 #endif 1688 Int maxV = 0; 1689 for (Int blockj = 0; blockj < sH; blockj++) 1690 { 1691 Int iX = 0; 1692 for (Int blocki = 0; blocki < sW; blocki++) 1693 { 1694 if (maxV < depthTmp[iX]) 1695 maxV = depthTmp[iX]; 1696 if (depthPosX + i*sW + blocki < widthDepth - 1) 1697 iX++; 1698 } 1699 if (depthPosY + j*sH + blockj < heightDepth - 1) 1700 depthTmp += depStride; 1701 } 1702 m_pDepth[i+j*dW] = maxV; 1703 } // end of i < dW 1704 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1705 if (depthPosY + ((j+1)<<1) < heightDepth) 1706 depthi += (depStride << 1); 1707 else 1708 depthi = depth + (heightDepth-1)*depStride; 1709 #endif 1710 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1711 if (depthPosY + ((j+1)<<1) < heightDepth) 1712 depthi += (depStride << 1); 1713 else 1714 depthi = depth + (heightDepth-depthPosY-1)*depStride; 1715 #endif 1716 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1717 if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1 1718 depthi += (depStride << 2); 1719 else 1720 depthi = depth + (heightDepth-depthPosY-1)*depStride; // the last line 1721 #endif 1722 } 1723 } 1724 1725 1726 // (size_x, size_y) is Chroma block size 1727 for ( Int yTxt = 0, yDepth = 0; yTxt < size_y; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY ) 1728 { 1729 for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX ) 1730 { 1731 Pel rep_depth = 0; // to store the depth value used for warping 1732 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1733 rep_depth = m_pDepth[(xTxt) + (yTxt)*dW]; 1734 #endif 1735 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1736 rep_depth = m_pDepth[(xTxt) + (yTxt)*dW]; 1737 #endif 1738 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1739 rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW]; 1740 #endif 1741 1742 // calculate the offset in the reference picture 1743 Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec; 1744 Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image 1745 Int xFrac = disparity & 0x7; 1746 Int absX = posX + refOffset; 1747 1748 if (xFrac == 0) 1749 absX = Clip3(0, widthChroma-1, absX); 1750 else 1751 absX = Clip3(4, widthChroma-5, absX); 1752 1753 refOffset = absX - posX; 1754 1755 assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 ); 1756 assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 ); 1757 m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true); 1758 m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true); 1759 } 1760 refCb += refStrideBlock; 1761 refCr += refStrideBlock; 1762 dstCb += dstStrideBlock; 1763 dstCr += dstStrideBlock; 1764 depth += depStrideBlock; 1765 } 1766 } 1767 } 1768 1769 #endif // MERL_VSP_C0152 1770 1121 1771 #if DEPTH_MAP_GENERATION 1122 1772 Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY ) … … 1704 2354 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 1705 2355 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 2356 #if FIX_LGE_ILLUCOMP_B0045 2357 iRefX = iCUPelX + (pMv->getHor() >> 2); 2358 iRefY = iCUPelY + (pMv->getVer() >> 2); 2359 #else 1706 2360 iRefX = iCUPelX + (pMv->getHor() >> 3); 1707 2361 iRefY = iCUPelY + (pMv->getVer() >> 3); 2362 #endif 1708 2363 uiWidth = pcCU->getWidth(0) >> 1; 1709 2364 uiHeight = pcCU->getHeight(0) >> 1; … … 1919 2574 UInt uiWedgeStride = pcWedgelet->getStride(); 1920 2575 2576 #if HS_REFERENCE_SUBSAMPLE_C0154 2577 Int subSamplePix; 2578 if ( pcWedgelet->getWidth() == 32 ) 2579 { 2580 subSamplePix = 2; 2581 } 2582 else 2583 { 2584 subSamplePix = 1; 2585 } 2586 #endif 2587 1921 2588 if( bAbove ) 1922 2589 { 2590 #if HS_REFERENCE_SUBSAMPLE_C0154 2591 for( Int k = 0; k < pcWedgelet->getWidth(); k+=subSamplePix ) 2592 #else 1923 2593 for( Int k = 0; k < pcWedgelet->getWidth(); k++ ) 2594 #endif 1924 2595 { 1925 2596 if( true == pabWedgePattern[k] ) … … 1937 2608 if( bLeft ) 1938 2609 { 2610 #if HS_REFERENCE_SUBSAMPLE_C0154 2611 for( Int k = 0; k < pcWedgelet->getHeight(); k+=subSamplePix ) 2612 #else 1939 2613 for( Int k = 0; k < pcWedgelet->getHeight(); k++ ) 2614 #endif 1940 2615 { 1941 2616 if( true == pabWedgePattern[k*uiWedgeStride] ) … … 2116 2791 } 2117 2792 2793 #if LGE_DMM3_SIMP_C0044 2794 /** 2795 - fetch best Wedgelet pattern at decoder 2796 */ 2797 UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt IntraTabIdx) 2798 { 2799 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); 2800 2801 UInt uiBestTabIdx = 0; 2802 TComPic* pcPicTex = pcCU->getSlice()->getTexturePic(); 2803 TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr()); 2804 UInt uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 2805 Int uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255; 2806 2807 std::vector< std::vector<UInt> > pauiWdgLstSz = g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]]; 2808 2809 if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ) 2810 { 2811 std::vector<UInt>* pauiWdgLst = &pauiWdgLstSz[uiColTexIntraDir-2]; 2812 uiBestTabIdx = pauiWdgLst->at(IntraTabIdx); 2813 } 2814 else 2815 { 2816 WedgeNodeList* pacWedgeNodeList = &g_aacWedgeNodeLists[(g_aucConvertToBit[uiWidth])]; 2817 uiBestTabIdx = pacWedgeNodeList->at(IntraTabIdx).getPatternIdx(); 2818 } 2819 2820 return uiBestTabIdx; 2821 } 2822 #endif 2823 2824 #if LGE_DMM3_SIMP_C0044 2825 /** 2826 - calculate best Wedgelet pattern at encoder 2827 */ 2828 UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Pel* piOrigi, UInt uiStride, UInt & ruiIntraTabIdx) 2829 #else 2118 2830 UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight ) 2831 #endif 2119 2832 { 2120 2833 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); … … 2144 2857 Int iDC2 = 0; 2145 2858 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 2146 2147 #if HHIQC_DMMFASTSEARCH_B0039 2859 #if LGE_DMM3_SIMP_C0044 2860 ruiIntraTabIdx = 0; 2861 #endif 2148 2862 TComPic* pcPicTex = pcCU->getSlice()->getTexturePic(); 2149 2863 TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr()); … … 2158 2872 { 2159 2873 UInt uiIdx = pauiWdgLst->at(uiIdxW); 2874 #if LGE_DMM3_SIMP_C0044 2875 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piOrigi, uiWidth, iDC1, iDC2 ); 2876 #else 2160 2877 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRefBlkY, uiWidth, iDC1, iDC2 ); 2878 #endif 2161 2879 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2162 2880 2881 #if LGE_DMM3_SIMP_C0044 2882 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piOrigi, uiStride, uiWidth, uiHeight, WedgeDist_SAD ); 2883 #else 2163 2884 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2885 #endif 2164 2886 2165 2887 if( uiActDist < uiBestDist || uiBestDist == MAX_UINT ) … … 2167 2889 uiBestDist = uiActDist; 2168 2890 uiBestTabIdx = uiIdx; 2891 #if LGE_DMM3_SIMP_C0044 2892 ruiIntraTabIdx = uiIdxW; 2893 #endif 2169 2894 } 2170 2895 } … … 2177 2902 for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ ) 2178 2903 { 2904 #if LGE_DMM3_SIMP_C0044 2905 calcWedgeDCs ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piOrigi, uiWidth, iDC1, iDC2 ); 2906 #else 2179 2907 calcWedgeDCs ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piRefBlkY, uiWidth, iDC1, iDC2 ); 2908 #endif 2180 2909 assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piPred, uiPredStride, iDC1, iDC2 ); 2181 2910 2911 #if LGE_DMM3_SIMP_C0044 2912 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piOrigi, uiStride, uiWidth, uiHeight, WedgeDist_SAD ); 2913 #else 2182 2914 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2915 #endif 2183 2916 2184 2917 if( uiActDist < uiBestNodeDist || uiBestNodeDist == MAX_UINT ) … … 2186 2919 uiBestNodeDist = uiActDist; 2187 2920 uiBestNodeId = uiNodeId; 2188 } 2189 } 2190 2921 #if LGE_DMM3_SIMP_C0044 2922 ruiIntraTabIdx = uiNodeId; 2923 #endif 2924 } 2925 } 2926 #if LGE_DMM3_SIMP_C0044 2927 uiBestTabIdx = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx(); 2928 #else 2191 2929 // refinement 2192 2930 uiBestDist = uiBestNodeDist; … … 2208 2946 } 2209 2947 } 2210 } 2211 #else 2212 for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ ) 2213 { 2214 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRefBlkY, uiWidth, iDC1, iDC2 ); 2215 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2216 2217 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2218 2219 if( uiActDist < uiBestDist || uiBestDist == MAX_UINT ) 2220 { 2221 uiBestDist = uiActDist; 2222 uiBestTabIdx = uiIdx; 2223 } 2224 } 2225 #endif 2948 #endif 2949 } 2226 2950 2227 2951 cPredYuv.destroy(); … … 2262 2986 { 2263 2987 // decoder: get and store wedge pattern in CU 2988 // decoder: get and store wedge pattern in CU 2989 #if LGE_DMM3_SIMP_C0044 2990 UInt uiIntraTabIdx = pcCU->getWedgePredTexIntraTabIdx ( uiAbsPartIdx ); 2991 uiTextureWedgeTabIdx = getBestWedgeFromTex( pcCU, uiAbsPartIdx, (UInt)iWidth, (UInt)iHeight, uiIntraTabIdx ); 2992 #else 2264 2993 uiTextureWedgeTabIdx = getBestWedgeFromTex( pcCU, uiAbsPartIdx, (UInt)iWidth, (UInt)iHeight ); 2994 #endif 2265 2995 2266 2996 UInt uiDepth = (pcCU->getDepth(0)) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1); … … 2277 3007 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2278 3008 3009 #if HHI_DMM_DELTADC_Q1_C0034 3010 #else 2279 3011 if( bDelta ) 2280 3012 { … … 2282 3014 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2283 3015 } 3016 #endif 2284 3017 2285 3018 // assign wedge pred DCs to prediction … … 2302 3035 getWedgePredDCs( pcContourWedge, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2303 3036 3037 #if HHI_DMM_DELTADC_Q1_C0034 3038 #else 2304 3039 if( bDelta ) 2305 3040 { … … 2307 3042 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2308 3043 } 3044 #endif 2309 3045 2310 3046 // assign wedge pred DCs to prediction … … 2315 3051 delete pcContourWedge; 2316 3052 } 2317 #endif 3053 #endif // HHI_DMM_PRED_TEX 2318 3054 2319 3055 #if HHI_DMM_WEDGE_INTRA … … 2483 3219 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2484 3220 3221 #if HHI_DMM_DELTADC_Q1_C0034 3222 #else 2485 3223 if( bDelta ) 2486 3224 { … … 2488 3226 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2489 3227 } 3228 #endif 2490 3229 2491 3230 // assign wedge pred DCs to prediction … … 2524 3263 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 2525 3264 3265 #if HHI_DMM_DELTADC_Q1_C0034 3266 #else 2526 3267 if( bDelta ) 2527 3268 { … … 2529 3270 xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 ); 2530 3271 } 3272 #endif 2531 3273 2532 3274 // assign wedge pred DCs to prediction … … 2613 3355 2614 3356 // 2nd step: derive wedge direction 2615 #if LOGI_INTRA_NAME_3MPM2616 3357 Int uiPreds[3] = {-1, -1, -1}; 2617 #else2618 Int uiPreds[2] = {-1, -1};2619 #endif2620 3358 Int iMode = -1; 2621 3359 Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 2622 3360 2623 3361 UInt uiDirMode = 0; 2624 #if LOGI_INTRA_NAME_3MPM2625 3362 if( iMode >= 0 ) { iPredNum = iMode; } 2626 3363 if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; } … … 2632 3369 Bool modeVer = !modeHor; 2633 3370 Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0; 2634 #else2635 if( iPredNum == 1 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[0]]; }2636 if( iPredNum == 2 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[1]]; }2637 2638 if( uiDirMode == 0 ) { return false; } // no DC2639 2640 Bool modeVer = (uiDirMode < 18);2641 Bool modeHor = !modeVer;2642 Int intraPredAngle = modeVer ? uiDirMode - 9 : modeHor ? uiDirMode - 25 : 0;2643 #endif2644 3371 Int absAng = abs(intraPredAngle); 2645 3372 Int signAng = intraPredAngle < 0 ? -1 : 1; … … 2960 3687 Int* ptrSrc = pcTComPattern->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); 2961 3688 Int sw = ( iWidth<<1 ) + 1; 2962 #if !LOGI_INTRA_NAME_3MPM2963 uiDirMode = g_aucAngIntraModeOrder[ uiDirMode ];2964 #endif2965 3689 xPredIntraAngDepth( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode ); 2966 3690 } -
trunk/source/Lib/TLibCommon/TComPrediction.h
r210 r296 78 78 UInt m_uiaShift[ 63 ]; // Table for multiplication to substitue of division operation 79 79 80 #if MERL_VSP_C0152 81 Int* m_pDepth; ///< Local variable, to store a depth block, just to prevent allocate memory every time 82 #endif 83 80 84 Void xPredIntraAng ( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter ); 81 85 Void xPredIntraPlanar ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height ); … … 83 87 // motion compensation functions 84 88 #if DEPTH_MAP_GENERATION 89 #if MERL_VSP_C0152 90 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false ); 91 #else 85 92 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false ); 93 #endif 94 #else 95 #if MERL_VSP_C0152 96 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false ); 86 97 #else 87 98 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false ); 88 99 #endif 89 90 #if DEPTH_MAP_GENERATION 100 #endif 101 102 #if DEPTH_MAP_GENERATION 103 #if MERL_VSP_C0152 104 Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ); 105 #else 91 106 Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ); 92 Void xPredInterPrdDepthMap ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset ); 107 #endif 108 Void xPredInterPrdDepthMap ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset 109 #if LGE_ILLUCOMP_DEPTH_C0046 110 , Bool bICFlag = false 111 #endif 112 ); 113 #else 114 #if MERL_VSP_C0152 115 Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx ); 93 116 #else 94 117 Void xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx ); 118 #endif 95 119 Void xPredInterPrdDepthMap ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset ); 120 #endif 121 #if MERL_VSP_C0152 122 Void xPredInterUniBWVSP ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi=false ); 123 Void xPredInterBiBWVSP ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ); 96 124 #endif 97 125 … … 108 136 #endif 109 137 Void xWeightedAverage ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); 110 138 139 #if MERL_VSP_C0152 140 Void xPredInterLumaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 141 , TComYuv *&dstPic ); 142 Void xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 143 , TComYuv *&dstPic ); 144 #endif 111 145 Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); 112 146 #if LGE_ILLUCOMP_B0045 … … 146 180 // inter 147 181 #if DEPTH_MAP_GENERATION 182 #if MERL_VSP_C0152 183 Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 ); 184 #else 148 185 Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 ); 186 #endif 187 #else 188 #if MERL_VSP_C0152 189 Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx,, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 ); 149 190 #else 150 191 Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 ); 151 192 #endif 152 193 #endif 194 195 #if MTK_MDIVRP_C0138 196 Void residualPrediction (TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred); 197 #endif 198 153 199 // motion vector prediction 154 200 Void getMvPredAMVP ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred ); … … 176 222 #if HHI_DMM_PRED_TEX 177 223 Void getBestContourFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge ); 224 #if LGE_DMM3_SIMP_C0044 225 UInt getBestWedgeFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Pel * piOrgi, UInt uiStride, UInt &ruiIntraTabIdx);//encoder 226 UInt getBestWedgeFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt IntraTabIdx);//decoder 227 #else 178 228 UInt getBestWedgeFromTex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight ); 229 #endif 179 230 Void copyTextureLumaBlock ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight ); 180 231 #endif -
trunk/source/Lib/TLibCommon/TComRdCost.cpp
r189 r296 181 181 } 182 182 183 #if H HI_INTER_VIEW_MOTION_PRED183 #if H3D_IVMP 184 184 Void 185 185 TComRdCost::setLambdaMVReg( Double dLambda ) -
trunk/source/Lib/TLibCommon/TComRdCost.h
r189 r296 203 203 #endif 204 204 Void setLambda ( Double dLambda ); 205 #if H HI_INTER_VIEW_MOTION_PRED205 #if H3D_IVMP 206 206 Void setLambdaMVReg ( Double dLambda ); 207 207 #endif -
trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp
r189 r296 44 44 45 45 46 #if H HI_INTER_VIEW_RESIDUAL_PRED46 #if H3D_IVRP 47 47 48 48 … … 184 184 AOF ( pcPic ); 185 185 186 #if MTK_MDIVRP_C0138 187 if (pcPic->getSPS()->getViewId() != 0) 188 { 189 return; 190 } 191 #endif 192 186 193 if( pcPic->getPOC() == 0 ) 187 194 { … … 219 226 } 220 227 221 #if QC_MULTI_DIS_CAN_A0097 228 #if H3D_NBDV 229 #if MTK_RELEASE_DV_CONSTRAINT_C0129 222 230 Bool 223 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp 224 #if QC_SIMPLIFIEDIVRP_M24938 225 , Bool bRecon 226 #endif 227 ) 231 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon ) 228 232 #else 229 233 Bool 230 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv 231 # if QC_SIMPLIFIEDIVRP_M24938232 , Bool bRecon 233 #endif 234 ) 235 #endif 234 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon ) 235 #endif 236 #else 237 Bool 238 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon ) 239 #endif //H3D_NBDV 236 240 { 237 241 AOF( pcCU ); … … 243 247 iBlkHeight = pcCU->getHeight ( 0 ); 244 248 pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos ); 245 #if QC_MULTI_DIS_CAN_A0097 246 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp 247 #if QC_SIMPLIFIEDIVRP_M24938 248 , bRecon 249 #endif 250 ); 251 #else 252 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv 253 #if QC_SIMPLIFIEDIVRP_M24938 254 , bRecon 255 #endif 256 ); 257 #endif 249 #if H3D_NBDV 250 #if MTK_RELEASE_DV_CONSTRAINT_C0129 251 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon); 252 #else 253 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon); 254 #endif 255 #else 256 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon); 257 #endif // H3D_NBDV 258 258 } 259 259 260 #if QC_MULTI_DIS_CAN_A0097 260 #if H3D_NBDV 261 #if MTK_RELEASE_DV_CONSTRAINT_C0129 261 262 Bool 262 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 263 #if QC_SIMPLIFIEDIVRP_M24938 264 , Bool bRecon 265 #endif 266 ) 263 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) 267 264 #else 268 265 Bool 269 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 270 #if QC_SIMPLIFIEDIVRP_M24938 271 , Bool bRecon 272 #endif 273 ) 274 #endif 275 { 266 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, Bool bRecon) 267 #endif 268 #else 269 Bool 270 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon) 271 #endif 272 { 273 #if MTK_C0138_FIXED 274 UInt uiBaseViewId = 0; 275 #else 276 276 UInt uiBaseViewId = m_pcDepthMapGenerator->getBaseViewId( 0 ); 277 277 #endif 278 278 if( !pcYuv ) 279 279 { 280 280 pcYuv = m_ppcYuvTmp[1]; 281 281 } 282 #if QC_SIMPLIFIEDIVRP_M24938283 282 UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos; 284 #endif 285 #if QC_MULTI_DIS_CAN_A0097 286 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp 287 #if QC_SIMPLIFIEDIVRP_M24938 288 , &uiXPosInRefView , &uiYPosInRefView , bRecon 289 #endif 290 ); 291 #else 292 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv 293 #if QC_SIMPLIFIEDIVRP_M24938 294 , &uiXPosInRefView , &uiYPosInRefView , bRecon 295 #endif 296 ); 297 #endif 298 #if QC_SIMPLIFIEDIVRP_M24938 283 #if H3D_NBDV 284 #if MTK_RELEASE_DV_CONSTRAINT_C0129 285 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon ); 286 #else 287 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon ); 288 #endif 289 #else 290 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon ); 291 #endif 292 #if MTK_MDIVRP_C0138 293 return true; 294 #else 299 295 return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight ); 300 #else 301 return xIsNonZero( pcYuv, uiBlkWidth, uiBlkHeight ); 302 #endif 303 } 304 305 #if QC_SIMPLIFIEDIVRP_M24938 296 #endif 297 } 298 306 299 Bool TComResidualGenerator::xIsNonZeroByCBF( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight ) 307 300 { … … 329 322 return( false ); 330 323 } 331 #endif332 324 333 325 … … 419 411 Pel* pRes = pcCUResidual->getLumaAddr(); 420 412 UInt uiLumaTrMode, uiChromaTrMode; 421 #if LG_RESTRICTEDRESPRED_M24766 413 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 422 414 Int iPUPredResiShift[4]; 423 415 #endif 424 416 pcCU->convertTransIdx ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode ); 425 #if H0736_AVC_STYLE_QP_RANGE426 417 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 427 #else428 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );429 #endif430 418 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); 431 419 // chroma Cb … … 434 422 piCoeff = pcCU->getCoeffCb(); 435 423 pRes = pcCUResidual->getCbAddr(); 436 #if H0736_AVC_STYLE_QP_RANGE437 424 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); 438 #else439 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC() );440 #endif441 425 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); 442 426 // chroma Cr … … 445 429 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); 446 430 431 #if !MTK_MDIVRP_C0138 447 432 if( pcCU->getResPredFlag( 0 ) ) 448 433 { 449 434 AOF( pcCU->getResPredAvail( 0 ) ); 450 Bool bOK = pcCU->getResidualSamples( 0, 451 #if QC_SIMPLIFIEDIVRP_M24938 452 true, 453 #endif 454 m_ppcYuvTmp[0] ); 435 Bool bOK = pcCU->getResidualSamples( 0, true, m_ppcYuvTmp[0] ); 455 436 AOF( bOK ); 456 437 #if LG_RESTRICTEDRESPRED_M24766 … … 461 442 #endif 462 443 } 444 #endif 463 445 464 446 //===== clear inter-view predicted parts ===== … … 517 499 518 500 519 #if QC_MULTI_DIS_CAN_A0097 501 #if H3D_NBDV 502 #if MTK_RELEASE_DV_CONSTRAINT_C0129 503 Void 504 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp 505 ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ) 506 #else // MTK_RELEASE_DV_CONSTRAINT_C0129 520 507 Void 521 508 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 522 #if QC_SIMPLIFIEDIVRP_M24938 523 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon 524 #endif 525 ) 526 #else 509 ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon) 510 #endif // MTK_RELEASE_DV_CONSTRAINT_C0129 511 #else // H3D_NBDV 527 512 Void 528 513 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 529 #if QC_SIMPLIFIEDIVRP_M24938 530 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon 531 #endif 532 ) 533 #endif 514 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ) 515 #endif // H3D_NBDV 534 516 { 535 517 //===== set and check some basic variables ===== … … 548 530 549 531 //===== get disparity ===== 550 #if QC_MULTI_DIS_CAN_A0097 532 #if H3D_NBDV 533 #if MTK_RELEASE_DV_CONSTRAINT_C0129 534 Int iDisparity_y = iDisp.getVer(); 535 Int iDisparity = iDisp.getHor(); 536 #else 551 537 Int iDisparity = iDisp; 552 #else 538 #endif 539 #else //H3D_NBDV 553 540 Int iMidPosX = Int( uiXPos + ( ( uiBlkWidth - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX(); 554 541 Int iMidPosY = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY(); 555 542 Int iDisparity = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId ); 556 #endif 543 #endif //H3D_NBDV 557 544 //===== compensate luma ===== 558 545 Int iYWidth = Int( uiBlkWidth ); … … 562 549 Int iYRefPosX0 = Int( uiXPos ) + ( iDisparity >> 2 ); 563 550 Int iYRefPosX1 = iYRefPosX0 + 1; 551 #if MTK_RELEASE_DV_CONSTRAINT_C0129 552 Int iYMaxPosY = Int( uiPicHeight ) - 1; 553 Int iYWeight3 = ( iDisparity_y & 3 ); 554 Int iYWeight2 = 4 - iYWeight3; 555 Int iYRefPosY0 = Max( 0, Min( iYMaxPosY, Int( uiYPos ) + ( iDisparity_y >> 2 )) ); 556 Int iYRefPosY1 = Max( 0, Min( iYMaxPosY, iYRefPosY0 + 1 )); 557 #endif 564 558 Int iYMaxPosX = Int( uiPicWidth ) - 1; 565 559 Int iSrcStrideY = pcBaseRes->getStride (); 566 560 Int iDesStrideY = pcYuv ->getStride (); 561 #if MTK_RELEASE_DV_CONSTRAINT_C0129 562 Pel* pSrcSamplesY0= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY0 * iSrcStrideY; 563 Pel* pSrcSamplesY1= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY1 * iSrcStrideY; 564 #else 567 565 Pel* pSrcSamplesY= pcBaseRes->getLumaAddr ( 0 ) + uiYPos * iSrcStrideY; 566 #endif 568 567 Pel* pDesSamplesY= pcYuv ->getLumaAddr (); 569 568 570 #if QC_SIMPLIFIEDIVRP_M24938 569 571 570 if( puiXPosInRefView != NULL ) 572 571 *puiXPosInRefView = Max( 0, Min( iYMaxPosX, iYRefPosX0 ) ); … … 575 574 if( bRecon == false ) 576 575 return; 577 #endif 578 576 577 #if MTK_RELEASE_DV_CONSTRAINT_C0129 578 for( Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY ) 579 #else 579 580 for( Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY += iSrcStrideY, pDesSamplesY += iDesStrideY ) 581 #endif 580 582 { 581 583 for( Int iX = 0; iX < iYWidth; iX++ ) … … 583 585 Int iXPic0 = Max( 0, Min( iYMaxPosX, iYRefPosX0 + iX ) ); 584 586 Int iXPic1 = Max( 0, Min( iYMaxPosX, iYRefPosX1 + iX ) ); 587 #if MTK_RELEASE_DV_CONSTRAINT_C0129 588 Pel Temp1,Temp2; 589 Temp1 =( iYWeight0 * pSrcSamplesY0[iXPic0] + iYWeight1 * pSrcSamplesY0[iXPic1] + 2 ) >> 2; 590 Temp2 =( iYWeight0 * pSrcSamplesY1[iXPic0] + iYWeight1 * pSrcSamplesY1[iXPic1] + 2 ) >> 2; 591 pDesSamplesY[iX] = ( iYWeight2 * Temp1 + iYWeight3 * Temp2 + 2 ) >> 2; 592 #else 585 593 pDesSamplesY[iX] = ( iYWeight0 * pSrcSamplesY[iXPic0] + iYWeight1 * pSrcSamplesY[iXPic1] + 2 ) >> 2; 594 #endif 586 595 } 587 596 } … … 594 603 Int iCRefPosX0 = Int( uiXPos >> 1 ) + ( iDisparity >> 3 ); 595 604 Int iCRefPosX1 = iCRefPosX0 + 1; 605 #if MTK_RELEASE_DV_CONSTRAINT_C0129 606 Int iCMaxPosY = Int( uiPicHeight >> 1 ) - 1; 607 Int iCWeight3 = ( iDisparity_y & 7 ); 608 Int iCWeight2 = 8 - iCWeight3; 609 Int iCRefPosY0 = Max( 0, Min( iCMaxPosY, Int( uiYPos >> 1 ) + ( iDisparity_y >> 3 )) ); 610 Int iCRefPosY1 = Max( 0, Min( iCMaxPosY, iCRefPosY0 + 1 )); 611 #endif 596 612 Int iCMaxPosX = Int( uiPicWidth >> 1 ) - 1; 597 613 Int iSrcStrideC = pcBaseRes->getCStride(); 598 614 Int iDesStrideC = pcYuv ->getCStride(); 615 #if MTK_RELEASE_DV_CONSTRAINT_C0129 616 Pel* pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC; 617 Pel* pSrcSamplesU1= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC; 618 Pel* pSrcSamplesV0= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC; 619 Pel* pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC; 620 #else 599 621 Pel* pSrcSamplesU= pcBaseRes->getCbAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC; 600 622 Pel* pSrcSamplesV= pcBaseRes->getCrAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC; 623 #endif 601 624 Pel* pDesSamplesU= pcYuv ->getCbAddr (); 602 625 Pel* pDesSamplesV= pcYuv ->getCrAddr (); 626 #if MTK_RELEASE_DV_CONSTRAINT_C0129 627 for( Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU0 += iSrcStrideC, pSrcSamplesU1 += iSrcStrideC, pDesSamplesU += iDesStrideC, 628 pSrcSamplesV0 += iSrcStrideC, pSrcSamplesV1 += iSrcStrideC, pDesSamplesV += iDesStrideC ) 629 #else 603 630 for( Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU += iSrcStrideC, pDesSamplesU += iDesStrideC, 604 631 pSrcSamplesV += iSrcStrideC, pDesSamplesV += iDesStrideC ) 632 #endif 605 633 { 606 634 for( Int iX = 0; iX < iCWidth; iX++ ) … … 608 636 Int iXPic0 = Max( 0, Min( iCMaxPosX, iCRefPosX0 + iX ) ); 609 637 Int iXPic1 = Max( 0, Min( iCMaxPosX, iCRefPosX1 + iX ) ); 638 #if MTK_RELEASE_DV_CONSTRAINT_C0129 639 Pel Temp1,Temp2; 640 Temp1 =( iCWeight0 * pSrcSamplesU0[iXPic0] + iCWeight1 * pSrcSamplesU0[iXPic1] + 4 ) >> 3; 641 Temp2 =( iCWeight0 * pSrcSamplesU1[iXPic0] + iCWeight1 * pSrcSamplesU1[iXPic1] + 4 ) >> 3; 642 pDesSamplesU[iX] = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3; 643 Temp1 =( iCWeight0 * pSrcSamplesV0[iXPic0] + iCWeight1 * pSrcSamplesV0[iXPic1] + 4 ) >> 3; 644 Temp2 =( iCWeight0 * pSrcSamplesV1[iXPic0] + iCWeight1 * pSrcSamplesV1[iXPic1] + 4 ) >> 3; 645 pDesSamplesV[iX] = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3; 646 #else 610 647 pDesSamplesU[iX] = ( iCWeight0 * pSrcSamplesU[iXPic0] + iCWeight1 * pSrcSamplesU[iXPic1] + 4 ) >> 3; 611 648 pDesSamplesV[iX] = ( iCWeight0 * pSrcSamplesV[iXPic0] + iCWeight1 * pSrcSamplesV[iXPic1] + 4 ) >> 3; 649 #endif 612 650 } 613 651 } … … 705 743 706 744 707 #endif // H HI_INTER_VIEW_RESIDUAL_PRED708 745 #endif // H3D_IVRP 746 -
trunk/source/Lib/TLibCommon/TComResidualGenerator.h
r189 r296 50 50 51 51 52 #if H HI_INTER_VIEW_RESIDUAL_PRED52 #if H3D_IVRP 53 53 54 54 class TComResidualGenerator … … 69 69 Void setRecResidualPic ( TComPic* pcPic ); 70 70 71 #if QC_MULTI_DIS_CAN_A0097 72 Bool getResidualSamples ( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp 73 #if QC_SIMPLIFIEDIVRP_M24938 74 , Bool bRecon 71 #if H3D_NBDV 72 #if MTK_RELEASE_DV_CONSTRAINT_C0129 73 Bool getResidualSamples ( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp_x, Bool bRecon ); 74 Bool getResidualSamples ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , TComMv iDisp_x, Bool bRecon ); 75 #else 76 Bool getResidualSamples ( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon ); 77 Bool getResidualSamples ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp, Bool bRecon ); 75 78 #endif 76 ); 77 Bool getResidualSamples ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp 78 #if QC_SIMPLIFIEDIVRP_M24938 79 , Bool bRecon 80 #endif 81 ); 82 #else 83 Bool getResidualSamples ( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv 84 #if QC_SIMPLIFIEDIVRP_M24938 85 , Bool bRecon 86 #endif 87 ); 88 Bool getResidualSamples ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 89 #if QC_SIMPLIFIEDIVRP_M24938 90 , Bool bRecon 91 #endif 92 ); 93 #endif 79 #else // H3D_NBDV 80 Bool getResidualSamples ( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon ); 81 Bool getResidualSamples ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon ); 82 #endif // H3D_NBDV 94 83 95 84 private: … … 100 89 Void xClearIntViewResidual ( TComDataCU* pcCU, TComYuv* pcCUResidual, UInt uiPartIdx ); 101 90 Void xClearResidual ( TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight ); 102 #if QC_MULTI_DIS_CAN_A0097 103 Void xSetPredResidualBlock ( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 104 #if QC_SIMPLIFIEDIVRP_M24938 105 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon 91 #if H3D_NBDV 92 #if MTK_RELEASE_DV_CONSTRAINT_C0129 93 Void xSetPredResidualBlock ( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ); 94 #else 95 Void xSetPredResidualBlock ( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ); 106 96 #endif 107 );108 97 #else 109 Void xSetPredResidualBlock ( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 110 #if QC_SIMPLIFIEDIVRP_M24938 111 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon 112 #endif 113 ); 98 Void xSetPredResidualBlock ( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ); 114 99 #endif 115 100 Bool xIsNonZero ( TComYuv* pcYuv, UInt uiBlkWidth, UInt uiBlkHeight ); 116 #if QC_SIMPLIFIEDIVRP_M24938117 101 Bool xIsNonZeroByCBF ( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight ); 118 #endif119 120 102 Void xDumpResidual ( TComPic* pcPic, char* pFilenameBase ); 121 122 103 private: 123 104 // general parameters … … 140 121 #endif // __TCOM_RESIDUAL_GENERATOR__ 141 122 142 #endif // H HI_INTER_VIEW_RESIDUAL_PRED123 #endif // H3D_IVRP 143 124 144 125 -
trunk/source/Lib/TLibCommon/TComRom.cpp
r189 r296 174 174 g_aacWedgeRefLists.clear(); 175 175 } 176 #if HHIQC_DMMFASTSEARCH_B0039 176 177 177 if ( !g_aacWedgeNodeLists.empty() ) 178 178 { … … 183 183 g_aacWedgeNodeLists.clear(); 184 184 } 185 #endif 185 186 186 #endif 187 187 } … … 306 306 307 307 #if RWTH_SDC_DLT_B0036 308 #if SAIT_SDC_C0096 309 UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, PLANAR_IDX }; 310 #else 308 311 UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, DMM_WEDGE_PREDDIR_IDX, PLANAR_IDX }; 312 #endif 309 313 #endif 310 314 … … 413 417 }; 414 418 415 #if !LOGI_INTRA_NAME_3MPM416 // Mapping each Unified Directional Intra prediction direction to DCT/DST transform417 // 0 implies use DCT, 1 implies DST418 419 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX420 const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE+NUM_DMM_MODE] =421 #else422 const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE] =423 #endif424 { //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 35425 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0426 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX427 , 0, 0, 0, 0, 0, 0, 0, 0428 #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX429 , 0, 0, 0, 0430 #endif431 };432 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX433 const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE+NUM_DMM_MODE] =434 #else435 const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE] =436 #endif437 { //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 35438 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0439 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX440 , 0, 0, 0, 0, 0, 0, 0, 0441 #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX442 , 0, 0, 0, 0443 #endif444 };445 #endif446 419 447 420 … … 478 451 const UChar g_aucConvertTxtTypeToIdx[4] = { 0, 1, 1, 2 }; 479 452 480 #if !LOGI_INTRA_NAME_3MPM481 // ====================================================================================================================482 // Angular Intra prediction483 // ====================================================================================================================484 485 // g_aucAngIntraModeOrder486 // Indexing this array with the mode indicated in the bitstream487 // gives a logical index used in the prediction functions.488 const UChar g_aucAngIntraModeOrder[NUM_INTRA_MODE] =489 { // ModeOrder LogicalOrderInPredFunctions490 34, // PLANAR_IDX PLANAR PLANAR491 9, // 0 VER DC492 25, // 1 HOR VER-8 (diagonal from top-left to bottom-right = HOR-8)493 0, // 2 DC VER-7494 1, // 4 VER-8 VER-6495 5, // 5 VER-4 VER-5496 13, // 6 VER+4 VER-4497 17, // 7 VER+8 VER-3498 21, // 8 HOR-4 VER-2499 29, // 9 HOR+4 VER-1500 33, // 10 HOR+8 VER501 3, // 11 VER-6 VER+1502 7, // 12 VER-2 VER+2503 11, // 13 VER+2 VER+3504 15, // 14 VER+6 VER+4505 19, // 15 HOR-6 VER+5506 23, // 16 HOR-2 VER+6507 27, // 17 HOR+2 VER+7508 31, // 18 HOR+6 VER+8509 2, // 19 VER-7 HOR-7510 4, // 20 VER-5 HOR-6511 6, // 21 VER-3 HOR-5512 8, // 22 VER-1 HOR-4513 10, // 23 VER+1 HOR-3514 12, // 24 VER+3 HOR-2515 14, // 25 VER+5 HOR-1516 16, // 26 VER+7 HOR517 18, // 27 HOR-7 HOR+1518 20, // 28 HOR-5 HOR+2519 22, // 29 HOR-3 HOR+3520 24, // 30 HOR-1 HOR+4521 26, // 31 HOR+1 HOR+5522 28, // 32 HOR+3 HOR+6523 30, // 33 HOR+5 HOR+7524 32, // 34 HOR+7 HOR+8525 0, // LM_CHROMA_IDX526 };527 528 const UChar g_aucIntraModeNumAng[7] =529 {530 4, // 2x2531 18, // 4x4532 35, // 8x8533 35, // 16x16534 35, // 32x32535 35, // 64x64536 6 // 128x128537 };538 539 const UChar g_aucIntraModeBitsAng[7] =540 {541 2, // 2x2 3 1+1542 5, // 4x4 17 4+1543 6, // 8x8 34 5+esc544 6, // 16x16 34 5+esc545 6, // 32x32 34 5+esc546 6, // 64x64 34 5+esc547 3 // 128x128 5 2+1548 };549 #endif550 453 551 454 // ==================================================================================================================== … … 587 490 }; 588 491 492 #if LGE_DMM3_SIMP_C0044 493 const UChar g_aucWedgeTexPredBitsListIdx[7] = 494 { 495 0, // 2x2 496 6, // 4x4 497 9, // 8x8 498 9, // 16x16 499 9, // 32x32 500 0, // 64x64 501 0 // 128x128 502 }; 503 #endif 504 589 505 const UChar g_aucIntraSizeIdxToWedgeSize[7] = 590 506 { … … 630 546 }; 631 547 632 #if MULTILEVEL_SIGMAP_EXT633 548 const UInt g_sigLastScan8x8[ 4 ][ 4 ] = 634 549 { … … 639 554 }; 640 555 UInt g_sigLastScanCG32x32[ 64 ]; 641 #endif642 556 643 557 UInt* g_auiNonSquareSigLastScan[ 4 ]; … … 645 559 const UInt g_uiMinInGroup[ 10 ] = {0,1,2,3,4,6,8,12,16,24}; 646 560 const UInt g_uiGroupIdx[ 32 ] = {0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9}; 647 #if LAST_CTX_REDUCTION648 561 const UInt g_uiLastCtx[ 28 ] = 649 562 { … … 653 566 10, 11, 12, 12, 13, 13, 14, 14, 2, 2 // 32x32 10 654 567 }; 655 #else656 const UInt g_uiLastCtx[ 28 ] =657 {658 0, 1, 2, 2, // 4x4 4659 3, 4, 5, 5, 6, 6, // 8x8 6660 7, 8, 9, 9, 10, 10, 11, 11, // 16x16 8661 12, 13, 14, 14, 15, 15, 16, 16, 17, 17 // 32x32 10662 };663 #endif664 568 665 569 // Rice parameters for absolute transform levels 666 #if EIGHT_BITS_RICE_CODE667 570 const UInt g_auiGoRiceRange[5] = 668 571 { … … 674 577 8, 7, 6, 5, 4 675 578 }; 676 #else 677 const UInt g_auiGoRiceRange[4] = 678 { 679 7, 20, 42, 70 680 }; 681 682 const UInt g_auiGoRicePrefixLen[4] = 683 { 684 8, 10, 10, 8 685 }; 686 #endif 687 688 #if EIGHT_BITS_RICE_CODE 579 689 580 const UInt g_aauiGoRiceUpdate[5][24] = 690 581 { 691 #if RESTRICT_GR1GR2FLAG_NUMBER692 582 { 693 583 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 … … 705 595 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 706 596 } 707 #else 708 { 709 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 710 }, 711 { 712 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 713 }, 714 { 715 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 716 }, 717 { 718 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 719 }, 720 { 721 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 722 } 723 #endif 724 }; 725 #else 726 const UInt g_aauiGoRiceUpdate[4][16] = 727 { 728 #if RESTRICT_GR1GR2FLAG_NUMBER 729 { 730 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 731 }, 732 { 733 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 734 }, 735 { 736 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 737 }, 738 { 739 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 740 } 741 #else 742 { 743 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 744 }, 745 { 746 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 747 }, 748 { 749 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 750 }, 751 { 752 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 753 } 754 #endif 755 }; 756 #endif 597 }; 757 598 758 599 // initialize g_auiFrameScanXY … … 808 649 if( iWidth < 16 ) 809 650 { 810 #if MULTILEVEL_SIGMAP_EXT811 651 UInt* pBuffTemp = pBuffD; 812 652 if( iWidth == 8 ) … … 814 654 pBuffTemp = g_sigLastScanCG32x32; 815 655 } 816 #endif817 656 for( UInt uiScanLine = 0; uiNextScanPos < uiNumScanPos; uiScanLine++ ) 818 657 { … … 826 665 while( iPrimDim >= 0 && iScndDim < iWidth ) 827 666 { 828 #if MULTILEVEL_SIGMAP_EXT829 667 pBuffTemp[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ; 830 #else831 pBuffD[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ;832 #endif833 668 uiNextScanPos++; 834 669 iScndDim++; … … 837 672 } 838 673 } 839 #if MULTILEVEL_SIGMAP_EXT840 674 if( iWidth > 4 ) 841 #else842 else843 #endif844 675 { 845 676 UInt uiNumBlkSide = iWidth >> 2; … … 851 682 uiNextScanPos = 0; 852 683 UInt initBlkPos = g_auiSigLastScan[ SCAN_DIAG ][ log2Blk ][ uiBlk ]; 853 #if MULTILEVEL_SIGMAP_EXT854 684 if( iWidth == 32 ) 855 685 { 856 686 initBlkPos = g_sigLastScanCG32x32[ uiBlk ]; 857 687 } 858 #endif859 688 UInt offsetY = initBlkPos / uiNumBlkSide; 860 689 UInt offsetX = initBlkPos - offsetY * uiNumBlkSide; … … 983 812 } 984 813 985 #if SCALING_LIST986 814 Int g_quantIntraDefault4x4[16] = 987 815 { … … 1022 850 24,25,28,33,41,54,71,91 1023 851 }; 1024 #else1025 Int g_quantIntraDefault4x4[16] =1026 {1027 6,13,20,28,1028 13,20,28,32,1029 20,28,32,37,1030 28,32,37,421031 };1032 Int g_quantInterDefault4x4[16] =1033 {1034 10,14,20,24,1035 14,20,24,27,1036 20,24,27,30,1037 24,27,30,341038 };1039 1040 Int g_quantIntraDefault8x8[64] =1041 {1042 6,10,13,16,18,23,25,27,1043 10,11,16,18,23,25,27,29,1044 13,16,18,23,25,27,29,31,1045 16,18,23,25,27,29,31,33,1046 18,23,25,27,29,31,33,36,1047 23,25,27,29,31,33,36,38,1048 25,27,29,31,33,36,38,40,1049 27,29,31,33,36,38,40,421050 };1051 1052 Int g_quantInterDefault8x8[64] =1053 {1054 9,13,15,17,19,21,22,24,1055 13,13,17,19,21,22,24,25,1056 15,17,19,21,22,24,25,27,1057 17,19,21,22,24,25,27,28,1058 19,21,22,24,25,27,28,30,1059 21,22,24,25,27,28,30,32,1060 22,24,25,27,28,30,32,33,1061 24,25,27,28,30,32,33,351062 };1063 1064 Int g_quantIntraDefault16x16[256] =1065 {1066 16,16,16,16,16,16,16,16,17,17,18,19,21,22,24,27,1067 16,16,16,16,16,16,16,16,17,18,18,20,21,23,25,27,1068 16,16,16,16,16,16,16,17,17,18,19,20,22,23,25,28,1069 16,16,16,16,16,16,17,17,18,19,20,21,23,25,27,29,1070 16,16,16,16,17,17,18,19,20,21,22,23,25,27,29,31,1071 16,16,16,16,17,18,19,20,22,23,24,26,27,29,32,34,1072 16,16,16,17,18,19,21,23,24,25,27,29,31,33,36,39,1073 16,16,17,17,19,20,23,25,27,29,31,33,35,38,41,44,1074 17,17,17,18,20,22,24,27,30,32,35,38,41,44,47,51,1075 17,18,18,19,21,23,25,29,32,36,40,43,47,51,55,60,1076 18,18,19,20,22,24,27,31,35,40,44,49,54,59,65,70,1077 19,20,20,21,23,26,29,33,38,43,49,56,62,69,75,82,1078 21,21,22,23,25,27,31,35,41,47,54,62,70,79,88,97,1079 22,23,23,25,27,29,33,38,44,51,59,69,79,90,101,113,1080 24,25,25,27,29,32,36,41,47,55,65,75,88,101,115,130,1081 27,27,28,29,31,34,39,44,51,60,70,82,97,113,130,1491082 };1083 1084 Int g_quantInterDefault16x16[256] =1085 {1086 16,16,16,16,16,16,16,16,17,17,18,19,20,21,22,27,1087 16,16,16,16,16,16,16,17,17,18,19,20,21,22,27,27,1088 16,16,16,16,16,16,17,17,18,19,20,21,22,27,27,28,1089 16,16,16,16,16,17,17,18,19,20,21,22,27,27,28,29,1090 16,16,16,16,17,17,18,19,20,21,22,27,27,28,29,30,1091 16,16,16,17,17,18,19,20,21,22,27,27,28,29,30,32,1092 16,16,17,17,18,19,20,21,22,27,27,28,29,30,32,36,1093 16,17,17,18,19,20,21,22,27,27,28,29,30,32,36,40,1094 17,17,18,19,20,21,22,27,27,28,29,30,32,36,40,45,1095 17,18,19,20,21,22,27,27,28,29,30,32,36,40,45,52,1096 18,19,20,21,22,27,27,28,29,30,32,36,40,45,52,59,1097 19,20,21,22,27,27,28,29,30,32,36,40,45,52,59,68,1098 20,21,22,27,27,28,29,30,32,36,40,45,52,59,68,79,1099 21,22,27,27,28,29,30,32,36,40,45,52,59,68,79,91,1100 22,27,27,28,29,30,32,36,40,45,52,59,68,79,91,103,1101 27,27,28,29,30,32,36,40,45,52,59,68,79,91,103,1171102 };1103 1104 Int g_quantIntraDefault32x32[1024] =1105 {1106 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,27,28,1107 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,23,23,24,25,27,28,1108 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,20,20,21,22,23,24,25,26,27,28,1109 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,21,22,23,24,25,26,27,28,1110 16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,20,21,22,23,23,24,25,26,28,29,1111 16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,19,20,21,21,22,23,24,25,26,27,28,30,1112 16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,18,18,19,19,20,20,21,21,22,23,24,25,26,27,28,29,30,1113 16,16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,19,19,20,20,21,21,22,23,24,25,26,27,28,29,30,31,1114 16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,19,20,20,21,21,22,22,23,24,25,26,27,28,29,30,31,33,1115 16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,20,20,21,22,22,23,23,24,25,26,27,28,29,30,31,33,34,1116 16,16,16,16,16,16,16,17,17,18,18,19,19,20,20,21,22,22,23,23,24,25,26,26,27,28,29,30,32,33,34,36,1117 16,16,16,16,16,16,17,17,18,18,19,20,20,21,21,22,23,23,24,25,25,26,27,28,29,30,31,32,33,35,36,38,1118 16,16,16,16,16,16,17,17,18,19,19,20,21,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,36,37,39,40,1119 16,16,16,16,16,17,17,18,18,19,20,21,22,23,24,24,25,26,27,28,29,30,31,32,33,34,35,37,38,39,41,43,1120 16,16,16,16,17,17,17,18,19,20,20,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,41,42,44,46,1121 16,16,17,17,17,17,18,18,19,20,21,22,23,24,26,27,28,29,31,32,33,34,35,37,38,39,41,42,44,45,47,49,1122 17,17,17,17,17,18,18,19,20,20,22,23,24,25,27,28,30,31,32,34,35,36,38,39,41,42,44,45,47,49,51,53,1123 17,17,17,17,18,18,19,19,20,21,22,23,25,26,28,29,31,33,34,36,37,39,41,42,44,45,47,49,51,53,55,57,1124 17,17,18,18,18,18,19,20,21,22,23,24,25,27,29,31,32,34,36,38,40,42,43,45,47,49,51,53,55,57,60,62,1125 18,18,18,18,19,19,20,20,21,22,23,25,26,28,30,32,34,36,38,40,42,44,46,48,51,53,55,57,60,62,65,67,1126 18,18,18,19,19,19,20,21,22,23,24,25,27,29,31,33,35,37,40,42,44,47,49,52,54,57,59,62,65,67,70,73,1127 19,19,19,19,20,20,21,21,22,23,25,26,28,30,32,34,36,39,42,44,47,50,52,55,58,61,64,67,70,73,76,79,1128 19,19,20,20,20,21,21,22,23,24,26,27,29,31,33,35,38,41,43,46,49,52,56,59,62,65,69,72,75,79,82,86,1129 20,20,20,21,21,21,22,23,24,25,26,28,30,32,34,37,39,42,45,48,52,55,59,62,66,70,74,77,81,85,89,93,1130 21,21,21,21,22,22,23,24,25,26,27,29,31,33,35,38,41,44,47,51,54,58,62,66,70,74,79,83,88,92,97,101,1131 22,22,22,22,23,23,24,25,26,27,28,30,32,34,36,39,42,45,49,53,57,61,65,70,74,79,84,89,94,99,104,110,1132 22,23,23,23,23,24,25,26,27,28,29,31,33,35,38,41,44,47,51,55,59,64,69,74,79,84,90,95,101,107,113,119,1133 23,23,24,24,24,25,26,27,28,29,30,32,34,37,39,42,45,49,53,57,62,67,72,77,83,89,95,101,108,114,121,128,1134 24,24,25,25,25,26,27,28,29,30,32,33,36,38,41,44,47,51,55,60,65,70,75,81,88,94,101,108,115,122,130,138,1135 25,25,26,26,26,27,28,29,30,31,33,35,37,39,42,45,49,53,57,62,67,73,79,85,92,99,107,114,122,131,139,148,1136 27,27,27,27,28,28,29,30,31,33,34,36,39,41,44,47,51,55,60,65,70,76,82,89,97,104,113,121,130,139,149,159,1137 28,28,28,28,29,30,30,31,33,34,36,38,40,43,46,49,53,57,62,67,73,79,86,93,101,110,119,128,138,148,159,1701138 };1139 1140 Int g_quantInterDefault32x32[1024] =1141 {1142 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,1143 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,1144 16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,1145 16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,1146 16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,1147 16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,1148 16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,1149 16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,1150 16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,1151 16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,1152 16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,1153 16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,1154 16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,1155 16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,1156 16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,1157 16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,1158 17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,1159 17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,1160 17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,1161 18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,1162 18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,1163 19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,1164 19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,1165 20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,1166 21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,1167 22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,1168 22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,1169 23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,1170 24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,1171 25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,1172 26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,123,1173 28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,123,1311174 };1175 #endif1176 852 UInt g_scalingListSize [4] = {16,64,256,1024}; 1177 853 UInt g_scalingListSizeX [4] = { 4, 8, 16, 32}; … … 1183 859 std::vector< std::vector<TComWedgeRef> > g_aacWedgeRefLists; 1184 860 1185 #if HHIQC_DMMFASTSEARCH_B00391186 861 std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 1187 862 std::vector< std::vector< TComWedgeNode> > g_aacWedgeNodeLists; 1188 #endif1189 863 1190 864 Void initWedgeLists() … … 1199 873 g_aacWedgeRefLists.push_back( acWedgeRefList ); 1200 874 1201 #if HHIQC_DMMFASTSEARCH_B00391202 875 // create WedgeNodeList 1203 876 std::vector<TComWedgeNode> acWedgeNodeList; … … 1260 933 } 1261 934 g_aacWedgeNodeLists.push_back( acWedgeNodeList ); 1262 #endif 935 1263 936 } 1264 937 return; … … 1298 971 for( Int iL = 0; iL < uiBlockSize; iL++ ) 1299 972 { 1300 #if HHIQC_DMMFASTSEARCH_B00391301 973 cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) ); 1302 #else1303 cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes );1304 #endif1305 974 addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList ); 1306 975 } 1307 976 } 1308 977 } 1309 #if HHIQC_DMMFASTSEARCH_B00391310 978 UInt uiThrSz = DMM3_SIMPLIFY_TR; 1311 979 … … 1325 993 } 1326 994 g_aauiWdgLstM3.push_back(auiWdgListSz); 1327 #endif1328 995 } 1329 996 … … 1361 1028 if( bValid ) 1362 1029 { 1363 #if HHIQC_DMMFASTSEARCH_B0039 1364 cWedgelet.findClosetAngle(); 1365 #endif 1030 cWedgelet.findClosetAngle(); 1366 1031 racWedgeList.push_back( cWedgelet ); 1367 1032 TComWedgeRef cWedgeRef; … … 1370 1035 } 1371 1036 } 1372 #endif 1037 #endif //HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1373 1038 1374 1039 //! \} -
trunk/source/Lib/TLibCommon/TComRom.h
r189 r296 135 135 extern const UInt g_uiLastCtx[ 28 ]; 136 136 137 #if EIGHT_BITS_RICE_CODE138 137 extern const UInt g_auiGoRiceRange[5]; //!< maximum value coded with Rice codes 139 138 extern const UInt g_auiGoRicePrefixLen[5]; //!< prefix length for each maximum value 140 139 extern const UInt g_aauiGoRiceUpdate[5][24]; //!< parameter update rules for Rice codes 141 #else142 extern const UInt g_auiGoRiceRange[4]; //!< maximum value coded with Rice codes143 extern const UInt g_auiGoRicePrefixLen[4]; //!< prefix length for each maximum value144 extern const UInt g_aauiGoRiceUpdate[4][16]; //!< parameter update rules for Rice codes145 #endif146 140 147 #if MULTILEVEL_SIGMAP_EXT148 141 extern const UInt g_sigLastScan8x8[ 4 ][ 4 ]; //!< coefficient group scan order for 8x8 TUs 149 142 extern UInt g_sigLastScanCG32x32[ 64 ]; 150 #endif151 143 152 144 // ==================================================================================================================== … … 188 180 extern const WedgeResolution g_aeWedgeResolutionList[5]; 189 181 extern const UChar g_aucWedgeFullBitsListIdx[7]; 182 #if LGE_DMM3_SIMP_C0044 183 extern const UChar g_aucWedgeTexPredBitsListIdx[7]; 184 #endif 190 185 extern const UChar g_aucIntraSizeIdxToWedgeSize[7]; 191 186 … … 193 188 extern std::vector< std::vector<TComWedgeRef> > g_aacWedgeRefLists; 194 189 195 #if HHI QC_DMMFASTSEARCH_B0039190 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 196 191 extern std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 197 192 extern std::vector< std::vector<TComWedgeNode> > g_aacWedgeNodeLists; … … 199 194 200 195 #if RWTH_SDC_DLT_B0036 196 #if SAIT_SDC_C0096 197 #define RWTH_SDC_NUM_PRED_MODES 3 198 #else 201 199 #define RWTH_SDC_NUM_PRED_MODES 4 200 #endif 202 201 extern UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES]; 203 202 #endif … … 207 206 Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList ); 208 207 209 #if DEFAULT_DC210 208 __inline Void mapDMMtoIntraMode( UInt& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? DC_IDX : dirMode; } 211 209 __inline Void mapDMMtoIntraMode( Int& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? DC_IDX : dirMode; } 212 #else213 __inline Void mapDMMtoIntraMode( UInt& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? PLANAR_IDX : dirMode; }214 __inline Void mapDMMtoIntraMode( Int& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? PLANAR_IDX : dirMode; }215 #endif216 210 #endif 217 211 … … 280 274 #define MAX_MATRIX_COEF_NUM 64 ///< max coefficient number for quantization matrix 281 275 #define MAX_MATRIX_SIZE_NUM 8 ///< max size number for quantization matrix 282 #if SCALING_LIST283 276 #define SCALING_LIST_DC 16 ///< default DC value 284 #endif285 277 enum ScalingListDIR 286 278 { … … 329 321 }, 330 322 }; 331 #if SCALING_LIST332 323 static const char MatrixType_DC[4][12][22] = 333 324 { … … 349 340 }, 350 341 }; 351 #endif352 342 extern Int g_quantIntraDefault4x4[16]; 353 343 extern Int g_quantIntraDefault8x8[64]; -
trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
r56 r296 66 66 m_pClipTable = NULL; 67 67 m_pClipTableBase = NULL; 68 #if SAO_UNIT_INTERLEAVING69 68 m_lumaTableBo = NULL; 70 #else71 m_ppLumaTableBo0 = NULL;72 m_ppLumaTableBo1 = NULL;73 #endif74 69 m_iUpBuff1 = NULL; 75 70 m_iUpBuff2 = NULL; … … 136 131 2, 137 132 2, 138 #if !SAO_UNIT_INTERLEAVING139 1,140 #endif141 133 1 142 134 }; … … 161 153 SAO_EO_LEN, 162 154 SAO_EO_LEN, 163 #if !SAO_UNIT_INTERLEAVING164 SAO_BO_LEN,165 #endif166 155 SAO_BO_LEN 167 156 }; … … 259 248 * m_iNumTotalParts must allow for sufficient storage in any allocated arrays */ 260 249 m_iNumTotalParts = max(3,m_aiNumCulPartsLevel[m_uiMaxSplitLevel]); 261 #if !SAO_UNIT_INTERLEAVING262 UInt auiTable[2][LUMA_GROUP_NUM] =263 {{0, 0, 0, 0, 0, 0, 0, 0,264 1, 2, 3, 4, 5, 6, 7, 8,265 9,10,11,12,13,14,15,16,266 0, 0, 0, 0, 0, 0, 0, 0},267 268 {1, 2, 3, 4, 5, 6, 7, 8,269 0, 0, 0, 0, 0, 0, 0, 0,270 0, 0, 0, 0, 0, 0, 0, 0,271 9,10,11,12,13,14,15,16}};272 #endif273 250 274 251 UInt uiInternalBitDepth = g_uiBitDepth+g_uiBitIncrement; … … 276 253 UInt uiBoRangeShift = uiInternalBitDepth - SAO_BO_BITS; 277 254 278 #if SAO_UNIT_INTERLEAVING279 255 m_lumaTableBo = new Pel [uiPixelRange]; 280 256 for (Int k2=0; k2<uiPixelRange; k2++) … … 282 258 m_lumaTableBo[k2] = 1 + (k2>>uiBoRangeShift); 283 259 } 284 #else285 m_ppLumaTableBo0 = new Pel [uiPixelRange];286 m_ppLumaTableBo1 = new Pel [uiPixelRange];287 for (Int k2=0; k2<uiPixelRange; k2++)288 {289 m_ppLumaTableBo0[k2] = auiTable[0][k2>>uiBoRangeShift];290 m_ppLumaTableBo1[k2] = auiTable[1][k2>>uiBoRangeShift];291 }292 #endif293 260 m_iUpBuff1 = new Int[m_iPicWidth+2]; 294 261 m_iUpBuff2 = new Int[m_iPicWidth+2]; … … 345 312 delete [] m_iOffsetBo; m_iOffsetBo = NULL; 346 313 } 347 #if SAO_UNIT_INTERLEAVING348 314 if (m_lumaTableBo) 349 315 { 350 316 delete[] m_lumaTableBo; m_lumaTableBo = NULL; 351 317 } 352 #else353 if (m_ppLumaTableBo0)354 {355 delete[] m_ppLumaTableBo0; m_ppLumaTableBo0 = NULL;356 }357 if (m_ppLumaTableBo1)358 {359 delete[] m_ppLumaTableBo1; m_ppLumaTableBo1 = NULL;360 }361 #endif362 318 363 319 … … 416 372 pcSaoParam->iNumClass[j] = m_iNumClass[j]; 417 373 } 418 #if SAO_UNIT_INTERLEAVING419 374 pcSaoParam->numCuInWidth = m_iNumCuInWidth; 420 375 pcSaoParam->numCuInHeight = m_iNumCuInHeight; … … 422 377 pcSaoParam->saoLcuParam[1] = new SaoLcuParam [m_iNumCuInHeight*m_iNumCuInWidth]; 423 378 pcSaoParam->saoLcuParam[2] = new SaoLcuParam [m_iNumCuInHeight*m_iNumCuInWidth]; 424 #endif425 379 } 426 380 … … 448 402 449 403 pSaoPart->UpPartIdx = iParentPartIdx; 450 #if !SAO_UNIT_INTERLEAVING451 pSaoPart->bEnableFlag = 0;452 #endif453 404 pSaoPart->iBestType = -1; 454 405 pSaoPart->iLength = 0; 455 406 456 #if SAO_UNIT_INTERLEAVING457 407 pSaoPart->bandPosition = 0; 458 408 459 409 for (j=0;j<MAX_NUM_SAO_OFFSETS;j++) 460 #else461 for (j=0;j<MAX_NUM_SAO_CLASS;j++)462 #endif463 410 { 464 411 pSaoPart->iOffset[j] = 0; … … 545 492 pcSaoParam->psSaoPart[1] = 0; 546 493 pcSaoParam->psSaoPart[2] = 0; 547 #if SAO_UNIT_INTERLEAVING548 494 if( pcSaoParam->saoLcuParam[0]) 549 495 { … … 558 504 delete [] pcSaoParam->saoLcuParam[2]; pcSaoParam->saoLcuParam[2] = NULL; 559 505 } 560 #endif561 506 } 562 507 … … 572 517 for(Int i=0; i< m_aiNumCulPartsLevel[m_uiMaxSplitLevel]; i++) 573 518 { 574 #if !SAO_UNIT_INTERLEAVING575 pcSaoParam->psSaoPart[c][i].bEnableFlag = 0;576 #endif577 519 pcSaoParam->psSaoPart[c][i].iBestType = -1; 578 520 pcSaoParam->psSaoPart[c][i].iLength = 0; … … 582 524 pcSaoParam->psSaoPart[c][i].iMinDist = MAX_INT; 583 525 pcSaoParam->psSaoPart[c][i].iMinRate = MAX_INT; 584 #if SAO_UNIT_INTERLEAVING585 526 pcSaoParam->psSaoPart[c][i].bandPosition = 0; 586 527 for (Int j=0;j<MAX_NUM_SAO_OFFSETS;j++) 587 #else588 for (Int j=0;j<MAX_NUM_SAO_CLASS;j++)589 #endif590 528 { 591 529 pcSaoParam->psSaoPart[c][i].iOffset[j] = 0; … … 594 532 } 595 533 } 596 #if SAO_UNIT_INTERLEAVING597 534 pcSaoParam->oneUnitFlag[0] = 0; 598 535 pcSaoParam->oneUnitFlag[1] = 0; … … 601 538 resetLcuPart(pcSaoParam->saoLcuParam[1]); 602 539 resetLcuPart(pcSaoParam->saoLcuParam[2]); 603 #endif604 540 } 605 541 } … … 882 818 break; 883 819 } 884 #if SAO_UNIT_INTERLEAVING885 820 case SAO_BO: 886 #else887 case SAO_BO_0:888 case SAO_BO_1:889 #endif890 821 { 891 822 for (y=0; y< height; y++) … … 1108 1039 break; 1109 1040 } 1110 #if SAO_UNIT_INTERLEAVING1111 1041 case SAO_BO: 1112 #else1113 case SAO_BO_0:1114 case SAO_BO_1:1115 #endif1116 1042 { 1117 1043 for (y=0; y<iLcuHeight; y++) … … 1134 1060 } 1135 1061 } 1136 #if !SAO_UNIT_INTERLEAVING1137 /** sample adaptive offset process for one partition1138 * \param *psQTPart, uiPartIdx, iYCbCr1139 */1140 Void TComSampleAdaptiveOffset::processSaoOnePart(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr)1141 {1142 int i;1143 UInt uiEdgeType, uiTypeIdx;1144 Pel* ppLumaTable = NULL;1145 SAOQTPart* pOnePart= &(psQTPart[uiPartIdx]);1146 1147 static Int iOffset[LUMA_GROUP_NUM];1148 Int LcuIdxX;1149 Int LcuIdxY;1150 Int iAddr;1151 Int iFrameWidthInCU = m_pcPic->getFrameWidthInCU();1152 1153 if(pOnePart->bEnableFlag)1154 {1155 uiTypeIdx = pOnePart->iBestType;1156 if (uiTypeIdx == SAO_BO_0 || uiTypeIdx == SAO_BO_1)1157 {1158 for (i=0;i<pOnePart->iLength;i++)1159 iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;1160 1161 if (uiTypeIdx == SAO_BO_0 )1162 {1163 ppLumaTable = m_ppLumaTableBo0;1164 }1165 if (uiTypeIdx == SAO_BO_1 )1166 {1167 ppLumaTable = m_ppLumaTableBo1;1168 }1169 1170 #if FULL_NBIT1171 for (i=0;i<(1<<(g_uiBitDepth));i++)1172 #else1173 for (i=0;i<(1<<(g_uiBitIncrement+8));i++)1174 #endif1175 {1176 m_iOffsetBo[i] = m_pClipTable[i + iOffset[ppLumaTable[i]]];1177 }1178 1179 }1180 if (uiTypeIdx == SAO_EO_0 || uiTypeIdx == SAO_EO_1 || uiTypeIdx == SAO_EO_2 || uiTypeIdx == SAO_EO_3)1181 {1182 for (i=0;i<pOnePart->iLength;i++)1183 {1184 iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;1185 }1186 for (uiEdgeType=0;uiEdgeType<6;uiEdgeType++)1187 {1188 m_iOffsetEo[uiEdgeType]= iOffset[m_auiEoTable[uiEdgeType]];1189 }1190 }1191 for (LcuIdxY = pOnePart->StartCUY; LcuIdxY<= pOnePart->EndCUY; LcuIdxY++)1192 {1193 for (LcuIdxX = pOnePart->StartCUX; LcuIdxX<= pOnePart->EndCUX; LcuIdxX++)1194 {1195 iAddr = LcuIdxY * iFrameWidthInCU + LcuIdxX;1196 processSaoCu(iAddr, uiTypeIdx, iYCbCr);1197 }1198 }1199 }1200 }1201 1202 /** Process quadtree sample adaptive offset1203 * \param psQTPart, uiPartIdx, iYCbCr1204 */1205 Void TComSampleAdaptiveOffset::processSaoQuadTree(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr)1206 {1207 SAOQTPart* pSaoPart= &(psQTPart[uiPartIdx]);1208 1209 if (uiPartIdx == 0)1210 {1211 initTmpSaoQuadTree(psQTPart, iYCbCr);1212 xSaoAllPart(psQTPart, iYCbCr);1213 return;1214 }1215 1216 if (!pSaoPart->bSplit)1217 {1218 if (pSaoPart->bEnableFlag)1219 {1220 processSaoOnePart(psQTPart, uiPartIdx, iYCbCr);1221 }1222 return;1223 }1224 1225 if (pSaoPart->PartLevel < m_uiMaxSplitLevel)1226 {1227 processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[0], iYCbCr);1228 processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[1], iYCbCr);1229 processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[2], iYCbCr);1230 processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[3], iYCbCr);1231 }1232 }1233 1234 /** run SAO processing in LCU order1235 * \param *psQTPart, iYCbCr1236 */1237 Void TComSampleAdaptiveOffset::xSaoAllPart(SAOQTPart *psQTPart, Int iYCbCr)1238 {1239 int i;1240 UInt uiEdgeType;1241 Pel* ppLumaTable = NULL;1242 Int iTypeIdx;1243 1244 static Int iOffset[LUMA_GROUP_NUM];1245 Int LcuIdxX;1246 Int LcuIdxY;1247 Int iAddr;1248 Int iFrameWidthInCU = m_pcPic->getFrameWidthInCU();1249 Int iFrameHeightInCU = m_pcPic->getFrameHeightInCU();1250 Int iPartIdx;1251 Pel *pRec;1252 Int iPicWidthTmp;1253 Int iStride;1254 Pel *pTmpUSwap;1255 Int iIsChroma = (iYCbCr == 0) ? 0:1;1256 1257 SAOQTPart* pOnePart;1258 1259 for (LcuIdxY = 0; LcuIdxY< iFrameHeightInCU; LcuIdxY++)1260 {1261 iAddr = LcuIdxY * iFrameWidthInCU;1262 if (iYCbCr == 0)1263 {1264 pRec = m_pcPic->getPicYuvRec()->getLumaAddr(iAddr);1265 iStride = m_pcPic->getStride();1266 iPicWidthTmp = m_iPicWidth;1267 }1268 else if (iYCbCr == 1)1269 {1270 pRec = m_pcPic->getPicYuvRec()->getCbAddr(iAddr);1271 iStride = m_pcPic->getCStride();1272 iPicWidthTmp = m_iPicWidth>>1;1273 }1274 else1275 {1276 pRec = m_pcPic->getPicYuvRec()->getCrAddr(iAddr);1277 iStride = m_pcPic->getCStride();1278 iPicWidthTmp = m_iPicWidth>>1;1279 }1280 1281 // pRec += iStride*(m_uiMaxCUHeight-1);1282 for (i=0;i<(m_uiMaxCUHeight>>iIsChroma)+1;i++)1283 {1284 m_pTmpL1[i] = pRec[0];1285 pRec+=iStride;1286 }1287 pRec-=(iStride<<1);1288 1289 memcpy(m_pTmpU2, pRec, sizeof(Pel)*iPicWidthTmp);1290 1291 for (LcuIdxX = 0; LcuIdxX< iFrameWidthInCU; LcuIdxX++)1292 {1293 iAddr = LcuIdxY * iFrameWidthInCU + LcuIdxX;1294 iPartIdx = m_iLcuPartIdx[iAddr];1295 if (iPartIdx>=0)1296 {1297 pOnePart = &(psQTPart[iPartIdx]);1298 iTypeIdx = pOnePart->iBestType;1299 if (iTypeIdx>=0)1300 {1301 if (iTypeIdx == SAO_BO_0 || iTypeIdx == SAO_BO_1)1302 {1303 for (i=0;i<pOnePart->iLength;i++)1304 iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;1305 1306 if (iTypeIdx == SAO_BO_0 )1307 {1308 ppLumaTable = m_ppLumaTableBo0;1309 }1310 if (iTypeIdx == SAO_BO_1 )1311 {1312 ppLumaTable = m_ppLumaTableBo1;1313 }1314 1315 #if FULL_NBIT1316 for (i=0;i<(1<<(g_uiBitDepth));i++)1317 #else1318 for (i=0;i<(1<<(g_uiBitIncrement+8));i++)1319 #endif1320 {1321 m_iOffsetBo[i] = m_pClipTable[i + iOffset[ppLumaTable[i]]];1322 }1323 1324 }1325 if (iTypeIdx == SAO_EO_0 || iTypeIdx == SAO_EO_1 || iTypeIdx == SAO_EO_2 || iTypeIdx == SAO_EO_3)1326 {1327 for (i=0;i<pOnePart->iLength;i++)1328 {1329 iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;1330 }1331 for (uiEdgeType=0;uiEdgeType<6;uiEdgeType++)1332 {1333 m_iOffsetEo[uiEdgeType]= iOffset[m_auiEoTable[uiEdgeType]];1334 }1335 }1336 processSaoCu(iAddr, iTypeIdx, iYCbCr);1337 }1338 }1339 else1340 {1341 if (LcuIdxX != (iFrameWidthInCU-1))1342 {1343 if( m_iLcuPartIdx[iAddr+1] >=0)1344 {1345 if (iYCbCr == 0)1346 {1347 pRec = m_pcPic->getPicYuvRec()->getLumaAddr(iAddr);1348 iStride = m_pcPic->getStride();1349 }1350 else if (iYCbCr == 1)1351 {1352 pRec = m_pcPic->getPicYuvRec()->getCbAddr(iAddr);1353 iStride = m_pcPic->getCStride();1354 }1355 else1356 {1357 pRec = m_pcPic->getPicYuvRec()->getCrAddr(iAddr);1358 iStride = m_pcPic->getCStride();1359 }1360 Int iWidthShift = m_uiMaxCUWidth>>iIsChroma;1361 for (i=0;i<(m_uiMaxCUHeight>>iIsChroma)+1;i++)1362 {1363 m_pTmpL1[i] = pRec[iWidthShift-1];1364 pRec+=iStride;1365 }1366 }1367 }1368 }1369 }1370 pTmpUSwap = m_pTmpU1;1371 m_pTmpU1 = m_pTmpU2;1372 m_pTmpU2 = pTmpUSwap;1373 }1374 }1375 1376 /** initialize buffer for quadtree boundary1377 * \param *psQTPart, iYCbCr1378 */1379 Void TComSampleAdaptiveOffset::initTmpSaoQuadTree(SAOQTPart *psQTPart, Int iYCbCr)1380 {1381 Pel *pRec;1382 Int iPicWidthTmp;1383 1384 1385 memset(m_iLcuPartIdx,-1, sizeof(Int)*m_iNumCuInWidth*m_iNumCuInHeight);1386 convertSaoQt2Lcu(psQTPart, 0);1387 1388 if (iYCbCr == 0)1389 {1390 pRec = m_pcPic->getPicYuvRec()->getLumaAddr();1391 iPicWidthTmp = m_iPicWidth;1392 }1393 else if (iYCbCr == 1)1394 {1395 pRec = m_pcPic->getPicYuvRec()->getCbAddr();1396 iPicWidthTmp = m_iPicWidth>>1;1397 }1398 else1399 {1400 pRec = m_pcPic->getPicYuvRec()->getCrAddr();1401 iPicWidthTmp = m_iPicWidth>>1;1402 }1403 1404 memcpy(m_pTmpU1, pRec, sizeof(Pel)*iPicWidthTmp);1405 }1406 1407 /** recursive covert quadtree partition index to each LCU1408 * \param psQTPart, uiPartIdx1409 */1410 Void TComSampleAdaptiveOffset::convertSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx)1411 {1412 1413 SAOQTPart* pSaoPart= &(psQTPart[uiPartIdx]);1414 1415 if (!pSaoPart->bSplit)1416 {1417 xSaoQt2Lcu(psQTPart, uiPartIdx);1418 return;1419 }1420 1421 if (pSaoPart->PartLevel < m_uiMaxSplitLevel)1422 {1423 convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[0]);1424 convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[1]);1425 convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[2]);1426 convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[3]);1427 }1428 }1429 1430 /** assign quadtree partition index to each LCU1431 * \param psQTPart, uiPartIdx1432 */1433 1434 Void TComSampleAdaptiveOffset::xSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx)1435 {1436 Int LcuIdxX;1437 Int LcuIdxY;1438 Int iAddr;1439 Int iFrameWidthInCU = m_iNumCuInWidth;1440 1441 for (LcuIdxY = psQTPart[uiPartIdx].StartCUY; LcuIdxY<= psQTPart[uiPartIdx].EndCUY; LcuIdxY++)1442 {1443 for (LcuIdxX = psQTPart[uiPartIdx].StartCUX; LcuIdxX<= psQTPart[uiPartIdx].EndCUX; LcuIdxX++)1444 {1445 iAddr = LcuIdxY * iFrameWidthInCU + LcuIdxX;1446 if (psQTPart[uiPartIdx].bEnableFlag)1447 {1448 m_iLcuPartIdx[iAddr] = (Int)uiPartIdx;1449 }1450 else1451 {1452 m_iLcuPartIdx[iAddr] = -1;1453 }1454 }1455 }1456 }1457 #endif1458 1062 /** Sample adaptive offset process 1459 1063 * \param pcPic, pcSaoParam … … 1474 1078 } 1475 1079 1476 #if SAO_UNIT_INTERLEAVING1477 1080 if (m_saoInterleavingFlag) 1478 1081 { … … 1496 1099 1497 1100 1498 #else1499 Int iY = 0;1500 processSaoQuadTree( pcSaoParam->psSaoPart[iY], 0 , iY);1501 1502 Int iCb = 1;1503 Int iCr = 2;1504 if (pcSaoParam->bSaoFlag[iCb])1505 {1506 processSaoQuadTree( pcSaoParam->psSaoPart[iCb], 0 , iCb);1507 }1508 if (pcSaoParam->bSaoFlag[iCr])1509 {1510 processSaoQuadTree( pcSaoParam->psSaoPart[iCr], 0 , iCr);1511 }1512 #endif1513 1101 m_pcPic = NULL; 1514 1102 } … … 1533 1121 } 1534 1122 } 1535 #if SAO_UNIT_INTERLEAVING1536 1123 /** Process SAO all units 1537 1124 * \param saoLcuParam SAO LCU parameters … … 1789 1376 1790 1377 1791 #endif1792 1378 1793 1379 //! \} -
trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h
r56 r296 52 52 #define SAO_BO_BITS 5 53 53 #define LUMA_GROUP_NUM (1<<SAO_BO_BITS) 54 #if SAO_UNIT_INTERLEAVING55 54 #define MAX_NUM_SAO_OFFSETS 4 56 55 #define MAX_NUM_SAO_CLASS 33 57 #else58 #define MAX_NUM_SAO_CLASS 3259 #endif60 56 // ==================================================================================================================== 61 57 // Class definition … … 95 91 Pel *m_pClipTable; 96 92 Pel *m_pClipTableBase; 97 #if SAO_UNIT_INTERLEAVING98 93 Pel *m_lumaTableBo; 99 #else100 Pel *m_ppLumaTableBo0;101 Pel *m_ppLumaTableBo1;102 #endif103 94 Int *m_iUpBuff1; 104 95 Int *m_iUpBuff2; … … 115 106 Pel* m_pTmpL2; 116 107 Int* m_iLcuPartIdx; 117 #if SAO_UNIT_INTERLEAVING118 108 Int m_maxNumOffsetsPerPic; 119 109 Bool m_saoInterleavingFlag; 120 #else121 Void initTmpSaoQuadTree(SAOQTPart *psQTPart, Int iYCbCr);122 Void disableSaoOnePart(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr);123 Void xSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx);124 Void convertSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx);125 Void xSaoAllPart(SAOQTPart *psQTPart, Int iYCbCr);126 #endif127 110 public: 128 111 TComSampleAdaptiveOffset (); … … 151 134 Void processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int iSaoType, UInt xPos, UInt yPos, UInt width, UInt height, Bool* pbBorderAvail); 152 135 153 #if SAO_UNIT_INTERLEAVING154 136 Void resetLcuPart(SaoLcuParam* saoLcuParam); 155 137 Void convertQT2SaoUnit(SAOParam* saoParam, UInt partIdx, Int yCbCr); … … 158 140 Void setSaoInterleavingFlag (Bool bVal) {m_saoInterleavingFlag = bVal;} 159 141 Bool getSaoInterleavingFlag () {return m_saoInterleavingFlag;} 160 #endif161 142 }; 162 143 -
trunk/source/Lib/TLibCommon/TComSlice.cpp
r210 r296 110 110 , m_cabacInitIdc ( -1 ) 111 111 #endif 112 #if TILES_WPP_ENTRY_POINT_SIGNALLING113 112 , m_numEntryPointOffsets ( 0 ) 114 #endif115 #if SONY_COLPIC_AVAILABILITY116 , m_iViewOrderIdx ( 0 )117 #endif118 113 #if LGE_ILLUCOMP_B0045 119 114 , m_bApplyIC ( false ) 120 115 #endif 116 #if INTER_VIEW_VECTOR_SCALING_C0115 117 , m_bIVScalingFlag (false) 118 , m_iViewOrderIdx ( 0 ) // will be changed to view_id 119 #endif 121 120 { 122 121 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 123 122 124 123 initEqualRef(); 125 124 … … 196 195 m_cabacInitFlag = false; 197 196 #endif 198 #if TILES_WPP_ENTRY_POINT_SIGNALLING199 197 m_numEntryPointOffsets = 0; 198 #if QC_TMVP_MRG_REFIDX_C0047 199 m_aiNewRefIdx[0] = -1; 200 m_aiNewRefIdx[1] = -1; 200 201 #endif 201 202 } … … 419 420 } 420 421 } 422 #if QC_TMVP_MRG_REFIDX_C0047 423 Int iCurrPOC = this->getPOC(); 424 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )//just to get one updated ref idx for merge in each L0/L1 direction, if it is not avaialbe, it is still -1 425 { 426 if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0) 427 continue; 428 429 Bool bZeroIdxInterViewFlag = ( this->getRefPic(RefPicList(uiRefListIdx), 0)->getPOC() == iCurrPOC ) ? true : false; 430 for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ ) 431 { 432 if ( (bZeroIdxInterViewFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() != iCurrPOC ) || 433 (!bZeroIdxInterViewFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() == iCurrPOC ) ) 434 { 435 this->setNewRefIdx(RefPicList(uiRefListIdx),i); 436 break; 437 } 438 } 439 } 440 441 #endif 421 442 } 422 443 … … 621 642 } 622 643 } 623 #if H0566_TLA624 644 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found 625 #else626 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found627 #endif628 645 { 629 646 pocCRA = getPOC(); … … 678 695 bRefreshPending = false; 679 696 } 680 #if H0566_TLA681 697 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found 682 #else683 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found684 #endif685 698 { 686 699 bRefreshPending = true; … … 698 711 m_iPOC = pSrc->m_iPOC; 699 712 m_viewId = pSrc->m_viewId; 700 #if SONY_COLPIC_AVAILABILITY 701 m_iViewOrderIdx = pSrc->m_iViewOrderIdx; 713 #if INTER_VIEW_VECTOR_SCALING_C0115 714 m_iViewOrderIdx = pSrc->m_iViewOrderIdx;// will be changed to view_id 715 m_bIVScalingFlag = pSrc->m_bIVScalingFlag; 702 716 #endif 703 717 m_eNalUnitType = pSrc->m_eNalUnitType; … … 804 818 805 819 m_saoEnabledFlag = pSrc->m_saoEnabledFlag; 806 #if SAO_UNIT_INTERLEAVING807 820 m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag; 808 821 m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb; 809 822 m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr; 810 #endif811 823 #if CABAC_INIT_FLAG 812 824 m_cabacInitFlag = pSrc->m_cabacInitFlag; 813 825 #endif 814 #if TILES_WPP_ENTRY_POINT_SIGNALLING815 826 m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; 816 #endif 817 818 #if H0111_MVD_L1_ZERO 827 819 828 m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; 820 #endif821 829 } 822 830 … … 830 838 Void TComSlice::setTLayerInfo( UInt uiTLayer ) 831 839 { 832 #if !H0566_TLA833 // If temporal_id_nesting_flag == 1, then num_temporal_layer_switching_point_flags shall be inferred to be 0 and temporal_layer_switching_point_flag shall be inferred to be 1 for all temporal layers834 if ( m_pcSPS->getTemporalIdNestingFlag() )835 {836 m_pcPPS->setNumTLayerSwitchingFlags( 0 );837 for ( UInt i = 0; i < MAX_TLAYER; i++ )838 {839 m_pcPPS->setTLayerSwitchingFlag( i, true );840 }841 }842 else843 {844 for ( UInt i = m_pcPPS->getNumTLayerSwitchingFlags(); i < MAX_TLAYER; i++ )845 {846 m_pcPPS->setTLayerSwitchingFlag( i, false );847 }848 }849 #endif850 840 851 841 m_uiTLayer = uiTLayer; 852 #if !H0566_TLA 853 m_bTLayerSwitchingFlag = m_pcPPS->getTLayerSwitchingFlag( uiTLayer ); 854 #endif 855 } 856 857 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS 842 } 843 844 #if H0566_TLA_SET_FOR_SWITCHING_POINTS 858 845 /** Function for checking if this is a switching-point 859 846 */ … … 933 920 /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. 934 921 */ 935 #if START_DECODING_AT_CRA936 922 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess) 937 #else938 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag)939 #endif940 923 { 941 924 TComPic* rpcPic; … … 983 966 if(isAvailable == 0) 984 967 { 985 #if START_DECODING_AT_CRA986 968 if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) 987 969 { 988 #endif989 970 if(!pReferencePictureSet->getUsed(i) ) 990 971 { … … 1000 981 iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); 1001 982 } 1002 #if START_DECODING_AT_CRA 1003 } 1004 #endif 983 } 1005 984 } 1006 985 } … … 1027 1006 if(isAvailable == 0) 1028 1007 { 1029 #if START_DECODING_AT_CRA1030 1008 if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) 1031 1009 { 1032 #endif1033 1010 if(!pReferencePictureSet->getUsed(i) ) 1034 1011 { … … 1044 1021 iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); 1045 1022 } 1046 #if START_DECODING_AT_CRA 1047 } 1048 #endif 1023 } 1049 1024 } 1050 1025 } … … 1112 1087 Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; 1113 1088 Int deltaRPS = pReferencePictureSet->getDeltaRPS(); 1114 #if RPS_IN_SPS1115 1089 TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); 1116 #else1117 TComReferencePictureSet* pcRefRPS = this->getPPS()->getRPSList()->getReferencePictureSet(rIdx);1118 #endif1119 1090 Int iRefPics = pcRefRPS->getNumberOfPictures(); 1120 1091 Int iNewIdc=0; … … 1143 1114 pcRPS->setNumRefIdc(iNewIdc); 1144 1115 pcRPS->setDeltaRPS(deltaRPS); 1145 #if RPS_IN_SPS1146 1116 pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); 1147 #else1148 pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getPPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());1149 #endif1150 1117 } 1151 1118 … … 1382 1349 Int iRefStride = pcRefPicYuvOrg->getStride(); 1383 1350 Int iSumOrgSAD = 0; 1351 #if LGE_ILLUCOMP_DEPTH_C0046 1352 Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; 1353 #else 1384 1354 double dThresholdOrgSAD = 0.05; 1355 #endif 1385 1356 // Histogram building - luminance 1386 1357 for ( Int y = 0; y < iHeight; y++) … … 1509 1480 , m_picWidthInLumaSamples (352) 1510 1481 , m_picHeightInLumaSamples (288) 1511 #if PIC_CROPPING1512 1482 , m_picCroppingFlag (false) 1513 1483 , m_picCropLeftOffset ( 0) … … 1515 1485 , m_picCropTopOffset ( 0) 1516 1486 , m_picCropBottomOffset ( 0) 1517 #endif1518 1487 , m_uiMaxCUWidth ( 32) 1519 1488 , m_uiMaxCUHeight ( 32) … … 1521 1490 , m_uiMinTrDepth ( 0) 1522 1491 , m_uiMaxTrDepth ( 1) 1523 #if RPS_IN_SPS1524 1492 , m_bLongTermRefsPresent (false) 1525 #endif1526 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1527 , m_numReorderFrames ( 0)1528 #endif1529 1493 , m_iNumberOfUsableInterViewRefs( 0 ) 1530 1494 , m_uiQuadtreeTULog2MaxSize ( 0) … … 1538 1502 , m_bDisInter4x4 ( 1) 1539 1503 , m_bUseALF (false) 1540 #if LCU_SYNTAX_ALF1541 1504 , m_bALFCoefInSlice (false) 1542 #endif1543 #if !PIC_CROPPING1544 , m_bUsePAD (false)1545 #endif1546 1505 , m_bUseLMChroma (false) 1547 1506 , m_bUseLComb (false) 1548 1507 , m_bLCMod (false) 1549 #if H0412_REF_PIC_LIST_RESTRICTION1550 1508 #if QC_MVHEVC_B0046 1551 1509 , m_restrictedRefPicListsFlag ( 0) … … 1554 1512 #endif 1555 1513 , m_listsModificationPresentFlag( 0) 1556 #endif1557 1514 , m_uiBitDepth ( 8) 1558 1515 , m_uiBitIncrement ( 0) 1559 #if H0736_AVC_STYLE_QP_RANGE1560 1516 , m_qpBDOffsetY ( 0) 1561 1517 , m_qpBDOffsetC ( 0) 1562 #endif1563 1518 #if LOSSLESS_CODING 1564 1519 , m_useLossless (false) … … 1583 1538 , m_bTemporalIdNestingFlag (false) 1584 1539 , m_scalingListEnabledFlag (false) 1585 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1586 , m_uiMaxDecFrameBuffering ( 0)1587 , m_uiMaxLatencyIncrease ( 0)1588 #endif1589 #if TILES_WPP_ENTRY_POINT_SIGNALLING1590 1540 , m_tilesOrEntropyCodingSyncIdc( 0 ) 1591 1541 , m_numSubstreams ( 0 ) 1592 #endif1593 1542 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1594 1543 , m_bUseDMM (false) … … 1603 1552 // AMVP parameter 1604 1553 ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) ); 1605 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1606 1554 for ( Int i = 0; i < MAX_TLAYER; i++ ) 1607 1555 { … … 1610 1558 m_numReorderPics[i] = 0; 1611 1559 } 1612 #endif1613 1560 1614 1561 m_uiViewId = 0; … … 1626 1573 ::memset( m_aiPdmOffset, 0x00, sizeof( m_aiPdmOffset ) ); 1627 1574 #endif 1628 #if H HI_INTER_VIEW_MOTION_PRED1575 #if H3D_IVMP 1629 1576 m_uiMultiviewMvPredMode = 0; 1630 1577 #endif … … 1748 1695 , m_iChromaQpOffset (0) 1749 1696 , m_iChromaQpOffset2nd (0) 1750 #if !RPS_IN_SPS1751 , m_bLongTermRefsPresent (false)1752 #endif1753 #if !H0566_TLA1754 , m_uiNumTlayerSwitchingFlags (0)1755 #endif1756 1697 , m_iSliceGranularity (0) 1757 1698 , m_iTileBehaviorControlPresentFlag (0) … … 1759 1700 , m_iColumnRowInfoPresent (0) 1760 1701 , m_iUniformSpacingIdr (0) 1761 #if !REMOVE_TILE_DEPENDENCE1762 , m_iTileBoundaryIndependenceIdr (0)1763 #endif1764 1702 , m_iNumColumnsMinus1 (0) 1765 1703 , m_puiColumnWidth (NULL) 1766 1704 , m_iNumRowsMinus1 (0) 1767 1705 , m_puiRowHeight (NULL) 1768 #if !WPP_SIMPLIFICATION1769 , m_iEntropyCodingSynchro (0)1770 , m_bCabacIstateReset (false)1771 #endif1772 1706 , m_iNumSubstreams (1) 1773 #if MULTIBITS_DATA_HIDING1774 1707 , m_signHideFlag(0) 1775 1708 , m_signHidingThreshold(0) 1776 #endif1777 1709 #if CABAC_INIT_FLAG 1778 1710 , m_cabacInitPresentFlag (false) … … 1783 1715 #endif 1784 1716 { 1785 #if !H0566_TLA1786 for ( UInt i = 0; i < MAX_TLAYER; i++ )1787 {1788 m_abTLayerSwitchingFlag[i] = false;1789 }1790 #endif1791 1717 } 1792 1718 … … 1860 1786 1861 1787 m_uiPredDepthMapGeneration = uiPdmGenMode; 1862 #if H HI_INTER_VIEW_MOTION_PRED1788 #if H3D_IVMP 1863 1789 m_uiMultiviewMvPredMode = uiPdmMvPredMode; 1864 1790 #endif … … 2056 1982 : m_bRefPicListModificationFlagL0 (false) 2057 1983 , m_bRefPicListModificationFlagL1 (false) 2058 #if !H0137_0138_LIST_MODIFICATION 2059 , m_uiNumberOfRefPicListModificationsL0 (0) 2060 , m_uiNumberOfRefPicListModificationsL1 (0) 2061 #endif 2062 { 2063 #if !H0137_0138_LIST_MODIFICATION 2064 ::memset( m_ListIdcL0, 0, sizeof(m_ListIdcL0) ); 2065 #endif 1984 { 2066 1985 ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); 2067 #if !H0137_0138_LIST_MODIFICATION2068 ::memset( m_ListIdcL1, 0, sizeof(m_ListIdcL1) );2069 #endif2070 1986 ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); 2071 1987 } … … 2081 1997 m_bSaoEnabled = false; 2082 1998 m_pSaoParam = NULL; 2083 #if LCU_SYNTAX_ALF2084 1999 m_alfParamSet = NULL; 2085 #else2086 m_pAlfParam = NULL;2087 #endif2088 2000 m_scalingList = NULL; 2089 2001 m_scalingListEnabled = false; … … 2105 2017 m_bSaoEnabled = src.m_bSaoEnabled; 2106 2018 m_pSaoParam = src.m_pSaoParam; 2107 #if LCU_SYNTAX_ALF2108 2019 m_alfParamSet = src.m_alfParamSet; 2109 #else2110 m_pAlfParam = src.m_pAlfParam;2111 #endif2112 2020 m_scalingList = src.m_scalingList; 2113 2021 m_scalingListEnabled = src.m_scalingListEnabled; 2114 #if SAO_UNIT_INTERLEAVING2115 2022 m_saoInterleavingFlag = src.m_saoInterleavingFlag; 2116 #endif2117 2023 2118 2024 return *this; … … 2135 2041 Void TComAPS::createAlfParam() 2136 2042 { 2137 #if LCU_SYNTAX_ALF2138 2043 m_alfParamSet = new AlfParamSet; 2139 #else2140 m_pAlfParam = new ALFParam;2141 #endif2142 2044 } 2143 2045 Void TComAPS::destroyAlfParam() 2144 2046 { 2145 #if LCU_SYNTAX_ALF2146 2047 if(m_alfParamSet != NULL) 2147 2048 { … … 2149 2050 m_alfParamSet = NULL; 2150 2051 } 2151 #else2152 if(m_pAlfParam != NULL)2153 {2154 delete m_pAlfParam;2155 m_pAlfParam = NULL;2156 }2157 #endif2158 2052 } 2159 2053 … … 2191 2085 * \returns true if use default quantization matrix in all size 2192 2086 */ 2193 #if SCALING_LIST2194 2087 Bool TComSlice::checkDefaultScalingList() 2195 2088 { … … 2208 2101 return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32 2209 2102 } 2210 #else2211 Bool TComSlice::checkDefaultScalingList()2212 {2213 UInt i;2214 Int *dst=0;2215 Int *src=0;2216 UInt defaultCounter=0;2217 2218 //4x42219 for(i=0;i<SCALING_LIST_NUM;i++)2220 {2221 src = (i<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4;2222 dst = getScalingList()->getScalingListAddress(SCALING_LIST_4x4,i);2223 if(::memcmp(dst,src,sizeof(UInt)*16) == 0) defaultCounter++;2224 }2225 2226 //8x82227 for(i=0;i<SCALING_LIST_NUM;i++)2228 {2229 src = (i<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;2230 dst = getScalingList()->getScalingListAddress(SCALING_LIST_8x8,i);2231 if(::memcmp(dst,src,sizeof(UInt)*64) == 0) defaultCounter++;2232 }2233 //16x162234 for(i=0;i<SCALING_LIST_NUM;i++)2235 {2236 src = (i<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16;2237 dst = getScalingList()->getScalingListAddress(SCALING_LIST_16x16,i);2238 if(::memcmp(dst,src,sizeof(UInt)*256) == 0) defaultCounter++;2239 }2240 //32x322241 for(i=0;i<SCALING_LIST_NUM_32x32;i++)2242 {2243 src = (i<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32;2244 dst = getScalingList()->getScalingListAddress(SCALING_LIST_32x32,i*3);2245 if(::memcmp(dst,src,sizeof(UInt)*1024) == 0) defaultCounter++;2246 }2247 return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x322248 }2249 #endif2250 2103 /** get scaling matrix from RefMatrixID 2251 2104 * \param sizeId size index … … 2255 2108 Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) 2256 2109 { 2257 #if SCALING_LIST2258 2110 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 2259 #else2260 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*g_scalingListSize[sizeId]);2261 #endif2262 2111 } 2263 2112 /** parse syntax infomation … … 2283 2132 for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) 2284 2133 { 2285 #if SCALING_LIST2286 2134 size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); 2287 #else2288 size = g_scalingListSize[sizeIdc];2289 #endif2290 2135 for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) 2291 2136 { … … 2313 2158 src[i] = data; 2314 2159 } 2315 #if SCALING_LIST2316 2160 //set DC value for default matrix check 2317 2161 setScalingListDC(sizeIdc,listIdc,src[0]); … … 2339 2183 setScalingListDC(sizeIdc,listIdc,data); 2340 2184 } 2341 #endif2342 2185 } 2343 2186 } … … 2354 2197 for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) 2355 2198 { 2356 #if SCALING_LIST2357 2199 m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; 2358 #else2359 m_scalingListCoef[sizeId][listId] = new Int [g_scalingListSize[sizeId]];2360 #endif2361 2200 } 2362 2201 } … … 2391 2230 src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; 2392 2231 break; 2393 #if SCALING_LIST2394 2232 case SCALING_LIST_16x16: 2395 2233 src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; … … 2398 2236 src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; 2399 2237 break; 2400 #else2401 case SCALING_LIST_16x16:2402 src = (listId<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16;2403 break;2404 case SCALING_LIST_32x32:2405 src = (listId<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32;2406 break;2407 #endif2408 2238 default: 2409 2239 assert(0); … … 2419 2249 Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId) 2420 2250 { 2421 #if SCALING_LIST2422 2251 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 2423 2252 setUseDefaultScalingMatrixFlag(sizeId,listId,true); 2424 2253 setScalingListDC(sizeId,listId,SCALING_LIST_DC); 2425 #else 2426 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*(Int)g_scalingListSize[sizeId]); 2427 #endif 2428 } 2429 #if SCALING_LIST 2254 } 2430 2255 /** check DC value of matrix for default matrix signaling 2431 2256 */ … … 2445 2270 } 2446 2271 } 2447 #endif2448 2272 2449 2273 ParameterSetManager::ParameterSetManager() -
trunk/source/Lib/TLibCommon/TComSlice.h
r210 r296 54 54 class TComDepthMapGenerator; 55 55 #endif 56 #if H HI_INTER_VIEW_RESIDUAL_PRED56 #if H3D_IVRP 57 57 class TComResidualGenerator; 58 58 #endif … … 68 68 // ==================================================================================================================== 69 69 70 #if RPS_IN_SPS71 70 /// Reference Picture Set class 72 71 class TComReferencePictureSet … … 142 141 Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets); 143 142 }; 144 #endif145 143 146 144 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 … … 179 177 UInt m_uiMaxDecPicBuffering[MAX_TLAYER]; 180 178 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; 181 179 #if INTER_VIEW_VECTOR_SCALING_C0115 180 Bool m_bIVScalingFlag; 181 #endif 182 182 public: 183 183 TComVPS(); … … 213 213 Void setDependentLayer(UInt v, UInt layer) { m_uiDependentLayer[layer] = v; } 214 214 UInt getDependentLayer(UInt layer) { return m_uiDependentLayer[layer]; } 215 #endif 216 #if INTER_VIEW_VECTOR_SCALING_C0115 217 Bool getIVScalingFlag( ) { return m_bIVScalingFlag; } 218 Void setIVScalingFlag(Bool b) { m_bIVScalingFlag = b; } 215 219 #endif 216 220 Void setNumReorderPics(UInt v, UInt tLayer) { m_numReorderPics[tLayer] = v; } … … 270 274 UInt m_picWidthInLumaSamples; 271 275 UInt m_picHeightInLumaSamples; 272 #if PIC_CROPPING273 276 Bool m_picCroppingFlag; 274 277 Int m_picCropLeftOffset; … … 276 279 Int m_picCropTopOffset; 277 280 Int m_picCropBottomOffset; 278 #else279 Int m_aiPad[2];280 #endif281 281 UInt m_uiMaxCUWidth; 282 282 UInt m_uiMaxCUHeight; … … 284 284 UInt m_uiMinTrDepth; 285 285 UInt m_uiMaxTrDepth; 286 #if RPS_IN_SPS287 286 TComRPSList* m_RPSList; 288 287 Bool m_bLongTermRefsPresent; 289 #endif290 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER291 288 Int m_numReorderPics[MAX_TLAYER]; 292 #else293 Int m_maxNumberOfReferencePictures;294 Int m_numReorderFrames;295 #endif296 289 297 290 Int m_iNumberOfUsableInterViewRefs; … … 309 302 Bool m_useAMP; 310 303 Bool m_bUseALF; 311 #if LCU_SYNTAX_ALF312 304 Bool m_bALFCoefInSlice; 313 #endif314 #if !PIC_CROPPING315 Bool m_bUsePAD;316 #endif317 305 Bool m_bUseLMChroma; // JL: 318 306 … … 321 309 Bool m_useNSQT; 322 310 323 #if H0412_REF_PIC_LIST_RESTRICTION324 311 Bool m_restrictedRefPicListsFlag; 325 312 Bool m_listsModificationPresentFlag; 326 #endif327 313 328 314 // Parameter … … 330 316 UInt m_uiBitDepth; 331 317 UInt m_uiBitIncrement; 332 #if H0736_AVC_STYLE_QP_RANGE333 318 Int m_qpBDOffsetY; 334 319 Int m_qpBDOffsetC; 335 #endif336 320 337 321 #if LOSSLESS_CODING … … 375 359 376 360 Bool m_scalingListEnabledFlag; 377 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER378 361 UInt m_uiMaxDecPicBuffering[MAX_TLAYER]; 379 362 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; 380 #else381 UInt m_uiMaxDecFrameBuffering;382 UInt m_uiMaxLatencyIncrease;383 #endif384 363 385 364 Bool m_useDF; 386 365 387 #if TILES_WPP_ENTRY_POINT_SIGNALLING388 366 UInt m_tilesOrEntropyCodingSyncIdc; 389 367 Int m_numSubstreams; 390 #endif391 368 392 369 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX … … 409 386 #endif 410 387 411 #if H HI_INTER_VIEW_MOTION_PRED388 #if H3D_IVMP 412 389 UInt m_uiMultiviewMvPredMode; 413 390 #endif 414 #if H HI_INTER_VIEW_RESIDUAL_PRED391 #if H3D_IVRP 415 392 UInt m_uiMultiviewResPredMode; 416 393 #endif … … 419 396 TComDepthMapGenerator* m_pcDepthMapGenerator; 420 397 #endif 421 #if H HI_INTER_VIEW_RESIDUAL_PRED398 #if H3D_IVRP 422 399 TComResidualGenerator* m_pcResidualGenerator; 423 400 #endif … … 446 423 UInt getPicHeightInLumaSamples () { return m_picHeightInLumaSamples; } 447 424 448 #if PIC_CROPPING449 425 Bool getPicCroppingFlag() const { return m_picCroppingFlag; } 450 426 Void setPicCroppingFlag(Bool val) { m_picCroppingFlag = val; } … … 457 433 Int getPicCropBottomOffset() const { return m_picCropBottomOffset; } 458 434 Void setPicCropBottomOffset(Int val) { m_picCropBottomOffset = val; } 459 #endif460 435 461 436 Void setMaxCUWidth ( UInt u ) { m_uiMaxCUWidth = u; } … … 489 464 UInt getQuadtreeTUMaxDepthInter() { return m_uiQuadtreeTUMaxDepthInter; } 490 465 UInt getQuadtreeTUMaxDepthIntra() { return m_uiQuadtreeTUMaxDepthIntra; } 491 #if !PIC_CROPPING492 Void setPad (Int iPad[2]) { m_aiPad[0] = iPad[0]; m_aiPad[1] = iPad[1]; }493 #endif494 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER495 466 Void setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i; } 496 467 Int getNumReorderPics(UInt tlayer) { return m_numReorderPics[tlayer]; } 497 #else498 Void setMaxNumberOfReferencePictures( Int u ) { m_maxNumberOfReferencePictures = u; }499 Int getMaxNumberOfReferencePictures() { return m_maxNumberOfReferencePictures; }500 Void setNumReorderFrames( Int i ) { m_numReorderFrames = i; }501 Int getNumReorderFrames() { return m_numReorderFrames; }502 #endif503 #if RPS_IN_SPS504 468 Void setRPSList( TComRPSList* RPSList ) { m_RPSList = RPSList; } 505 469 TComRPSList* getRPSList() { return m_RPSList; } 506 470 Bool getLongTermRefsPresent() { return m_bLongTermRefsPresent; } 507 471 Void setLongTermRefsPresent(Bool b) { m_bLongTermRefsPresent=b; } 508 #endif509 472 510 473 Void setNumberOfUsableInterViewRefs( Int number ) { m_iNumberOfUsableInterViewRefs = number; } … … 513 476 Int getUsableInterViewRef( Int pos ) { return m_aiUsableInterViewRefs[pos]; } 514 477 515 #if !PIC_CROPPING516 Void setPadX ( Int u ) { m_aiPad[0] = u; }517 Void setPadY ( Int u ) { m_aiPad[1] = u; }518 Int getPad ( Int u ) { assert(u < 2); return m_aiPad[u];}519 Int* getPad ( ) { return m_aiPad; }520 #endif521 478 522 479 // physical transform … … 526 483 // Tool list 527 484 Bool getUseALF () { return m_bUseALF; } 528 #if LCU_SYNTAX_ALF529 485 Void setUseALFCoefInSlice(Bool b) {m_bALFCoefInSlice = b;} 530 486 Bool getUseALFCoefInSlice() {return m_bALFCoefInSlice;} 531 #endif 532 533 #if !PIC_CROPPING 534 Bool getUsePAD () { return m_bUsePAD; } 535 Void setUsePAD ( Bool b ) { m_bUsePAD = b; } 536 #endif 487 537 488 Void setUseALF ( Bool b ) { m_bUseALF = b; } 538 489 Void setUseLComb (Bool b) { m_bUseLComb = b; } … … 551 502 Void setUseNSQT( Bool b ) { m_useNSQT = b; } 552 503 553 #if H0412_REF_PIC_LIST_RESTRICTION554 504 Bool getRestrictedRefPicListsFlag () { return m_restrictedRefPicListsFlag; } 555 505 Void setRestrictedRefPicListsFlag ( Bool b ) { m_restrictedRefPicListsFlag = b; } 556 506 Bool getListsModificationPresentFlag () { return m_listsModificationPresentFlag; } 557 507 Void setListsModificationPresentFlag ( Bool b ) { m_listsModificationPresentFlag = b; } 558 #endif559 508 560 509 // AMVP mode (for each depth) … … 571 520 UInt getBitIncrement () { return m_uiBitIncrement; } 572 521 Void setBitIncrement ( UInt u ) { m_uiBitIncrement = u; } 573 #if H0736_AVC_STYLE_QP_RANGE574 522 Int getQpBDOffsetY () { return m_qpBDOffsetY; } 575 523 Void setQpBDOffsetY ( Int value ) { m_qpBDOffsetY = value; } 576 524 Int getQpBDOffsetC () { return m_qpBDOffsetC; } 577 525 Void setQpBDOffsetC ( Int value ) { m_qpBDOffsetC = value; } 578 #endif579 526 580 527 Void setLFCrossSliceBoundaryFlag ( Bool bValue ) { m_bLFCrossSliceBoundaryFlag = bValue; } … … 619 566 Void setUniformSpacingIdr ( Int i ) { m_iUniformSpacingIdr = i; } 620 567 Int getUniformSpacingIdr () { return m_iUniformSpacingIdr; } 621 #if !REMOVE_TILE_DEPENDENCE622 Void setTileBoundaryIndependenceIdr ( Int i ) { m_iTileBoundaryIndependenceIdr = i; }623 Int getTileBoundaryIndependenceIdr () { return m_iTileBoundaryIndependenceIdr; }624 #endif625 568 Void setNumColumnsMinus1 ( Int i ) { m_iNumColumnsMinus1 = i; } 626 569 Int getNumColumnsMinus1 () { return m_iNumColumnsMinus1; } … … 655 598 Bool getScalingListFlag () { return m_scalingListEnabledFlag; } 656 599 Void setScalingListFlag ( Bool b ) { m_scalingListEnabledFlag = b; } 657 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER658 600 UInt getMaxDecPicBuffering (UInt tlayer) { return m_uiMaxDecPicBuffering[tlayer]; } 659 601 Void setMaxDecPicBuffering ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui; } 660 602 UInt getMaxLatencyIncrease (UInt tlayer) { return m_uiMaxLatencyIncrease[tlayer]; } 661 603 Void setMaxLatencyIncrease ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui; } 662 #else663 UInt getMaxDecFrameBuffering () { return m_uiMaxDecFrameBuffering; }664 Void setMaxDecFrameBuffering ( UInt ui ) { m_uiMaxDecFrameBuffering = ui; }665 UInt getMaxLatencyIncrease () { return m_uiMaxLatencyIncrease; }666 Void setMaxLatencyIncrease ( UInt ui ) { m_uiMaxLatencyIncrease= ui; }667 #endif668 #if TILES_WPP_ENTRY_POINT_SIGNALLING669 604 UInt getTilesOrEntropyCodingSyncIdc () { return m_tilesOrEntropyCodingSyncIdc; } 670 605 Void setTilesOrEntropyCodingSyncIdc ( UInt val ) { m_tilesOrEntropyCodingSyncIdc = val; } 671 606 Int getNumSubstreams () { return m_numSubstreams; } 672 607 Void setNumSubstreams ( Int numSubstreams ) { m_numSubstreams = numSubstreams; } 673 #endif674 608 675 609 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX … … 705 639 Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 ); 706 640 #endif 707 #if H HI_INTER_VIEW_RESIDUAL_PRED641 #if H3D_IVRP 708 642 Void setMultiviewResPredMode ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; } 709 643 #endif … … 716 650 #endif 717 651 718 #if H HI_INTER_VIEW_MOTION_PRED652 #if H3D_IVMP 719 653 UInt getMultiviewMvPredMode () { return m_uiMultiviewMvPredMode; } 720 654 #endif 721 #if H HI_INTER_VIEW_RESIDUAL_PRED655 #if H3D_IVRP 722 656 UInt getMultiviewResPredMode () { return m_uiMultiviewResPredMode; } 723 657 #endif … … 727 661 TComDepthMapGenerator* getDepthMapGenerator() { return m_pcDepthMapGenerator; } 728 662 #endif 729 #if H HI_INTER_VIEW_RESIDUAL_PRED663 #if H3D_IVRP 730 664 Void setResidualGenerator( TComResidualGenerator* pcResidualGenerator ) { m_pcResidualGenerator = pcResidualGenerator; } 731 665 TComResidualGenerator* getResidualGenerator() { return m_pcResidualGenerator; } … … 733 667 }; 734 668 735 #if !RPS_IN_SPS736 /// Reference Picture Set class737 class TComReferencePictureSet738 {739 private:740 Int m_numberOfPictures;741 Int m_numberOfNegativePictures;742 Int m_numberOfPositivePictures;743 Int m_numberOfLongtermPictures;744 Int m_deltaPOC[MAX_NUM_REF_PICS];745 Int m_POC[MAX_NUM_REF_PICS];746 Bool m_used[MAX_NUM_REF_PICS];747 Bool m_interRPSPrediction;748 Int m_deltaRIdxMinus1;749 Int m_deltaRPS;750 Int m_numRefIdc;751 Int m_refIdc[MAX_NUM_REF_PICS+1];752 753 public:754 TComReferencePictureSet();755 virtual ~TComReferencePictureSet();756 757 Void setUsed(Int bufferNum, Bool used);758 Void setDeltaPOC(Int bufferNum, Int deltaPOC);759 Void setPOC(Int bufferNum, Int deltaPOC);760 Void setNumberOfPictures(Int numberOfPictures);761 762 Int getUsed(Int bufferNum);763 Int getDeltaPOC(Int bufferNum);764 Int getPOC(Int bufferNum);765 Int getNumberOfPictures();766 767 Void setNumberOfNegativePictures(Int number) { m_numberOfNegativePictures = number; }768 Int getNumberOfNegativePictures() { return m_numberOfNegativePictures; }769 Void setNumberOfPositivePictures(Int number) { m_numberOfPositivePictures = number; }770 Int getNumberOfPositivePictures() { return m_numberOfPositivePictures; }771 Void setNumberOfLongtermPictures(Int number) { m_numberOfLongtermPictures = number; }772 Int getNumberOfLongtermPictures() { return m_numberOfLongtermPictures; }773 774 Void setInterRPSPrediction(Bool flag) { m_interRPSPrediction = flag; }775 Bool getInterRPSPrediction() { return m_interRPSPrediction; }776 Void setDeltaRIdxMinus1(Int x) { m_deltaRIdxMinus1 = x; }777 Int getDeltaRIdxMinus1() { return m_deltaRIdxMinus1; }778 Void setDeltaRPS(Int x) { m_deltaRPS = x; }779 Int getDeltaRPS() { return m_deltaRPS; }780 Void setNumRefIdc(Int x) { m_numRefIdc = x; }781 Int getNumRefIdc() { return m_numRefIdc; }782 783 Void setRefIdc(Int bufferNum, Int refIdc);784 Int getRefIdc(Int bufferNum);785 786 Void sortDeltaPOC();787 Void printDeltaPOC();788 };789 790 /// Reference Picture Set set class791 class TComRPSList792 {793 private:794 Int m_numberOfReferencePictureSets;795 TComReferencePictureSet* m_referencePictureSets;796 797 public:798 TComRPSList();799 virtual ~TComRPSList();800 801 Void create (Int numberOfEntries);802 Void destroy ();803 804 805 TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum);806 Int getNumberOfReferencePictureSets();807 Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);808 };809 #endif810 669 811 670 /// Reference Picture Lists class … … 815 674 UInt m_bRefPicListModificationFlagL0; 816 675 UInt m_bRefPicListModificationFlagL1; 817 #if !H0137_0138_LIST_MODIFICATION818 UInt m_uiNumberOfRefPicListModificationsL0;819 UInt m_uiNumberOfRefPicListModificationsL1;820 UInt m_ListIdcL0[32];821 #endif822 676 UInt m_RefPicSetIdxL0[32]; 823 #if !H0137_0138_LIST_MODIFICATION824 UInt m_ListIdcL1[32];825 #endif826 677 UInt m_RefPicSetIdxL1[32]; 827 678 … … 837 688 Bool getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; } 838 689 Void setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; } 839 #if !H0137_0138_LIST_MODIFICATION840 UInt getNumberOfRefPicListModificationsL0() { return m_uiNumberOfRefPicListModificationsL0; }841 Void setNumberOfRefPicListModificationsL0(UInt nr) { m_uiNumberOfRefPicListModificationsL0 = nr; }842 UInt getNumberOfRefPicListModificationsL1() { return m_uiNumberOfRefPicListModificationsL1; }843 Void setNumberOfRefPicListModificationsL1(UInt nr) { m_uiNumberOfRefPicListModificationsL1 = nr; }844 Void setListIdcL0(UInt idx, UInt idc) { m_ListIdcL0[idx] = idc; }845 UInt getListIdcL0(UInt idx) { return m_ListIdcL0[idx]; }846 #endif847 690 Void setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; } 848 691 UInt getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; } 849 #if !H0137_0138_LIST_MODIFICATION850 Void setListIdcL1(UInt idx, UInt idc) { m_ListIdcL1[idx] = idc; }851 UInt getListIdcL1(UInt idx) { return m_ListIdcL1[idx]; }852 #endif853 692 Void setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; } 854 693 UInt getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; } … … 867 706 // access channel 868 707 TComSPS* m_pcSPS; 869 #if !RPS_IN_SPS870 TComRPSList* m_RPSList;871 #endif872 708 UInt m_uiMaxCuDQPDepth; 873 709 UInt m_uiMinCuDQPSize; … … 876 712 Int m_iChromaQpOffset2nd; 877 713 878 #if !RPS_IN_SPS 879 Bool m_bLongTermRefsPresent; 880 #endif 881 882 #if !H0566_TLA 883 UInt m_uiNumTlayerSwitchingFlags; // num_temporal_layer_switching_point_flags 884 Bool m_abTLayerSwitchingFlag[ MAX_TLAYER ]; // temporal_layer_switching_point_flag 885 #endif 714 886 715 887 716 Int m_iSliceGranularity; … … 890 719 UInt m_uiBiPredIdc; // Use of Weighting Bi-Prediction (B_SLICE) 891 720 892 #if H0388893 721 Bool m_OutputFlagPresentFlag; // Indicates the presence of output_flag in slice header 894 #endif895 722 896 723 Int m_iTileBehaviorControlPresentFlag; … … 898 725 Int m_iColumnRowInfoPresent; 899 726 Int m_iUniformSpacingIdr; 900 #if !REMOVE_TILE_DEPENDENCE901 Int m_iTileBoundaryIndependenceIdr;902 #endif903 727 Int m_iNumColumnsMinus1; 904 728 UInt* m_puiColumnWidth; … … 907 731 908 732 Int m_iEntropyCodingMode; // !!! in PPS now, but also remains in slice header! 909 #if !WPP_SIMPLIFICATION910 Int m_iEntropyCodingSynchro;911 Bool m_bCabacIstateReset;912 #endif913 733 Int m_iNumSubstreams; 914 734 915 735 Bool m_enableTMVPFlag; 916 736 917 #if MULTIBITS_DATA_HIDING918 737 Int m_signHideFlag; 919 738 Int m_signHidingThreshold; 920 #endif921 739 922 740 #if CABAC_INIT_FLAG … … 927 745 #endif 928 746 #endif 929 #if DBL_CONTROL930 747 Bool m_DeblockingFilterControlPresent; 931 #endif932 #if PARALLEL_MERGE933 748 UInt m_log2ParallelMergeLevelMinus2; 934 #endif935 749 public: 936 750 TComPPS(); … … 951 765 Void setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b; } 952 766 953 #if !H0566_TLA 954 UInt getNumTLayerSwitchingFlags() { return m_uiNumTlayerSwitchingFlags; } 955 Void setNumTLayerSwitchingFlags( UInt uiNumTlayerSwitchingFlags ) { assert( uiNumTlayerSwitchingFlags < MAX_TLAYER ); m_uiNumTlayerSwitchingFlags = uiNumTlayerSwitchingFlags; } 956 957 Bool getTLayerSwitchingFlag( UInt uiTLayer ) { assert( uiTLayer < MAX_TLAYER ); return m_abTLayerSwitchingFlag[ uiTLayer ]; } 958 Void setTLayerSwitchingFlag( UInt uiTLayer, Bool bValue ) { m_abTLayerSwitchingFlag[ uiTLayer ] = bValue; } 959 #endif 960 961 #if !RPS_IN_SPS 962 Bool getLongTermRefsPresent() { return m_bLongTermRefsPresent; } 963 Void setLongTermRefsPresent(Bool b) { m_bLongTermRefsPresent=b; } 964 #endif 767 965 768 Void setSPS ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; } 966 769 TComSPS* getSPS () { return m_pcSPS; } 967 #if !RPS_IN_SPS968 Void setRPSList ( TComRPSList* RPSList ) { m_RPSList = RPSList; }969 TComRPSList* getRPSList () { return m_RPSList; }970 #endif971 770 Void setMaxCuDQPDepth ( UInt u ) { m_uiMaxCuDQPDepth = u; } 972 771 UInt getMaxCuDQPDepth () { return m_uiMaxCuDQPDepth;} … … 985 784 Void setWPBiPredIdc ( UInt u ) { m_uiBiPredIdc = u; } 986 785 987 #if H0388988 786 Void setOutputFlagPresentFlag( Bool b ) { m_OutputFlagPresentFlag = b; } 989 787 Bool getOutputFlagPresentFlag() { return m_OutputFlagPresentFlag; } 990 #endif991 788 992 789 Void setTileBehaviorControlPresentFlag ( Int i ) { m_iTileBehaviorControlPresentFlag = i; } … … 998 795 Void setUniformSpacingIdr ( Int i ) { m_iUniformSpacingIdr = i; } 999 796 Int getUniformSpacingIdr () { return m_iUniformSpacingIdr; } 1000 #if !REMOVE_TILE_DEPENDENCE1001 Void setTileBoundaryIndependenceIdr ( Int i ) { m_iTileBoundaryIndependenceIdr = i; }1002 Int getTileBoundaryIndependenceIdr () { return m_iTileBoundaryIndependenceIdr; }1003 #endif1004 797 Void setNumColumnsMinus1 ( Int i ) { m_iNumColumnsMinus1 = i; } 1005 798 Int getNumColumnsMinus1 () { return m_iNumColumnsMinus1; } … … 1034 827 Void setEntropyCodingMode(Int iEntropyCodingMode) { m_iEntropyCodingMode = iEntropyCodingMode; } 1035 828 Int getEntropyCodingMode() { return m_iEntropyCodingMode; } 1036 #if !WPP_SIMPLIFICATION1037 Void setEntropyCodingSynchro(Int iEntropyCodingSynchro) { m_iEntropyCodingSynchro = iEntropyCodingSynchro; }1038 Int getEntropyCodingSynchro() { return m_iEntropyCodingSynchro; }1039 Void setCabacIstateReset(Bool bCabacIstateReset) { m_bCabacIstateReset = bCabacIstateReset; }1040 Bool getCabacIstateReset() { return m_bCabacIstateReset; }1041 #endif1042 829 Void setNumSubstreams(Int iNumSubstreams) { m_iNumSubstreams = iNumSubstreams; } 1043 830 Int getNumSubstreams() { return m_iNumSubstreams; } 1044 831 1045 #if MULTIBITS_DATA_HIDING1046 832 Void setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; } 1047 833 Void setTSIG( Int tsig ) { m_signHidingThreshold = tsig; } 1048 834 Int getSignHideFlag() { return m_signHideFlag; } 1049 835 Int getTSIG() { return m_signHidingThreshold; } 1050 #endif1051 836 1052 837 Void setEnableTMVPFlag( Bool b ) { m_enableTMVPFlag = b; } … … 1063 848 #endif 1064 849 #endif 1065 #if DBL_CONTROL1066 850 Void setDeblockingFilterControlPresent ( Bool bValue ) { m_DeblockingFilterControlPresent = bValue; } 1067 851 Bool getDeblockingFilterControlPresent () { return m_DeblockingFilterControlPresent; } 1068 #endif1069 #if PARALLEL_MERGE1070 852 UInt getLog2ParallelMergeLevelMinus2 () { return m_log2ParallelMergeLevelMinus2; } 1071 853 Void setLog2ParallelMergeLevelMinus2 (UInt mrgLevel) { m_log2ParallelMergeLevelMinus2 = mrgLevel; } 1072 #endif1073 854 }; 1074 855 … … 1087 868 Int* getScalingListDefaultAddress (UInt sizeId, UInt listId); //!< get default matrix coefficient 1088 869 Void processDefaultMarix (UInt sizeId, UInt listId); 1089 #if SCALING_LIST1090 870 Void setScalingListDC (UInt sizeId, UInt listId, UInt u) { m_scalingListDC[sizeId][listId] = u; } //!< set DC value 1091 871 Int getScalingListDC (UInt sizeId, UInt listId) { return m_scalingListDC[sizeId][listId]; } //!< get DC value … … 1093 873 Void setUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId, Bool b) { m_useDefaultScalingMatrixFlag[sizeId][listId] = b; } //!< set default matrix enabled/disabled in each matrix 1094 874 Bool getUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId) { return m_useDefaultScalingMatrixFlag[sizeId][listId]; } //!< get default matrix enabled/disabled in each matrix 1095 #endif1096 875 Void processRefMatrix (UInt sizeId, UInt listId , UInt refListId ); 1097 876 Bool xParseScalingList (char* pchFile); … … 1100 879 Void init (); 1101 880 Void destroy (); 1102 #if SCALING_LIST1103 881 Int m_scalingListDC [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16 1104 882 Bool m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag 1105 #endif1106 883 UInt m_refMatrixId [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID 1107 884 Bool m_scalingListPresentFlag; //!< flag for using default matrix … … 1124 901 Bool getAlfEnabled () {return m_bAlfEnabled; } //!< get ALF enabled/disabled in APS 1125 902 1126 #if LCU_SYNTAX_ALF1127 903 AlfParamSet* getAlfParam () {return m_alfParamSet;} 1128 #else1129 ALFParam* getAlfParam () {return m_pAlfParam; } //!< get ALF parameters in APS1130 #endif1131 904 SAOParam* getSaoParam () {return m_pSaoParam; } //!< get SAO parameters in APS 1132 905 … … 1151 924 Bool getScalingListEnabled () { return m_scalingListEnabled; } //!< get ScalingList enabled/disabled in APS 1152 925 TComScalingList* getScalingList () { return m_scalingList; } //!< get ScalingList class pointer in APS 1153 #if SAO_UNIT_INTERLEAVING1154 926 Bool getSaoInterleavingFlag() {return m_saoInterleavingFlag;} //!< get SAO interleaving flag in APS 1155 927 Void setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;} //!< set SAO interleaving flag in APS 1156 #endif1157 928 1158 929 private: … … 1161 932 Bool m_bAlfEnabled; //!< ALF enabled/disabled in APS (true for enabled) 1162 933 SAOParam* m_pSaoParam; //!< SAO parameter object pointer 1163 #if LCU_SYNTAX_ALF1164 934 AlfParamSet* m_alfParamSet; 1165 #else1166 ALFParam* m_pAlfParam; //!< ALF parameter object pointer1167 #endif1168 935 Bool m_loopFilterOffsetInAPS; //< offset for deblocking filter in 0 = slice header, 1 = APS 1169 936 Bool m_loopFilterDisable; //< Deblocking filter enabled/disabled in APS … … 1172 939 Bool m_scalingListEnabled; //!< ScalingList enabled/disabled in APS (true for enabled) 1173 940 TComScalingList* m_scalingList; //!< ScalingList class pointer 1174 #if SAO_UNIT_INTERLEAVING1175 941 Bool m_saoInterleavingFlag; //!< SAO interleaving flag 1176 #endif1177 942 1178 943 public: … … 1206 971 bool m_alfEnabledFlag; 1207 972 bool m_saoEnabledFlag; 1208 #if SAO_UNIT_INTERLEAVING1209 973 bool m_saoInterleavingFlag; ///< SAO interleaving flag 1210 974 bool m_saoEnabledFlagCb; ///< SAO Cb enabled flag 1211 975 bool m_saoEnabledFlagCr; ///< SAO Cr enabled flag 1212 #endif1213 976 Int m_iPPSId; ///< picture parameter set ID 1214 #if H03881215 977 Bool m_PicOutputFlag; ///< pic_output_flag 1216 #endif1217 978 Int m_iPOC; 1218 979 Int m_iLastIDR; … … 1248 1009 1249 1010 Bool m_bCheckLDC; 1011 #if QC_TMVP_MRG_REFIDX_C0047 1012 Int m_aiNewRefIdx [2]; 1013 #endif 1250 1014 1251 1015 // Data … … 1265 1029 #endif 1266 1030 #if QC_IV_AS_LT_B0046 1267 Bool m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture1031 Bool m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture 1268 1032 #endif 1269 1033 TComSPS* m_pcSPS; … … 1328 1092 #endif 1329 1093 1330 #if H0111_MVD_L1_ZERO1331 1094 Bool m_bLMvdL1Zero; 1332 #endif1333 #if TILES_WPP_ENTRY_POINT_SIGNALLING1334 1095 Int m_numEntryPointOffsets; 1335 #endif1336 1096 1337 1097 Int m_viewId; … … 1340 1100 Int m_aaiCodedOffset[2][MAX_VIEW_NUM]; 1341 1101 1342 #if SONY_COLPIC_AVAILABILITY|QC_MVHEVC_B00461343 Int m_iViewOrderIdx;1344 #endif1345 1102 #if LGE_ILLUCOMP_B0045 1346 1103 Bool m_bApplyIC; 1104 #endif 1105 #if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046 1106 Bool m_bIVScalingFlag; 1107 Int m_iViewOrderIdx; // will be changed to view_id 1108 #endif 1109 1110 #if MERL_VSP_C0152 1111 TComPic* m_apcRefPicBaseTxt; 1112 TComPic* m_apcRefPicBaseDepth; 1113 Int* m_aiShiftLUT; 1114 Int m_iShiftPrec; 1347 1115 #endif 1348 1116 … … 1380 1148 Void setAPSId ( Int Id) { m_iAPSId =Id; } //!< set APS ID 1381 1149 Int getAPSId () { return m_iAPSId; } //!< get APS ID 1382 #if H03881383 1150 Void setPicOutputFlag( Bool b ) { m_PicOutputFlag = b; } 1384 1151 Bool getPicOutputFlag() { return m_PicOutputFlag; } 1385 #endif1386 1152 Void setAlfEnabledFlag(Bool s) {m_alfEnabledFlag =s; } 1387 1153 Bool getAlfEnabledFlag() { return m_alfEnabledFlag; } 1388 1154 Void setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; } 1389 1155 Bool getSaoEnabledFlag() { return m_saoEnabledFlag; } 1390 #if SAO_UNIT_INTERLEAVING1391 1156 Void setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag 1392 1157 Bool getSaoInterleavingFlag() { return m_saoInterleavingFlag; } //!< get SAO interleaving flag … … 1395 1160 Void setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; } //!< set SAO Cr enabled flag 1396 1161 Bool getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; } //!< get SAO Cr enabled flag 1397 #endif1398 1162 Void setRPS ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; } 1399 1163 TComReferencePictureSet* getRPS () { return m_pcRPS; } … … 1430 1194 Int getRefViewId ( RefPicList e, Int iRefIdx) { return m_aiRefViewIdList[e][iRefIdx]; } 1431 1195 TComPic* getTexturePic () const { return m_pcTexturePic; } 1432 #if SONY_COLPIC_AVAILABILITY1433 Int getViewOrderIdx () { return m_iViewOrderIdx; }1434 #endif1435 1196 Int getDepth () { return m_iDepth; } 1436 1197 UInt getColDir () { return m_uiColDir; } … … 1440 1201 #endif 1441 1202 Bool getCheckLDC () { return m_bCheckLDC; } 1442 #if H0111_MVD_L1_ZERO1443 1203 Bool getMvdL1ZeroFlag () { return m_bLMvdL1Zero; } 1444 #endif1445 1204 Int getRefIdxOfLC (RefPicList e, Int iRefIdx) { return m_iRefIdxOfLC[e][iRefIdx]; } 1446 1205 Int getListIdFromIdxOfLC(Int iRefIdx) { return m_eListIdFromIdxOfLC[iRefIdx]; } … … 1482 1241 Void setRefViewId ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefViewIdList[e][iRefIdx] = i; } 1483 1242 Void setTexturePic ( TComPic *pcTexturePic ) { m_pcTexturePic = pcTexturePic; } 1484 #if SONY_COLPIC_AVAILABILITY1485 Void setViewOrderIdx ( Int i ) { m_iViewOrderIdx = i; }1486 #endif1487 1243 Void setNumRefIdx ( RefPicList e, Int i ) { m_aiNumRefIdx[e] = i; } 1488 1244 Void setPic ( TComPic* p ) { m_pcPic = p; } … … 1499 1255 #endif 1500 1256 Void setCheckLDC ( Bool b ) { m_bCheckLDC = b; } 1501 #if H0111_MVD_L1_ZERO1502 1257 Void setMvdL1ZeroFlag ( Bool b) { m_bLMvdL1Zero = b; } 1503 #endif1504 1258 1505 1259 Bool isIntra () { return m_eSliceType == I_SLICE; } … … 1539 1293 Void setTLayer ( UInt uiTLayer ) { m_uiTLayer = uiTLayer; } 1540 1294 1541 #if !H0566_TLA1542 Bool getTLayerSwitchingFlag() { return m_bTLayerSwitchingFlag; }1543 Void setTLayerSwitchingFlag( Bool bValue ) { m_bTLayerSwitchingFlag = bValue; }1544 #endif1545 1295 1546 1296 Void setTLayerInfo( UInt uiTLayer ); 1547 1297 Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 1548 1298 Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList); 1549 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS1299 #if H0566_TLA_SET_FOR_SWITCHING_POINTS 1550 1300 Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList); 1551 1301 #endif 1552 #if START_DECODING_AT_CRA1553 1302 Int checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess = 0); 1554 #else1555 Int checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag);1556 #endif1557 1303 Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet); 1558 1304 … … 1628 1374 Int getCABACinitIDC() {return m_cabacInitIdc; } //!< get CABAC initial IDC number 1629 1375 #endif 1630 #if TILES_WPP_ENTRY_POINT_SIGNALLING1631 1376 Void setNumEntryPointOffsets(Int val) { m_numEntryPointOffsets = val; } 1632 1377 Int getNumEntryPointOffsets() { return m_numEntryPointOffsets; } 1633 #endif1634 1378 1635 1379 Void setViewId( Int viewId ) { m_viewId = viewId; } … … 1653 1397 Bool getApplyIC () { return m_bApplyIC; } 1654 1398 Void xSetApplyIC (); 1399 #endif 1400 #if QC_TMVP_MRG_REFIDX_C0047 1401 Int getNewRefIdx ( RefPicList e ) { return m_aiNewRefIdx[e]; } 1402 Void setNewRefIdx ( RefPicList e, Int i ) { m_aiNewRefIdx[e] = i; } 1403 #endif 1404 #if INTER_VIEW_VECTOR_SCALING_C0115 1405 Void setIVScalingFlag( Bool val ) { m_bIVScalingFlag = val; } 1406 Bool getIVScalingFlag() { return m_bIVScalingFlag; } 1407 Void setViewOrderIdx ( Int i ) { m_iViewOrderIdx = i; } // will be changed to view_id 1408 Int getViewOrderIdx () { return m_iViewOrderIdx; } // will be changed to view_id 1409 #endif 1410 1411 #if MERL_VSP_C0152 1412 TComPic* getRefPicBaseTxt () { return m_apcRefPicBaseTxt; } 1413 Void setRefPicBaseTxt ( TComPic* RefPic) { m_apcRefPicBaseTxt = RefPic; } 1414 TComPic* getRefPicBaseDepth () { return m_apcRefPicBaseDepth; } 1415 Void setRefPicBaseDepth ( TComPic* RefPic) { m_apcRefPicBaseDepth = RefPic; } 1416 1417 Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; } 1418 Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; } 1655 1419 #endif 1656 1420 -
trunk/source/Lib/TLibCommon/TComTrQuant.cpp
r56 r296 180 180 181 181 182 #if H0736_AVC_STYLE_QP_RANGE183 182 /** Set qP for Quantization. 184 183 * \param qpy QPy … … 214 213 m_cQP.setQpParam( qpScaled, bLowpass, eSliceType ); 215 214 } 216 #else217 /// Including Chroma QP Parameter setting218 Void TComTrQuant::setQPforQuant( Int iQP, Bool bLowpass, SliceType eSliceType, TextType eTxtType, Int Shift)219 {220 iQP = Clip3( MIN_QP, MAX_QP, iQP + Shift );221 222 if(eTxtType != TEXT_LUMA) //Chroma223 {224 iQP = g_aucChromaScale[ iQP ];225 }226 227 m_cQP.setQpParam( iQP, bLowpass, eSliceType );228 }229 #endif230 215 231 216 #if MATRIX_MULT … … 421 406 * \param shift specifies right shift after 1D transform 422 407 */ 423 #if !UNIFIED_TRANSFORM424 void partialButterfly4(short src[4][4],short dst[4][4],int shift)425 {426 int j;427 int E[2],O[2];428 int add = 1<<(shift-1);429 430 for (j=0; j<4; j++)431 {432 /* E and O */433 E[0] = src[j][0] + src[j][3];434 O[0] = src[j][0] - src[j][3];435 E[1] = src[j][1] + src[j][2];436 O[1] = src[j][1] - src[j][2];437 438 dst[0][j] = (g_aiT4[0][0]*E[0] + g_aiT4[0][1]*E[1] + add)>>shift;439 dst[2][j] = (g_aiT4[2][0]*E[0] + g_aiT4[2][1]*E[1] + add)>>shift;440 dst[1][j] = (g_aiT4[1][0]*O[0] + g_aiT4[1][1]*O[1] + add)>>shift;441 dst[3][j] = (g_aiT4[3][0]*O[0] + g_aiT4[3][1]*O[1] + add)>>shift;442 }443 }444 #endif445 408 446 409 void partialButterfly4(short *src,short *dst,int shift, int line) … … 470 433 // Fast DST Algorithm. Full matrix multiplication for DST and Fast DST algorithm 471 434 // give identical results 472 #if UNIFIED_TRANSFORM473 435 void fastForwardDst(short *block,short *coeff,int shift) // input block, output coeff 474 #else475 void fastForwardDst(short block[4][4],short coeff[4][4],int shift) // input block, output coeff476 #endif477 436 { 478 437 int i, c[4]; … … 481 440 { 482 441 // Intermediate Variables 483 #if UNIFIED_TRANSFORM484 442 c[0] = block[4*i+0] + block[4*i+3]; 485 443 c[1] = block[4*i+1] + block[4*i+3]; … … 491 449 coeff[ 8+i] = ( 29 * c[2] + 55 * c[0] - c[3] + rnd_factor ) >> shift; 492 450 coeff[12+i] = ( 55 * c[2] - 29 * c[1] + c[3] + rnd_factor ) >> shift; 493 #else 494 c[0] = block[i][0] + block[i][3]; 495 c[1] = block[i][1] + block[i][3]; 496 c[2] = block[i][0] - block[i][1]; 497 c[3] = 74* block[i][2]; 498 499 coeff[0][i] = ( 29 * c[0] + 55 * c[1] + c[3] + rnd_factor ) >> shift; 500 coeff[1][i] = ( 74 * (block[i][0]+ block[i][1] - block[i][3]) + rnd_factor ) >> shift; 501 coeff[2][i] = ( 29 * c[2] + 55 * c[0] - c[3] + rnd_factor ) >> shift; 502 coeff[3][i] = ( 55 * c[2] - 29 * c[1] + c[3] + rnd_factor ) >> shift; 503 #endif 504 } 505 } 506 507 #if UNIFIED_TRANSFORM 451 } 452 } 453 508 454 void fastInverseDst(short *tmp,short *block,int shift) // input tmp, output block 509 #else510 void fastInverseDst(short tmp[4][4],short block[4][4],int shift) // input tmp, output block511 #endif512 455 { 513 456 int i, c[4]; … … 516 459 { 517 460 // Intermediate Variables 518 #if UNIFIED_TRANSFORM519 461 c[0] = tmp[ i] + tmp[ 8+i]; 520 462 c[1] = tmp[8+i] + tmp[12+i]; … … 526 468 block[4*i+2] = Clip3( -32768, 32767, ( 74 * (tmp[i] - tmp[8+i] + tmp[12+i]) + rnd_factor ) >> shift ); 527 469 block[4*i+3] = Clip3( -32768, 32767, ( 55 * c[0] + 29 * c[2] - c[3] + rnd_factor ) >> shift ); 528 #else 529 c[0] = tmp[0][i] + tmp[2][i]; 530 c[1] = tmp[2][i] + tmp[3][i]; 531 c[2] = tmp[0][i] - tmp[3][i]; 532 c[3] = 74* tmp[1][i]; 533 534 block[i][0] = Clip3( -32768, 32767, ( 29 * c[0] + 55 * c[1] + c[3] + rnd_factor ) >> shift ); 535 block[i][1] = Clip3( -32768, 32767, ( 55 * c[2] - 29 * c[1] + c[3] + rnd_factor ) >> shift ); 536 block[i][2] = Clip3( -32768, 32767, ( 74 * (tmp[0][i] - tmp[2][i] + tmp[3][i]) + rnd_factor ) >> shift ); 537 block[i][3] = Clip3( -32768, 32767, ( 55 * c[0] + 29 * c[2] - c[3] + rnd_factor ) >> shift ); 538 #endif 539 } 540 } 541 #if !UNIFIED_TRANSFORM 542 /** 4x4 forward transform (2D) 543 * \param block input data (residual) 544 * \param coeff output data (transform coefficients) 545 * \param uiMode is Intra Prediction mode used in Mode-Dependent DCT/DST only 546 */ 547 void xTr4(short block[4][4],short coeff[4][4],UInt uiMode) 548 { 549 #if FULL_NBIT 550 int shift_1st = 1 + g_uiBitDepth - 8; // log2(4) - 1 + g_uiBitDepth - 8 551 #else 552 int shift_1st = 1 + g_uiBitIncrement; // log2(4) - 1 + g_uiBitIncrement 553 #endif 554 int shift_2nd = 8; // log2(4) + 6 555 short tmp[4][4]; 556 #if LOGI_INTRA_NAME_3MPM 557 if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25))) // Check for DCT or DST 558 #else 559 if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode])// Check for DCT or DST 560 #endif 561 { 562 fastForwardDst(block,tmp,shift_1st); // Forward DST BY FAST ALGORITHM, block input, tmp output 563 } 564 else 565 { 566 partialButterfly4(block,tmp,shift_1st); 567 } 568 569 #if LOGI_INTRA_NAME_3MPM 570 if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34))) // Check for DCT or DST 571 #else 572 if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] ) // Check for DCT or DST 573 #endif 574 { 575 fastForwardDst(tmp,coeff,shift_2nd); // Forward DST BY FAST ALGORITHM, tmp input, coeff output 576 } 577 else 578 { 579 partialButterfly4(tmp,coeff,shift_2nd); 580 } 581 } 582 583 /** 4x4 inverse transform implemented using partial butterfly structure (1D) 584 * \param src input data (transform coefficients) 585 * \param dst output data (residual) 586 * \param shift specifies right shift after 1D transform 587 */ 588 void partialButterflyInverse4(short src[4][4],short dst[4][4],int shift) 589 { 590 int j; 591 int E[2],O[2]; 592 int add = 1<<(shift-1); 593 594 for (j=0; j<4; j++) 595 { 596 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ 597 O[0] = g_aiT4[1][0]*src[1][j] + g_aiT4[3][0]*src[3][j]; 598 O[1] = g_aiT4[1][1]*src[1][j] + g_aiT4[3][1]*src[3][j]; 599 E[0] = g_aiT4[0][0]*src[0][j] + g_aiT4[2][0]*src[2][j]; 600 E[1] = g_aiT4[0][1]*src[0][j] + g_aiT4[2][1]*src[2][j]; 601 602 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ 603 dst[j][0] = Clip3( -32768, 32767, (E[0] + O[0] + add)>>shift ); 604 dst[j][1] = Clip3( -32768, 32767, (E[1] + O[1] + add)>>shift ); 605 dst[j][2] = Clip3( -32768, 32767, (E[1] - O[1] + add)>>shift ); 606 dst[j][3] = Clip3( -32768, 32767, (E[0] - O[0] + add)>>shift ); 607 } 608 } 609 #endif 470 } 471 } 610 472 611 473 void partialButterflyInverse4(short *src,short *dst,int shift, int line) … … 634 496 } 635 497 636 #if !UNIFIED_TRANSFORM637 /** 4x4 inverse transform (2D)638 * \param coeff input data (transform coefficients)639 * \param block output data (residual)640 * \param uiMode is Intra Prediction mode used in Mode-Dependent DCT/DST only641 */642 void xITr4(short coeff[4][4],short block[4][4], UInt uiMode)643 {644 int shift_1st = SHIFT_INV_1ST;645 #if FULL_NBIT646 int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);647 #else648 int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;649 #endif650 short tmp[4][4];651 652 #if LOGI_INTRA_NAME_3MPM653 if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34))) // Check for DCT or DST654 #else655 if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] ) // Check for DCT or DST656 #endif657 {658 fastInverseDst(coeff,tmp,shift_1st); // Inverse DST by FAST Algorithm, coeff input, tmp output659 }660 else661 {662 partialButterflyInverse4(coeff,tmp,shift_1st);663 }664 #if LOGI_INTRA_NAME_3MPM665 if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25))) // Check for DCT or DST666 #else667 if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode] ) // Check for DCT or DST668 #endif669 {670 fastInverseDst(tmp,block,shift_2nd); // Inverse DST by FAST Algorithm, tmp input, coeff output671 }672 else673 {674 partialButterflyInverse4(tmp,block,shift_2nd);675 }676 }677 678 /** 8x8 forward transform implemented using partial butterfly structure (1D)679 * \param src input data (residual)680 * \param dst output data (transform coefficients)681 * \param shift specifies right shift after 1D transform682 */683 void partialButterfly8(short src[8][8],short dst[8][8],int shift)684 {685 int j,k;686 int E[4],O[4];687 int EE[2],EO[2];688 int add = 1<<(shift-1);689 690 for (j=0; j<8; j++)691 {692 /* E and O*/693 for (k=0;k<4;k++)694 {695 E[k] = src[j][k] + src[j][7-k];696 O[k] = src[j][k] - src[j][7-k];697 }698 /* EE and EO */699 EE[0] = E[0] + E[3];700 EO[0] = E[0] - E[3];701 EE[1] = E[1] + E[2];702 EO[1] = E[1] - E[2];703 704 dst[0][j] = (g_aiT8[0][0]*EE[0] + g_aiT8[0][1]*EE[1] + add)>>shift;705 dst[4][j] = (g_aiT8[4][0]*EE[0] + g_aiT8[4][1]*EE[1] + add)>>shift;706 dst[2][j] = (g_aiT8[2][0]*EO[0] + g_aiT8[2][1]*EO[1] + add)>>shift;707 dst[6][j] = (g_aiT8[6][0]*EO[0] + g_aiT8[6][1]*EO[1] + add)>>shift;708 709 dst[1][j] = (g_aiT8[1][0]*O[0] + g_aiT8[1][1]*O[1] + g_aiT8[1][2]*O[2] + g_aiT8[1][3]*O[3] + add)>>shift;710 dst[3][j] = (g_aiT8[3][0]*O[0] + g_aiT8[3][1]*O[1] + g_aiT8[3][2]*O[2] + g_aiT8[3][3]*O[3] + add)>>shift;711 dst[5][j] = (g_aiT8[5][0]*O[0] + g_aiT8[5][1]*O[1] + g_aiT8[5][2]*O[2] + g_aiT8[5][3]*O[3] + add)>>shift;712 dst[7][j] = (g_aiT8[7][0]*O[0] + g_aiT8[7][1]*O[1] + g_aiT8[7][2]*O[2] + g_aiT8[7][3]*O[3] + add)>>shift;713 }714 }715 #endif716 498 717 499 void partialButterfly8(short *src,short *dst,int shift, int line) … … 751 533 } 752 534 753 #if !UNIFIED_TRANSFORM 754 /** 8x8 forward transform (2D) 755 * \param block input data (residual) 756 * \param coeff output data (transform coefficients) 757 */ 758 void xTr8(short block[8][8],short coeff[8][8]) 759 { 760 #if FULL_NBIT 761 int shift_1st = 2 + g_uiBitDepth - 8; // log2(8) - 1 + g_uiBitDepth - 8 762 #else 763 int shift_1st = 2 + g_uiBitIncrement; // log2(8) - 1 + g_uiBitIncrement 764 #endif 765 int shift_2nd = 9; // log2(8) + 6 766 short tmp[8][8]; 767 768 partialButterfly8(block,tmp,shift_1st); 769 partialButterfly8(tmp,coeff,shift_2nd); 770 } 771 772 /** 8x8 inverse transform implemented using partial butterfly structure (1D) 773 * \param src input data (transform coefficients) 774 * \param dst output data (residual) 775 * \param shift specifies right shift after 1D transform 776 */ 777 void partialButterflyInverse8(short src[8][8],short dst[8][8],int shift) 535 536 void partialButterflyInverse8(short *src,short *dst,int shift, int line) 778 537 { 779 538 int j,k; … … 782 541 int add = 1<<(shift-1); 783 542 784 for (j=0; j< 8; j++)543 for (j=0; j<line; j++) 785 544 { 786 545 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ 787 546 for (k=0;k<4;k++) 788 547 { 789 O[k] = g_aiT8[ 1][k]*src[ 1][j] + g_aiT8[ 3][k]*src[ 3][j] + g_aiT8[ 5][k]*src[ 5][j] + g_aiT8[ 7][k]*src[ 7][j];790 } 791 792 EO[0] = g_aiT8[2][0]*src[ 2][j] + g_aiT8[6][0]*src[6][j];793 EO[1] = g_aiT8[2][1]*src[ 2][j] + g_aiT8[6][1]*src[6][j];794 EE[0] = g_aiT8[0][0]*src[ 0][j] + g_aiT8[4][0]*src[4][j];795 EE[1] = g_aiT8[0][1]*src[ 0][j] + g_aiT8[4][1]*src[4][j];548 O[k] = g_aiT8[ 1][k]*src[line] + g_aiT8[ 3][k]*src[3*line] + g_aiT8[ 5][k]*src[5*line] + g_aiT8[ 7][k]*src[7*line]; 549 } 550 551 EO[0] = g_aiT8[2][0]*src[ 2*line ] + g_aiT8[6][0]*src[ 6*line ]; 552 EO[1] = g_aiT8[2][1]*src[ 2*line ] + g_aiT8[6][1]*src[ 6*line ]; 553 EE[0] = g_aiT8[0][0]*src[ 0 ] + g_aiT8[4][0]*src[ 4*line ]; 554 EE[1] = g_aiT8[0][1]*src[ 0 ] + g_aiT8[4][1]*src[ 4*line ]; 796 555 797 556 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ … … 802 561 for (k=0;k<4;k++) 803 562 { 804 dst[j][k] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );805 dst[j][k+4] = Clip3( -32768, 32767, (E[3-k] - O[3-k] + add)>>shift );806 }807 }808 }809 #endif810 811 void partialButterflyInverse8(short *src,short *dst,int shift, int line)812 {813 int j,k;814 int E[4],O[4];815 int EE[2],EO[2];816 int add = 1<<(shift-1);817 818 for (j=0; j<line; j++)819 {820 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */821 for (k=0;k<4;k++)822 {823 O[k] = g_aiT8[ 1][k]*src[line] + g_aiT8[ 3][k]*src[3*line] + g_aiT8[ 5][k]*src[5*line] + g_aiT8[ 7][k]*src[7*line];824 }825 826 EO[0] = g_aiT8[2][0]*src[ 2*line ] + g_aiT8[6][0]*src[ 6*line ];827 EO[1] = g_aiT8[2][1]*src[ 2*line ] + g_aiT8[6][1]*src[ 6*line ];828 EE[0] = g_aiT8[0][0]*src[ 0 ] + g_aiT8[4][0]*src[ 4*line ];829 EE[1] = g_aiT8[0][1]*src[ 0 ] + g_aiT8[4][1]*src[ 4*line ];830 831 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */832 E[0] = EE[0] + EO[0];833 E[3] = EE[0] - EO[0];834 E[1] = EE[1] + EO[1];835 E[2] = EE[1] - EO[1];836 for (k=0;k<4;k++)837 {838 563 dst[ k ] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift ); 839 564 dst[ k+4 ] = Clip3( -32768, 32767, (E[3-k] - O[3-k] + add)>>shift ); … … 844 569 } 845 570 846 #if !UNIFIED_TRANSFORM 847 /** 8x8 inverse transform (2D) 848 * \param coeff input data (transform coefficients) 849 * \param block output data (residual) 850 */ 851 void xITr8(short coeff[8][8],short block[8][8]) 571 572 void partialButterfly16(short *src,short *dst,int shift, int line) 573 { 574 int j,k; 575 int E[8],O[8]; 576 int EE[4],EO[4]; 577 int EEE[2],EEO[2]; 578 int add = 1<<(shift-1); 579 580 for (j=0; j<line; j++) 581 { 582 /* E and O*/ 583 for (k=0;k<8;k++) 584 { 585 E[k] = src[k] + src[15-k]; 586 O[k] = src[k] - src[15-k]; 587 } 588 /* EE and EO */ 589 for (k=0;k<4;k++) 590 { 591 EE[k] = E[k] + E[7-k]; 592 EO[k] = E[k] - E[7-k]; 593 } 594 /* EEE and EEO */ 595 EEE[0] = EE[0] + EE[3]; 596 EEO[0] = EE[0] - EE[3]; 597 EEE[1] = EE[1] + EE[2]; 598 EEO[1] = EE[1] - EE[2]; 599 600 dst[ 0 ] = (g_aiT16[ 0][0]*EEE[0] + g_aiT16[ 0][1]*EEE[1] + add)>>shift; 601 dst[ 8*line ] = (g_aiT16[ 8][0]*EEE[0] + g_aiT16[ 8][1]*EEE[1] + add)>>shift; 602 dst[ 4*line ] = (g_aiT16[ 4][0]*EEO[0] + g_aiT16[ 4][1]*EEO[1] + add)>>shift; 603 dst[ 12*line] = (g_aiT16[12][0]*EEO[0] + g_aiT16[12][1]*EEO[1] + add)>>shift; 604 605 for (k=2;k<16;k+=4) 606 { 607 dst[ k*line ] = (g_aiT16[k][0]*EO[0] + g_aiT16[k][1]*EO[1] + g_aiT16[k][2]*EO[2] + g_aiT16[k][3]*EO[3] + add)>>shift; 608 } 609 610 for (k=1;k<16;k+=2) 611 { 612 dst[ k*line ] = (g_aiT16[k][0]*O[0] + g_aiT16[k][1]*O[1] + g_aiT16[k][2]*O[2] + g_aiT16[k][3]*O[3] + 613 g_aiT16[k][4]*O[4] + g_aiT16[k][5]*O[5] + g_aiT16[k][6]*O[6] + g_aiT16[k][7]*O[7] + add)>>shift; 614 } 615 616 src += 16; 617 dst ++; 618 619 } 620 } 621 622 623 void partialButterflyInverse16(short *src,short *dst,int shift, int line) 624 { 625 int j,k; 626 int E[8],O[8]; 627 int EE[4],EO[4]; 628 int EEE[2],EEO[2]; 629 int add = 1<<(shift-1); 630 631 for (j=0; j<line; j++) 632 { 633 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ 634 for (k=0;k<8;k++) 635 { 636 O[k] = g_aiT16[ 1][k]*src[ line] + g_aiT16[ 3][k]*src[ 3*line] + g_aiT16[ 5][k]*src[ 5*line] + g_aiT16[ 7][k]*src[ 7*line] + 637 g_aiT16[ 9][k]*src[ 9*line] + g_aiT16[11][k]*src[11*line] + g_aiT16[13][k]*src[13*line] + g_aiT16[15][k]*src[15*line]; 638 } 639 for (k=0;k<4;k++) 640 { 641 EO[k] = g_aiT16[ 2][k]*src[ 2*line] + g_aiT16[ 6][k]*src[ 6*line] + g_aiT16[10][k]*src[10*line] + g_aiT16[14][k]*src[14*line]; 642 } 643 EEO[0] = g_aiT16[4][0]*src[ 4*line ] + g_aiT16[12][0]*src[ 12*line ]; 644 EEE[0] = g_aiT16[0][0]*src[ 0 ] + g_aiT16[ 8][0]*src[ 8*line ]; 645 EEO[1] = g_aiT16[4][1]*src[ 4*line ] + g_aiT16[12][1]*src[ 12*line ]; 646 EEE[1] = g_aiT16[0][1]*src[ 0 ] + g_aiT16[ 8][1]*src[ 8*line ]; 647 648 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ 649 for (k=0;k<2;k++) 650 { 651 EE[k] = EEE[k] + EEO[k]; 652 EE[k+2] = EEE[1-k] - EEO[1-k]; 653 } 654 for (k=0;k<4;k++) 655 { 656 E[k] = EE[k] + EO[k]; 657 E[k+4] = EE[3-k] - EO[3-k]; 658 } 659 for (k=0;k<8;k++) 660 { 661 dst[k] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift ); 662 dst[k+8] = Clip3( -32768, 32767, (E[7-k] - O[7-k] + add)>>shift ); 663 } 664 src ++; 665 dst += 16; 666 } 667 } 668 669 670 void partialButterfly32(short *src,short *dst,int shift, int line) 671 { 672 int j,k; 673 int E[16],O[16]; 674 int EE[8],EO[8]; 675 int EEE[4],EEO[4]; 676 int EEEE[2],EEEO[2]; 677 int add = 1<<(shift-1); 678 679 for (j=0; j<line; j++) 680 { 681 /* E and O*/ 682 for (k=0;k<16;k++) 683 { 684 E[k] = src[k] + src[31-k]; 685 O[k] = src[k] - src[31-k]; 686 } 687 /* EE and EO */ 688 for (k=0;k<8;k++) 689 { 690 EE[k] = E[k] + E[15-k]; 691 EO[k] = E[k] - E[15-k]; 692 } 693 /* EEE and EEO */ 694 for (k=0;k<4;k++) 695 { 696 EEE[k] = EE[k] + EE[7-k]; 697 EEO[k] = EE[k] - EE[7-k]; 698 } 699 /* EEEE and EEEO */ 700 EEEE[0] = EEE[0] + EEE[3]; 701 EEEO[0] = EEE[0] - EEE[3]; 702 EEEE[1] = EEE[1] + EEE[2]; 703 EEEO[1] = EEE[1] - EEE[2]; 704 705 dst[ 0 ] = (g_aiT32[ 0][0]*EEEE[0] + g_aiT32[ 0][1]*EEEE[1] + add)>>shift; 706 dst[ 16*line ] = (g_aiT32[16][0]*EEEE[0] + g_aiT32[16][1]*EEEE[1] + add)>>shift; 707 dst[ 8*line ] = (g_aiT32[ 8][0]*EEEO[0] + g_aiT32[ 8][1]*EEEO[1] + add)>>shift; 708 dst[ 24*line ] = (g_aiT32[24][0]*EEEO[0] + g_aiT32[24][1]*EEEO[1] + add)>>shift; 709 for (k=4;k<32;k+=8) 710 { 711 dst[ k*line ] = (g_aiT32[k][0]*EEO[0] + g_aiT32[k][1]*EEO[1] + g_aiT32[k][2]*EEO[2] + g_aiT32[k][3]*EEO[3] + add)>>shift; 712 } 713 for (k=2;k<32;k+=4) 714 { 715 dst[ k*line ] = (g_aiT32[k][0]*EO[0] + g_aiT32[k][1]*EO[1] + g_aiT32[k][2]*EO[2] + g_aiT32[k][3]*EO[3] + 716 g_aiT32[k][4]*EO[4] + g_aiT32[k][5]*EO[5] + g_aiT32[k][6]*EO[6] + g_aiT32[k][7]*EO[7] + add)>>shift; 717 } 718 for (k=1;k<32;k+=2) 719 { 720 dst[ k*line ] = (g_aiT32[k][ 0]*O[ 0] + g_aiT32[k][ 1]*O[ 1] + g_aiT32[k][ 2]*O[ 2] + g_aiT32[k][ 3]*O[ 3] + 721 g_aiT32[k][ 4]*O[ 4] + g_aiT32[k][ 5]*O[ 5] + g_aiT32[k][ 6]*O[ 6] + g_aiT32[k][ 7]*O[ 7] + 722 g_aiT32[k][ 8]*O[ 8] + g_aiT32[k][ 9]*O[ 9] + g_aiT32[k][10]*O[10] + g_aiT32[k][11]*O[11] + 723 g_aiT32[k][12]*O[12] + g_aiT32[k][13]*O[13] + g_aiT32[k][14]*O[14] + g_aiT32[k][15]*O[15] + add)>>shift; 724 } 725 src += 32; 726 dst ++; 727 } 728 } 729 730 731 void partialButterflyInverse32(short *src,short *dst,int shift, int line) 732 { 733 int j,k; 734 int E[16],O[16]; 735 int EE[8],EO[8]; 736 int EEE[4],EEO[4]; 737 int EEEE[2],EEEO[2]; 738 int add = 1<<(shift-1); 739 740 for (j=0; j<line; j++) 741 { 742 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */ 743 for (k=0;k<16;k++) 744 { 745 O[k] = g_aiT32[ 1][k]*src[ line ] + g_aiT32[ 3][k]*src[ 3*line ] + g_aiT32[ 5][k]*src[ 5*line ] + g_aiT32[ 7][k]*src[ 7*line ] + 746 g_aiT32[ 9][k]*src[ 9*line ] + g_aiT32[11][k]*src[ 11*line ] + g_aiT32[13][k]*src[ 13*line ] + g_aiT32[15][k]*src[ 15*line ] + 747 g_aiT32[17][k]*src[ 17*line ] + g_aiT32[19][k]*src[ 19*line ] + g_aiT32[21][k]*src[ 21*line ] + g_aiT32[23][k]*src[ 23*line ] + 748 g_aiT32[25][k]*src[ 25*line ] + g_aiT32[27][k]*src[ 27*line ] + g_aiT32[29][k]*src[ 29*line ] + g_aiT32[31][k]*src[ 31*line ]; 749 } 750 for (k=0;k<8;k++) 751 { 752 EO[k] = g_aiT32[ 2][k]*src[ 2*line ] + g_aiT32[ 6][k]*src[ 6*line ] + g_aiT32[10][k]*src[ 10*line ] + g_aiT32[14][k]*src[ 14*line ] + 753 g_aiT32[18][k]*src[ 18*line ] + g_aiT32[22][k]*src[ 22*line ] + g_aiT32[26][k]*src[ 26*line ] + g_aiT32[30][k]*src[ 30*line ]; 754 } 755 for (k=0;k<4;k++) 756 { 757 EEO[k] = g_aiT32[4][k]*src[ 4*line ] + g_aiT32[12][k]*src[ 12*line ] + g_aiT32[20][k]*src[ 20*line ] + g_aiT32[28][k]*src[ 28*line ]; 758 } 759 EEEO[0] = g_aiT32[8][0]*src[ 8*line ] + g_aiT32[24][0]*src[ 24*line ]; 760 EEEO[1] = g_aiT32[8][1]*src[ 8*line ] + g_aiT32[24][1]*src[ 24*line ]; 761 EEEE[0] = g_aiT32[0][0]*src[ 0 ] + g_aiT32[16][0]*src[ 16*line ]; 762 EEEE[1] = g_aiT32[0][1]*src[ 0 ] + g_aiT32[16][1]*src[ 16*line ]; 763 764 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */ 765 EEE[0] = EEEE[0] + EEEO[0]; 766 EEE[3] = EEEE[0] - EEEO[0]; 767 EEE[1] = EEEE[1] + EEEO[1]; 768 EEE[2] = EEEE[1] - EEEO[1]; 769 for (k=0;k<4;k++) 770 { 771 EE[k] = EEE[k] + EEO[k]; 772 EE[k+4] = EEE[3-k] - EEO[3-k]; 773 } 774 for (k=0;k<8;k++) 775 { 776 E[k] = EE[k] + EO[k]; 777 E[k+8] = EE[7-k] - EO[7-k]; 778 } 779 for (k=0;k<16;k++) 780 { 781 dst[k] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift ); 782 dst[k+16] = Clip3( -32768, 32767, (E[15-k] - O[15-k] + add)>>shift ); 783 } 784 src ++; 785 dst += 32; 786 } 787 } 788 789 790 /** MxN forward transform (2D) 791 * \param block input data (residual) 792 * \param coeff output data (transform coefficients) 793 * \param iWidth input data (width of transform) 794 * \param iHeight input data (height of transform) 795 */ 796 void xTrMxN(short *block,short *coeff, int iWidth, int iHeight, UInt uiMode) 797 { 798 #if FULL_NBIT 799 int shift_1st = g_aucConvertToBit[iWidth] + 1 + g_uiBitDepth - 8; // log2(iWidth) - 1 + g_uiBitDepth - 8 800 #else 801 int shift_1st = g_aucConvertToBit[iWidth] + 1 + g_uiBitIncrement; // log2(iWidth) - 1 + g_uiBitIncrement 802 #endif 803 int shift_2nd = g_aucConvertToBit[iHeight] + 8; // log2(iHeight) + 6 804 805 short tmp[ 64 * 64 ]; 806 807 if( iWidth == 16 && iHeight == 4) 808 { 809 partialButterfly16( block, tmp, shift_1st, iHeight ); 810 partialButterfly4( tmp, coeff, shift_2nd, iWidth ); 811 } 812 else if( iWidth == 32 && iHeight == 8 ) 813 { 814 partialButterfly32( block, tmp, shift_1st, iHeight ); 815 partialButterfly8( tmp, coeff, shift_2nd, iWidth ); 816 } 817 else if( iWidth == 4 && iHeight == 16) 818 { 819 partialButterfly4( block, tmp, shift_1st, iHeight ); 820 partialButterfly16( tmp, coeff, shift_2nd, iWidth ); 821 } 822 else if( iWidth == 8 && iHeight == 32 ) 823 { 824 partialButterfly8( block, tmp, shift_1st, iHeight ); 825 partialButterfly32( tmp, coeff, shift_2nd, iWidth ); 826 } 827 else if( iWidth == 4 && iHeight == 4) 828 { 829 if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25))) // Check for DCT or DST 830 { 831 fastForwardDst(block,tmp,shift_1st); // Forward DST BY FAST ALGORITHM, block input, tmp output 832 } 833 else 834 { 835 partialButterfly4(block, tmp, shift_1st, iHeight); 836 } 837 if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34))) // Check for DCT or DST 838 { 839 fastForwardDst(tmp,coeff,shift_2nd); // Forward DST BY FAST ALGORITHM, tmp input, coeff output 840 } 841 else 842 { 843 partialButterfly4(tmp, coeff, shift_2nd, iWidth); 844 } 845 } 846 else if( iWidth == 8 && iHeight == 8) 847 { 848 partialButterfly8( block, tmp, shift_1st, iHeight ); 849 partialButterfly8( tmp, coeff, shift_2nd, iWidth ); 850 } 851 else if( iWidth == 16 && iHeight == 16) 852 { 853 partialButterfly16( block, tmp, shift_1st, iHeight ); 854 partialButterfly16( tmp, coeff, shift_2nd, iWidth ); 855 } 856 else if( iWidth == 32 && iHeight == 32) 857 { 858 partialButterfly32( block, tmp, shift_1st, iHeight ); 859 partialButterfly32( tmp, coeff, shift_2nd, iWidth ); 860 } 861 } 862 /** MxN inverse transform (2D) 863 * \param coeff input data (transform coefficients) 864 * \param block output data (residual) 865 * \param iWidth input data (width of transform) 866 * \param iHeight input data (height of transform) 867 */ 868 void xITrMxN(short *coeff,short *block, int iWidth, int iHeight, UInt uiMode) 852 869 { 853 870 int shift_1st = SHIFT_INV_1ST; … … 857 874 int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement; 858 875 #endif 859 short tmp[8][8];860 861 partialButterflyInverse8(coeff,tmp,shift_1st);862 partialButterflyInverse8(tmp,block,shift_2nd);863 }864 865 /** 16x16 forward transform implemented using partial butterfly structure (1D)866 * \param src input data (residual)867 * \param dst output data (transform coefficients)868 * \param shift specifies right shift after 1D transform869 */870 void partialButterfly16(short src[16][16],short dst[16][16],int shift)871 {872 int j,k;873 int E[8],O[8];874 int EE[4],EO[4];875 int EEE[2],EEO[2];876 int add = 1<<(shift-1);877 878 for (j=0; j<16; j++)879 {880 /* E and O*/881 for (k=0;k<8;k++)882 {883 E[k] = src[j][k] + src[j][15-k];884 O[k] = src[j][k] - src[j][15-k];885 }886 /* EE and EO */887 for (k=0;k<4;k++)888 {889 EE[k] = E[k] + E[7-k];890 EO[k] = E[k] - E[7-k];891 }892 /* EEE and EEO */893 EEE[0] = EE[0] + EE[3];894 EEO[0] = EE[0] - EE[3];895 EEE[1] = EE[1] + EE[2];896 EEO[1] = EE[1] - EE[2];897 898 dst[ 0][j] = (g_aiT16[ 0][0]*EEE[0] + g_aiT16[ 0][1]*EEE[1] + add)>>shift;899 dst[ 8][j] = (g_aiT16[ 8][0]*EEE[0] + g_aiT16[ 8][1]*EEE[1] + add)>>shift;900 dst[ 4][j] = (g_aiT16[ 4][0]*EEO[0] + g_aiT16[ 4][1]*EEO[1] + add)>>shift;901 dst[12][j] = (g_aiT16[12][0]*EEO[0] + g_aiT16[12][1]*EEO[1] + add)>>shift;902 903 for (k=2;k<16;k+=4)904 {905 dst[k][j] = (g_aiT16[k][0]*EO[0] + g_aiT16[k][1]*EO[1] + g_aiT16[k][2]*EO[2] + g_aiT16[k][3]*EO[3] + add)>>shift;906 }907 908 for (k=1;k<16;k+=2)909 {910 dst[k][j] = (g_aiT16[k][0]*O[0] + g_aiT16[k][1]*O[1] + g_aiT16[k][2]*O[2] + g_aiT16[k][3]*O[3] +911 g_aiT16[k][4]*O[4] + g_aiT16[k][5]*O[5] + g_aiT16[k][6]*O[6] + g_aiT16[k][7]*O[7] + add)>>shift;912 }913 914 }915 }916 #endif917 918 void partialButterfly16(short *src,short *dst,int shift, int line)919 {920 int j,k;921 int E[8],O[8];922 int EE[4],EO[4];923 int EEE[2],EEO[2];924 int add = 1<<(shift-1);925 926 for (j=0; j<line; j++)927 {928 /* E and O*/929 for (k=0;k<8;k++)930 {931 E[k] = src[k] + src[15-k];932 O[k] = src[k] - src[15-k];933 }934 /* EE and EO */935 for (k=0;k<4;k++)936 {937 EE[k] = E[k] + E[7-k];938 EO[k] = E[k] - E[7-k];939 }940 /* EEE and EEO */941 EEE[0] = EE[0] + EE[3];942 EEO[0] = EE[0] - EE[3];943 EEE[1] = EE[1] + EE[2];944 EEO[1] = EE[1] - EE[2];945 946 dst[ 0 ] = (g_aiT16[ 0][0]*EEE[0] + g_aiT16[ 0][1]*EEE[1] + add)>>shift;947 dst[ 8*line ] = (g_aiT16[ 8][0]*EEE[0] + g_aiT16[ 8][1]*EEE[1] + add)>>shift;948 dst[ 4*line ] = (g_aiT16[ 4][0]*EEO[0] + g_aiT16[ 4][1]*EEO[1] + add)>>shift;949 dst[ 12*line] = (g_aiT16[12][0]*EEO[0] + g_aiT16[12][1]*EEO[1] + add)>>shift;950 951 for (k=2;k<16;k+=4)952 {953 dst[ k*line ] = (g_aiT16[k][0]*EO[0] + g_aiT16[k][1]*EO[1] + g_aiT16[k][2]*EO[2] + g_aiT16[k][3]*EO[3] + add)>>shift;954 }955 956 for (k=1;k<16;k+=2)957 {958 dst[ k*line ] = (g_aiT16[k][0]*O[0] + g_aiT16[k][1]*O[1] + g_aiT16[k][2]*O[2] + g_aiT16[k][3]*O[3] +959 g_aiT16[k][4]*O[4] + g_aiT16[k][5]*O[5] + g_aiT16[k][6]*O[6] + g_aiT16[k][7]*O[7] + add)>>shift;960 }961 962 src += 16;963 dst ++;964 965 }966 }967 968 #if !UNIFIED_TRANSFORM969 /** 16x16 forward transform (2D)970 * \param block input data (residual)971 * \param coeff output data (transform coefficients)972 */973 void xTr16(short block[16][16],short coeff[16][16])974 {975 #if FULL_NBIT976 int shift_1st = 3 + g_uiBitDepth - 8; // log2(16) - 1 + g_uiBitDepth - 8977 #else978 int shift_1st = 3 + g_uiBitIncrement; // log2(16) - 1 + g_uiBitIncrement979 #endif980 int shift_2nd = 10; // log2(16) + 6981 short tmp[16][16];982 983 partialButterfly16(block,tmp,shift_1st);984 partialButterfly16(tmp,coeff,shift_2nd);985 }986 987 /** 16x16 inverse transform implemented using partial butterfly structure (1D)988 * \param src input data (transform coefficients)989 * \param dst output data (residual)990 * \param shift specifies right shift after 1D transform991 */992 void partialButterflyInverse16(short src[16][16],short dst[16][16],int shift)993 {994 int j,k;995 int E[8],O[8];996 int EE[4],EO[4];997 int EEE[2],EEO[2];998 int add = 1<<(shift-1);999 1000 for (j=0; j<16; j++)1001 {1002 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */1003 for (k=0;k<8;k++)1004 {1005 O[k] = g_aiT16[ 1][k]*src[ 1][j] + g_aiT16[ 3][k]*src[ 3][j] + g_aiT16[ 5][k]*src[ 5][j] + g_aiT16[ 7][k]*src[ 7][j] +1006 g_aiT16[ 9][k]*src[ 9][j] + g_aiT16[11][k]*src[11][j] + g_aiT16[13][k]*src[13][j] + g_aiT16[15][k]*src[15][j];1007 }1008 for (k=0;k<4;k++)1009 {1010 EO[k] = g_aiT16[ 2][k]*src[ 2][j] + g_aiT16[ 6][k]*src[ 6][j] + g_aiT16[10][k]*src[10][j] + g_aiT16[14][k]*src[14][j];1011 }1012 EEO[0] = g_aiT16[4][0]*src[4][j] + g_aiT16[12][0]*src[12][j];1013 EEE[0] = g_aiT16[0][0]*src[0][j] + g_aiT16[ 8][0]*src[ 8][j];1014 EEO[1] = g_aiT16[4][1]*src[4][j] + g_aiT16[12][1]*src[12][j];1015 EEE[1] = g_aiT16[0][1]*src[0][j] + g_aiT16[ 8][1]*src[ 8][j];1016 1017 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */1018 for (k=0;k<2;k++)1019 {1020 EE[k] = EEE[k] + EEO[k];1021 EE[k+2] = EEE[1-k] - EEO[1-k];1022 }1023 for (k=0;k<4;k++)1024 {1025 E[k] = EE[k] + EO[k];1026 E[k+4] = EE[3-k] - EO[3-k];1027 }1028 for (k=0;k<8;k++)1029 {1030 dst[j][k] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );1031 dst[j][k+8] = Clip3( -32768, 32767, (E[7-k] - O[7-k] + add)>>shift );1032 }1033 }1034 }1035 #endif1036 1037 void partialButterflyInverse16(short *src,short *dst,int shift, int line)1038 {1039 int j,k;1040 int E[8],O[8];1041 int EE[4],EO[4];1042 int EEE[2],EEO[2];1043 int add = 1<<(shift-1);1044 1045 for (j=0; j<line; j++)1046 {1047 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */1048 for (k=0;k<8;k++)1049 {1050 O[k] = g_aiT16[ 1][k]*src[ line] + g_aiT16[ 3][k]*src[ 3*line] + g_aiT16[ 5][k]*src[ 5*line] + g_aiT16[ 7][k]*src[ 7*line] +1051 g_aiT16[ 9][k]*src[ 9*line] + g_aiT16[11][k]*src[11*line] + g_aiT16[13][k]*src[13*line] + g_aiT16[15][k]*src[15*line];1052 }1053 for (k=0;k<4;k++)1054 {1055 EO[k] = g_aiT16[ 2][k]*src[ 2*line] + g_aiT16[ 6][k]*src[ 6*line] + g_aiT16[10][k]*src[10*line] + g_aiT16[14][k]*src[14*line];1056 }1057 EEO[0] = g_aiT16[4][0]*src[ 4*line ] + g_aiT16[12][0]*src[ 12*line ];1058 EEE[0] = g_aiT16[0][0]*src[ 0 ] + g_aiT16[ 8][0]*src[ 8*line ];1059 EEO[1] = g_aiT16[4][1]*src[ 4*line ] + g_aiT16[12][1]*src[ 12*line ];1060 EEE[1] = g_aiT16[0][1]*src[ 0 ] + g_aiT16[ 8][1]*src[ 8*line ];1061 1062 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */1063 for (k=0;k<2;k++)1064 {1065 EE[k] = EEE[k] + EEO[k];1066 EE[k+2] = EEE[1-k] - EEO[1-k];1067 }1068 for (k=0;k<4;k++)1069 {1070 E[k] = EE[k] + EO[k];1071 E[k+4] = EE[3-k] - EO[3-k];1072 }1073 for (k=0;k<8;k++)1074 {1075 dst[k] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );1076 dst[k+8] = Clip3( -32768, 32767, (E[7-k] - O[7-k] + add)>>shift );1077 }1078 src ++;1079 dst += 16;1080 }1081 }1082 1083 #if !UNIFIED_TRANSFORM1084 /** 16x16 inverse transform (2D)1085 * \param coeff input data (transform coefficients)1086 * \param block output data (residual)1087 */1088 void xITr16(short coeff[16][16],short block[16][16])1089 {1090 int shift_1st = SHIFT_INV_1ST;1091 #if FULL_NBIT1092 int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);1093 #else1094 int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;1095 #endif1096 short tmp[16][16];1097 1098 partialButterflyInverse16(coeff,tmp,shift_1st);1099 partialButterflyInverse16(tmp,block,shift_2nd);1100 }1101 1102 /** 32x32 forward transform implemented using partial butterfly structure (1D)1103 * \param src input data (residual)1104 * \param dst output data (transform coefficients)1105 * \param shift specifies right shift after 1D transform1106 */1107 void partialButterfly32(short src[32][32],short dst[32][32],int shift)1108 {1109 int j,k;1110 int E[16],O[16];1111 int EE[8],EO[8];1112 int EEE[4],EEO[4];1113 int EEEE[2],EEEO[2];1114 int add = 1<<(shift-1);1115 1116 for (j=0; j<32; j++)1117 {1118 /* E and O*/1119 for (k=0;k<16;k++)1120 {1121 E[k] = src[j][k] + src[j][31-k];1122 O[k] = src[j][k] - src[j][31-k];1123 }1124 /* EE and EO */1125 for (k=0;k<8;k++)1126 {1127 EE[k] = E[k] + E[15-k];1128 EO[k] = E[k] - E[15-k];1129 }1130 /* EEE and EEO */1131 for (k=0;k<4;k++)1132 {1133 EEE[k] = EE[k] + EE[7-k];1134 EEO[k] = EE[k] - EE[7-k];1135 }1136 /* EEEE and EEEO */1137 EEEE[0] = EEE[0] + EEE[3];1138 EEEO[0] = EEE[0] - EEE[3];1139 EEEE[1] = EEE[1] + EEE[2];1140 EEEO[1] = EEE[1] - EEE[2];1141 1142 dst[ 0][j] = (g_aiT32[ 0][0]*EEEE[0] + g_aiT32[ 0][1]*EEEE[1] + add)>>shift;1143 dst[16][j] = (g_aiT32[16][0]*EEEE[0] + g_aiT32[16][1]*EEEE[1] + add)>>shift;1144 dst[ 8][j] = (g_aiT32[ 8][0]*EEEO[0] + g_aiT32[ 8][1]*EEEO[1] + add)>>shift;1145 dst[24][j] = (g_aiT32[24][0]*EEEO[0] + g_aiT32[24][1]*EEEO[1] + add)>>shift;1146 for (k=4;k<32;k+=8)1147 {1148 dst[k][j] = (g_aiT32[k][0]*EEO[0] + g_aiT32[k][1]*EEO[1] + g_aiT32[k][2]*EEO[2] + g_aiT32[k][3]*EEO[3] + add)>>shift;1149 }1150 for (k=2;k<32;k+=4)1151 {1152 dst[k][j] = (g_aiT32[k][0]*EO[0] + g_aiT32[k][1]*EO[1] + g_aiT32[k][2]*EO[2] + g_aiT32[k][3]*EO[3] +1153 g_aiT32[k][4]*EO[4] + g_aiT32[k][5]*EO[5] + g_aiT32[k][6]*EO[6] + g_aiT32[k][7]*EO[7] + add)>>shift;1154 }1155 for (k=1;k<32;k+=2)1156 {1157 dst[k][j] = (g_aiT32[k][ 0]*O[ 0] + g_aiT32[k][ 1]*O[ 1] + g_aiT32[k][ 2]*O[ 2] + g_aiT32[k][ 3]*O[ 3] +1158 g_aiT32[k][ 4]*O[ 4] + g_aiT32[k][ 5]*O[ 5] + g_aiT32[k][ 6]*O[ 6] + g_aiT32[k][ 7]*O[ 7] +1159 g_aiT32[k][ 8]*O[ 8] + g_aiT32[k][ 9]*O[ 9] + g_aiT32[k][10]*O[10] + g_aiT32[k][11]*O[11] +1160 g_aiT32[k][12]*O[12] + g_aiT32[k][13]*O[13] + g_aiT32[k][14]*O[14] + g_aiT32[k][15]*O[15] + add)>>shift;1161 }1162 }1163 }1164 #endif1165 1166 void partialButterfly32(short *src,short *dst,int shift, int line)1167 {1168 int j,k;1169 int E[16],O[16];1170 int EE[8],EO[8];1171 int EEE[4],EEO[4];1172 int EEEE[2],EEEO[2];1173 int add = 1<<(shift-1);1174 1175 for (j=0; j<line; j++)1176 {1177 /* E and O*/1178 for (k=0;k<16;k++)1179 {1180 E[k] = src[k] + src[31-k];1181 O[k] = src[k] - src[31-k];1182 }1183 /* EE and EO */1184 for (k=0;k<8;k++)1185 {1186 EE[k] = E[k] + E[15-k];1187 EO[k] = E[k] - E[15-k];1188 }1189 /* EEE and EEO */1190 for (k=0;k<4;k++)1191 {1192 EEE[k] = EE[k] + EE[7-k];1193 EEO[k] = EE[k] - EE[7-k];1194 }1195 /* EEEE and EEEO */1196 EEEE[0] = EEE[0] + EEE[3];1197 EEEO[0] = EEE[0] - EEE[3];1198 EEEE[1] = EEE[1] + EEE[2];1199 EEEO[1] = EEE[1] - EEE[2];1200 1201 dst[ 0 ] = (g_aiT32[ 0][0]*EEEE[0] + g_aiT32[ 0][1]*EEEE[1] + add)>>shift;1202 dst[ 16*line ] = (g_aiT32[16][0]*EEEE[0] + g_aiT32[16][1]*EEEE[1] + add)>>shift;1203 dst[ 8*line ] = (g_aiT32[ 8][0]*EEEO[0] + g_aiT32[ 8][1]*EEEO[1] + add)>>shift;1204 dst[ 24*line ] = (g_aiT32[24][0]*EEEO[0] + g_aiT32[24][1]*EEEO[1] + add)>>shift;1205 for (k=4;k<32;k+=8)1206 {1207 dst[ k*line ] = (g_aiT32[k][0]*EEO[0] + g_aiT32[k][1]*EEO[1] + g_aiT32[k][2]*EEO[2] + g_aiT32[k][3]*EEO[3] + add)>>shift;1208 }1209 for (k=2;k<32;k+=4)1210 {1211 dst[ k*line ] = (g_aiT32[k][0]*EO[0] + g_aiT32[k][1]*EO[1] + g_aiT32[k][2]*EO[2] + g_aiT32[k][3]*EO[3] +1212 g_aiT32[k][4]*EO[4] + g_aiT32[k][5]*EO[5] + g_aiT32[k][6]*EO[6] + g_aiT32[k][7]*EO[7] + add)>>shift;1213 }1214 for (k=1;k<32;k+=2)1215 {1216 dst[ k*line ] = (g_aiT32[k][ 0]*O[ 0] + g_aiT32[k][ 1]*O[ 1] + g_aiT32[k][ 2]*O[ 2] + g_aiT32[k][ 3]*O[ 3] +1217 g_aiT32[k][ 4]*O[ 4] + g_aiT32[k][ 5]*O[ 5] + g_aiT32[k][ 6]*O[ 6] + g_aiT32[k][ 7]*O[ 7] +1218 g_aiT32[k][ 8]*O[ 8] + g_aiT32[k][ 9]*O[ 9] + g_aiT32[k][10]*O[10] + g_aiT32[k][11]*O[11] +1219 g_aiT32[k][12]*O[12] + g_aiT32[k][13]*O[13] + g_aiT32[k][14]*O[14] + g_aiT32[k][15]*O[15] + add)>>shift;1220 }1221 src += 32;1222 dst ++;1223 }1224 }1225 1226 #if !UNIFIED_TRANSFORM1227 /** 32x32 forward transform (2D)1228 * \param block input data (residual)1229 * \param coeff output data (transform coefficients)1230 */1231 void xTr32(short block[32][32],short coeff[32][32])1232 {1233 #if FULL_NBIT1234 int shift_1st = 4 + g_uiBitDepth - 8; // log2(32) - 1 + g_uiBitDepth - 81235 #else1236 int shift_1st = 4 + g_uiBitIncrement; // log2(32) - 1 + g_uiBitIncrement1237 #endif1238 int shift_2nd = 11; // log2(32) + 61239 short tmp[32][32];1240 1241 partialButterfly32(block,tmp,shift_1st);1242 partialButterfly32(tmp,coeff,shift_2nd);1243 }1244 1245 /** 32x32 inverse transform implemented using partial butterfly structure (1D)1246 * \param src input data (transform coefficients)1247 * \param dst output data (residual)1248 * \param shift specifies right shift after 1D transform1249 */1250 void partialButterflyInverse32(short src[32][32],short dst[32][32],int shift)1251 {1252 int j,k;1253 int E[16],O[16];1254 int EE[8],EO[8];1255 int EEE[4],EEO[4];1256 int EEEE[2],EEEO[2];1257 int add = 1<<(shift-1);1258 1259 for (j=0; j<32; j++)1260 {1261 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */1262 for (k=0;k<16;k++)1263 {1264 O[k] = g_aiT32[ 1][k]*src[ 1][j] + g_aiT32[ 3][k]*src[ 3][j] + g_aiT32[ 5][k]*src[ 5][j] + g_aiT32[ 7][k]*src[ 7][j] +1265 g_aiT32[ 9][k]*src[ 9][j] + g_aiT32[11][k]*src[11][j] + g_aiT32[13][k]*src[13][j] + g_aiT32[15][k]*src[15][j] +1266 g_aiT32[17][k]*src[17][j] + g_aiT32[19][k]*src[19][j] + g_aiT32[21][k]*src[21][j] + g_aiT32[23][k]*src[23][j] +1267 g_aiT32[25][k]*src[25][j] + g_aiT32[27][k]*src[27][j] + g_aiT32[29][k]*src[29][j] + g_aiT32[31][k]*src[31][j];1268 }1269 for (k=0;k<8;k++)1270 {1271 EO[k] = g_aiT32[ 2][k]*src[ 2][j] + g_aiT32[ 6][k]*src[ 6][j] + g_aiT32[10][k]*src[10][j] + g_aiT32[14][k]*src[14][j] +1272 g_aiT32[18][k]*src[18][j] + g_aiT32[22][k]*src[22][j] + g_aiT32[26][k]*src[26][j] + g_aiT32[30][k]*src[30][j];1273 }1274 for (k=0;k<4;k++)1275 {1276 EEO[k] = g_aiT32[4][k]*src[4][j] + g_aiT32[12][k]*src[12][j] + g_aiT32[20][k]*src[20][j] + g_aiT32[28][k]*src[28][j];1277 }1278 EEEO[0] = g_aiT32[8][0]*src[8][j] + g_aiT32[24][0]*src[24][j];1279 EEEO[1] = g_aiT32[8][1]*src[8][j] + g_aiT32[24][1]*src[24][j];1280 EEEE[0] = g_aiT32[0][0]*src[0][j] + g_aiT32[16][0]*src[16][j];1281 EEEE[1] = g_aiT32[0][1]*src[0][j] + g_aiT32[16][1]*src[16][j];1282 1283 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */1284 EEE[0] = EEEE[0] + EEEO[0];1285 EEE[3] = EEEE[0] - EEEO[0];1286 EEE[1] = EEEE[1] + EEEO[1];1287 EEE[2] = EEEE[1] - EEEO[1];1288 for (k=0;k<4;k++)1289 {1290 EE[k] = EEE[k] + EEO[k];1291 EE[k+4] = EEE[3-k] - EEO[3-k];1292 }1293 for (k=0;k<8;k++)1294 {1295 E[k] = EE[k] + EO[k];1296 E[k+8] = EE[7-k] - EO[7-k];1297 }1298 for (k=0;k<16;k++)1299 {1300 dst[j][k] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );1301 dst[j][k+16] = Clip3( -32768, 32767, (E[15-k] - O[15-k] + add)>>shift );1302 }1303 }1304 }1305 #endif1306 1307 void partialButterflyInverse32(short *src,short *dst,int shift, int line)1308 {1309 int j,k;1310 int E[16],O[16];1311 int EE[8],EO[8];1312 int EEE[4],EEO[4];1313 int EEEE[2],EEEO[2];1314 int add = 1<<(shift-1);1315 1316 for (j=0; j<line; j++)1317 {1318 /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */1319 for (k=0;k<16;k++)1320 {1321 O[k] = g_aiT32[ 1][k]*src[ line ] + g_aiT32[ 3][k]*src[ 3*line ] + g_aiT32[ 5][k]*src[ 5*line ] + g_aiT32[ 7][k]*src[ 7*line ] +1322 g_aiT32[ 9][k]*src[ 9*line ] + g_aiT32[11][k]*src[ 11*line ] + g_aiT32[13][k]*src[ 13*line ] + g_aiT32[15][k]*src[ 15*line ] +1323 g_aiT32[17][k]*src[ 17*line ] + g_aiT32[19][k]*src[ 19*line ] + g_aiT32[21][k]*src[ 21*line ] + g_aiT32[23][k]*src[ 23*line ] +1324 g_aiT32[25][k]*src[ 25*line ] + g_aiT32[27][k]*src[ 27*line ] + g_aiT32[29][k]*src[ 29*line ] + g_aiT32[31][k]*src[ 31*line ];1325 }1326 for (k=0;k<8;k++)1327 {1328 EO[k] = g_aiT32[ 2][k]*src[ 2*line ] + g_aiT32[ 6][k]*src[ 6*line ] + g_aiT32[10][k]*src[ 10*line ] + g_aiT32[14][k]*src[ 14*line ] +1329 g_aiT32[18][k]*src[ 18*line ] + g_aiT32[22][k]*src[ 22*line ] + g_aiT32[26][k]*src[ 26*line ] + g_aiT32[30][k]*src[ 30*line ];1330 }1331 for (k=0;k<4;k++)1332 {1333 EEO[k] = g_aiT32[4][k]*src[ 4*line ] + g_aiT32[12][k]*src[ 12*line ] + g_aiT32[20][k]*src[ 20*line ] + g_aiT32[28][k]*src[ 28*line ];1334 }1335 EEEO[0] = g_aiT32[8][0]*src[ 8*line ] + g_aiT32[24][0]*src[ 24*line ];1336 EEEO[1] = g_aiT32[8][1]*src[ 8*line ] + g_aiT32[24][1]*src[ 24*line ];1337 EEEE[0] = g_aiT32[0][0]*src[ 0 ] + g_aiT32[16][0]*src[ 16*line ];1338 EEEE[1] = g_aiT32[0][1]*src[ 0 ] + g_aiT32[16][1]*src[ 16*line ];1339 1340 /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */1341 EEE[0] = EEEE[0] + EEEO[0];1342 EEE[3] = EEEE[0] - EEEO[0];1343 EEE[1] = EEEE[1] + EEEO[1];1344 EEE[2] = EEEE[1] - EEEO[1];1345 for (k=0;k<4;k++)1346 {1347 EE[k] = EEE[k] + EEO[k];1348 EE[k+4] = EEE[3-k] - EEO[3-k];1349 }1350 for (k=0;k<8;k++)1351 {1352 E[k] = EE[k] + EO[k];1353 E[k+8] = EE[7-k] - EO[7-k];1354 }1355 for (k=0;k<16;k++)1356 {1357 dst[k] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );1358 dst[k+16] = Clip3( -32768, 32767, (E[15-k] - O[15-k] + add)>>shift );1359 }1360 src ++;1361 dst += 32;1362 }1363 }1364 1365 #if !UNIFIED_TRANSFORM1366 /** 32x32 inverse transform (2D)1367 * \param coeff input data (transform coefficients)1368 * \param block output data (residual)1369 */1370 void xITr32(short coeff[32][32],short block[32][32])1371 {1372 int shift_1st = SHIFT_INV_1ST;1373 #if FULL_NBIT1374 int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);1375 #else1376 int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;1377 #endif1378 short tmp[32][32];1379 1380 partialButterflyInverse32(coeff,tmp,shift_1st);1381 partialButterflyInverse32(tmp,block,shift_2nd);1382 }1383 #endif1384 1385 /** MxN forward transform (2D)1386 * \param block input data (residual)1387 * \param coeff output data (transform coefficients)1388 * \param iWidth input data (width of transform)1389 * \param iHeight input data (height of transform)1390 */1391 #if UNIFIED_TRANSFORM1392 void xTrMxN(short *block,short *coeff, int iWidth, int iHeight, UInt uiMode)1393 #else1394 void xTrMxN(short *block,short *coeff, int iWidth, int iHeight)1395 #endif1396 {1397 #if FULL_NBIT1398 int shift_1st = g_aucConvertToBit[iWidth] + 1 + g_uiBitDepth - 8; // log2(iWidth) - 1 + g_uiBitDepth - 81399 #else1400 int shift_1st = g_aucConvertToBit[iWidth] + 1 + g_uiBitIncrement; // log2(iWidth) - 1 + g_uiBitIncrement1401 #endif1402 int shift_2nd = g_aucConvertToBit[iHeight] + 8; // log2(iHeight) + 61403 1404 short tmp[ 64 * 64 ];1405 1406 if( iWidth == 16 && iHeight == 4)1407 {1408 partialButterfly16( block, tmp, shift_1st, iHeight );1409 partialButterfly4( tmp, coeff, shift_2nd, iWidth );1410 }1411 else if( iWidth == 32 && iHeight == 8 )1412 {1413 partialButterfly32( block, tmp, shift_1st, iHeight );1414 partialButterfly8( tmp, coeff, shift_2nd, iWidth );1415 }1416 else if( iWidth == 4 && iHeight == 16)1417 {1418 partialButterfly4( block, tmp, shift_1st, iHeight );1419 partialButterfly16( tmp, coeff, shift_2nd, iWidth );1420 }1421 else if( iWidth == 8 && iHeight == 32 )1422 {1423 partialButterfly8( block, tmp, shift_1st, iHeight );1424 partialButterfly32( tmp, coeff, shift_2nd, iWidth );1425 }1426 #if UNIFIED_TRANSFORM1427 else if( iWidth == 4 && iHeight == 4)1428 {1429 #if LOGI_INTRA_NAME_3MPM1430 if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25))) // Check for DCT or DST1431 #else1432 if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode])// Check for DCT or DST1433 #endif1434 {1435 fastForwardDst(block,tmp,shift_1st); // Forward DST BY FAST ALGORITHM, block input, tmp output1436 }1437 else1438 {1439 partialButterfly4(block, tmp, shift_1st, iHeight);1440 }1441 #if LOGI_INTRA_NAME_3MPM1442 if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34))) // Check for DCT or DST1443 #else1444 if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] ) // Check for DCT or DST1445 #endif1446 {1447 fastForwardDst(tmp,coeff,shift_2nd); // Forward DST BY FAST ALGORITHM, tmp input, coeff output1448 }1449 else1450 {1451 partialButterfly4(tmp, coeff, shift_2nd, iWidth);1452 }1453 }1454 else if( iWidth == 8 && iHeight == 8)1455 {1456 partialButterfly8( block, tmp, shift_1st, iHeight );1457 partialButterfly8( tmp, coeff, shift_2nd, iWidth );1458 }1459 else if( iWidth == 16 && iHeight == 16)1460 {1461 partialButterfly16( block, tmp, shift_1st, iHeight );1462 partialButterfly16( tmp, coeff, shift_2nd, iWidth );1463 }1464 else if( iWidth == 32 && iHeight == 32)1465 {1466 partialButterfly32( block, tmp, shift_1st, iHeight );1467 partialButterfly32( tmp, coeff, shift_2nd, iWidth );1468 }1469 #endif1470 }1471 /** MxN inverse transform (2D)1472 * \param coeff input data (transform coefficients)1473 * \param block output data (residual)1474 * \param iWidth input data (width of transform)1475 * \param iHeight input data (height of transform)1476 */1477 #if UNIFIED_TRANSFORM1478 void xITrMxN(short *coeff,short *block, int iWidth, int iHeight, UInt uiMode)1479 #else1480 void xITrMxN(short *coeff,short *block, int iWidth, int iHeight)1481 #endif1482 {1483 int shift_1st = SHIFT_INV_1ST;1484 #if FULL_NBIT1485 int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);1486 #else1487 int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;1488 #endif1489 876 1490 877 short tmp[ 64*64]; … … 1509 896 partialButterflyInverse8(tmp,block,shift_2nd,iHeight); 1510 897 } 1511 #if UNIFIED_TRANSFORM1512 898 else if( iWidth == 4 && iHeight == 4) 1513 899 { 1514 #if LOGI_INTRA_NAME_3MPM1515 900 if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34))) // Check for DCT or DST 1516 #else1517 if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] ) // Check for DCT or DST1518 #endif1519 901 { 1520 902 fastInverseDst(coeff,tmp,shift_1st); // Inverse DST by FAST Algorithm, coeff input, tmp output … … 1524 906 partialButterflyInverse4(coeff,tmp,shift_1st,iWidth); 1525 907 } 1526 #if LOGI_INTRA_NAME_3MPM1527 908 if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25))) // Check for DCT or DST 1528 #else1529 if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode] ) // Check for DCT or DST1530 #endif1531 909 { 1532 910 fastInverseDst(tmp,block,shift_2nd); // Inverse DST by FAST Algorithm, tmp input, coeff output … … 1552 930 partialButterflyInverse32(tmp,block,shift_2nd,iHeight); 1553 931 } 1554 #endif1555 932 } 1556 933 1557 934 #endif //MATRIX_MULT 1558 935 1559 #if MULTIBITS_DATA_HIDING1560 936 // To minimize the distortion only. No rate is considered. 1561 937 Void TComTrQuant::signBitHidingHDQ( TComDataCU* pcCU, TCoeff* pQCoef, TCoeff* pCoef, UInt const *scan, Int* deltaU, Int width, Int height ) … … 1684 1060 return; 1685 1061 } 1686 #endif1687 1062 1688 1063 Void TComTrQuant::xQuant( TComDataCU* pcCU, … … 1715 1090 else 1716 1091 { 1717 #if MULTIBITS_DATA_HIDING1718 1092 const UInt log2BlockSize = g_aucConvertToBit[ iWidth ] + 2; 1719 1093 … … 1740 1114 1741 1115 Int deltaU[32*32] ; 1742 #endif1743 1116 1744 1117 #if ADAPTIVE_QP_SELECTION … … 1746 1119 Int iQpBase = pcCU->getSlice()->getSliceQpBase(); 1747 1120 1748 #if H0736_AVC_STYLE_QP_RANGE1749 1121 Int qpScaled; 1750 1122 Int qpBDOffset = (eTType == TEXT_LUMA)? pcCU->getSlice()->getSPS()->getQpBDOffsetY() : pcCU->getSlice()->getSPS()->getQpBDOffsetC(); … … 1768 1140 } 1769 1141 cQpBase.setQpParam(qpScaled, false, pcCU->getSlice()->getSliceType()); 1770 #else1771 if(eTType != TEXT_LUMA)1772 {1773 iQpBase = g_aucChromaScale[iQpBase];1774 }1775 cQpBase.setQpParam(iQpBase, false, pcCU->getSlice()->getSliceType());1776 #endif1777 1142 #endif 1778 1143 … … 1811 1176 #endif 1812 1177 1813 #if MULTIBITS_DATA_HIDING1814 1178 Int qBits8 = iQBits-8; 1815 #endif1816 1179 for( Int n = 0; n < iWidth*iHeight; n++ ) 1817 1180 { … … 1829 1192 } 1830 1193 iLevel = (Int)((tmpLevel + iAdd ) >> iQBits); 1831 #if MULTIBITS_DATA_HIDING1832 1194 deltaU[uiBlockPos] = (Int)((tmpLevel - (iLevel<<iQBits) )>> qBits8); 1833 #endif1834 1195 #else 1835 1196 iLevel = ((Int64)abs(iLevel) * piQuantCoeff[uiBlockPos] + iAdd ) >> iQBits; 1836 #if MULTIBITS_DATA_HIDING1837 1197 deltaU[uiBlockPos] = (Int)( ((Int64)abs(iLevel) * piQuantCoeff[uiBlockPos] - (iLevel<<iQBits) )>> qBits8 ); 1838 #endif1839 1198 #endif 1840 1199 uiAcSum += iLevel; … … 1842 1201 piQCoef[uiBlockPos] = Clip3( -32768, 32767, iLevel ); 1843 1202 } // for n 1844 #if MULTIBITS_DATA_HIDING1845 1203 if( pcCU->getSlice()->getPPS()->getSignHideFlag() ) 1846 1204 { … … 1850 1208 } 1851 1209 } 1852 #endif1853 1210 } //if RDOQ 1854 1211 //return; … … 1888 1245 iShift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - iTransformShift; 1889 1246 1890 #if DEQUANT_CLIPPING1891 1247 TCoeff clipQCoef; 1892 1248 const Int bitRange = min( 15, ( Int )( 12 + uiLog2TrSize + uiBitDepth - m_cQP.m_iPer) ); 1893 1249 const Int levelLimit = 1 << bitRange; 1894 #endif1895 1250 1896 1251 if(getUseScalingList()) … … 1911 1266 for( Int n = 0; n < iWidth*iHeight; n++ ) 1912 1267 { 1913 #if DEQUANT_CLIPPING1914 1268 clipQCoef = Clip3( -32768, 32767, piQCoef[n] ); 1915 1269 iCoeffQ = ((clipQCoef * piDequantCoef[n]) + iAdd ) >> (iShift - m_cQP.m_iPer); 1916 #else1917 iCoeffQ = ((piQCoef[n] * piDequantCoef[n]) + iAdd ) >> (iShift - m_cQP.m_iPer);1918 #endif1919 1270 piCoef[n] = Clip3(-32768,32767,iCoeffQ); 1920 1271 } … … 1924 1275 for( Int n = 0; n < iWidth*iHeight; n++ ) 1925 1276 { 1926 #if DEQUANT_CLIPPING1927 1277 clipQCoef = Clip3( -levelLimit, levelLimit - 1, piQCoef[n] ); 1928 1278 iCoeffQ = (clipQCoef * piDequantCoef[n]) << (m_cQP.m_iPer - iShift); 1929 #else1930 iCoeffQ = (piQCoef[n] * piDequantCoef[n]) << (m_cQP.m_iPer - iShift);1931 #endif1932 1279 piCoef[n] = Clip3(-32768,32767,iCoeffQ); 1933 1280 } … … 1941 1288 for( Int n = 0; n < iWidth*iHeight; n++ ) 1942 1289 { 1943 #if DEQUANT_CLIPPING1944 1290 clipQCoef = Clip3( -32768, 32767, piQCoef[n] ); 1945 1291 iCoeffQ = ( clipQCoef * scale + iAdd ) >> iShift; 1946 #else1947 iCoeffQ = ( piQCoef[n] * scale + iAdd ) >> iShift;1948 #endif1949 1292 piCoef[n] = Clip3(-32768,32767,iCoeffQ); 1950 1293 } … … 2134 1477 xTr(piBlkResi,psCoeff,uiStride,(UInt)iSize,uiMode); 2135 1478 #else 2136 #if UNIFIED_TRANSFORM2137 1479 Int j; 2138 #else2139 Int iSize = iWidth;2140 if( iWidth != iHeight)2141 #endif2142 1480 { 2143 1481 short block[ 64 * 64 ]; … … 2149 1487 } 2150 1488 } 2151 #if UNIFIED_TRANSFORM2152 1489 xTrMxN( block, coeff, iWidth, iHeight, uiMode ); 2153 #else2154 xTrMxN( block, coeff, iWidth, iHeight );2155 #endif2156 1490 for ( j = 0; j < iHeight * iWidth; j++ ) 2157 1491 { … … 2160 1494 return ; 2161 1495 } 2162 #if !UNIFIED_TRANSFORM2163 if (iSize==4)2164 {2165 short block[4][4];2166 short coeff[4][4];2167 for (j=0; j<4; j++)2168 {2169 memcpy(block[j],piBlkResi+j*uiStride,4*sizeof(short));2170 }2171 xTr4(block,coeff,uiMode);2172 for (j=0; j<4; j++)2173 {2174 for (k=0; k<4; k++)2175 {2176 psCoeff[j*4+k] = coeff[j][k];2177 }2178 }2179 }2180 else if (iSize==8)2181 {2182 short block[8][8];2183 short coeff[8][8];2184 2185 for (j=0; j<8; j++)2186 {2187 memcpy(block[j],piBlkResi+j*uiStride,8*sizeof(short));2188 }2189 2190 xTr8(block,coeff);2191 for (j=0; j<8; j++)2192 {2193 for (k=0; k<8; k++)2194 {2195 psCoeff[j*8+k] = coeff[j][k];2196 }2197 }2198 }2199 else if (iSize==16)2200 {2201 short block[16][16];2202 short coeff[16][16];2203 2204 for (j=0; j<16; j++)2205 {2206 memcpy(block[j],piBlkResi+j*uiStride,16*sizeof(short));2207 }2208 xTr16(block,coeff);2209 for (j=0; j<16; j++)2210 {2211 for (k=0; k<16; k++)2212 {2213 psCoeff[j*16+k] = coeff[j][k];2214 }2215 }2216 }2217 else if (iSize==32)2218 {2219 short block[32][32];2220 short coeff[32][32];2221 2222 for (j=0; j<32; j++)2223 {2224 memcpy(block[j],piBlkResi+j*uiStride,32*sizeof(short));2225 }2226 xTr32(block,coeff);2227 for (j=0; j<32; j++)2228 {2229 for (k=0; k<32; k++)2230 {2231 psCoeff[j*32+k] = coeff[j][k];2232 }2233 }2234 }2235 #endif2236 1496 #endif 2237 1497 } … … 2255 1515 xITr(plCoef,pResidual,uiStride,(UInt)iSize,uiMode); 2256 1516 #else 2257 #if UNIFIED_TRANSFORM2258 1517 Int j; 2259 #else2260 Int j,k;2261 Int iSize = iWidth;2262 if( iWidth != iHeight )2263 #endif2264 1518 { 2265 1519 short block[ 64 * 64 ]; … … 2269 1523 coeff[j] = (short)plCoef[j]; 2270 1524 } 2271 #if UNIFIED_TRANSFORM2272 1525 xITrMxN( coeff, block, iWidth, iHeight, uiMode ); 2273 #else2274 xITrMxN( coeff, block, iWidth, iHeight );2275 #endif2276 1526 { 2277 1527 for ( j = 0; j < iHeight; j++ ) … … 2282 1532 return ; 2283 1533 } 2284 #if !UNIFIED_TRANSFORM2285 if (iSize==4)2286 {2287 short block[4][4];2288 short coeff[4][4];2289 2290 for (j=0; j<4; j++)2291 {2292 for (k=0; k<4; k++)2293 {2294 coeff[j][k] = (short)plCoef[j*4+k];2295 }2296 }2297 xITr4(coeff,block,uiMode);2298 for (j=0; j<4; j++)2299 {2300 memcpy(pResidual+j*uiStride,block[j],4*sizeof(short));2301 }2302 }2303 else if (iSize==8)2304 {2305 short block[8][8];2306 short coeff[8][8];2307 2308 for (j=0; j<8; j++)2309 {2310 for (k=0; k<8; k++)2311 {2312 coeff[j][k] = (short)plCoef[j*8+k];2313 }2314 }2315 xITr8(coeff,block);2316 for (j=0; j<8; j++)2317 {2318 memcpy(pResidual+j*uiStride,block[j],8*sizeof(short));2319 }2320 }2321 else if (iSize==16)2322 {2323 short block[16][16];2324 short coeff[16][16];2325 2326 for (j=0; j<16; j++)2327 {2328 for (k=0; k<16; k++)2329 {2330 coeff[j][k] = (short)plCoef[j*16+k];2331 }2332 }2333 xITr16(coeff,block);2334 for (j=0; j<16; j++)2335 {2336 memcpy(pResidual+j*uiStride,block[j],16*sizeof(short));2337 }2338 }2339 2340 else if (iSize==32)2341 {2342 short block[32][32];2343 short coeff[32][32];2344 2345 for (j=0; j<32; j++)2346 {2347 for (k=0; k<32; k++)2348 {2349 coeff[j][k] = (short)plCoef[j*32+k];2350 }2351 }2352 xITr32(coeff,block);2353 for (j=0; j<32; j++)2354 {2355 memcpy(pResidual+j*uiStride,block[j],32*sizeof(short));2356 }2357 }2358 #endif2359 1534 #endif 2360 1535 } … … 2442 1617 ::memset( pdCostCoeff, 0, sizeof(Double) * uiMaxNumCoeff ); 2443 1618 ::memset( pdCostSig, 0, sizeof(Double) * uiMaxNumCoeff ); 2444 #if MULTIBITS_DATA_HIDING2445 1619 Int rateIncUp [ 32 * 32 ]; 2446 1620 Int rateIncDown [ 32 * 32 ]; … … 2451 1625 ::memset( sigRateDelta, 0, sizeof(Int) * uiMaxNumCoeff ); 2452 1626 ::memset( deltaU, 0, sizeof(Int) * uiMaxNumCoeff ); 2453 #endif2454 1627 2455 1628 const UInt * scanCG; … … 2457 1630 { 2458 1631 scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlkSize > 3 ? uiLog2BlkSize-2-1 : 0 ]; 2459 #if MULTILEVEL_SIGMAP_EXT2460 1632 if( uiLog2BlkSize == 3 ) 2461 1633 { … … 2466 1638 scanCG = g_sigLastScanCG32x32; 2467 1639 } 2468 #endif2469 1640 } 2470 1641 else … … 2486 1657 dTemp = dErrScale; 2487 1658 2488 #if RESTRICT_GR1GR2FLAG_NUMBER2489 1659 UInt c1Idx = 0; 2490 1660 UInt c2Idx = 0; 2491 1661 Int baseLevel; 2492 #endif2493 1662 2494 1663 const UInt * scan; … … 2502 1671 } 2503 1672 2504 #if !MULTILEVEL_SIGMAP_EXT2505 if (blockType < 4)2506 {2507 for( Int iScanPos = (Int) uiMaxNumCoeff-1; iScanPos >= 0; iScanPos-- )2508 {2509 //===== quantization =====2510 UInt uiBlkPos = scan[iScanPos];2511 // set coeff2512 uiQ = piQCoef[uiBlkPos];2513 dTemp = pdErrScale[uiBlkPos];2514 Int lLevelDouble = plSrcCoeff[ uiBlkPos ];2515 lLevelDouble = (Int)min<Int64>(((Int64)abs(lLevelDouble) * uiQ), MAX_INT-(1 << (iQBits - 1)));2516 #if ADAPTIVE_QP_SELECTION2517 if( m_bUseAdaptQpSelect )2518 {2519 piArlDstCoeff[uiBlkPos] = (Int)(( lLevelDouble + iAddC) >> iQBitsC );2520 }2521 #endif2522 UInt uiMaxAbsLevel = (lLevelDouble + (1 << (iQBits - 1))) >> iQBits;2523 uiMaxAbsLevel=plSrcCoeff[ uiBlkPos ]>=0 ? min<UInt>(uiMaxAbsLevel,32767): min<UInt>(uiMaxAbsLevel,32768);2524 Double dErr = Double( lLevelDouble );2525 pdCostCoeff0[ iScanPos ] = dErr * dErr * dTemp;2526 d64BlockUncodedCost += pdCostCoeff0[ iScanPos ];2527 piDstCoeff[ uiBlkPos ] = uiMaxAbsLevel;2528 2529 if ( uiMaxAbsLevel > 0 && iLastScanPos < 0 )2530 {2531 iLastScanPos = iScanPos;2532 #if LEVEL_CTX_LUMA_RED2533 uiCtxSet = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2;2534 #else2535 uiCtxSet = iScanPos < SCAN_SET_SIZE ? 0 : 3;2536 uiCtxSet = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;2537 #endif2538 }2539 2540 if ( iLastScanPos >= 0 )2541 {2542 //===== coefficient level estimation =====2543 UInt uiLevel;2544 UInt uiOneCtx = 4 * uiCtxSet + c1;2545 #if RESTRICT_GR1GR2FLAG_NUMBER2546 UInt uiAbsCtx = uiCtxSet + c2;2547 #else2548 UInt uiAbsCtx = 3 * uiCtxSet + c2;2549 #endif2550 2551 if( iScanPos == iLastScanPos )2552 {2553 #if RESTRICT_GR1GR2FLAG_NUMBER2554 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx, iQBits, dTemp, 1 );2555 #else2556 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam, iQBits, dTemp, 1 );2557 #endif2558 }2559 else2560 {2561 UInt uiPosY = uiBlkPos >> uiLog2BlkSize;2562 UInt uiPosX = uiBlkPos - ( uiPosY << uiLog2BlkSize );2563 UShort uiCtxSig = getSigCtxInc( piDstCoeff, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );2564 #if RESTRICT_GR1GR2FLAG_NUMBER2565 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx, iQBits, dTemp, 0 );2566 #else2567 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam, iQBits, dTemp, 0 );2568 #endif2569 #if MULTIBITS_DATA_HIDING2570 sigRateDelta[ uiBlkPos ] = m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 1 ] - m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 0 ];2571 #endif2572 }2573 #if MULTIBITS_DATA_HIDING2574 deltaU[ uiBlkPos ] = (lLevelDouble - ((Int)uiLevel << iQBits)) >> (iQBits-8);2575 if( uiLevel > 0 )2576 {2577 #if RESTRICT_GR1GR2FLAG_NUMBER2578 Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx );2579 rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow;2580 rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow;2581 #else2582 Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam );2583 rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;2584 rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;2585 #endif2586 }2587 else // uiLevel == 02588 {2589 rateIncUp [ uiBlkPos ] = m_pcEstBitsSbac->m_greaterOneBits[ uiOneCtx ][ 0 ];2590 }2591 #endif2592 piDstCoeff[ uiBlkPos ] = uiLevel;2593 d64BaseCost += pdCostCoeff [ iScanPos ];2594 2595 #if RESTRICT_GR1GR2FLAG_NUMBER2596 baseLevel = (c1Idx < C1FLAG_NUMBER) ? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;2597 if( uiLevel >= baseLevel )2598 {2599 #if EIGHT_BITS_RICE_CODE2600 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel, 23 ) ];2601 #else2602 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel, 15 ) ];2603 #endif2604 }2605 if ( uiLevel >= 1)2606 {2607 c1Idx ++;2608 }2609 #endif2610 2611 //===== update bin model =====2612 if( uiLevel > 1 )2613 {2614 c1 = 0;2615 c2 += (c2 < 2);2616 uiNumOne++;2617 #if RESTRICT_GR1GR2FLAG_NUMBER2618 c2Idx ++;2619 #else2620 if( uiLevel > 2 )2621 {2622 #if EIGHT_BITS_RICE_CODE2623 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 23 ) ];2624 #else2625 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 15 ) ];2626 #endif2627 }2628 #endif2629 }2630 else if( (c1 < 3) && (c1 > 0) && uiLevel)2631 {2632 c1++;2633 }2634 2635 //===== context set update =====2636 if( ( iScanPos % SCAN_SET_SIZE == 0 ) && ( iScanPos > 0 ) )2637 {2638 c1 = 1;2639 c2 = 0;2640 uiGoRiceParam = 0;2641 2642 #if RESTRICT_GR1GR2FLAG_NUMBER2643 c1Idx = 0;2644 c2Idx = 0;2645 #endif2646 #if LEVEL_CTX_LUMA_RED2647 uiCtxSet = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2;2648 #else2649 uiCtxSet = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;2650 #endif2651 if( uiNumOne > 0 )2652 {2653 uiCtxSet++;2654 #if !LEVEL_CTX_LUMA_RED2655 if(uiNumOne > 3 && eTType==TEXT_LUMA)2656 {2657 uiCtxSet++;2658 }2659 #endif2660 }2661 uiNumOne >>= 1;2662 }2663 }2664 else2665 {2666 d64BaseCost += pdCostCoeff0[ iScanPos ];2667 }2668 }2669 }2670 else //(uiLog2BlkSize > 3), for 16x16 and 32x32 TU2671 {2672 #endif2673 1673 ::memset( pdCostCoeffGroupSig, 0, sizeof(Double) * MLS_GRP_NUM ); 2674 1674 ::memset( uiSigCoeffGroupFlag, 0, sizeof(UInt) * MLS_GRP_NUM ); … … 2683 1683 UInt uiCGPosY = uiCGBlkPos / uiNumBlkSide; 2684 1684 UInt uiCGPosX = uiCGBlkPos - (uiCGPosY * uiNumBlkSide); 2685 #if MULTILEVEL_SIGMAP_EXT2686 1685 if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) ) 2687 1686 { … … 2689 1688 uiCGPosX = (uiScanIdx == SCAN_VER ? uiCGBlkPos : 0); 2690 1689 } 2691 #endif2692 1690 ::memset( &rdStats, 0, sizeof (coeffGroupRDStats)); 2693 1691 … … 2718 1716 { 2719 1717 iLastScanPos = iScanPos; 2720 #if LEVEL_CTX_LUMA_RED2721 1718 uiCtxSet = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2; 2722 #else2723 uiCtxSet = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;2724 #endif2725 1719 iCGLastScanPos = iCGScanPos; 2726 1720 } … … 2731 1725 UInt uiLevel; 2732 1726 UInt uiOneCtx = 4 * uiCtxSet + c1; 2733 #if RESTRICT_GR1GR2FLAG_NUMBER2734 1727 UInt uiAbsCtx = uiCtxSet + c2; 2735 #else2736 UInt uiAbsCtx = 3 * uiCtxSet + c2;2737 #endif2738 1728 2739 1729 if( iScanPos == iLastScanPos ) 2740 1730 { 2741 #if RESTRICT_GR1GR2FLAG_NUMBER2742 1731 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], 2743 1732 lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam, 2744 1733 c1Idx, c2Idx, iQBits, dTemp, 1 ); 2745 #else2746 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ],2747 lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam,2748 iQBits, dTemp, 1 );2749 #endif2750 1734 } 2751 1735 else … … 2754 1738 UInt uiPosX = uiBlkPos - ( uiPosY << uiLog2BlkSize ); 2755 1739 UShort uiCtxSig = getSigCtxInc( piDstCoeff, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType ); 2756 #if RESTRICT_GR1GR2FLAG_NUMBER2757 1740 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], 2758 1741 lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam, 2759 1742 c1Idx, c2Idx, iQBits, dTemp, 0 ); 2760 #else2761 uiLevel = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ],2762 lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam,2763 iQBits, dTemp, 0 );2764 #endif2765 #if MULTIBITS_DATA_HIDING2766 1743 sigRateDelta[ uiBlkPos ] = m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 1 ] - m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 0 ]; 2767 #endif2768 1744 } 2769 #if MULTIBITS_DATA_HIDING2770 1745 deltaU[ uiBlkPos ] = (lLevelDouble - ((Int)uiLevel << iQBits)) >> (iQBits-8); 2771 1746 if( uiLevel > 0 ) 2772 1747 { 2773 #if RESTRICT_GR1GR2FLAG_NUMBER2774 1748 Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ); 2775 1749 rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow; 2776 1750 rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow; 2777 #else2778 Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam );2779 rateIncUp [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;2780 rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;2781 #endif2782 1751 } 2783 1752 else // uiLevel == 0 … … 2785 1754 rateIncUp [ uiBlkPos ] = m_pcEstBitsSbac->m_greaterOneBits[ uiOneCtx ][ 0 ]; 2786 1755 } 2787 #endif2788 1756 piDstCoeff[ uiBlkPos ] = uiLevel; 2789 1757 d64BaseCost += pdCostCoeff [ iScanPos ]; 2790 1758 2791 1759 2792 #if RESTRICT_GR1GR2FLAG_NUMBER2793 1760 baseLevel = (c1Idx < C1FLAG_NUMBER) ? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; 2794 1761 if( uiLevel >= baseLevel ) 2795 1762 { 2796 #if EIGHT_BITS_RICE_CODE2797 1763 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel , 23 ) ]; 2798 #else2799 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel, 15 ) ];2800 #endif2801 1764 } 2802 1765 if ( uiLevel >= 1) … … 2804 1767 c1Idx ++; 2805 1768 } 2806 #endif2807 1769 2808 1770 //===== update bin model ===== … … 2812 1774 c2 += (c2 < 2); 2813 1775 uiNumOne++; 2814 #if RESTRICT_GR1GR2FLAG_NUMBER2815 1776 c2Idx ++; 2816 #else2817 if( uiLevel > 2 )2818 {2819 #if EIGHT_BITS_RICE_CODE2820 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 23 ) ];2821 #else2822 uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 15 ) ];2823 #endif2824 }2825 #endif2826 1777 } 2827 1778 else if( (c1 < 3) && (c1 > 0) && uiLevel) … … 2837 1788 uiGoRiceParam = 0; 2838 1789 2839 #if RESTRICT_GR1GR2FLAG_NUMBER2840 1790 c1Idx = 0; 2841 1791 c2Idx = 0; 2842 #endif2843 #if LEVEL_CTX_LUMA_RED2844 1792 uiCtxSet = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2; 2845 #else2846 uiCtxSet = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;2847 #endif2848 1793 if( uiNumOne > 0 ) 2849 1794 { 2850 1795 uiCtxSet++; 2851 #if !LEVEL_CTX_LUMA_RED2852 if( uiNumOne > 3 && eTType==TEXT_LUMA)2853 {2854 uiCtxSet++;2855 }2856 #endif2857 1796 } 2858 1797 uiNumOne >>= 1; … … 2882 1821 if (iCGLastScanPos >= 0) 2883 1822 { 2884 #if REMOVE_INFER_SIGGRP2885 1823 if( iCGScanPos ) 2886 #else2887 #if MULTILEVEL_SIGMAP_EXT2888 if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiScanIdx, uiWidth, uiHeight ) && (iCGScanPos != 0) )2889 #else2890 if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiWidth, uiHeight ) && (iCGScanPos != 0) )2891 #endif2892 #endif2893 1824 { 2894 1825 if (uiSigCoeffGroupFlag[ uiCGBlkPos ] == 0) 2895 1826 { 2896 #if MULTILEVEL_SIGMAP_EXT2897 1827 UInt uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiScanIdx, uiWidth, uiHeight); 2898 #else2899 UInt uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiWidth, uiHeight);2900 #endif2901 1828 d64BaseCost += xGetRateSigCoeffGroup(0, uiCtxSig) - rdStats.d64SigCost;; 2902 1829 pdCostCoeffGroupSig[ iCGScanPos ] = xGetRateSigCoeffGroup(0, uiCtxSig); … … 2915 1842 2916 1843 // add SigCoeffGroupFlag cost to total cost 2917 #if MULTILEVEL_SIGMAP_EXT2918 1844 UInt uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiScanIdx, uiWidth, uiHeight); 2919 #else2920 UInt uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiWidth, uiHeight);2921 #endif2922 1845 if (iCGScanPos < iCGLastScanPos) 2923 1846 { … … 2958 1881 } // end if if (uiSigCoeffGroupFlag[ uiCGBlkPos ] == 0) 2959 1882 } 2960 #if REMOVE_INFER_SIGGRP2961 1883 else 2962 1884 { 2963 1885 uiSigCoeffGroupFlag[ uiCGBlkPos ] = 1; 2964 1886 } 2965 #else2966 else // if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY ) && (uiCGScanPos != 0) && (uiSigCoeffGroupFlag[ uiCGBlkPos ] != 0) )2967 {2968 uiSigCoeffGroupFlag[ uiCGBlkPos ] = 1;2969 } // end if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY ) && (uiCGScanPos != 0) && (uiSigCoeffGroupFlag[ uiCGBlkPos ] != 0) )2970 #endif2971 1887 } 2972 1888 } //end for (iCGScanPos) 2973 #if !MULTILEVEL_SIGMAP_EXT2974 }2975 #endif2976 1889 2977 1890 //===== estimate last position ===== … … 2998 1911 } 2999 1912 3000 #if !MULTILEVEL_SIGMAP_EXT3001 if (blockType < 4)3002 {3003 for( Int iScanPos = iLastScanPos; iScanPos >= 0; iScanPos-- )3004 {3005 UInt uiBlkPos = scan[iScanPos];3006 if( piDstCoeff[ uiBlkPos ] )3007 {3008 UInt uiPosY = uiBlkPos >> uiLog2BlkSize;3009 UInt uiPosX = uiBlkPos - ( uiPosY << uiLog2BlkSize );3010 Double d64CostLast= uiScanIdx == SCAN_VER ? xGetRateLast( uiPosY, uiPosX, uiWidth ) : xGetRateLast( uiPosX, uiPosY, uiWidth );3011 Double totalCost = d64BaseCost + d64CostLast - pdCostSig[ iScanPos ];3012 if( totalCost < d64BestCost )3013 {3014 iBestLastIdxP1 = iScanPos + 1;3015 d64BestCost = totalCost;3016 }3017 if( piDstCoeff[ uiBlkPos ] > 1 )3018 {3019 break;3020 }3021 d64BaseCost -= pdCostCoeff[ iScanPos ];3022 d64BaseCost += pdCostCoeff0[ iScanPos ];3023 }3024 else3025 {3026 d64BaseCost -= pdCostSig[ iScanPos ];3027 }3028 }3029 }3030 else //if (uiLog2BlkSize < 4)3031 {3032 #endif3033 1913 Bool bFoundLast = false; 3034 1914 for (Int iCGScanPos = iCGLastScanPos; iCGScanPos >= 0; iCGScanPos--) … … 3041 1921 for (Int iScanPosinCG = uiCGSize-1; iScanPosinCG >= 0; iScanPosinCG--) 3042 1922 { 3043 #if MULTILEVEL_SIGMAP_EXT3044 1923 iScanPos = iCGScanPos*uiCGSize + iScanPosinCG; 3045 #else3046 Int iScanPos = iCGScanPos*uiCGSize + iScanPosinCG;3047 #endif3048 1924 if (iScanPos > iLastScanPos) continue; 3049 1925 UInt uiBlkPos = scan[iScanPos]; … … 3081 1957 } // end if (uiSigCoeffGroupFlag[ uiCGBlkPos ]) 3082 1958 } // end for 3083 #if !MULTILEVEL_SIGMAP_EXT3084 } //if (uiLog2BlkSize < 4)3085 #endif3086 1959 3087 1960 for ( Int scanPos = 0; scanPos < iBestLastIdxP1; scanPos++ ) … … 3099 1972 } 3100 1973 3101 #if MULTIBITS_DATA_HIDING3102 1974 if( pcCU->getSlice()->getPPS()->getSignHideFlag() && uiAbsSum>=2) 3103 1975 { … … 3226 2098 } 3227 2099 } 3228 #endif3229 2100 } 3230 2101 … … 3311 2182 const TCoeff *pData = pcCoeff + posX + posY * width; 3312 2183 3313 #if !SIGMAP_CTX_SUBBLOCK3314 Int thred = std::max(height, width) >> 2;3315 #endif3316 2184 3317 2185 Int cnt = 0; … … 3341 2209 3342 2210 cnt = ( cnt + 1 ) >> 1; 3343 #if SIGMAP_CTX_SUBBLOCK3344 2211 return (( textureType == TEXT_LUMA && ((posX>>2) + (posY>>2)) > 0 ) ? 4 : 1) + offset + cnt; 3345 #else3346 return (( textureType == TEXT_LUMA && posX + posY >= thred ) ? 4 : 1) + offset + cnt;3347 #endif3348 2212 } 3349 2213 … … 3373 2237 UShort ui16CtxNumAbs, 3374 2238 UShort ui16AbsGoRice, 3375 #if RESTRICT_GR1GR2FLAG_NUMBER3376 2239 UInt c1Idx, 3377 2240 UInt c2Idx, 3378 #endif3379 2241 Int iQBits, 3380 2242 Double dTemp, … … 3407 2269 { 3408 2270 Double dErr = Double( lLevelDouble - ( uiAbsLevel << iQBits ) ); 3409 #if RESTRICT_GR1GR2FLAG_NUMBER3410 2271 Double dCurrCost = dErr * dErr * dTemp + xGetICRateCost( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx ); 3411 #else3412 Double dCurrCost = dErr * dErr * dTemp + xGetICRateCost( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice );3413 #endif3414 2272 dCurrCost += dCurrCostSig; 3415 2273 … … 3436 2294 UShort ui16CtxNumAbs, 3437 2295 UShort ui16AbsGoRice 3438 #if RESTRICT_GR1GR2FLAG_NUMBER3439 2296 , UInt c1Idx, 3440 2297 UInt c2Idx 3441 #endif3442 2298 ) const 3443 2299 { 3444 2300 Double iRate = xGetIEPRate(); 3445 #if RESTRICT_GR1GR2FLAG_NUMBER3446 2301 UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; 3447 2302 … … 3476 2331 } 3477 2332 else 3478 #endif3479 2333 if( uiAbsLevel == 1 ) 3480 2334 { … … 3488 2342 else 3489 2343 { 3490 #if RESTRICT_GR1GR2FLAG_NUMBER3491 2344 assert (0); 3492 #else 3493 UInt uiSymbol = uiAbsLevel - 3; 2345 } 2346 return xGetICost( iRate ); 2347 } 2348 2349 __inline Int TComTrQuant::xGetICRate ( UInt uiAbsLevel, 2350 UShort ui16CtxNumOne, 2351 UShort ui16CtxNumAbs, 2352 UShort ui16AbsGoRice 2353 , UInt c1Idx, 2354 UInt c2Idx 2355 ) const 2356 { 2357 Int iRate = 0; 2358 UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; 2359 2360 if ( uiAbsLevel >= baseLevel ) 2361 { 2362 UInt uiSymbol = uiAbsLevel - baseLevel; 3494 2363 UInt uiMaxVlc = g_auiGoRiceRange[ ui16AbsGoRice ]; 3495 2364 Bool bExpGolomb = ( uiSymbol > uiMaxVlc ); … … 3507 2376 3508 2377 iRate += ui16NumBins << 15; 3509 iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ];3510 iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 1 ];3511 #endif3512 }3513 return xGetICost( iRate );3514 }3515 3516 #if MULTIBITS_DATA_HIDING3517 __inline Int TComTrQuant::xGetICRate ( UInt uiAbsLevel,3518 UShort ui16CtxNumOne,3519 UShort ui16CtxNumAbs,3520 UShort ui16AbsGoRice3521 #if RESTRICT_GR1GR2FLAG_NUMBER3522 , UInt c1Idx,3523 UInt c2Idx3524 #endif3525 ) const3526 {3527 Int iRate = 0;3528 #if RESTRICT_GR1GR2FLAG_NUMBER3529 UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;3530 3531 if ( uiAbsLevel >= baseLevel )3532 {3533 UInt uiSymbol = uiAbsLevel - baseLevel;3534 UInt uiMaxVlc = g_auiGoRiceRange[ ui16AbsGoRice ];3535 Bool bExpGolomb = ( uiSymbol > uiMaxVlc );3536 3537 if( bExpGolomb )3538 {3539 uiAbsLevel = uiSymbol - uiMaxVlc;3540 int iEGS = 1; for( UInt uiMax = 2; uiAbsLevel >= uiMax; uiMax <<= 1, iEGS += 2 );3541 iRate += iEGS << 15;3542 uiSymbol = min<UInt>( uiSymbol, ( uiMaxVlc + 1 ) );3543 }3544 3545 UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1;3546 UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice;3547 3548 iRate += ui16NumBins << 15;3549 2378 3550 2379 if (c1Idx < C1FLAG_NUMBER) … … 3559 2388 } 3560 2389 else 3561 #endif3562 2390 if( uiAbsLevel == 0 ) 3563 2391 { … … 3575 2403 else 3576 2404 { 3577 #if RESTRICT_GR1GR2FLAG_NUMBER3578 2405 assert(0); 3579 #else3580 UInt uiSymbol = uiAbsLevel - 3;3581 UInt uiMaxVlc = g_auiGoRiceRange[ ui16AbsGoRice ];3582 Bool bExpGolomb = ( uiSymbol > uiMaxVlc );3583 3584 if( bExpGolomb )3585 {3586 uiAbsLevel = uiSymbol - uiMaxVlc;3587 int iEGS = 1; for( UInt uiMax = 2; uiAbsLevel >= uiMax; uiMax <<= 1, iEGS += 2 );3588 iRate += iEGS << 15;3589 uiSymbol = min<UInt>( uiSymbol, ( uiMaxVlc + 1 ) );3590 }3591 3592 UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1;3593 UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice;3594 3595 iRate += ui16NumBins << 15;3596 iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ];3597 iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 1 ];3598 #endif3599 2406 } 3600 2407 return iRate; 3601 2408 } 3602 #endif3603 2409 3604 2410 __inline Double TComTrQuant::xGetRateSigCoeffGroup ( UShort uiSignificanceCoeffGroup, … … 3674 2480 const UInt uiCGPosX, 3675 2481 const UInt uiCGPosY, 3676 #if MULTILEVEL_SIGMAP_EXT3677 2482 const UInt scanIdx, 3678 #endif3679 2483 Int width, Int height) 3680 2484 { … … 3684 2488 width >>= 2; 3685 2489 height >>= 2; 3686 #if MULTILEVEL_SIGMAP_EXT3687 2490 if( width == 2 && height == 2 ) // 8x8 3688 2491 { … … 3698 2501 } 3699 2502 } 3700 #endif3701 2503 if( uiCGPosX < width - 1 ) 3702 2504 { … … 3707 2509 uiLower = (uiSigCoeffGroupFlag[ (uiCGPosY + 1 ) * width + uiCGPosX ] != 0); 3708 2510 } 3709 #if REMOVE_INFER_SIGGRP3710 2511 return (uiRight || uiLower); 3711 #else 3712 return uiRight + uiLower; 3713 #endif 3714 3715 } 3716 #if !REMOVE_INFER_SIGGRP 3717 // return 1 if both right neighbour and lower neighour are 1's 3718 Bool TComTrQuant::bothCGNeighboursOne ( const UInt* uiSigCoeffGroupFlag, 3719 const UInt uiCGPosX, 3720 const UInt uiCGPosY, 3721 #if MULTILEVEL_SIGMAP_EXT 3722 const UInt scanIdx, 3723 #endif 3724 Int width, Int height) 3725 { 3726 UInt uiRight = 0; 3727 UInt uiLower = 0; 3728 3729 width >>= 2; 3730 height >>= 2; 3731 #if MULTILEVEL_SIGMAP_EXT 3732 if( width == 2 && height == 2 ) // 8x8 3733 { 3734 if( scanIdx == SCAN_HOR ) 3735 { 3736 width = 1; 3737 height = 4; 3738 } 3739 else if( scanIdx == SCAN_VER ) 3740 { 3741 width = 4; 3742 height = 1; 3743 } 3744 } 3745 #endif 3746 if( uiCGPosX < width - 1 ) 3747 { 3748 uiRight = (uiSigCoeffGroupFlag[ uiCGPosY * width + uiCGPosX + 1 ] != 0); 3749 } 3750 if (uiCGPosY < height - 1 ) 3751 { 3752 uiLower = (uiSigCoeffGroupFlag[ (uiCGPosY + 1 ) * width + uiCGPosX ] != 0); 3753 } 3754 3755 return (uiRight & uiLower); 3756 } 3757 #endif 2512 2513 } 3758 2514 /** set quantized matrix coefficient for encode 3759 2515 * \param scalingList quantaized matrix address … … 3842 2598 UInt width = g_scalingListSizeX[sizeId]; 3843 2599 UInt height = g_scalingListSizeX[sizeId]; 3844 #if SCALING_LIST3845 2600 UInt ratio = g_scalingListSizeX[sizeId]/min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]); 3846 #endif3847 2601 Int *quantcoeff; 3848 2602 Int *coeff = scalingList->getScalingListAddress(sizeId,listId); 3849 2603 quantcoeff = getQuantCoeff(listId, qp, sizeId, SCALING_LIST_SQT); 3850 2604 3851 #if SCALING_LIST3852 2605 processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId)); 3853 #else3854 processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width,1,(Int)g_scalingListSizeX[sizeId],0);3855 #endif3856 2606 3857 2607 if(sizeId == SCALING_LIST_32x32 || sizeId == SCALING_LIST_16x16) //for NSQT 3858 2608 { 3859 2609 quantcoeff = getQuantCoeff(listId, qp, sizeId-1,SCALING_LIST_VER); 3860 #if SCALING_LIST3861 2610 processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width>>2,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId)); 3862 #else3863 processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width>>2,1,(Int)g_scalingListSizeX[sizeId],0);3864 #endif3865 2611 3866 2612 quantcoeff = getQuantCoeff(listId, qp, sizeId-1,SCALING_LIST_HOR); 3867 #if SCALING_LIST3868 2613 processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height>>2,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId)); 3869 #else3870 processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height>>2,width,1,(Int)g_scalingListSizeX[sizeId],0);3871 #endif3872 2614 } 3873 2615 } … … 3882 2624 UInt width = g_scalingListSizeX[sizeId]; 3883 2625 UInt height = g_scalingListSizeX[sizeId]; 3884 #if SCALING_LIST3885 2626 UInt ratio = g_scalingListSizeX[sizeId]/min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]); 3886 #endif3887 2627 Int *dequantcoeff; 3888 2628 Int *coeff = scalingList->getScalingListAddress(sizeId,listId); 3889 2629 3890 2630 dequantcoeff = getDequantCoeff(listId, qp, sizeId,SCALING_LIST_SQT); 3891 #if SCALING_LIST3892 2631 processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId)); 3893 #else3894 processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width,1,(Int)g_scalingListSizeX[sizeId],0);3895 #endif3896 2632 3897 2633 if(sizeId == SCALING_LIST_32x32 || sizeId == SCALING_LIST_16x16) 3898 2634 { 3899 2635 dequantcoeff = getDequantCoeff(listId, qp, sizeId-1,SCALING_LIST_VER); 3900 #if SCALING_LIST3901 2636 processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width>>2,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId)); 3902 #else3903 processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width>>2,1,(Int)g_scalingListSizeX[sizeId],0);3904 #endif3905 2637 3906 2638 dequantcoeff = getDequantCoeff(listId, qp, sizeId-1,SCALING_LIST_HOR); 3907 2639 3908 #if SCALING_LIST3909 2640 processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height>>2,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId)); 3910 #else3911 processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height>>2,width,1,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),0);3912 #endif3913 2641 } 3914 2642 } … … 4004 2732 } 4005 2733 } 4006 #if SCALING_LIST4007 2734 if(ratio > 1) 4008 2735 { 4009 2736 quantcoeff[0] = quantScales / dc; 4010 2737 } 4011 #endif4012 2738 } 4013 2739 /** set quantized matrix coefficient for decode … … 4032 2758 } 4033 2759 } 4034 #if SCALING_LIST4035 2760 if(ratio > 1) 4036 2761 { 4037 2762 dequantcoeff[0] = invQuantScales * dc; 4038 2763 } 4039 #endif4040 2764 } 4041 2765 -
trunk/source/Lib/TLibCommon/TComTrQuant.h
r56 r296 89 89 Int m_iBits; 90 90 91 #if H0736_AVC_STYLE_QP_RANGE92 91 Void setQpParam( Int qpScaled, Bool bLowpass, SliceType eSliceType ) 93 92 { … … 97 96 m_iBits = QP_BITS + m_iPer; 98 97 } 99 #else100 Void setQpParam( Int iQP, Bool bLowpass, SliceType eSliceType )101 {102 assert ( iQP >= MIN_QP && iQP <= MAX_QP );103 m_iQP = iQP;104 105 m_iPer = (iQP + 6*g_uiBitIncrement)/6;106 #if FULL_NBIT107 m_iPer += g_uiBitDepth - 8;108 #endif109 m_iRem = iQP % 6;110 111 m_iBits = QP_BITS + m_iPer;112 }113 #endif114 98 115 99 Void clear() … … 165 149 166 150 // Misc functions 167 #if H0736_AVC_STYLE_QP_RANGE168 151 Void setQPforQuant( Int qpy, Bool bLowpass, SliceType eSliceType, TextType eTxtType, Int qpBdOffset, Int chromaQPOffset); 169 #else170 Void setQPforQuant( Int iQP, Bool bLowpass, SliceType eSliceType, TextType eTxtType, Int Shift);171 #endif172 152 173 153 #if RDOQ_CHROMA_LAMBDA … … 192 172 const UInt uiCGPosX, 193 173 const UInt uiCGPosY, 194 #if MULTILEVEL_SIGMAP_EXT195 174 const UInt scanIdx, 196 #endif197 175 Int width, Int height); 198 #if !REMOVE_INFER_SIGGRP199 static Bool bothCGNeighboursOne ( const UInt* uiSigCoeffGroupFlag,200 const UInt uiCGPosX,201 const UInt uiCGPosY,202 #if MULTILEVEL_SIGMAP_EXT203 const UInt scanIdx,204 #endif205 Int width, Int height);206 #endif207 176 Void initScalingList (); 208 177 Void destroyScalingList (); … … 259 228 Void xT ( UInt uiMode,Pel* pResidual, UInt uiStride, Int* plCoeff, Int iWidth, Int iHeight ); 260 229 261 #if MULTIBITS_DATA_HIDING262 230 Void signBitHidingHDQ( TComDataCU* pcCU, TCoeff* pQCoef, TCoeff* pCoef, UInt const *scan, Int* deltaU, Int width, Int height ); 263 #endif264 231 265 232 // quantization … … 298 265 UShort ui16CtxNumAbs, 299 266 UShort ui16AbsGoRice, 300 #if RESTRICT_GR1GR2FLAG_NUMBER301 267 UInt c1Idx, 302 268 UInt c2Idx, 303 #endif304 269 Int iQBits, 305 270 Double dTemp, … … 309 274 UShort ui16CtxNumAbs, 310 275 UShort ui16AbsGoRice 311 #if RESTRICT_GR1GR2FLAG_NUMBER312 276 , UInt c1Idx, 313 277 UInt c2Idx 314 #endif315 278 ) const; 316 #if MULTIBITS_DATA_HIDING317 279 __inline Int xGetICRate ( UInt uiAbsLevel, 318 280 UShort ui16CtxNumOne, 319 281 UShort ui16CtxNumAbs, 320 282 UShort ui16AbsGoRice 321 #if RESTRICT_GR1GR2FLAG_NUMBER322 283 , UInt c1Idx, 323 284 UInt c2Idx 324 #endif325 285 ) const; 326 #endif327 286 __inline Double xGetRateLast ( const UInt uiPosX, 328 287 const UInt uiPosY, -
trunk/source/Lib/TLibCommon/TComWedgelet.cpp
r189 r296 52 52 m_uhOri ( 0 ), 53 53 m_eWedgeRes( FULL_PEL ) 54 #if HHI QC_DMMFASTSEARCH_B003954 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 55 55 , m_bIsCoarse( false ) 56 56 #endif … … 65 65 m_uhOri ( rcWedge.m_uhOri ), 66 66 m_eWedgeRes( rcWedge.m_eWedgeRes ), 67 #if HHI QC_DMMFASTSEARCH_B003967 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 68 68 m_bIsCoarse( rcWedge.m_bIsCoarse ), 69 69 m_uiAng ( rcWedge.m_uiAng ), … … 101 101 } 102 102 103 #if HHI QC_DMMFASTSEARCH_B0039103 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 104 104 Void TComWedgelet::findClosetAngle() 105 105 { … … 142 142 m_uhOri = uhOri; 143 143 m_eWedgeRes = eWedgeRes; 144 #if HHI QC_DMMFASTSEARCH_B0039144 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 145 145 m_bIsCoarse = bIsCoarse; 146 146 #endif … … 687 687 case( 2 ): { for( UInt iX = uiTempBlockSize-1; iX > uhXs; iX-- ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } } break; 688 688 case( 3 ): { for( UInt iY = uiTempBlockSize-1; iY > uhYs; iY-- ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break; 689 #if HHI QC_DMMFASTSEARCH_B0039689 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 690 690 case( 4 ): 691 691 { … … 721 721 case( 2 ): { uiOffX = 1; uiOffY = 1; } break; 722 722 case( 3 ): { uiOffX = 0; uiOffY = 1; } break; 723 #if HHI QC_DMMFASTSEARCH_B0039723 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 724 724 case( 4 ): 725 725 { … … 805 805 } 806 806 807 #if HHI QC_DMMFASTSEARCH_B0039807 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 808 808 TComWedgeNode::TComWedgeNode() 809 809 { -
trunk/source/Lib/TLibCommon/TComWedgelet.h
r189 r296 50 50 }; 51 51 52 #if HHI QC_DMMFASTSEARCH_B003952 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 53 53 #define NUM_WEDGE_REFINES 8 54 54 #define NO_IDX MAX_UINT … … 67 67 UChar m_uhOri; // orientation index 68 68 WedgeResolution m_eWedgeRes; // start/end pos resolution 69 #if HHI QC_DMMFASTSEARCH_B003969 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 70 70 Bool m_bIsCoarse; 71 71 UInt m_uiAng; … … 99 99 UChar getEndY () { return m_uhYe; } 100 100 UChar getOri () { return m_uhOri; } 101 #if HHI QC_DMMFASTSEARCH_B0039101 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 102 102 Bool getIsCoarse() { return m_bIsCoarse; } 103 103 UInt getAng () { return m_uiAng; } … … 153 153 typedef std::vector<TComWedgeRef> WedgeRefList; 154 154 155 #if HHI QC_DMMFASTSEARCH_B0039155 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 156 156 // ==================================================================================================================== 157 157 // Class definition TComWedgeNode -
trunk/source/Lib/TLibCommon/TComYuv.cpp
r189 r296 392 392 } 393 393 394 #if LG_RESTRICTEDRESPRED_M24766 394 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 395 395 Void 396 396 TComYuv::add(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) … … 408 408 #endif 409 409 410 #if LG_RESTRICTEDRESPRED_M24766 410 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 411 411 Void 412 412 TComYuv::getPUXYOffset(PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset) … … 435 435 #endif 436 436 437 #if LG_RESTRICTEDRESPRED_M24766 437 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 438 438 Void 439 439 TComYuv::addLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) … … 449 449 Pel* pDstSamples = getLumaAddr(); 450 450 451 #if LG_RESTRICTEDRESPRED_M24766 451 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 452 452 Int iXOffset, iYOffset; 453 453 … … 502 502 } 503 503 504 #if LG_RESTRICTEDRESPRED_M24766 504 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 505 505 Void 506 506 TComYuv::addChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ) … … 518 518 Pel* pDstSamplesCr = getCrAddr(); 519 519 520 #if LG_RESTRICTEDRESPRED_M24766 520 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 521 521 Int iXOffset, iYOffset; 522 522 … … 676 676 } 677 677 678 #if LG_RESTRICTEDRESPRED_M24766 678 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 679 679 Void TComYuv::subtract(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 680 680 { … … 690 690 #endif 691 691 692 #if LG_RESTRICTEDRESPRED_M24766 692 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 693 693 Void TComYuv::subtractLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 694 694 #else … … 706 706 Int iDstStride = getStride(); 707 707 708 #if LG_RESTRICTEDRESPRED_M24766 708 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 709 709 Int iXOffset, iYOffset; 710 710 … … 814 814 } 815 815 816 #if LG_RESTRICTEDRESPRED_M24766 816 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 817 817 Void TComYuv::subtractChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 818 818 #else … … 832 832 Int iSrc1Stride = pcYuvSrc1->getCStride(); 833 833 Int iDstStride = getCStride(); 834 #if LG_RESTRICTEDRESPRED_M24766 834 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 835 835 Int iXOffset, iYOffset; 836 836 -
trunk/source/Lib/TLibCommon/TComYuv.h
r100 r296 146 146 Void addClipPartLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); //GT 147 147 148 #if LG_RESTRICTEDRESPRED_M24766 148 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 149 149 // pcYuvSrc0 - pcYuvSrc1 -> m_apiBuf 150 150 Void subtract (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); … … 166 166 // Remove High frequency 167 167 Void removeHighFreq ( TComYuv* pcYuvSrc, UInt uiPartIdx, UInt uiWidht, UInt uiHeight ); 168 #if LG_RESTRICTEDRESPRED_M24766 168 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 169 169 Void getPUXYOffset (PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset); 170 170 Void add (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract = false ); -
trunk/source/Lib/TLibCommon/TypeDef.h
r211 r296 41 41 //! \ingroup TLibCommon 42 42 //! \{ 43 44 // MV-HEVC 45 #define QC_IV_AS_LT_B0046 1 //JCT3V-B0046: inter-view reference pictures are treated as long-term pictures 46 #define QC_REM_IDV_B0046 1 //JCT3V-B0046: removal of IDV NAL unit type 47 #define DV_V_RESTRICTION_B0037 1 //JCT3V-B0037: disparity vector vertical range restriction 48 #define QC_TMVP_IDX_MOD_B0046 1 //JCT3V-B0046: the reference index for temporal merging candidate is set to 0, as defined in HEVC 49 50 // 3D-HEVC 43 51 #define QC_MVHEVC_B0046 0 //JCT3V-B0046: disable 3DHEVC tools 44 #define QC_IV_AS_LT_B0046 1 //JCT3V-B0046: inter-view reference pictures are treated as long-term pictures45 #define QC_TMVP_IDX_MOD_B0046 1 //JCT3V-B0046: the reference index for temporal merging candidate is set to 0, as defined in HEVC46 #define QC_REM_IDV_B0046 1 //JCT3V-B0046: removal of IDV NAL unit type47 #define FIX_DEL_NULLPTR 148 #define FIX_MISUSE_REFINDEX 149 #define FIX_FCO_COMP_WARNING 150 #define DV_V_RESTRICTION_B0037 1 // JCT3V-B0037 disparity vector vertical range restriction51 52 52 53 #if !QC_MVHEVC_B0046 53 ///// ***** FIXES ********* 54 // A 55 #define FIX_POZNAN_CABAC_INIT_FLAG 1 56 #define FIX_LG_RESTRICTEDRESPRED_M24766 1 57 58 // B 59 #define FIX_LGE_IVMP_PARALLEL_MERGE_B0136 1 60 #define FIX_RDO_NEGDIST 1 61 #define FIX_DMM_NEG_DIST 1 62 #define FIX_LGE_DVMCP_B0133 1 63 64 65 // FCO 66 #define FLEX_CODING_ORDER_M23723 1 67 #if FLEX_CODING_ORDER_M23723 68 #define DISABLE_FCO_FOR_VSO 0 // Optional compile settings to disable VSO with FCO. 69 #endif 70 71 ///// ***** PATCHES ********* 72 #define TMVP_DEPTH_SWITCH 1 // JCT3V-B0092 additional encoder option only 73 74 ///// ***** DEPTH MODELING MODES ********* 54 55 ///// ***** DMM ********* 75 56 #define HHI_DMM_WEDGE_INTRA 1 // depth model modes independent on texture (explicit and intra-predicted Wedgelet prediction) 76 57 #define HHI_DMM_PRED_TEX 1 // depth model modes dependent on texture (inter-component Wedgelet and Contour prediction ) 58 // HHIQC_DMMFASTSEARCH_B0039, fast Wedgelet search for DMM modes 1 and 3 59 77 60 #define LGE_EDGE_INTRA_A0070 1 // JCT3V-A0070 61 62 #define HHI_DMM_DELTADC_Q1_C0034 1 // JCT3V-C0034: no quantization and fast encoder search for DMM delta DC values 63 #if ( HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA ) && HHI_DMM_PRED_TEX 64 #define LGE_DMM3_SIMP_C0044 1 65 #endif 66 #define FIX_DMM_CTX_INIT_C0034 1 // JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short) 67 68 ///// ***** SDC ********* 78 69 #define RWTH_SDC_DLT_B0036 1 // JCT3V-B0036: Simplified Depth Coding + Depth Lookup Table 79 #define HHIQC_DMMFASTSEARCH_B0039 1 // JCT3V-B0039: fast Wedgelet search for DMM modes 1 and 3 80 81 ///// ***** INTERVIEW MOTION VECTOR PREDICTION ********* 82 #define HHI_INTER_VIEW_MOTION_PRED 1 // inter-view motion parameter prediction 83 #define SHARP_INTERVIEW_DECOUPLE_B0111 1 // JCT3V-B0111 decoupling inter-view candidate 84 #define QC_MRG_CANS_B0048 1 // JCT3V-B0048, B0086, B0069 85 #if QC_MRG_CANS_B0048 86 #define OL_DISMV_POS_B0069 1 // different pos for disparity MV candidate, B0069 87 #endif 88 #define MTK_INTERVIEW_MERGE_A0049 1 // JCT3V-A0049 second part 89 #if HHI_INTER_VIEW_MOTION_PRED 90 #define SAIT_IMPROV_MOTION_PRED_M24829 1 // improved inter-view motion vector prediction 91 #else 92 #define SAIT_IMPROV_MOTION_PRED_M24829 0 93 #endif 70 #if RWTH_SDC_DLT_B0036 71 #define SAIT_SDC_C0096 1 // JCT3V-C0096: Improved Simple Depth Coding(removal of DMM2 among four SDC modes(DC, Planar, DMM1 and DMM2)) 72 #endif 73 #define FIX_SDC_ENC_C0143 1 // JCT3V-C0143 fix for unnecessary encoder checks in case of SDC 74 75 ///// ***** TMVP/AMVP ********* 76 #define TMVP_DEPTH_SWITCH 1 // JCT3V-B0092 additional encoder option only 77 #define QC_TMVP_MRG_REFIDX_C0047 1 // only enabled when QC_TMVP_IDX_MOD_B0046 is enabled. 78 #define INTER_VIEW_VECTOR_SCALING_C0115 1 // JCT3V-C0115 Inter-view vector scaling for TMVP & flag 79 #define INTER_VIEW_VECTOR_SCALING_C0116 1 // JCT3V-C0116 Inter-view vector scaling for AMVP 80 81 ///// ***** INTERVIEW MOTION PARAMETER PREDICTION ********* 82 #define H3D_IVMP 1 // Inter-view motion parameter prediction 83 // HHI_INTER_VIEW_MOTION_PRED 84 // SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction 85 // SHARP_INTERVIEW_DECOUPLE_B0111, decoupling inter-view candidate 86 // QC_MRG_CANS_B0048 , JCT3V-B0048, B0086, B0069 87 // OL_DISMV_POS_B0069 , different pos for disparity MV candidate, B0069 88 // MTK_INTERVIEW_MERGE_A0049 , second part 89 #define QC_AMVP_MRG_UNIFY_IVCAN_C0051 1 90 #define QC_C0051_FIXED_BY_MTK 1 // Bug fix for C0051 implementation 91 94 92 95 93 ///// ***** INTERVIEW RESIDUAL PREDICTION ********* 96 #define HHI_INTER_VIEW_RESIDUAL_PRED 1 // inter-view residual prediction 97 #if HHI_INTER_VIEW_RESIDUAL_PRED 98 #define LG_RESTRICTEDRESPRED_M24766 1 // restricted inter-view residual prediction 99 #define QC_SIMPLIFIEDIVRP_M24938 1 94 #define H3D_IVRP 1 // Inter-view residual prediction 95 // HHI_INTER_VIEW_RESIDUAL_PRED 96 // QC_SIMPLIFIEDIVRP_M24938 97 #if H3D_IVRP 98 #define LG_RESTRICTEDRESPRED_M24766 1 // Restricted inter-view residual prediction 99 #define FIX_LG_RESTRICTEDRESPRED_M24766 1 100 100 #else 101 101 #define LG_RESTRICTEDRESPRED_M24766 0 102 #define QC_SIMPLIFIEDIVRP_M24938 0 103 #endif 102 #endif 103 104 #define MTK_MDIVRP_C0138 1 // Mode-dependent inter-view residual prediction 105 #define MTK_C0138_FIXED 1 // Fix for IBP coding structure in view direction (not CTC) 106 104 107 105 108 ///// ***** DISPARITY VECTOR DERIVATION ********* 106 #define QC_MULTI_DIS_CAN_A0097 1 // JCT3V-A0097 107 #define LGE_DVMCP_A0126 1 // JCT3V-A0126 108 #define LGE_DVMCP_MEM_REDUCTION_B0135 1 // JCT3V-B0135 109 #define DV_DERIVATION_PARALLEL_B0096 1 // JCT3V-B0096, enable parallel derivation of disparity vector 110 #define QC_SIMPLE_NBDV_B0047 1 // JCT3V-B0047 109 #define H3D_NBDV 1 // Neighboring block disparity derivation 110 // JCT3V-A0097 111 // LGE_DVMCP_A0126 112 // LGE_DVMCP_MEM_REDUCTION_B0135 113 // DV_DERIVATION_PARALLEL_B0096, enable parallel derivation of disparity vector 114 // QC_SIMPLE_NBDV_B0047 115 // FIX_LGE_DVMCP_B0133 116 // LGE_IVMP_PARALLEL_MERGE_B0136, B0136 support of parallel merge/skip in disparity vector derivation 117 // FIX_LGE_IVMP_PARALLEL_MERGE_B0136 118 119 #define QC_NBDV_LDB_FIX_C0055 1 // JCT3V-C0055 120 #define MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097 1 // JCT3V-C0141/C0097 121 #define MTK_RELEASE_DV_CONSTRAINT_C0129 1 // JCT3V-C0129 122 #define MTK_SIMPLIFY_DVTC_C0135 1 // JCT3V-C0135 111 123 112 124 ///// ***** MOTION PARAMETER INHERITANCE ********* 113 #define HHI_MPI 1 // motion parameter inheritance from texture picture for depth map coding 125 #define MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 1 // JCT3V-C0137 126 #define HHI_MPI 0 // motion parameter inheritance from texture picture for depth map coding 114 127 #if HHI_MPI 115 128 #define FIX_MPI_B0065 1 // JCT3V-B0065, fix the MPI bug when RQT is off … … 133 146 #if LGE_ILLUCOMP_B0045 134 147 #define LGE_ILLUCOMP_B0045_ENCSIMP 1 148 #define FIX_LGE_ILLUCOMP_B0045 1 149 #define LGE_ILLUCOMP_DEPTH_C0046 1 // JCT2-C0046 Apply illumination compensation to depth 150 #if LGE_ILLUCOMP_DEPTH_C0046 151 #define FIX_ILLUCOMP_DEPTH 1 152 #endif 135 153 #endif 136 154 … … 140 158 ///// ***** QUADTREE LIMITATION ********* 141 159 #define OL_QTLIMIT_PREDCODING_B0068 1 //JCT3V-B0068 160 #define HHI_QTLPC_RAU_OFF_C0160 1 // JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units 142 161 143 162 ///// ***** OTHERS ********* 144 163 #define LG_ZEROINTRADEPTHRESI_A0087 1 // JCT2-A0087 145 #define SONY_COLPIC_AVAILABILITY 1146 164 #define HHI_FULL_PEL_DEPTH_MAP_MV_ACC 1 // full-pel mv accuracy for depth maps 147 #define VIDYO_VPS_INTEGRATION 1 148 149 150 151 ///// ***** DEFINED PARAMETERS ********* 152 #if QC_MULTI_DIS_CAN_A0097 165 #define VIDYO_VPS_INTEGRATION 1 // Integration of VPS 166 #define HHI_DEPTH_INTRA_SEARCH_RAU_C0160 1 // JCT3V-C0160 change 1: full Intra search in depth random access units 167 #define FIX_POZNAN_CABAC_INIT_FLAG 1 168 169 ///// ***** FCO ********* 170 #define FLEX_CODING_ORDER_M23723 1 171 #if FLEX_CODING_ORDER_M23723 172 #define DISABLE_FCO_FOR_VSO 0 // Optional compile settings to disable VSO with FCO. 173 #endif 174 175 ///// ***** VSP ********* 176 #define MERL_VSP_C0152 1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools 177 #if MERL_VSP_C0152 178 179 /* 180 * Two macros are used to configure combinations of JCT3V-C0152 and JCT3V-C0131 181 * 182 * a) (full) A full JCT3V-C0152 implementation, including JCT3V-C0131 183 * #define MERL_VSP_COMPENSATION_C0152 1 184 * #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 1 185 * 186 * b) (mvp2off) For partial JCT3V-C0152 excluding overlaps from JCT3V-C0131 187 * #define MERL_VSP_COMPENSATION_C0152 1 188 * #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 0 189 * 190 * c) (nocand) For JCT3V-C0131 only 191 * #define MERL_VSP_COMPENSATION_C0152 0 192 * #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 1 193 */ 194 195 #define MERL_VSP_COMPENSATION_C0152 1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add (nocand). 196 #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 1 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine (mvp2off). 197 198 #define MERL_VSP_BLOCKSIZE_C0152 4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4. 199 #define VSP_MERGE_POS 5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5. 200 #define LGE_SIMP_DVP_REFINE_C0112 1 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block 201 202 #else // !MERL_VSP_C0152 203 #define MERL_VSP_COMPENSATION_C0152 0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add 204 #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 0 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine 205 #define MERL_VSP_BLOCKSIZE_C0152 4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4. 206 #define LGE_SIMP_DVP_REFINE_C0112 0 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block 207 #endif 208 209 210 ///// ***** DERIVED PARAMETERS ********* 211 #if H3D_NBDV 153 212 #define DIS_CANS 1 154 213 #endif … … 172 231 173 232 174 #if LGE_DVMCP_A0126233 #if H3D_NBDV 175 234 #define DVFROM_LEFTBELOW 1 176 235 #define DVFROM_LEFT 2 … … 182 241 183 242 184 #if HHI QC_DMMFASTSEARCH_B0039243 #if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA 185 244 #define DMM3_SIMPLIFY_TR 1 186 245 #endif … … 189 248 #if RWTH_SDC_DLT_B0036 190 249 #define Log2( n ) ( log((double)n) / log(2.0) ) 250 #define HS_REFERENCE_SUBSAMPLE_C0154 1 191 251 #endif 192 252 193 253 #define HHI_MPI_MERGE_POS 0 194 254 #endif 255 256 195 257 ///// ***** HM 6.1 ********* 258 259 //// REMOVED HM 6.1 Guard macros (corresponding to macros removed in HM 6.3.1) 260 /* 196 261 #define SKIPFRAME_BUGFIX 1 ///< bug fix to enable skipFrame at decoder 197 262 #define START_DECODING_AT_CRA 1 ///< H0496, start decoding at clear random access point 198 263 #define NO_COMBINED_PARALLEL 1 ///< Disallow any combined usage of parallel tools among Tile, EntropySlice and Wavefont 264 #define PARALLEL_MERGE 1 ///< H0082 parallel merge/skip 265 #define MVP_AT_ENTROPYSLICE_BOUNDARY 1 //< H0362 enable motion prediction accross entropy slice boundary 266 #define FAST_DECISION_FOR_MRG_RD_COST 1 ////< H0178: Fast Decision for Merge 2Nx2N RDCost 267 #define PIC_CROPPING 1 ///< Picture cropping and size constraints 268 #define NAL_REF_FLAG 1 ///< Change nal_ref_idc to nal_ref_flag (JCTVC-F463) 269 #define REMOVE_DIV_OPERATION 1 ///< H0238: Simplified intra horizontal and vertical filtering 270 #define LOGI_INTRA_NAME_3MPM 1 ///< H0407: logical Intra mode naming (sequential angular mode numbering) and 3 MPM mode coding 271 #define LEVEL_CTX_LUMA_RED 1 ///<H0130: Luma level context reduction 272 #define REMOVE_INFER_SIGGRP 1 ///<H0131: Remove inferred significant_coeff_group_flag 273 #define SET_MERGE_TMVP_REFIDX 1 ///< H0278/H0199: Setting the merge TMVP refidx to 0 for the non-first partition 274 #define MULTILEVEL_SIGMAP_EXT 1 ///< H0526: multi-level significance map extended to smaller TUs 275 #define MULTIBITS_DATA_HIDING 1 ///< H0481: multiple sign bit hiding 276 #define DEQUANT_CLIPPING 1 ///< H0312/H0541: transformed coefficients clipping before de-quantization 277 #define REMOVE_NON_SCALED 1 ///< H0164/H0250: Removal of non-scaled merge candidate 278 #define MRG_IDX_CTX_RED 1 ///< H0251: Merge index context reduction 279 #define SIMP_MRG_PRUN 1 ///< H0252: simplification of merge pruning process 280 #define AMVP_PRUNING_SIMPLIFICATION 1 ///H0316: simplify the pruning process of AMVP by exempting the temporal candidate 281 #define AMVP_ZERO_CHECKING_REMOVAL 1 ///H0239/H0316: remove zero motion vector checking of AMVP 282 #define H0111_MVD_L1_ZERO 1 ///< H0111: modification of bi-prediction 283 #define CLIPSCALEDMVP 1 ///< H0216: Clipping scaled MV to 16 bit 284 #define UNIFIED_TRANSFORM_TREE 1 ///< H0123: unified tree structure for TU 285 #define SIGMAP_CTX_SUBBLOCK 1 ///< H0290: 4x4 sub-block based region for significant_flag context selection 286 #define LAST_CTX_REDUCTION 1 ///< H0537/H514: contexts reduction for last position coding 287 #define AMP_CTX 1 ///<H0545: context reduction for asymmetric partition 288 #define RESTRICT_GR1GR2FLAG_NUMBER 1 ///< H0554: Throughput improvement of CABAC coefficients level coding 289 #define EIGHT_BITS_RICE_CODE 1 ///< H0498 : 8 bits rice codes 290 #define SAO_UNIT_INTERLEAVING 1 ///< H0273 291 #define ALF_SINGLE_FILTER_SHAPE 1 //< !!! H0068: Single filter type : 9x7 cross + 3x3 square 292 #define ALF_16_BA_GROUPS 1 ///< H0409 16 BA groups 293 #define LCU_SYNTAX_ALF 1 ///< H0274 LCU-syntax ALF 294 #define ALF_CHROMA_COEF_PRED_HARMONIZATION 1 ///< H0483: ALF chroma coeff pred harmonization 295 #define CABAC_LINEAR_INIT 1 ///< H0535 : linear CABAC initialization 296 #define UNIFIED_TRANSFORM 1 ///< H0492: unify square and non-square transform 297 #define G519_TU_AMP_NSQT_HARMONIZATION 1 ///< G519: Harmonization of implicit TU, AMP and NSQT 298 #define CHROMA_MODE_CODING 1 //H0326/H0475 : 2-length fixed, bypass coding for chroma intra prediction mode 299 #define NSQT_LFFIX 1 ///< Bug fix related to NSQT and deblocking filter 300 #define H0736_AVC_STYLE_QP_RANGE 1 ///< H0736: AVC style qp range and wrapping. 301 #define H0204_QP_PREDICTION 1 ///< H0204: improved QP prediction 302 #define BURST_IPCM 1 ///< H0051: Burst IPCM 303 #define H0137_0138_LIST_MODIFICATION 1 // Enabled reference picture lists combination (H0137) and reference picture list modification (H0138) updates 304 #define LTRP_MULT 1 ///< enable/disable multiple long term reference pictures with same POC LSB 305 #define OL_FLUSH 1 // Set to 1 to enable Wavefront Flush. 306 #define FIXED_NUMBER_OF_TILES_SLICE_MODE 1 307 #define SCALING_LIST 1 //JCTVC-H0230/H0461/H0237 308 #define DEFAULT_DC 1 // JCTVC-H0242 309 #define RPS_IN_SPS 1 // Adopted during discussion of JCTVC-H0423 310 #define H0412_REF_PIC_LIST_RESTRICTION 1 311 #define H0566_TLA 1 312 #define H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1 313 #define DBL_H0473_PART_1 1 //Deblocking filtering simplification 314 #define DBL_CONTROL 1 //PPS deblocking_filter_control_present_flag (JCTVC-H0398); condition for inherit params flag in SH (JCTVC-H0424) 315 #define DBL_STRONG_FILTER_CLIP 1 //Introduction of strong filter clipping in deblocking filter (JCTVC-H0275) 316 #define H0388 1 // JCTVC-H0388 317 #define TILES_WPP_ENTRY_POINT_SIGNALLING 1 // JCTVC-H0556. Assumes either Tiles is ON or WPP is ON (not both simultaneously). 318 #define REMOVE_TILE_DEPENDENCE 1 // remove tile_boundary_independence_flag and dependent tiles 319 #define TILES_OR_ENTROPY_SYNC_IDC 1 // tiles_or_entropy_coding_sync_idc flag 320 #define COMPLETE_SLICES_IN_TILE 1 // Among the constraints between slices and tiles, all slices within a tile shall be complete (JCTVC-H0348/JCTVC-H0463) for SliceMode 1&2 321 #define WPP_SIMPLIFICATION 1 // JCTVC-H0349/JCTVC-0517 322 */ 323 199 324 200 325 #define LOSSLESS_CODING 1 ///< H0530: lossless and lossy (mixed) coding … … 203 328 #endif 204 329 205 #define PARALLEL_MERGE 1 //< H0082 parallel merge/skip206 #define LGE_IVMP_PARALLEL_MERGE_B0136 1 //< B0136 support of parallel merge/skip in disparity vector derivation207 330 #define LOG2_PARALLEL_MERGE_LEVEL_MINUS2 0 //< H0082 parallel merge level 0-> 4x4, 1-> 8x8, 2->16x16, 3->32x32, 4->64x64 208 331 209 #if PARALLEL_MERGE &&LOG2_PARALLEL_MERGE_LEVEL_MINUS2332 #if LOG2_PARALLEL_MERGE_LEVEL_MINUS2 210 333 #define CU_BASED_MRG_CAND_LIST 1 //< H0240: single merge candidate list for all PUs inside a 8x8 CU conditioned on LOG2_PARALLEL_MERGE_LEVEL_MINUS2 > 0 211 334 #define FIX_CU_BASED_MRG_CAND_LIST_B0136 1 //< B0136 bug fix for CU_BASED_MRG_CAND_LIST 212 335 #endif 213 336 214 #define MVP_AT_ENTROPYSLICE_BOUNDARY 1 //< H0362 enable motion prediction accross entropy slice boundary215 216 #define FAST_DECISION_FOR_MRG_RD_COST 1 ////< H0178: Fast Decision for Merge 2Nx2N RDCost217 218 #define PIC_CROPPING 1 ///< Picture cropping and size constraints219 #define NAL_REF_FLAG 1 ///< Change nal_ref_idc to nal_ref_flag (JCTVC-F463)220 #define REMOVE_DIV_OPERATION 1 ///< H0238: Simplified intra horizontal and vertical filtering221 #define LOGI_INTRA_NAME_3MPM 1 ///< H0407: logical Intra mode naming (sequential angular mode numbering) and 3 MPM mode coding222 223 #define LEVEL_CTX_LUMA_RED 1 ///<H0130: Luma level context reduction224 #define REMOVE_INFER_SIGGRP 1 ///<H0131: Remove inferred significant_coeff_group_flag225 226 #define SET_MERGE_TMVP_REFIDX 1 ///< H0278/H0199: Setting the merge TMVP refidx to 0 for the non-first partition227 228 #define MULTILEVEL_SIGMAP_EXT 1 ///< H0526: multi-level significance map extended to smaller TUs229 #define MULTIBITS_DATA_HIDING 1 ///< H0481: multiple sign bit hiding230 231 #define DEQUANT_CLIPPING 1 ///< H0312/H0541: transformed coefficients clipping before de-quantization232 233 #define REMOVE_NON_SCALED 1 ///< H0164/H0250: Removal of non-scaled merge candidate234 #define MRG_IDX_CTX_RED 1 ///< H0251: Merge index context reduction235 #define SIMP_MRG_PRUN 1 ///< H0252: simplification of merge pruning process236 237 #define AMVP_PRUNING_SIMPLIFICATION 1 ///H0316: simplify the pruning process of AMVP by exempting the temporal candidate238 #define AMVP_ZERO_CHECKING_REMOVAL 1 ///H0239/H0316: remove zero motion vector checking of AMVP239 240 #define H0111_MVD_L1_ZERO 1 ///< H0111: modification of bi-prediction241 337 #define DISABLING_CLIP_FOR_BIPREDME 1 ///< Ticket #175 242 243 #define CLIPSCALEDMVP 1 ///< H0216: Clipping scaled MV to 16 bit244 245 #define UNIFIED_TRANSFORM_TREE 1 ///< H0123: unified tree structure for TU246 247 #define SIGMAP_CTX_SUBBLOCK 1 ///< H0290: 4x4 sub-block based region for significant_flag context selection248 249 338 #define SIGMAP_CONST_AT_HIGH_FREQUENCY 1 ///< H0095 method2.1: const significance map at high freaquency 250 339 251 #define LAST_CTX_REDUCTION 1 ///< H0537/H514: contexts reduction for last position coding252 253 #define AMP_CTX 1 ///<H0545: context reduction for asymmetric partition254 255 #define RESTRICT_GR1GR2FLAG_NUMBER 1 ///< H0554: Throughput improvement of CABAC coefficients level coding256 #if RESTRICT_GR1GR2FLAG_NUMBER //257 340 #define C1FLAG_NUMBER 8 // maximum number of largerThan1 flag coded in one chunk : 16 in HM5 258 341 #define C2FLAG_NUMBER 1 // maximum number of largerThan2 flag coded in one chunk: 16 in HM5 259 #endif 260 261 #define EIGHT_BITS_RICE_CODE 1 ///< H0498 : 8 bits rice codes 262 263 #define SAO_UNIT_INTERLEAVING 1 ///< H0273 342 264 343 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_1 0 ///< disable the encoder constraint that does not test SAO/BO mode for chroma in interleaved mode 265 344 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_2 0 ///< disable the encoder constraint that reduce the range of SAO/EO for chroma in interleaved mode 266 345 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 0 ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode 267 268 #define ALF_SINGLE_FILTER_SHAPE 1 //< !!! H0068: Single filter type : 9x7 cross + 3x3 square 269 270 #define ALF_16_BA_GROUPS 1 ///< H0409 16 BA groups 271 #define LCU_SYNTAX_ALF 1 ///< H0274 LCU-syntax ALF 272 #define ALF_CHROMA_COEF_PRED_HARMONIZATION 1 ///< H0483: ALF chroma coeff pred harmonization 273 274 #define CABAC_LINEAR_INIT 1 ///< H0535 : linear CABAC initialization 275 276 #define COLLOCATED_REF_IDX 1 ///< H0442: signal collocated reference index 277 278 #define UNIFIED_TRANSFORM 1 ///< H0492: unify square and non-square transform 346 #define COLLOCATED_REF_IDX 1 ///< H0442: signal collocated reference index 347 279 348 280 349 #define MAX_NUM_SPS 32 … … 293 362 #define FAST_BIT_EST 1 ///< G763: Table-based bit estimation for CABAC 294 363 295 #define G519_TU_AMP_NSQT_HARMONIZATION 1 ///< G519: Harmonization of implicit TU, AMP and NSQT296 364 297 365 #define MLS_GRP_NUM 64 ///< G644 : Max number of coefficient groups, max(16, 64) … … 305 373 306 374 307 #define CHROMA_MODE_CODING 1 //H0326/H0475 : 2-length fixed, bypass coding for chroma intra prediction mode308 309 #define NSQT_LFFIX 1 ///< Bug fix related to NSQT and deblocking filter310 375 #define NS_HAD 1 311 376 … … 313 378 #define APS_BITS_FOR_ALF_BYTE_LENGTH 8 314 379 315 #define H0736_AVC_STYLE_QP_RANGE 1 ///< H0736: AVC style qp range and wrapping. 316 #define H0204_QP_PREDICTION 1 ///< H0204: improved QP prediction 380 317 381 318 382 #define HHI_RQT_INTRA_SPEEDUP 1 ///< tests one best mode with full rqt 319 383 #define HHI_RQT_INTRA_SPEEDUP_MOD 0 ///< tests two best modes with full rqt 320 384 321 #define BURST_IPCM 1 ///< H0051: Burst IPCM 385 322 386 323 387 #if HHI_RQT_INTRA_SPEEDUP_MOD && !HHI_RQT_INTRA_SPEEDUP … … 325 389 #endif 326 390 327 #define H0137_0138_LIST_MODIFICATION 1 // Enabled reference picture lists combination (H0137) and reference picture list modification (H0138) updates 328 #if !H0137_0138_LIST_MODIFICATION 329 #error "H0137_0138_LIST_MODIFICATION must be enabled for multi-view coding." 330 #endif 391 331 392 332 393 #define VERBOSE_RATE 0 ///< Print additional rate information in encoder … … 386 447 387 448 #if LGE_EDGE_INTRA_A0070 388 #if HHI_DMM_WEDGE_INTRA &&HHI_DMM_PRED_TEX449 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 389 450 #define EDGE_INTRA_IDX (NUM_INTRA_MODE+NUM_DMM_MODE) 390 #endif // HHI_DMM_WEDGE_INTRA &&HHI_DMM_PRED_TEX451 #endif // HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 391 452 #if LGE_EDGE_INTRA_DELTA_DC 392 453 #define EDGE_INTRA_DELTA_IDX (EDGE_INTRA_IDX+1) … … 402 463 // this should be done with encoder only decision 403 464 // but because of the absence of reference frame management, the related code was hard coded currently 404 #define LTRP_MULT 1 ///< enable/disable multiple long term reference pictures with same POC LSB405 406 #define OL_FLUSH 1 // Set to 1 to enable Wavefront Flush.407 465 #define OL_FLUSH_ALIGN 0 // Align flush to byte boundary. This preserves byte operations in CABAC (faster) but at the expense of an average 408 466 // of 4 bits per flush. … … 413 471 414 472 #define PLANAR_IDX 0 415 #if LOGI_INTRA_NAME_3MPM416 473 #define VER_IDX 26 // index for intra VERTICAL mode 417 474 #define HOR_IDX 10 // index for intra HORIZONTAL mode 418 475 #define DC_IDX 1 // index for intra DC mode 419 #else420 #define DC_IDX 3 // index for intra DC mode421 #endif422 476 #define NUM_CHROMA_MODE 6 // total number of chroma modes 423 477 #define DM_CHROMA_IDX 36 // chroma mode index for derived from luma intra mode … … 430 484 #define FULL_NBIT 0 ///< When enabled, does not use g_uiBitIncrement anymore to support > 8 bit data 431 485 432 #define FIXED_NUMBER_OF_TILES_SLICE_MODE 1 486 433 487 #define AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE 1 ///< OPTION IDENTIFIER. mode==1 -> Limit maximum number of largest coding tree blocks in a slice 434 488 #define AD_HOC_SLICES_FIXED_NUMBER_OF_BYTES_IN_SLICE 2 ///< OPTION IDENTIFIER. mode==2 -> Limit maximum number of bins/bits in a slice 435 #if FIXED_NUMBER_OF_TILES_SLICE_MODE436 489 #define AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE 3 437 #endif438 490 439 491 // Entropy slice options … … 459 511 460 512 #define SCALING_LIST_OUTPUT_RESULT 0 //JCTVC-G880/JCTVC-G1016 quantization matrices 461 #define SCALING_LIST 1 //JCTVC-H0230/H0461/H0237462 463 #define DEFAULT_DC 1 // JCTVC-H0242464 465 #define RPS_IN_SPS 1 // Adopted during discussion of JCTVC-H0423466 467 #define H0412_REF_PIC_LIST_RESTRICTION 1468 469 #define H0566_TLA 1470 #if H0566_TLA471 513 #define H0566_TLA_SET_FOR_SWITCHING_POINTS 1 472 #endif 473 474 #define H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1 475 476 #define DBL_H0473_PART_1 1 //Deblocking filtering simplification 477 #define DBL_CONTROL 1 //PPS deblocking_filter_control_present_flag (JCTVC-H0398); condition for inherit params flag in SH (JCTVC-H0424) 478 #define DBL_STRONG_FILTER_CLIP 1 //Introduction of strong filter clipping in deblocking filter (JCTVC-H0275) 514 479 515 480 516 #define CABAC_INIT_FLAG 1 // JCTVC-H0540 481 517 #define CABAC_INIT_PRESENT_FLAG 1 482 518 483 #define H0388 1 // JCTVC-H0388484 485 #define TILES_WPP_ENTRY_POINT_SIGNALLING 1 // JCTVC-H0556. Assumes either Tiles is ON or WPP is ON (not both simultaneously).486 #define REMOVE_TILE_DEPENDENCE 1 // remove tile_boundary_independence_flag and dependent tiles487 #define TILES_OR_ENTROPY_SYNC_IDC 1 // tiles_or_entropy_coding_sync_idc flag488 #define COMPLETE_SLICES_IN_TILE 1 // Among the constraints between slices and tiles, all slices within a tile shall be complete (JCTVC-H0348/JCTVC-H0463) for SliceMode 1&2489 #define WPP_SIMPLIFICATION 1 // JCTVC-H0349/JCTVC-0517490 519 491 520 // ==================================================================================================================== … … 568 597 { 569 598 SAO_EO_LEN = 4, 570 #if SAO_UNIT_INTERLEAVING571 599 SAO_BO_LEN = 4, 572 600 SAO_MAX_BO_CLASSES = 32 573 #else574 SAO_BO_LEN = 16575 #endif576 601 }; 577 602 … … 582 607 SAO_EO_2, 583 608 SAO_EO_3, 584 #if SAO_UNIT_INTERLEAVING585 609 SAO_BO, 586 #else587 SAO_BO_0,588 SAO_BO_1,589 #endif590 610 MAX_NUM_SAO_TYPE 591 611 }; … … 593 613 typedef struct _SaoQTPart 594 614 { 595 #if !SAO_UNIT_INTERLEAVING596 Bool bEnableFlag;597 #endif598 615 Int iBestType; 599 616 Int iLength; 600 #if SAO_UNIT_INTERLEAVING601 617 Int bandPosition ; 602 618 Int iOffset[4]; 603 #else604 Int iOffset[32];605 #endif606 619 Int StartCUX; 607 620 Int StartCUY; … … 627 640 } SAOQTPart; 628 641 629 #if SAO_UNIT_INTERLEAVING630 642 typedef struct _SaoLcuParam 631 643 { … … 641 653 Int length; 642 654 } SaoLcuParam; 643 #endif644 655 645 656 struct SAOParam … … 649 660 Int iMaxSplitLevel; 650 661 Int iNumClass[MAX_NUM_SAO_TYPE]; 651 #if SAO_UNIT_INTERLEAVING652 662 Bool oneUnitFlag[3]; 653 663 SaoLcuParam* saoLcuParam[3]; 654 664 Int numCuInHeight; 655 665 Int numCuInWidth; 656 #endif657 666 ~SAOParam(); 658 667 }; … … 661 670 { 662 671 Int alf_flag; ///< indicates use of ALF 663 #if !LCU_SYNTAX_ALF664 Int chroma_idc; ///< indicates use of ALF for chroma665 #endif666 672 Int num_coeff; ///< number of filter coefficients 667 673 Int filter_shape; 668 #if !LCU_SYNTAX_ALF669 Int filter_shape_chroma;670 Int num_coeff_chroma; ///< number of filter coefficients (chroma)671 Int *coeff_chroma; ///< filter coefficient array (chroma)672 #endif673 674 Int *filterPattern; 674 675 Int startSecondFilter; … … 678 679 Int **coeffmulti; 679 680 Int minKStart; 680 #if !LCU_SYNTAX_ALF681 Int maxScanVal;682 Int kMinTab[42];683 684 Int alf_pcr_region_flag;685 ~ALFParam();686 #endif687 #if LCU_SYNTAX_ALF688 681 Int componentID; 689 682 Int* kMinTab; … … 698 691 Void destroy(); 699 692 Void copy(const ALFParam& src); 700 #endif 701 }; 702 703 #if LCU_SYNTAX_ALF 693 }; 694 704 695 struct AlfUnitParam 705 696 { … … 734 725 Void destroy(); 735 726 }; 736 #endif737 727 738 728 -
trunk/source/Lib/TLibDecoder/NALread.cpp
r210 r296 124 124 assert(forbidden_zero_bit == 0); 125 125 126 #if NAL_REF_FLAG127 126 nalu.m_nalRefFlag = (bs.read(1) != 0 ); 128 127 nalu.m_nalUnitType = (NalUnitType) bs.read(6); 129 #else130 nalu.m_nalRefIDC = (NalRefIdc) bs.read(2);131 nalu.m_nalUnitType = (NalUnitType) bs.read(5);132 #endif133 128 134 129 #if QC_MVHEVC_B0046 … … 137 132 nalu.m_temporalId = bs.read(3) - 1; 138 133 #else 139 #if H0388140 134 nalu.m_temporalId = bs.read(3); 141 135 // unsigned reserved_one_5bits = bs.read(5); … … 147 141 nalu.m_isDepth = bs.read(1); 148 142 #endif 149 #if H0566_TLA150 143 if ( nalu.m_temporalId ) 151 144 { … … 157 150 } 158 151 #endif 159 #else160 switch (nalu.m_nalUnitType)161 {162 case NAL_UNIT_CODED_SLICE:163 case NAL_UNIT_CODED_SLICE_IDR:164 #if H0566_TLA165 #if !QC_REM_IDV_B0046166 case NAL_UNIT_CODED_SLICE_IDV:167 #endif168 case NAL_UNIT_CODED_SLICE_CRA:169 case NAL_UNIT_CODED_SLICE_TLA:170 #else171 case NAL_UNIT_CODED_SLICE_CDR:172 #endif173 {174 nalu.m_temporalId = bs.read(3);175 #if VIDYO_VPS_INTEGRATION176 nalu.m_layerId = bs.read(5) - 1;177 #else178 nalu.m_OutputFlag = bs.read(1);179 // unsigned reserved_one_4bits = bs.read(4);180 // assert(reserved_one_4bits == 1);181 nalu.m_viewId = bs.read(3)-1;182 nalu.m_isDepth = bs.read(1);183 #endif184 185 #if H0566_TLA186 if (nalu.m_temporalId == 0)187 {188 #if QC_REM_IDV_B0046189 assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR);190 #else191 assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV );192 #endif193 }194 else195 {196 assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA);197 }198 #endif199 }200 break;201 default:202 nalu.m_temporalId = 0;203 nalu.m_OutputFlag = true;204 break;205 }206 #endif207 #endif208 152 } 209 153 //! \} -
trunk/source/Lib/TLibDecoder/TDecBinCoder.h
r56 r296 54 54 virtual Void start () = 0; 55 55 virtual Void finish () = 0; 56 #if OL_FLUSH57 56 virtual Void flush () = 0; 58 #endif59 57 60 58 virtual Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ) = 0; … … 64 62 65 63 virtual Void resetBac () = 0; 66 #if BURST_IPCM67 64 virtual Void decodeNumSubseqIPCM( Int& numSubseqIPCM ) = 0; 68 #endif69 65 virtual Void decodePCMAlignBits() = 0; 70 66 virtual Void xReadPCMCode ( UInt uiLength, UInt& ruiCode) = 0; -
trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
r56 r296 65 65 TDecBinCABAC::start() 66 66 { 67 #if !OL_FLUSH ||OL_FLUSH_ALIGN67 #if OL_FLUSH_ALIGN 68 68 assert( m_pcTComBitstream->getNumBitsUntilByteAligned() == 0 ); 69 69 #endif … … 72 72 m_bitsNeeded = -8; 73 73 m_uiValue = m_pcTComBitstream->readByte() << 8; 74 #if OL_FLUSH &&!OL_FLUSH_ALIGN74 #if !OL_FLUSH_ALIGN 75 75 m_uiLastByte = m_pcTComBitstream->readByte(); 76 76 m_uiValue |= m_uiLastByte; … … 85 85 } 86 86 87 #if OL_FLUSH88 87 Void 89 88 TDecBinCABAC::flush() … … 108 107 #endif // OL_FLUSH_ALIGN 109 108 } 110 #endif // OL_FLUSH111 109 112 110 /** … … 122 120 m_uiValue = pcTDecBinCABAC->m_uiValue; 123 121 m_bitsNeeded= pcTDecBinCABAC->m_bitsNeeded; 124 #if OL_FLUSH &&!OL_FLUSH_ALIGN122 #if !OL_FLUSH_ALIGN 125 123 m_uiLastByte= pcTDecBinCABAC->m_uiLastByte; 126 124 #endif … … 152 150 { 153 151 m_bitsNeeded = -8; 154 #if OL_FLUSH &&!OL_FLUSH_ALIGN152 #if !OL_FLUSH_ALIGN 155 153 m_uiLastByte = m_pcTComBitstream->readByte(); 156 154 m_uiValue += m_uiLastByte; … … 173 171 if ( m_bitsNeeded >= 0 ) 174 172 { 175 #if OL_FLUSH &&!OL_FLUSH_ALIGN173 #if !OL_FLUSH_ALIGN 176 174 m_uiLastByte = m_pcTComBitstream->readByte(); 177 175 m_uiValue += m_uiLastByte << m_bitsNeeded; … … 192 190 { 193 191 m_bitsNeeded = -8; 194 #if OL_FLUSH &&!OL_FLUSH_ALIGN192 #if !OL_FLUSH_ALIGN 195 193 m_uiLastByte = m_pcTComBitstream->readByte(); 196 194 m_uiValue += m_uiLastByte; … … 215 213 while ( numBins > 8 ) 216 214 { 217 #if OL_FLUSH &&!OL_FLUSH_ALIGN215 #if !OL_FLUSH_ALIGN 218 216 m_uiLastByte = m_pcTComBitstream->readByte(); 219 217 m_uiValue = ( m_uiValue << 8 ) + ( m_uiLastByte << ( 8 + m_bitsNeeded ) ); … … 241 239 if ( m_bitsNeeded >= 0 ) 242 240 { 243 #if OL_FLUSH &&!OL_FLUSH_ALIGN241 #if !OL_FLUSH_ALIGN 244 242 m_uiLastByte = m_pcTComBitstream->readByte(); 245 243 m_uiValue += m_uiLastByte << m_bitsNeeded; … … 285 283 { 286 284 m_bitsNeeded = -8; 287 #if OL_FLUSH &&!OL_FLUSH_ALIGN285 #if !OL_FLUSH_ALIGN 288 286 m_uiLastByte = m_pcTComBitstream->readByte(); 289 287 m_uiValue += m_uiLastByte; … … 306 304 } 307 305 308 #if BURST_IPCM309 306 /** Decode subsequent_pcm_num. 310 307 * \param numSubseqIPCM … … 323 320 { 324 321 m_bitsNeeded = -8; 325 #if OL_FLUSH &&!OL_FLUSH_ALIGN322 #if !OL_FLUSH_ALIGN 326 323 m_uiLastByte = m_pcTComBitstream->readByte(); 327 324 m_uiValue += m_uiLastByte; … … 342 339 numSubseqIPCM --; 343 340 } 344 #endif345 341 346 342 /** Decode PCM alignment zero bits. -
trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.h
r56 r296 56 56 Void start (); 57 57 Void finish (); 58 #if OL_FLUSH59 58 Void flush (); 60 #endif61 59 62 60 Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ); … … 66 64 67 65 Void resetBac (); 68 #if BURST_IPCM69 66 Void decodeNumSubseqIPCM( Int& numSubseqIPCM ) ; 70 #endif71 67 Void decodePCMAlignBits(); 72 68 Void xReadPCMCode ( UInt uiLength, UInt& ruiCode ); … … 82 78 UInt m_uiRange; 83 79 UInt m_uiValue; 84 #if OL_FLUSH &&!OL_FLUSH_ALIGN80 #if !OL_FLUSH_ALIGN 85 81 UInt m_uiLastByte; 86 82 #endif -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r210 r296 169 169 assert(m_pcBitstream->getNumBitsLeft() == 8); /* rsbp_trailing_bits */ 170 170 } 171 #if RPS_IN_SPS172 171 void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) 173 #else174 void TDecCavlc::parseShortTermRefPicSet( TComPPS* pcPPS, TComReferencePictureSet* rps, Int idx )175 #endif176 172 { 177 173 UInt code; … … 184 180 Int rIdx = idx - 1 - code; 185 181 assert (rIdx <= idx && rIdx >= 0); 186 #if RPS_IN_SPS187 182 TComReferencePictureSet* rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx); 188 #else189 TComReferencePictureSet* rpsRef = pcPPS->getRPSList()->getReferencePictureSet(rIdx);190 #endif191 183 Int k = 0, k0 = 0, k1 = 0; 192 184 READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign … … 265 257 READ_FLAG(uiCode, "aps_scaling_list_data_present_flag"); aps->setScalingListEnabled( (uiCode==1)?true:false ); 266 258 READ_FLAG(uiCode, "aps_deblocking_filter_flag"); aps->setLoopFilterOffsetInAPS( (uiCode==1)?true:false ); 267 #if !SAO_UNIT_INTERLEAVING268 READ_FLAG(uiCode, "aps_sample_adaptive_offset_flag"); aps->setSaoEnabled( (uiCode==1)?true:false );269 #endif270 #if !LCU_SYNTAX_ALF271 READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag"); aps->setAlfEnabled( (uiCode==1)?true:false );272 #endif273 259 if(aps->getScalingListEnabled()) 274 260 { 275 261 parseScalingList( aps->getScalingList() ); 276 262 } 277 #if DBL_CONTROL278 263 if(aps->getLoopFilterOffsetInAPS()) 279 264 { 280 265 xParseDblParam( aps ); 281 266 } 282 #endif283 #if SAO_UNIT_INTERLEAVING284 267 READ_FLAG(uiCode, "aps_sao_interleaving_flag"); aps->setSaoInterleavingFlag( (uiCode==1)?true:false ); 285 268 if(!aps->getSaoInterleavingFlag()) 286 269 { 287 270 READ_FLAG(uiCode, "aps_sample_adaptive_offset_flag"); aps->setSaoEnabled( (uiCode==1)?true:false ); 288 #endif289 271 if(aps->getSaoEnabled()) 290 272 { … … 292 274 xParseSaoParam( aps->getSaoParam() ); 293 275 } 294 #if SAO_UNIT_INTERLEAVING 295 } 296 #endif 297 #if LCU_SYNTAX_ALF 276 } 298 277 READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag"); aps->setAlfEnabled( (uiCode==1)?true:false ); 299 #endif300 278 if(aps->getAlfEnabled()) 301 279 { 302 #if !LCU_SYNTAX_ALF303 aps->getAlfParam()->alf_flag = 1;304 #endif305 280 xParseAlfParam( aps->getAlfParam()); 306 281 } … … 316 291 } 317 292 318 #if DBL_CONTROL319 293 Void TDecCavlc::xParseDblParam ( TComAPS* aps ) 320 294 { … … 333 307 } 334 308 } 335 #endif336 309 /** parse SAO parameters 337 310 * \param pSaoParam … … 341 314 UInt uiSymbol; 342 315 343 #if SAO_UNIT_INTERLEAVING344 316 int i,j, compIdx; 345 317 int numCuInWidth; … … 393 365 } 394 366 } 395 #else 396 if (pSaoParam->bSaoFlag[0]) 397 { 398 xParseSaoSplitParam (pSaoParam, 0, 0); 399 xParseSaoOffsetParam(pSaoParam, 0, 0); 400 READ_FLAG (uiSymbol, "sao_flag_cb"); 401 pSaoParam->bSaoFlag[1] = uiSymbol? true:false; 402 if (pSaoParam->bSaoFlag[1]) 403 { 404 xParseSaoSplitParam (pSaoParam, 0, 1); 405 xParseSaoOffsetParam(pSaoParam, 0, 1); 406 } 407 408 READ_FLAG (uiSymbol, "sao_flag_cr"); 409 pSaoParam->bSaoFlag[2] = uiSymbol? true:false; 410 if (pSaoParam->bSaoFlag[2]) 411 { 412 xParseSaoSplitParam (pSaoParam, 0, 2); 413 xParseSaoOffsetParam(pSaoParam, 0, 2); 414 } 415 } 416 #endif 417 } 418 #if SAO_UNIT_INTERLEAVING 367 } 419 368 /** copy SAO parameter 420 369 * \param dst … … 584 533 } 585 534 586 #else 587 /** Decode quadtree split flag 588 * \param pSaoParam, iPartIdx 589 */ 590 Void TDecCavlc::xParseSaoSplitParam(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr) 591 { 592 UInt uiSymbol; 593 SAOQTPart* pSaoPart = NULL; 594 pSaoPart= &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]); 595 596 if(pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel) 597 { 598 READ_FLAG (uiSymbol, "sao_split_flag"); 599 pSaoPart->bSplit = uiSymbol? true:false; 600 if(pSaoPart->bSplit) 601 { 602 for (Int i=0;i<NUM_DOWN_PART;i++) 603 { 604 xParseSaoSplitParam(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr); 605 } 606 } 607 } 608 else 609 { 610 pSaoPart->bSplit = false; 611 } 612 } 613 614 /** Decode SAO for one partition 615 * \param pSaoParam, iPartIdx 616 */ 617 Void TDecCavlc::xParseSaoOffsetParam(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr) 618 { 619 UInt uiSymbol; 620 Int iSymbol; 621 SAOQTPart* pSaoPart = NULL; 622 pSaoPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]); 623 624 static Int iTypeLength[MAX_NUM_SAO_TYPE] = { 625 SAO_EO_LEN, 626 SAO_EO_LEN, 627 SAO_EO_LEN, 628 SAO_EO_LEN, 629 SAO_BO_LEN, 630 SAO_BO_LEN 631 }; 632 if(!pSaoPart->bSplit) 633 { 634 READ_UVLC (uiSymbol, "sao_type_idx"); 635 if (uiSymbol) 636 { 637 pSaoPart->iBestType = uiSymbol-1; 638 pSaoPart->bEnableFlag = true; 639 } 640 else 641 { 642 pSaoPart->iBestType = -1; 643 pSaoPart->bEnableFlag = false; 644 } 645 646 if (pSaoPart->bEnableFlag) 647 { 648 pSaoPart->iLength = iTypeLength[pSaoPart->iBestType]; 649 for(Int i=0; i< pSaoPart->iLength; i++) 650 { 651 READ_SVLC (iSymbol, "sao_offset"); 652 pSaoPart->iOffset[i] = iSymbol; 653 } 654 } 655 return; 656 } 657 658 //split 659 if (pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel) 660 { 661 for(Int i=0;i<NUM_DOWN_PART;i++) 662 { 663 xParseSaoOffsetParam(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr); 664 } 665 } 666 } 667 #endif 668 669 #if LCU_SYNTAX_ALF 535 670 536 Void TDecCavlc::xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS, Int firstLCUAddr, Bool acrossSlice, Int numLCUInWidth, Int numLCUInHeight) 671 537 { … … 931 797 } 932 798 933 #endif934 799 935 800 Void TDecCavlc::xParseAlfParam(ALFParam* pAlfParam) … … 937 802 UInt uiSymbol; 938 803 Int iSymbol; 939 #if ALF_SINGLE_FILTER_SHAPE940 804 Int sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE] = {ALF_FILTER_LEN}; 941 #else 942 Int sqrFiltLengthTab[2] = { 9, 9}; 943 #endif 944 945 #if LCU_SYNTAX_ALF 805 946 806 switch(pAlfParam->componentID) 947 807 { … … 961 821 case ALF_Y: 962 822 { 963 #endif964 823 pAlfParam->filters_per_group = 0; 965 824 memset (pAlfParam->filterPattern, 0 , sizeof(Int)*NO_VAR_BINS); 966 #if !LCU_SYNTAX_ALF967 READ_FLAG (uiSymbol, "alf_region_adaptation_flag");968 pAlfParam->alf_pcr_region_flag = uiSymbol;969 #endif970 #if ALF_SINGLE_FILTER_SHAPE971 825 pAlfParam->filter_shape = 0; 972 #else973 READ_UVLC (uiSymbol, "alf_length_luma_minus_5_div2");974 pAlfParam->filter_shape = uiSymbol;975 #endif976 826 pAlfParam->num_coeff = sqrFiltLengthTab[pAlfParam->filter_shape]; 977 827 … … 989 839 { 990 840 pAlfParam->filters_per_group = 1; 991 #if LCU_SYNTAX_ALF992 #if ALF_16_BA_GROUPS993 841 Int numMergeFlags = 16; 994 #else995 Int numMergeFlags = 15;996 #endif997 #else998 #if ALF_16_BA_GROUPS999 Int numMergeFlags = 16;1000 #else1001 Int numMergeFlags = pAlfParam->alf_pcr_region_flag ? 16 : 15;1002 #endif1003 #endif1004 842 for (Int i=1; i<numMergeFlags; i++) 1005 843 { … … 1021 859 } 1022 860 1023 #if ALF_SINGLE_FILTER_SHAPE1024 861 Int minScanVal = MIN_SCAN_POS_CROSS; 1025 #else1026 Int minScanVal = (pAlfParam->filter_shape == ALF_STAR5x5) ? 0: MIN_SCAN_POS_CROSS;1027 #endif1028 862 1029 863 // Determine maxScanVal … … 1036 870 1037 871 // Golomb parameters 1038 #if LCU_SYNTAX_ALF1039 872 if( pAlfParam->filters_per_group > 1 ) 1040 873 { 1041 #endif1042 874 READ_UVLC (uiSymbol, "alf_min_kstart_minus1"); 1043 875 pAlfParam->minKStart = 1 + uiSymbol; … … 1051 883 kMin = pAlfParam->kMinTab[scanPos]; 1052 884 } 1053 #if LCU_SYNTAX_ALF 1054 } 1055 #endif 885 } 1056 886 1057 887 Int scanPos; … … 1061 891 { 1062 892 scanPos = pDepthInt[i] - 1; 1063 #if LCU_SYNTAX_ALF1064 893 Int k = (pAlfParam->filters_per_group == 1) ? kTableTabShapes[ALF_CROSS9x7_SQUARE3x3][i] : pAlfParam->kMinTab[scanPos]; 1065 894 pAlfParam->coeffmulti[idx][i] = xGolombDecode(k); 1066 #else 1067 pAlfParam->coeffmulti[idx][i] = xGolombDecode(pAlfParam->kMinTab[scanPos]); 1068 #endif 1069 } 1070 } 1071 #if LCU_SYNTAX_ALF 895 } 896 } 1072 897 } 1073 898 break; … … 1079 904 } 1080 905 } 1081 #else1082 // filter parameters for chroma1083 READ_UVLC (uiSymbol, "alf_chroma_idc");1084 pAlfParam->chroma_idc = uiSymbol;1085 1086 if(pAlfParam->chroma_idc)1087 {1088 1089 #if ALF_SINGLE_FILTER_SHAPE1090 pAlfParam->filter_shape_chroma = 0;1091 #else1092 READ_UVLC (uiSymbol, "alf_length_chroma_minus_5_div2");1093 1094 pAlfParam->filter_shape_chroma = uiSymbol;1095 #endif1096 pAlfParam->num_coeff_chroma = sqrFiltLengthTab[pAlfParam->filter_shape_chroma];1097 // filter coefficients for chroma1098 for(Int pos=0; pos<pAlfParam->num_coeff_chroma; pos++)1099 {1100 READ_SVLC (iSymbol, "alf_coeff_chroma");1101 pAlfParam->coeff_chroma[pos] = iSymbol;1102 }1103 }1104 #endif1105 906 } 1106 907 … … 1137 938 } 1138 939 1139 #if TILES_OR_ENTROPY_SYNC_IDC1140 940 Void TDecCavlc::parsePPS(TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet) 1141 #else1142 Void TDecCavlc::parsePPS(TComPPS* pcPPS)1143 #endif1144 941 { 1145 942 #if ENC_DEC_TRACE … … 1150 947 Int iCode; 1151 948 1152 #if !RPS_IN_SPS1153 TComRPSList* rpsList = pcPPS->getRPSList();1154 #endif1155 949 READ_UVLC( uiCode, "pic_parameter_set_id"); pcPPS->setPPSId (uiCode); 1156 950 READ_UVLC( uiCode, "seq_parameter_set_id"); pcPPS->setSPSId (uiCode); 1157 951 1158 #if MULTIBITS_DATA_HIDING1159 952 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 1160 953 if( pcPPS->getSignHideFlag() ) … … 1162 955 READ_CODE( 4, uiCode, "sign_hiding_threshold"); pcPPS->setTSIG(uiCode); 1163 956 } 1164 #endif1165 957 1166 958 #if CABAC_INIT_FLAG 1167 959 READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); 1168 #endif1169 #if !RPS_IN_SPS1170 // RPS is put before entropy_coding_mode_flag1171 // since entropy_coding_mode_flag will probably be removed from the WD1172 TComReferencePictureSet* pcRPS;1173 1174 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );1175 rpsList->create(uiCode);1176 1177 for(Int i=0; i< rpsList->getNumberOfReferencePictureSets(); i++)1178 {1179 pcRPS = rpsList->getReferencePictureSet(i);1180 parseShortTermRefPicSet(pcPPS,pcRPS,i);1181 }1182 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcPPS->setLongTermRefsPresent(uiCode);1183 960 #endif 1184 961 // entropy_coding_mode_flag … … 1187 964 if (pcPPS->getEntropyCodingMode()) 1188 965 { 1189 #if !WPP_SIMPLIFICATION 1190 READ_UVLC( uiCode, "entropy_coding_synchro" ); pcPPS->setEntropyCodingSynchro( uiCode ); 1191 READ_FLAG( uiCode, "cabac_istate_reset" ); pcPPS->setCabacIstateReset( uiCode ? true : false ); 1192 #endif 1193 #if !TILES_OR_ENTROPY_SYNC_IDC 1194 #if !WPP_SIMPLIFICATION 1195 if ( pcPPS->getEntropyCodingSynchro() ) 1196 #endif 1197 { 1198 READ_UVLC( uiCode, "num_substreams_minus1" ); pcPPS->setNumSubstreams(uiCode+1); 1199 } 1200 #endif 1201 } 1202 #if !H0566_TLA 1203 READ_UVLC( uiCode, "num_temporal_layer_switching_point_flags" ); pcPPS->setNumTLayerSwitchingFlags( uiCode ); 1204 for ( UInt i = 0; i < pcPPS->getNumTLayerSwitchingFlags(); i++ ) 1205 { 1206 READ_FLAG( uiCode, "temporal_layer_switching_point_flag" ); pcPPS->setTLayerSwitchingFlag( i, uiCode > 0 ? true : false ); 1207 } 1208 #endif 966 } 1209 967 1210 968 // num_ref_idx_l0_default_active_minus1 … … 1241 999 //printf("TDecCavlc::parsePPS():\tm_bUseWeightPred=%d\tm_uiBiPredIdc=%d\n", pcPPS->getUseWP(), pcPPS->getWPBiPredIdc()); 1242 1000 1243 #if H03881244 1001 READ_FLAG( uiCode, "output_flag_present_flag" ); 1245 1002 pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 1246 #endif 1247 1248 #if TILES_OR_ENTROPY_SYNC_IDC 1003 1249 1004 if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==1) 1250 1005 { 1251 #endif1252 1006 READ_FLAG ( uiCode, "tile_info_present_flag" ); 1253 1007 pcPPS->setColumnRowInfoPresent(uiCode); … … 1290 1044 Int iNumColTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumColumnsMinus1()); 1291 1045 Int iNumRowTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumRowsMinus1()); 1292 #if !REMOVE_TILE_DEPENDENCE1293 pcPPS->setTileBoundaryIndependenceIdr( 1 ); //default1294 #endif1295 1046 pcPPS->setLFCrossTileBoundaryFlag(true); //default 1296 1047 1297 1048 if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0) 1298 1049 { 1299 #if !REMOVE_TILE_DEPENDENCE1300 READ_FLAG ( uiCode, "tile_boundary_independence_flag" );1301 pcPPS->setTileBoundaryIndependenceIdr( uiCode );1302 1303 if(pcPPS->getTileBoundaryIndependenceIdr() == 1)1304 {1305 #endif1306 1050 READ_FLAG ( uiCode, "loop_filter_across_tile_flag" ); 1307 1051 pcPPS->setLFCrossTileBoundaryFlag( (uiCode == 1)?true:false ); 1308 #if !REMOVE_TILE_DEPENDENCE 1309 } 1310 #endif 1311 } 1312 } 1313 #if TILES_OR_ENTROPY_SYNC_IDC 1052 } 1053 } 1314 1054 } 1315 1055 else if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==2) … … 1317 1057 READ_UVLC( uiCode, "num_substreams_minus1" ); pcPPS->setNumSubstreams(uiCode+1); 1318 1058 } 1319 #endif 1320 1321 #if DBL_CONTROL 1059 1322 1060 READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); 1323 1061 pcPPS->setDeblockingFilterControlPresent( uiCode ? true : false); 1324 #endif1325 #if PARALLEL_MERGE1326 1062 READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); 1327 1063 assert(uiCode == LOG2_PARALLEL_MERGE_LEVEL_MINUS2); 1328 1064 pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); 1329 #endif1330 1065 1331 1066 READ_FLAG( uiCode, "pps_extension_flag"); … … 1458 1193 } 1459 1194 } 1195 #if INTER_VIEW_VECTOR_SCALING_C0115 1196 READ_FLAG( uiCode, "inter_view_vector_scaling_flag" ); pcVPS->setIVScalingFlag( uiCode ? true:false); 1197 #endif 1460 1198 } 1461 1199 … … 1468 1206 #endif 1469 1207 #endif 1470 #if HHI_MPI 1208 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 1471 1209 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Bool bIsDepth) 1472 1210 #else … … 1493 1231 READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); 1494 1232 READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); 1495 #if PIC_CROPPING1496 1233 READ_FLAG( uiCode, "pic_cropping_flag"); pcSPS->setPicCroppingFlag ( uiCode ? true : false ); 1497 1234 if (uiCode != 0) … … 1502 1239 READ_UVLC( uiCode, "pic_crop_bottom_offset" ); pcSPS->setPicCropBottomOffset( uiCode ); 1503 1240 } 1504 #endif1505 1241 1506 1242 #if FULL_NBIT … … 1522 1258 #endif 1523 1259 1524 #if H0736_AVC_STYLE_QP_RANGE1525 1260 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 1526 #endif1527 1261 1528 1262 g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); … … 1534 1268 #endif 1535 1269 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 1536 #if H0736_AVC_STYLE_QP_RANGE1537 1270 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 1538 #endif1539 1271 1540 1272 READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); … … 1551 1283 1552 1284 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 1553 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER1554 1285 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 1555 1286 { … … 1561 1292 pcSPS->setMaxLatencyIncrease( uiCode, i ); 1562 1293 } 1563 #else 1564 READ_UVLC( uiCode, "max_num_ref_pics" ); pcSPS->setMaxNumberOfReferencePictures(uiCode); 1565 READ_UVLC( uiCode, "num_reorder_frames" ); pcSPS->setNumReorderFrames(uiCode); 1566 READ_UVLC ( uiCode, "max_dec_frame_buffering"); 1567 pcSPS->setMaxDecFrameBuffering( uiCode ); 1568 READ_UVLC ( uiCode, "max_latency_increase"); 1569 pcSPS->setMaxLatencyIncrease( uiCode ); 1570 #endif 1571 1572 #if H0412_REF_PIC_LIST_RESTRICTION 1294 1573 1295 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag" ); 1574 1296 pcSPS->setRestrictedRefPicListsFlag( uiCode ); … … 1582 1304 pcSPS->setListsModificationPresentFlag(true); 1583 1305 } 1584 #endif1585 1306 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 1586 1307 UInt log2MinCUSize = uiCode + 3; … … 1625 1346 READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); 1626 1347 READ_FLAG( uiCode, "adaptive_loop_filter_enabled_flag" ); pcSPS->setUseALF ( uiCode ? true : false ); 1627 #if LCU_SYNTAX_ALF1628 1348 if(pcSPS->getUseALF()) 1629 1349 { 1630 1350 READ_FLAG( uiCode, "alf_coef_in_slice_flag" ); pcSPS->setUseALFCoefInSlice ( uiCode ? true : false ); 1631 1351 } 1632 #endif1633 1352 if( pcSPS->getUsePCM() ) 1634 1353 { … … 1639 1358 1640 1359 1641 #if RPS_IN_SPS1642 1360 TComRPSList* rpsList = pcSPS->getRPSList(); 1643 1361 TComReferencePictureSet* rps; … … 1652 1370 } 1653 1371 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); 1654 #endif1655 #if !PIC_CROPPING1656 //!!!KS: Syntax not in WD !!!1657 1658 xReadUvlc ( uiCode ); pcSPS->setPadX ( uiCode );1659 xReadUvlc ( uiCode ); pcSPS->setPadY ( uiCode );1660 #endif1661 1372 1662 1373 // AMVP mode for each depth (AM_NONE or AM_EXPL) … … 1667 1378 } 1668 1379 1669 #if TILES_WPP_ENTRY_POINT_SIGNALLING1670 1380 READ_CODE(2, uiCode, "tiles_or_entropy_coding_sync_idc"); pcSPS->setTilesOrEntropyCodingSyncIdc(uiCode); 1671 #endif 1672 1673 #if TILES_OR_ENTROPY_SYNC_IDC 1381 1674 1382 if(pcSPS->getTilesOrEntropyCodingSyncIdc() == 1) 1675 1383 { 1676 #endif1677 1384 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); 1678 1385 pcSPS->setNumColumnsMinus1( uiCode ); … … 1701 1408 free(rowHeight); 1702 1409 } 1703 #if !REMOVE_TILE_DEPENDENCE1704 pcSPS->setTileBoundaryIndependenceIdr( 1 ); //default1705 #endif1706 1410 pcSPS->setLFCrossTileBoundaryFlag(true); //default 1707 1411 1708 1412 if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0) 1709 1413 { 1710 #if !REMOVE_TILE_DEPENDENCE1711 READ_FLAG ( uiCode, "tile_boundary_independence_flag" );1712 pcSPS->setTileBoundaryIndependenceIdr( uiCode );1713 if(pcSPS->getTileBoundaryIndependenceIdr() == 1)1714 {1715 #endif1716 1414 READ_FLAG ( uiCode, "loop_filter_across_tile_flag" ); 1717 1415 pcSPS->setLFCrossTileBoundaryFlag( (uiCode==1)?true:false); 1718 #if !REMOVE_TILE_DEPENDENCE 1719 } 1720 #endif 1721 } 1722 #if TILES_OR_ENTROPY_SYNC_IDC 1723 } 1724 #endif 1416 } 1417 } 1725 1418 READ_FLAG( uiCode, "sps_extension_flag"); 1726 1419 #if !QC_MVHEVC_B0046 … … 1799 1492 pcSPS->setPredDepthMapGeneration( 0, false ); 1800 1493 #endif 1801 #if H HI_INTER_VIEW_RESIDUAL_PRED1494 #if H3D_IVRP 1802 1495 pcSPS->setMultiviewResPredMode ( 0 ); 1803 1496 #endif … … 1814 1507 pcSPS->setPredDepthMapGeneration( uiCode, true ); 1815 1508 #endif 1816 #if H HI_INTER_VIEW_RESIDUAL_PRED1509 #if H3D_IVRP 1817 1510 pcSPS->setMultiviewResPredMode ( 0 ); 1818 1511 #endif … … 1841 1534 #if DEPTH_MAP_GENERATION 1842 1535 UInt uiPredDepthMapGeneration = 0, uiPdmPrecision = 0; 1843 #if H HI_INTER_VIEW_MOTION_PRED1536 #if H3D_IVMP 1844 1537 UInt uiMultiviewMvPredMode = 0; 1845 1538 #endif 1846 #if H HI_INTER_VIEW_RESIDUAL_PRED1539 #if H3D_IVRP 1847 1540 UInt uiMultiviewResPredMode = 0; 1848 1541 #endif … … 1856 1549 READ_SVLC( iCode, "Pdm_offset" ); m_aaiTempPdmOffset [ uiViewId ][ uiBaseId ] = iCode; 1857 1550 } 1858 #if H HI_INTER_VIEW_MOTION_PRED1551 #if H3D_IVMP 1859 1552 READ_UVLC( uiMultiviewMvPredMode, "multi_view_mv_pred_mode" ); 1860 1553 #endif 1861 #if H HI_INTER_VIEW_RESIDUAL_PRED1554 #if H3D_IVRP 1862 1555 READ_FLAG( uiMultiviewResPredMode, "multi_view_residual_pred_mode" ); 1863 1556 #endif 1864 1557 } 1865 #if H HI_INTER_VIEW_MOTION_PRED1558 #if H3D_IVMP 1866 1559 pcSPS->setPredDepthMapGeneration( uiViewId, false, uiPredDepthMapGeneration, uiMultiviewMvPredMode, uiPdmPrecision, m_aaiTempPdmScaleNomDelta, m_aaiTempPdmOffset ); 1867 1560 #else … … 1869 1562 #endif 1870 1563 #endif 1871 #if H HI_INTER_VIEW_RESIDUAL_PRED1564 #if H3D_IVRP 1872 1565 pcSPS->setMultiviewResPredMode ( uiMultiviewResPredMode ); 1873 1566 #endif … … 1891 1584 } 1892 1585 1893 #if LCU_SYNTAX_ALF 1586 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 1587 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) 1588 #else 1894 1589 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) 1895 #else1896 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl)1897 1590 #endif 1898 1591 { … … 1927 1620 { 1928 1621 UInt uiCodeTmp = 0; 1929 if ( rpcSlice->getSPS()->getViewId() && !rpcSlice->getSPS()->isDepth() ) 1622 if ( rpcSlice->getSPS()->getViewId() 1623 #if !LGE_ILLUCOMP_DEPTH_C0046 1624 && !rpcSlice->getSPS()->isDepth() 1625 #endif 1626 ) 1930 1627 { 1931 1628 READ_FLAG (uiCodeTmp, "applying IC flag"); … … 1977 1674 rpcSlice->setSPS(sps); 1978 1675 rpcSlice->setPPS(pps); 1979 #if H03881980 1676 if( pps->getOutputFlagPresentFlag() ) 1981 1677 { … … 1987 1683 rpcSlice->setPicOutputFlag( true ); 1988 1684 } 1989 #endif1990 1685 #if QC_REM_IDV_B0046 1991 1686 #if !QC_MVHEVC_B0046 … … 2054 1749 { 2055 1750 rps = rpcSlice->getLocalRPS(); 2056 #if RPS_IN_SPS2057 1751 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2058 #else2059 parseShortTermRefPicSet(pps,rps, pps->getRPSList()->getNumberOfReferencePictureSets());2060 #endif2061 1752 rpcSlice->setRPS(rps); 2062 1753 } 2063 1754 else // use reference to short-term reference picture set in PPS 2064 1755 { 2065 #if RPS_IN_SPS2066 1756 READ_UVLC( uiCode, "short_term_ref_pic_set_idx"); rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 2067 #else2068 READ_UVLC( uiCode, "short_term_ref_pic_set_idx"); rpcSlice->setRPS(pps->getRPSList()->getReferencePictureSet(uiCode));2069 #endif2070 1757 rps = rpcSlice->getRPS(); 2071 1758 } 2072 #if RPS_IN_SPS2073 1759 if(sps->getLongTermRefsPresent()) 2074 #else2075 if(pps->getLongTermRefsPresent())2076 #endif2077 1760 { 2078 1761 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2079 1762 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2080 1763 Int prev = 0; 2081 #if LTRP_MULT2082 1764 Int prevMsb=0; 2083 1765 Int prevDeltaPocLt=0; 2084 #endif2085 1766 for(Int j=rps->getNumberOfLongtermPictures()+offset-1 ; j > offset-1; j--) 2086 1767 { … … 2088 1769 prev += uiCode; 2089 1770 2090 #if LTRP_MULT2091 1771 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2092 1772 Int decDeltaPOCMsbPresent=uiCode; … … 2109 1789 else 2110 1790 { 2111 #endif2112 1791 rps->setPOC(j,rpcSlice->getPOC()-prev); 2113 1792 rps->setDeltaPOC(j,-(Int)prev); 2114 #if LTRP_MULT2115 1793 } 2116 1794 prevDeltaPocLt=prev; 2117 #endif2118 1795 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 2119 1796 } … … 2134 1811 if (sps->getUseSAO()) 2135 1812 { 2136 #if SAO_UNIT_INTERLEAVING2137 1813 READ_FLAG(uiCode, "slice_sao_interleaving_flag"); rpcSlice->setSaoInterleavingFlag(uiCode); 2138 #endif2139 1814 READ_FLAG(uiCode, "slice_sample_adaptive_offset_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 2140 #if SAO_UNIT_INTERLEAVING2141 1815 if (rpcSlice->getSaoEnabledFlag() && rpcSlice->getSaoInterleavingFlag()) 2142 1816 { … … 2149 1823 rpcSlice->setSaoEnabledFlagCr(0); 2150 1824 } 2151 #endif2152 1825 } 2153 1826 READ_UVLC ( uiCode, "aps_id" ); rpcSlice->setAPSId(uiCode); … … 2177 1850 if( !rpcSlice->isIntra() ) 2178 1851 { 2179 #if H0412_REF_PIC_LIST_RESTRICTION2180 1852 #if QC_MVHEVC_B0046 2181 1853 if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() ) … … 2188 1860 else 2189 1861 { 2190 #endif2191 1862 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); 2192 #if H0412_REF_PIC_LIST_RESTRICTION 2193 } 2194 #endif 1863 } 2195 1864 2196 1865 if(refPicListModification->getRefPicListModificationFlagL0()) … … 2198 1867 uiCode = 0; 2199 1868 Int i = 0; 2200 #if H0137_0138_LIST_MODIFICATION2201 1869 Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc(); 2202 1870 if ( NumPocTotalCurr > 1 ) … … 2221 1889 } 2222 1890 } 2223 #else 2224 Int list_modification_idc = 0; 2225 while(list_modification_idc != 3) 2226 { 2227 READ_UVLC( uiCode, "list_modification_idc" ); refPicListModification->setListIdcL0(i, uiCode ); 2228 list_modification_idc = uiCode; 2229 if(uiCode != 3) 2230 { 2231 READ_UVLC( uiCode, "ref_pic_set_idx" ); refPicListModification->setRefPicSetIdxL0(i, uiCode ); 2232 } 2233 i++; 2234 } 2235 refPicListModification->setNumberOfRefPicListModificationsL0(i-1); 2236 #endif 2237 } 2238 #if !H0137_0138_LIST_MODIFICATION 2239 else 2240 { 2241 refPicListModification->setNumberOfRefPicListModificationsL0(0); 2242 } 2243 #endif 1891 } 2244 1892 } 2245 1893 else 2246 1894 { 2247 1895 refPicListModification->setRefPicListModificationFlagL0(0); 2248 #if !H0137_0138_LIST_MODIFICATION2249 refPicListModification->setNumberOfRefPicListModificationsL0(0);2250 #endif2251 1896 } 2252 1897 if(rpcSlice->isInterB()) 2253 1898 { 2254 #if H0412_REF_PIC_LIST_RESTRICTION2255 1899 #if QC_MVHEVC_B0046 2256 1900 if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() ) … … 2263 1907 else 2264 1908 { 2265 #endif2266 1909 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); 2267 #if H0412_REF_PIC_LIST_RESTRICTION 2268 } 2269 #endif 1910 } 2270 1911 if(refPicListModification->getRefPicListModificationFlagL1()) 2271 1912 { 2272 1913 uiCode = 0; 2273 1914 Int i = 0; 2274 #if H0137_0138_LIST_MODIFICATION2275 1915 Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc(); 2276 1916 if ( NumPocTotalCurr > 1 ) … … 2295 1935 } 2296 1936 } 2297 #else 2298 Int list_modification_idc = 0; 2299 while(list_modification_idc != 3) 2300 { 2301 READ_UVLC( uiCode, "list_modification_idc" ); refPicListModification->setListIdcL1(i, uiCode ); 2302 list_modification_idc = uiCode; 2303 if(uiCode != 3) 2304 { 2305 READ_UVLC( uiCode, "ref_pic_set_idx" ); refPicListModification->setRefPicSetIdxL1(i, uiCode ); 2306 } 2307 i++; 2308 } 2309 refPicListModification->setNumberOfRefPicListModificationsL1(i-1); 2310 #endif 2311 } 2312 #if !H0137_0138_LIST_MODIFICATION 2313 else 2314 { 2315 refPicListModification->setNumberOfRefPicListModificationsL1(0); 2316 } 2317 #endif 1937 } 2318 1938 } 2319 1939 else 2320 1940 { 2321 1941 refPicListModification->setRefPicListModificationFlagL1(0); 2322 #if !H0137_0138_LIST_MODIFICATION2323 refPicListModification->setNumberOfRefPicListModificationsL1(0);2324 #endif2325 1942 } 2326 1943 } … … 2340 1957 READ_UVLC( uiCode, "num_ref_idx_lc_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_C, uiCode + 1 ); 2341 1958 2342 #if H0412_REF_PIC_LIST_RESTRICTION2343 1959 #if QC_MVHEVC_B0046 2344 1960 if( rpcSlice->getViewId() && rpcSlice->getSPS()->getListsModificationPresentFlag() ) … … 2347 1963 #endif 2348 1964 { 2349 #endif2350 1965 READ_FLAG( uiCode, "ref_pic_list_modification_flag_lc" ); rpcSlice->setRefPicListModificationFlagLC( uiCode ? 1 : 0 ); 2351 1966 if(uiCode) … … 2355 1970 READ_FLAG( uiCode, "pic_from_list_0_flag" ); 2356 1971 rpcSlice->setListIdFromIdxOfLC(i, uiCode); 2357 #if H0137_0138_LIST_MODIFICATION2358 1972 if (((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_0) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_0 ) == 1)) || ((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_1) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_1 ) == 1)) ) 2359 1973 { … … 2364 1978 READ_UVLC( uiCode, "ref_idx_list_curr" ); 2365 1979 } 2366 #else2367 READ_UVLC( uiCode, "ref_idx_list_curr" );2368 #endif2369 1980 rpcSlice->setRefIdxFromIdxOfLC(i, uiCode); 2370 1981 rpcSlice->setRefIdxOfLC((RefPicList)rpcSlice->getListIdFromIdxOfLC(i), rpcSlice->getRefIdxFromIdxOfLC(i), i); 2371 1982 } 2372 1983 } 2373 #if H0412_REF_PIC_LIST_RESTRICTION2374 1984 } 2375 1985 else … … 2377 1987 rpcSlice->setRefPicListModificationFlagLC(false); 2378 1988 } 2379 #endif2380 1989 } 2381 1990 else … … 2390 1999 } 2391 2000 2392 #if H0111_MVD_L1_ZERO2393 2001 if (rpcSlice->isInterB()) 2394 2002 { 2395 2003 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 2396 2004 } 2397 #endif2398 2005 2399 2006 #if CABAC_INIT_FLAG … … 2421 2028 rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 2422 2029 2423 #if H0736_AVC_STYLE_QP_RANGE2424 2030 assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); 2425 2031 assert( rpcSlice->getSliceQp() <= 51 ); 2426 #endif 2427 2428 #if DBL_CONTROL 2032 2429 2033 if (rpcSlice->getPPS()->getDeblockingFilterControlPresent()) 2430 2034 { … … 2436 2040 rpcSlice->setInheritDblParamFromAPS(0); 2437 2041 } 2438 #else2439 READ_FLAG ( uiCode, "inherit_dbl_param_from_APS_flag" ); rpcSlice->setInheritDblParamFromAPS(uiCode ? 1 : 0);2440 #endif2441 2042 if(!rpcSlice->getInheritDblParamFromAPS()) 2442 2043 { … … 2448 2049 } 2449 2050 } 2450 #if DBL_CONTROL2451 2051 } 2452 #endif2453 2052 if ( rpcSlice->getSliceType() == B_SLICE ) 2454 2053 { … … 2490 2089 } 2491 2090 2492 #if ( HHI_MPI || H HI_INTER_VIEW_MOTION_PRED)2493 #if ( HHI_MPI && H HI_INTER_VIEW_MOTION_PRED)2091 #if ( HHI_MPI || H3D_IVMP ) 2092 #if ( HHI_MPI && H3D_IVMP ) 2494 2093 const int iExtraMergeCandidates = ( sps->getUseMVI() || sps->getMultiviewMvPredMode() ) ? 1 : 0; 2495 2094 #elif HHI_MPI 2496 2095 const int iExtraMergeCandidates = sps->getUseMVI() ? 1 : 0; 2096 #elif MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 2097 const int iExtraMergeCandidates = ( (isDepth || sps->getMultiviewMvPredMode()) ) ? 1 : 0; 2497 2098 #else 2498 2099 const int iExtraMergeCandidates = sps->getMultiviewMvPredMode() ? 1 : 0; … … 2518 2119 2519 2120 Int uiNumCUsInFrame = uiNumLCUsInWidth* uiNumLCUsInHeight; 2520 #if LCU_SYNTAX_ALF2521 2121 if(sps->getUseALFCoefInSlice()) 2522 2122 { … … 2531 2131 if(!sps->getUseALFCoefInSlice()) 2532 2132 { 2533 #endif2534 2133 xParseAlfCuControlParam(alfCUCtrl, uiNumCUsInFrame); 2535 #if LCU_SYNTAX_ALF 2536 } 2537 #endif 2134 } 2538 2135 2539 2136 } … … 2544 2141 if (!bEntropySlice) 2545 2142 { 2546 #if !REMOVE_TILE_DEPENDENCE2547 if (sps->getTileBoundaryIndependenceIdr())2548 {2549 #endif2550 2143 xReadCode(1, uiCode); // read flag indicating if tile markers transmitted 2551 2144 rpcSlice->setTileMarkerFlag( uiCode ); 2552 #if !REMOVE_TILE_DEPENDENCE 2553 } 2554 #endif 2555 } 2556 2557 #if TILES_WPP_ENTRY_POINT_SIGNALLING 2145 } 2146 2558 2147 Int tilesOrEntropyCodingSyncIdc = rpcSlice->getSPS()->getTilesOrEntropyCodingSyncIdc(); 2559 2148 UInt *entryPointOffset = NULL; … … 2616 2205 delete [] entryPointOffset; 2617 2206 } 2618 #else2619 #if WPP_SIMPLIFICATION2620 if (pps->getNumSubstreams() > 1)2621 #else2622 if (pps->getEntropyCodingSynchro())2623 #endif2624 {2625 UInt uiNumSubstreams = pps->getNumSubstreams();2626 rpcSlice->allocSubstreamSizes(uiNumSubstreams);2627 UInt *puiSubstreamSizes = rpcSlice->getSubstreamSizes();2628 2629 for (UInt ui = 0; ui+1 < uiNumSubstreams; ui++)2630 {2631 xReadCode(2, uiCode);2632 2633 switch ( uiCode )2634 {2635 case 0:2636 xReadCode(8, uiCode);2637 break;2638 case 1:2639 xReadCode(16, uiCode);2640 break;2641 case 2:2642 xReadCode(24, uiCode);2643 break;2644 case 3:2645 xReadCode(32, uiCode);2646 break;2647 default:2648 printf("Error in parseSliceHeader\n");2649 exit(-1);2650 break;2651 }2652 puiSubstreamSizes[ui] = uiCode;2653 }2654 }2655 #endif2656 2207 2657 2208 if (!bEntropySlice) 2658 2209 { 2659 2210 // Reading location information 2660 #if !REMOVE_TILE_DEPENDENCE2661 if (sps->getTileBoundaryIndependenceIdr())2662 {2663 #endif2664 #if !TILES_WPP_ENTRY_POINT_SIGNALLING2665 xReadCode(1, uiCode); // read flag indicating if location information signaled in slice header2666 Bool bTileLocationInformationInSliceHeaderFlag = (uiCode)? true : false;2667 2668 if (bTileLocationInformationInSliceHeaderFlag)2669 {2670 // location count2671 xReadCode(5, uiCode); // number of tiles for which location information signaled2672 rpcSlice->setTileLocationCount ( uiCode + 1 );2673 2674 xReadCode(5, uiCode); // number of bits used by diff2675 Int iBitsUsedByDiff = uiCode + 1;2676 2677 // read out tile start location2678 Int iLastSize = 0;2679 for (UInt uiIdx=0; uiIdx<rpcSlice->getTileLocationCount(); uiIdx++)2680 {2681 Int iAbsDiff, iCurSize, iCurDiff;2682 if (uiIdx==0)2683 {2684 xReadCode(iBitsUsedByDiff-1, uiCode); iAbsDiff = uiCode;2685 rpcSlice->setTileLocation( uiIdx, iAbsDiff );2686 iCurDiff = iAbsDiff;2687 iLastSize = iAbsDiff;2688 }2689 else2690 {2691 xReadCode(1, uiCode); // read sign2692 Int iSign = (uiCode) ? -1 : +1;2693 2694 xReadCode(iBitsUsedByDiff-1, uiCode); iAbsDiff = uiCode;2695 iCurDiff = (iSign) * iAbsDiff;2696 iCurSize = iLastSize + iCurDiff;2697 iLastSize = iCurSize;2698 rpcSlice->setTileLocation( uiIdx, rpcSlice->getTileLocation( uiIdx-1 ) + iCurSize ); // calculate byte location2699 }2700 }2701 }2702 #endif2703 2211 2704 2212 // read out trailing bits 2705 2213 m_pcBitstream->readOutTrailingBits(); 2706 #if !REMOVE_TILE_DEPENDENCE2707 }2708 #endif2709 2214 } 2710 2215 return; … … 2767 2272 #endif 2768 2273 2769 #if H HI_INTER_VIEW_MOTION_PRED2274 #if H3D_IVMP 2770 2275 Void TDecCavlc::parseMVPIdx( Int& riMVPIdx, Int iAMVPCands ) 2771 2276 #else … … 2801 2306 Void TDecCavlc::parseIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2802 2307 { 2803 #if BURST_IPCM2804 2308 assert(0); 2805 #else2806 UInt uiSymbol;2807 2808 xReadFlag( uiSymbol );2809 2810 if ( uiSymbol )2811 {2812 Bool bIpcmFlag = true;2813 2814 xReadPCMAlignZero();2815 2816 pcCU->setPartSizeSubParts ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );2817 pcCU->setSizeSubParts ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );2818 pcCU->setIPCMFlagSubParts ( bIpcmFlag, uiAbsPartIdx, uiDepth );2819 2820 UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();2821 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx;2822 UInt uiChromaOffset = uiLumaOffset>>2;2823 2824 Pel* piPCMSample;2825 UInt uiWidth;2826 UInt uiHeight;2827 UInt uiSampleBits;2828 UInt uiX, uiY;2829 2830 piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset;2831 uiWidth = pcCU->getWidth(uiAbsPartIdx);2832 uiHeight = pcCU->getHeight(uiAbsPartIdx);2833 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();2834 2835 for(uiY = 0; uiY < uiHeight; uiY++)2836 {2837 for(uiX = 0; uiX < uiWidth; uiX++)2838 {2839 UInt uiSample;2840 xReadCode(uiSampleBits, uiSample);2841 2842 piPCMSample[uiX] = uiSample;2843 }2844 piPCMSample += uiWidth;2845 }2846 2847 piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;2848 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;2849 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;2850 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();2851 2852 for(uiY = 0; uiY < uiHeight; uiY++)2853 {2854 for(uiX = 0; uiX < uiWidth; uiX++)2855 {2856 UInt uiSample;2857 xReadCode(uiSampleBits, uiSample);2858 piPCMSample[uiX] = uiSample;2859 }2860 piPCMSample += uiWidth;2861 }2862 2863 piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;2864 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;2865 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;2866 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();2867 2868 for(uiY = 0; uiY < uiHeight; uiY++)2869 {2870 for(uiX = 0; uiX < uiWidth; uiX++)2871 {2872 UInt uiSample;2873 xReadCode(uiSampleBits, uiSample);2874 piPCMSample[uiX] = uiSample;2875 }2876 piPCMSample += uiWidth;2877 }2878 }2879 #endif2880 2309 } 2881 2310 … … 2907 2336 Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2908 2337 { 2909 #if H0736_AVC_STYLE_QP_RANGE2910 2338 Int qp; 2911 #else2912 UInt uiQp;2913 #endif2914 2339 Int iDQp; 2915 2340 2916 2341 xReadSvlc( iDQp ); 2917 2342 2918 #if H0736_AVC_STYLE_QP_RANGE2919 2343 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 2920 2344 qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; 2921 #else2922 uiQp = pcCU->getRefQP( uiAbsPartIdx ) + iDQp;2923 #endif2924 2345 2925 2346 UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ; 2926 2347 UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; 2927 2348 2928 #if H0736_AVC_STYLE_QP_RANGE2929 2349 pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); 2930 #else2931 pcCU->setQPSubParts( uiQp, uiAbsQpCUPartIdx, uiQpCUDepth );2932 #endif2933 2350 } 2934 2351 … … 2964 2381 } 2965 2382 2966 #if H HI_INTER_VIEW_RESIDUAL_PRED2383 #if H3D_IVRP 2967 2384 Void 2968 2385 TDecCavlc::parseResPredFlag( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) … … 3394 2811 READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); 3395 2812 scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code+1))); 3396 #if SCALING_LIST3397 2813 if( sizeId > SCALING_LIST_8x8 ) 3398 2814 { 3399 2815 scalingList->setScalingListDC(sizeId,listId,scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))); 3400 2816 } 3401 #endif3402 2817 scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); 3403 2818 … … 3420 2835 Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId) 3421 2836 { 3422 #if SCALING_LIST3423 2837 Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); 3424 2838 Int data; … … 3460 2874 } 3461 2875 } 3462 #else3463 Int i,coefNum = g_scalingListSize[sizeId];3464 Int data;3465 Int nextCoef = SCALING_LIST_START_VALUE;3466 UInt* scan = g_auiFrameScanXY [ sizeId + 1 ];3467 Int *dst = scalingList->getScalingListAddress(sizeId, listId);3468 3469 for(i = 0; i < coefNum; i++)3470 {3471 READ_SVLC( data, "scaling_list_delta_coef");3472 nextCoef = (nextCoef + data + 256 ) % 256;3473 dst[scan[i]] = nextCoef;3474 }3475 #endif3476 2876 } 3477 2877 -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r210 r296 82 82 UInt xGetBit (); 83 83 84 #if RPS_IN_SPS85 84 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 86 #else87 void parseShortTermRefPicSet (TComPPS* pcPPS, TComReferencePictureSet* pcRPS, Int idx);88 #endif89 85 private: 90 86 TComInputBitstream* m_pcBitstream; … … 118 114 Void parseVPS ( TComVPS* pcVPS ); 119 115 #endif 120 #if HHI_MPI 116 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 121 117 Void parseSPS ( TComSPS* pcSPS, Bool bIsDepth ); 122 118 #else 123 119 Void parseSPS ( TComSPS* pcSPS ); 124 120 #endif 125 #if TILES_OR_ENTROPY_SYNC_IDC126 121 Void parsePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet); 127 #else128 Void parsePPS ( TComPPS* pcPPS);129 #endif130 122 Void parseSEI(SEImessages&); 131 123 Void parseAPS ( TComAPS* pAPS ); 132 #if LCU_SYNTAX_ALF 124 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 125 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth); 126 #else 133 127 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet); 134 #else135 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl );136 128 #endif 137 129 Void parseTerminatingBit ( UInt& ruiBit ); 138 130 139 #if H HI_INTER_VIEW_MOTION_PRED131 #if H3D_IVMP 140 132 Void parseMVPIdx ( Int& riMVPIdx, Int iAMVPCands ); 141 133 #else … … 149 141 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 150 142 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); 151 #if H HI_INTER_VIEW_RESIDUAL_PRED143 #if H3D_IVRP 152 144 Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); 153 145 #endif … … 171 163 Void readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ); 172 164 Void updateContextTables ( SliceType eSliceType, Int iQp ) { return; } 173 #if OL_FLUSH174 165 Void decodeFlush() {}; 175 #endif176 166 177 167 Void xParsePredWeightTable ( TComSlice* pcSlice ); … … 186 176 #endif 187 177 protected: 188 #if DBL_CONTROL189 178 Void xParseDblParam ( TComAPS* aps ); 190 #endif191 179 Void xParseSaoParam ( SAOParam* pSaoParam ); 192 #if SAO_UNIT_INTERLEAVING193 180 Void xParseSaoOffset (SaoLcuParam* saoLcuParam); 194 181 Void xParseSaoUnit (Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool& repeatedRow ); 195 #else196 Void xParseSaoSplitParam ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr );197 Void xParseSaoOffsetParam ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr );198 #endif199 #if LCU_SYNTAX_ALF200 182 Void xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS = true, Int firstLCUAddr = 0, Bool acrossSlice = true, Int numLCUInWidth= -1, Int numLCUInHeight= -1); 201 183 Void parseAlfParamSet(AlfParamSet* pAlfParamSet, Int firstLCUAddr, Bool alfAcrossSlice); 202 184 Void parseAlfFixedLengthRun(UInt& idx, UInt rx, UInt numLCUInWidth); 203 185 Void parseAlfStoredFilterIdx(UInt& idx, UInt numFilterSetsInBuffer); 204 #endif205 186 Void xParseAlfParam ( ALFParam* pAlfParam ); 206 187 Void xParseAlfCuControlParam(AlfCUCtrlInfo& cAlfParam, Int iNumCUsInPic); -
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r189 r296 54 54 m_ppcYuvResi = NULL; 55 55 m_ppcYuvReco = NULL; 56 #if H HI_INTER_VIEW_RESIDUAL_PRED56 #if H3D_IVRP 57 57 m_ppcYuvResPred = NULL; 58 58 #endif … … 82 82 m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; 83 83 m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; 84 #if H HI_INTER_VIEW_RESIDUAL_PRED84 #if H3D_IVRP 85 85 m_ppcYuvResPred = new TComYuv* [m_uiMaxDepth-1]; 86 86 #endif … … 96 96 m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight ); 97 97 m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); 98 #if H HI_INTER_VIEW_RESIDUAL_PRED98 #if H3D_IVRP 99 99 m_ppcYuvResPred[ui] = new TComYuv; m_ppcYuvResPred[ui]->create( uiWidth, uiHeight ); 100 100 #endif … … 120 120 m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL; 121 121 m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; 122 #if H HI_INTER_VIEW_RESIDUAL_PRED122 #if H3D_IVRP 123 123 m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL; 124 124 #endif … … 128 128 delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; 129 129 delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; 130 #if H HI_INTER_VIEW_RESIDUAL_PRED130 #if H3D_IVRP 131 131 delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL; 132 132 #endif … … 148 148 } 149 149 150 #if BURST_IPCM151 150 pcCU->setNumSucIPCM(0); 152 #endif153 151 154 152 // start from the top level CU … … 240 238 if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 241 239 { 242 #if BURST_IPCM243 240 if(pcCU->getNumSucIPCM() == 0) 244 241 { … … 252 249 pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); 253 250 } 254 #else255 #if HHI_MPI256 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )257 #endif258 m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );259 #endif260 251 } 261 252 else … … 323 314 324 315 // decode CU mode and the partition size 325 #if BURST_IPCM326 316 if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 ) 327 #else328 if( !pcCU->getSlice()->isIntra() )329 #endif330 317 #if HHI_MPI 331 318 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) … … 339 326 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 340 327 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 341 #if H HI_INTER_VIEW_MOTION_PRED328 #if H3D_IVMP 342 329 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 343 330 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 361 348 362 349 UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 350 363 351 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 364 352 { 365 353 const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); 354 #if MERL_VSP_C0152 355 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); 356 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 357 #endif 366 358 pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP ); 367 359 pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); … … 370 362 pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); 371 363 } 364 #if LGE_ILLUCOMP_DEPTH_C0046 365 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 366 #endif 372 367 } 373 368 else 374 369 { 375 370 #endif 376 #if SIMP_MRG_PRUN377 371 UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); 372 #if MERL_VSP_C0152 373 Int iVSPIndexTrue[3] = {-1, -1, -1}; 374 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); 375 { 376 Int iVSPIdx = 0; 377 Int numVspIdx; 378 numVspIdx = 3; 379 for (Int i = 0; i < numVspIdx; i++) 380 { 381 if (iVSPIndexTrue[i] == uiMergeIndex) 382 { 383 iVSPIdx = i+1; 384 break; 385 } 386 } 387 pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth ); //Initialize the VSP, may change later in get InterMergeCandidates() 388 } 389 #else 378 390 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 379 #else380 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );381 UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);382 391 #endif 383 392 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); … … 400 409 } 401 410 #endif 402 #if H HI_INTER_VIEW_RESIDUAL_PRED411 #if H3D_IVRP && !MTK_MDIVRP_C0138 403 412 m_pcEntropyDecoder->decodeResPredFlag( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); 404 413 #endif … … 411 420 { 412 421 #endif 413 #if BURST_IPCM414 422 if( pcCU->getNumSucIPCM() == 0 ) 415 423 { … … 424 432 pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); 425 433 } 426 #else427 m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );428 m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );429 #endif430 434 431 435 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) … … 449 453 450 454 #if LGE_ILLUCOMP_B0045 455 #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI 456 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) != uiDepth ) 457 { 458 #endif 451 459 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 452 460 #endif 453 461 454 #if H HI_INTER_VIEW_RESIDUAL_PRED462 #if H3D_IVRP && !MTK_MDIVRP_C0138 455 463 if( !pcCU->isIntra( uiAbsPartIdx ) ) 456 464 { 457 465 m_pcEntropyDecoder->decodeResPredFlag ( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 ); 466 } 467 #endif 468 #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI 458 469 } 459 470 #endif … … 467 478 468 479 UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 480 469 481 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 470 482 { 471 483 const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); 484 #if MERL_VSP_C0152 485 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); 486 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 487 #endif 472 488 pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER ); 473 489 pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); … … 476 492 pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); 477 493 } 478 494 #if LGE_ILLUCOMP_DEPTH_C0046 495 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 496 #endif 479 497 if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) 480 498 { … … 551 569 } 552 570 553 #if BURST_IPCM554 571 if( pcCU->getNumSucIPCM() > 0 ) 555 572 { … … 557 574 return; 558 575 } 559 #endif560 576 561 577 ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth); … … 658 674 659 675 // inter prediction 676 #if MERL_VSP_C0152 677 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth], uiAbsPartIdx ); 678 #else 660 679 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); 661 680 #endif 681 #if MTK_MDIVRP_C0138 682 if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) 683 { 684 m_pcPrediction->residualPrediction(pcCU, m_ppcYuvReco[uiDepth], m_ppcYuvResPred[uiDepth]); 685 } 686 #endif 687 662 688 #if HHI_MPI 663 689 if( pcCU->getTextureModeDepth( 0 ) != -1 ) … … 665 691 #endif 666 692 667 #if H HI_INTER_VIEW_RESIDUAL_PRED693 #if H3D_IVRP && !MTK_MDIVRP_C0138 668 694 if( pcCU->getResPredFlag( 0 ) ) 669 695 { … … 695 721 else 696 722 { 697 #if HHI_INTER_VIEW_RESIDUAL_PRED 723 #if H3D_IVRP 724 #if MTK_MDIVRP_C0138 725 if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) 726 #else 698 727 if( pcCU->getResPredFlag( 0 ) ) 728 #endif 699 729 { 700 730 m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) ); … … 765 795 766 796 //===== inverse transform ===== 767 #if H0736_AVC_STYLE_QP_RANGE768 797 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 769 #else770 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );771 #endif772 798 773 799 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; … … 885 911 if(eText == TEXT_CHROMA_U) 886 912 { 887 #if H0736_AVC_STYLE_QP_RANGE888 913 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); 889 #else890 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset() );891 #endif892 914 } 893 915 else 894 916 { 895 #if H0736_AVC_STYLE_QP_RANGE896 917 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); 897 #else898 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );899 #endif900 918 } 901 919 … … 1197 1215 pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); 1198 1216 1199 #if H0736_AVC_STYLE_QP_RANGE1200 1217 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 1201 #else1202 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );1203 #endif1204 1218 1205 1219 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); 1206 1220 1207 1221 // Cb and Cr 1208 #if H0736_AVC_STYLE_QP_RANGE1209 1222 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); 1210 #else1211 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() );1212 #endif1213 1223 1214 1224 uiWidth >>= 1; … … 1217 1227 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); 1218 1228 1219 #if H0736_AVC_STYLE_QP_RANGE1220 1229 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); 1221 #else1222 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );1223 #endif1224 1230 1225 1231 piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); … … 1375 1381 Int iSumPix[2]; 1376 1382 memset(iSumPix, 0, sizeof(Int)*2); 1377 1383 #if HS_REFERENCE_SUBSAMPLE_C0154 1384 Int subSamplePix; 1385 if ( uiSize == 64 || uiSize == 32 ) 1386 { 1387 subSamplePix = 2; 1388 } 1389 else 1390 { 1391 subSamplePix = 1; 1392 } 1393 for (Int y=0; y<uiSize; y+=subSamplePix) 1394 { 1395 for (Int x=0; x<uiSize; x+=subSamplePix) 1396 { 1397 UChar ucSegment = pMask?(UChar)pMask[x]:0; 1398 assert( ucSegment < uiNumSegments ); 1399 1400 iSumDepth[ucSegment] += pOrig[x]; 1401 iSumPix[ucSegment] += 1; 1402 } 1403 pOrig += uiStride*subSamplePix; 1404 pMask += uiMaskStride*subSamplePix; 1405 } 1406 #else 1378 1407 for (Int y=0; y<uiSize; y++) 1379 1408 { … … 1390 1419 pMask += uiMaskStride; 1391 1420 } 1392 1421 #endif 1393 1422 // compute mean for each segment 1394 1423 for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ ) -
trunk/source/Lib/TLibDecoder/TDecCu.h
r189 r296 61 61 TComYuv** m_ppcYuvResi; ///< array of residual buffer 62 62 TComYuv** m_ppcYuvReco; ///< array of prediction & reconstruction buffer 63 #if H HI_INTER_VIEW_RESIDUAL_PRED63 #if H3D_IVRP 64 64 TComYuv** m_ppcYuvResPred; ///< residual prediction buffer 65 65 #endif 66 66 TComDataCU** m_ppcCU; ///< CU data array 67 67 68 68 // access channel 69 69 TComTrQuant* m_pcTrQuant; … … 85 85 /// destroy internal buffers 86 86 Void destroy (); 87 87 88 88 /// decode CU information 89 89 Void decodeCU ( TComDataCU* pcCU, UInt& ruiIsLast ); -
trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
r189 r296 72 72 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); 73 73 74 if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) || pcCU->getSlice()->getSPS()->isDepth()) 74 if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) 75 #if !LGE_ILLUCOMP_DEPTH_C0046 76 || pcCU->getSlice()->getSPS()->isDepth() 77 #endif 78 ) 75 79 { 76 80 return; … … 80 84 return; 81 85 86 #if LGE_ILLUCOMP_DEPTH_C0046 87 if(pcCU->isICFlagRequired(uiAbsPartIdx, uiDepth)) //This modification is not needed after integrating JCT3V-C0137 88 #else 82 89 if(pcCU->isICFlagRequired(uiAbsPartIdx)) 90 #endif 83 91 m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); 84 92 } … … 100 108 } 101 109 102 #if H HI_INTER_VIEW_RESIDUAL_PRED110 #if H3D_IVRP && !MTK_MDIVRP_C0138 103 111 Void 104 112 TDecEntropy::decodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ) … … 115 123 if( bResPredAllowed ) 116 124 { 117 bResPredAvailable = pcSubCU->getResidualSamples( uiPUIdx 118 #if QC_SIMPLIFIEDIVRP_M24938 119 , false 120 #endif 121 ); 125 bResPredAvailable = pcSubCU->getResidualSamples( uiPUIdx , false ); 122 126 } 123 127 … … 272 276 273 277 #if CU_BASED_MRG_CAND_LIST 274 #if H HI_INTER_VIEW_MOTION_PRED278 #if H3D_IVMP 275 279 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 276 280 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 293 297 { 294 298 #if !CU_BASED_MRG_CAND_LIST 295 #if H HI_INTER_VIEW_MOTION_PRED299 #if H3D_IVMP 296 300 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 297 301 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 326 330 else 327 331 { 328 #if SIMP_MRG_PRUN329 332 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 330 333 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 331 #else332 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );333 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);334 #endif335 334 } 336 335 #else 337 #if SIMP_MRG_PRUN338 336 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 337 #if MERL_VSP_C0152 338 Int iVSPIndexTrue[3] = {-1, -1, -1}; 339 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); 340 341 #if HHI_MPI 342 if(pcCU->getTextureModeDepth( uiSubPartIdx ) == uiDepth)//MPI is used 343 { 344 TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); 345 UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 346 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 347 { 348 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); 349 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 350 } 351 } 352 else // MPI not used 353 #endif 354 { 355 Int iVSPIdx = 0; 356 Int numVspIdx; 357 numVspIdx = 3; 358 for (Int i = 0; i < numVspIdx; i++) 359 { 360 if (iVSPIndexTrue[i] == uiMergeIndex) 361 { 362 iVSPIdx = i+1; 363 break; 364 } 365 } 366 pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth ); //Initialize the VSP, may change later in get InterMergeCandidates() 367 } 368 369 #else 339 370 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 340 #else341 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );342 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);343 371 #endif 344 372 #endif … … 485 513 if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) && (pcSubCU->getAMVPMode(uiPartAddr) == AM_EXPL) ) 486 514 { 487 #if H HI_INTER_VIEW_MOTION_PRED515 #if H3D_IVMP 488 516 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcSubCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 489 517 m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx, iNumAMVPCands ); … … 492 520 #endif 493 521 } 494 #if SHARP_INTERVIEW_DECOUPLE_B0111522 #if H3D_IVMP 495 523 pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo, iMVPIdx); 496 524 #else … … 509 537 } 510 538 511 #if UNIFIED_TRANSFORM_TREE512 539 Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP ) 513 #else514 Void TDecEntropy::xDecodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )515 #endif516 540 { 517 541 UInt uiSubdiv; 518 542 const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth; 519 543 520 #if UNIFIED_TRANSFORM_TREE521 544 if(uiTrIdx==0) 522 545 { … … 532 555 } 533 556 } 534 #endif // UNIFIED_TRANSFORM_TREE535 557 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) 536 558 { 537 559 uiSubdiv = 1; 538 560 } 539 #if G519_TU_AMP_NSQT_HARMONIZATION540 561 else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) 541 #else542 else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )543 #endif544 562 { 545 563 uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx)); … … 618 636 if( uiSubdiv ) 619 637 { 620 #if UNIFIED_TRANSFORM_TREE621 638 UInt size; 622 639 width >>= 1; … … 624 641 size = width*height; 625 642 uiTrIdx++; 626 #endif627 643 ++uiDepth; 628 644 const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); … … 640 656 for( Int i = 0; i < 4; i++ ) 641 657 { 642 #if UNIFIED_TRANSFORM_TREE643 658 UInt nsAddr = 0; 644 659 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 ); 645 660 xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP ); 646 #else647 UInt nsAddr = 0;648 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );649 xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );650 #endif651 661 uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode ); 652 662 uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiChromaTrMode ); 653 663 uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiChromaTrMode ); 654 664 uiAbsPartIdx += uiQPartNum; 655 #if UNIFIED_TRANSFORM_TREE656 665 offsetLuma += size; offsetChroma += (size>>2); 657 #endif658 666 } 659 667 … … 713 721 } 714 722 } 715 #if UNIFIED_TRANSFORM_TREE716 723 // transform_unit begin 717 724 UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); … … 779 786 } 780 787 // transform_unit end 781 #endif // UNIFIED_TRANSFORM_TREE 782 } 783 } 784 785 #if !UNIFIED_TRANSFORM_TREE 786 Void TDecEntropy::decodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 787 { 788 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 789 DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" ) 790 DTRACE_CABAC_V( uiDepth ) 791 DTRACE_CABAC_T( "\n" ) 792 UInt temp = 0; 793 UInt temp1 = 0; 794 UInt temp2 = 0; 795 xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 ); 796 } 797 #endif // UNIFIED_TRANSFORM_TREE 798 799 #if UNIFIED_TRANSFORM_TREE 788 } 789 } 790 791 800 792 Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 801 793 { … … 805 797 } 806 798 } 807 #else 808 Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 809 { 810 if ( pcCU->getSlice()->getPPS()->getUseDQP() ) 811 { 812 m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, uiDepth ); 813 } 814 } 815 #endif 816 817 #if !UNIFIED_TRANSFORM_TREE 818 Void TDecEntropy::xDecodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP ) 819 { 820 UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2; 821 UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ); 822 UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); 823 UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); 824 if( uiLog2TrSize == 2 ) 825 { 826 UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); 827 if( ( uiAbsPartIdx % uiQPDiv ) == 0 ) 828 { 829 m_uiBakAbsPartIdx = uiAbsPartIdx; 830 m_uiBakChromaOffset = uiChromaOffset; 831 } 832 else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) ) 833 { 834 uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); 835 uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); 836 } 837 } 838 839 if ( uiCbfY || uiCbfU || uiCbfV ) 840 { 841 // dQP: only for LCU 842 if ( pcCU->getSlice()->getPPS()->getUseDQP() ) 843 { 844 if ( bCodeDQP ) 845 { 846 decodeQP( pcCU, uiAbsPartIdx, uiDepth); 847 bCodeDQP = false; 848 } 849 } 850 UInt uiLumaTrMode, uiChromaTrMode; 851 pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); 852 const UInt uiStopTrMode = uiLumaTrMode; 853 854 if( uiTrIdx == uiStopTrMode ) 855 { 856 if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) ) 857 { 858 Int trWidth = uiWidth; 859 Int trHeight = uiHeight; 860 pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight ); 861 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); 862 } 863 864 uiWidth >>= 1; 865 uiHeight >>= 1; 866 867 if( uiLog2TrSize == 2 ) 868 { 869 UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); 870 if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) ) 871 { 872 uiWidth <<= 1; 873 uiHeight <<= 1; 874 Int trWidth = uiWidth; 875 Int trHeight = uiHeight; 876 pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight ); 877 if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) ) 878 { 879 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); 880 } 881 if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) ) 882 { 883 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); 884 } 885 } 886 } 887 else 888 { 889 Int trWidth = uiWidth; 890 Int trHeight = uiHeight; 891 pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight ); 892 if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) ) 893 { 894 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); 895 } 896 if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) ) 897 { 898 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); 899 } 900 } 901 } 902 else 903 { 904 { 905 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 906 DTRACE_CABAC_T( "\tgoing down\tdepth=" ); 907 DTRACE_CABAC_V( uiDepth ); 908 DTRACE_CABAC_T( "\ttridx=" ); 909 DTRACE_CABAC_V( uiTrIdx ); 910 DTRACE_CABAC_T( "\n" ); 911 } 912 if( uiCurrTrIdx <= uiTrIdx ) 913 { 914 assert(1); 915 } 916 UInt uiSize; 917 uiWidth >>= 1; 918 uiHeight >>= 1; 919 uiSize = uiWidth*uiHeight; 920 uiDepth++; 921 uiTrIdx++; 922 923 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 924 UInt uiIdx = uiAbsPartIdx; 925 926 xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); 927 uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum; 928 929 xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); 930 uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum; 931 932 xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); 933 uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum; 934 935 xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); 936 { 937 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 938 DTRACE_CABAC_T( "\tgoing up\n" ); 939 } 940 } 941 } 942 } 943 #endif // !UNIFIED_TRANSFORM_TREE 799 944 800 945 801 /** decode coefficients … … 956 812 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; 957 813 UInt uiChromaOffset = uiLumaOffset>>2; 958 #if UNIFIED_TRANSFORM_TREE959 814 UInt temp = 0; 960 815 UInt temp1 = 0; 961 816 UInt temp2 = 0; 962 #else963 UInt uiLumaTrMode, uiChromaTrMode;964 #endif965 817 966 818 #if RWTH_SDC_DLT_B0036 … … 980 832 if( pcCU->isIntra(uiAbsPartIdx) ) 981 833 { 982 #if !UNIFIED_TRANSFORM_TREE983 decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );984 985 pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );986 987 #endif // !UNIFIED_TRANSFORM_TREE988 834 } 989 835 else … … 1007 853 } 1008 854 1009 #if !UNIFIED_TRANSFORM_TREE1010 decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );1011 1012 pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );1013 #endif // !UNIFIED_TRANSFORM_TREE1014 855 } 1015 856 … … 1030 871 #endif 1031 872 1032 #if UNIFIED_TRANSFORM_TREE1033 873 xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP ); 1034 #else // UNIFIED_TRANSFORM_TREE1035 xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );1036 #endif // UNIFIED_TRANSFORM_TREE1037 874 1038 875 #if FIX_MPI_B0065 -
trunk/source/Lib/TLibDecoder/TDecEntropy.h
r210 r296 67 67 virtual Void setBitstream ( TComInputBitstream* p ) = 0; 68 68 69 #if OL_FLUSH70 69 virtual Void decodeFlush() = 0; 71 #endif72 70 73 71 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 74 72 virtual Void parseVPS ( TComVPS* pcVPS ) = 0; 75 73 #endif 76 #if HHI_MPI 74 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 77 75 virtual Void parseSPS ( TComSPS* pcSPS, Bool bIsDepth ) = 0; 78 76 #else 79 77 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 80 78 #endif 81 #if TILES_OR_ENTROPY_SYNC_IDC82 79 virtual Void parsePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet ) = 0; 83 #else84 virtual Void parsePPS ( TComPPS* pcPPS ) = 0;85 #endif86 80 virtual Void parseAPS ( TComAPS* pAPS ) = 0; 87 81 virtual void parseSEI(SEImessages&) = 0; 88 82 89 #if LCU_SYNTAX_ALF 83 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 84 virtual Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) = 0; 85 #else 90 86 virtual Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) = 0; 91 #else92 virtual Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl ) = 0;93 87 #endif 94 88 95 89 virtual Void parseTerminatingBit ( UInt& ruilsLast ) = 0; 96 90 97 #if H HI_INTER_VIEW_MOTION_PRED91 #if H3D_IVMP 98 92 virtual Void parseMVPIdx ( Int& riMVPIdx, Int iNumAMVPCands ) = 0; 99 93 #else … … 109 103 virtual Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0; 110 104 virtual Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 111 #if H HI_INTER_VIEW_RESIDUAL_PRED105 #if H3D_IVRP 112 106 virtual Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 113 107 #endif … … 159 153 UInt m_uiBakAbsPartIdx; 160 154 UInt m_uiBakChromaOffset; 161 #if UNIFIED_TRANSFORM_TREE162 155 UInt m_bakAbsPartIdxCU; 163 #endif164 156 165 157 public: … … 179 171 #endif 180 172 181 #if HHI_MPI 173 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 182 174 Void decodeSPS ( TComSPS* pcSPS, Bool bIsDepth ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, bIsDepth); } 183 175 #else 184 176 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 185 177 #endif 186 #if TILES_OR_ENTROPY_SYNC_IDC187 178 Void decodePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet ) { m_pcEntropyDecoderIf->parsePPS(pcPPS, parameterSet); } 188 #else189 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); }190 #endif191 179 Void decodeAPS ( TComAPS* pAPS ) { m_pcEntropyDecoderIf->parseAPS(pAPS);} 192 180 void decodeSEI(SEImessages& seis) { m_pcEntropyDecoderIf->parseSEI(seis); } 193 181 194 #if LCU_SYNTAX_ALF 182 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 183 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet, isDepth); } 184 #else 195 185 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet); } 196 #else197 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl ) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl); }198 186 #endif 199 187 … … 210 198 Void decodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 211 199 Void decodeMergeIndex ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth ); 212 #if H HI_INTER_VIEW_RESIDUAL_PRED200 #if H3D_IVRP && !MTK_MDIVRP_C0138 213 201 Void decodeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ); 214 202 #endif … … 223 211 Void decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 224 212 225 #if !UNIFIED_TRANSFORM_TREE226 Void decodeTransformIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );227 #endif228 #if UNIFIED_TRANSFORM_TREE229 213 Void decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 230 #else231 Void decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );232 #endif233 214 234 215 Void readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ) { m_pcEntropyDecoderIf->readTileMarker( uiTileIdx, uiBitsUsed ); } … … 237 218 238 219 private: 239 #if UNIFIED_TRANSFORM_TREE240 220 Void xDecodeTransform ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP ); 241 #else242 Void xDecodeTransformSubdiv ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 );243 244 Void xDecodeCoeff ( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP );245 #endif //UNIFIED_TRANSFORM_TREE246 221 247 222 public: … … 253 228 Void setSliceGranularity (Int iSliceGranularity) {m_pcEntropyDecoderIf->setSliceGranularity(iSliceGranularity);} 254 229 255 #if SAO_UNIT_INTERLEAVING256 230 Void decodeSaoParam (SAOParam* saoParam); 257 231 void decodeSaoLcu(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool &repeatedRow ); 258 232 Void decodeSaoOneLcu(SaoLcuParam* saoLcuParam); 259 #endif 260 261 #if OL_FLUSH 233 262 234 Void decodeFlush() { m_pcEntropyDecoderIf->decodeFlush(); } 263 #endif264 235 265 236 #if RWTH_SDC_DLT_B0036 -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r189 r296 79 79 Void TDecGop::destroy() 80 80 { 81 #if LCU_SYNTAX_ALF82 81 m_alfParamSetPilot.releaseALFParam(); 83 #endif84 82 } 85 83 … … 95 93 ,TComDepthMapGenerator* pcDepthMapGenerator 96 94 #endif 97 #if H HI_INTER_VIEW_RESIDUAL_PRED95 #if H3D_IVRP 98 96 ,TComResidualGenerator* pcResidualGenerator 99 97 #endif … … 111 109 m_pcDepthMapGenerator = pcDepthMapGenerator; 112 110 #endif 113 #if H HI_INTER_VIEW_RESIDUAL_PRED111 #if H3D_IVRP 114 112 m_pcResidualGenerator = pcResidualGenerator; 115 113 #endif … … 120 118 // Private member functions 121 119 // ==================================================================================================================== 122 #if LCU_SYNTAX_ALF123 120 Void TDecGop::patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr) 124 121 { … … 195 192 } 196 193 197 #endif198 194 // ==================================================================================================================== 199 195 // Public member functions … … 279 275 if(pcSlice->getAlfEnabledFlag()) 280 276 { 281 #if LCU_SYNTAX_ALF282 277 if(pcSlice->getSPS()->getUseALFCoefInSlice()) 283 278 { … … 289 284 if( !pcSlice->getSPS()->getUseALFCoefInSlice()) 290 285 { 291 #endif292 286 m_vAlfCUCtrlSlices.push_back(m_cAlfCUCtrlOneSlice); 293 #if LCU_SYNTAX_ALF294 287 } 295 #endif296 288 } 297 289 } … … 303 295 { 304 296 m_pcDepthMapGenerator->initViewComponent( rpcPic ); 305 #if ! QC_MULTI_DIS_CAN_A0097297 #if !H3D_NBDV 306 298 m_pcDepthMapGenerator->predictDepthMap ( rpcPic ); 307 299 #endif 308 #if H HI_INTER_VIEW_RESIDUAL_PRED300 #if H3D_IVRP 309 301 m_pcResidualGenerator->initViewComponent( rpcPic ); 310 302 #endif … … 312 304 #endif 313 305 314 #if QC_SIMPLE_NBDV_B0047306 #if H3D_NBDV 315 307 if(pcSlice->getViewId() && pcSlice->getSPS()->getMultiviewMvPredMode()) 316 308 { … … 323 315 m_pcSliceDecoder->decompressSlice( pcBitstream, ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders); 324 316 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiNumSubstreams-1] ); 325 #if WPP_SIMPLIFICATION326 317 if ( uiNumSubstreams > 1 ) 327 #else328 if ( pcSlice->getPPS()->getEntropyCodingSynchro() )329 #endif330 318 { 331 319 // deallocate all created substreams, including internal buffers. … … 343 331 else 344 332 { 345 #if H HI_INTER_VIEW_RESIDUAL_PRED333 #if H3D_IVRP 346 334 // set residual picture 347 335 m_pcResidualGenerator->setRecResidualPic( rpcPic ); 348 336 #endif 349 337 #if DEPTH_MAP_GENERATION 350 #if ! QC_MULTI_DIS_CAN_A0097338 #if !H3D_NBDV 351 339 // update virtual depth map 352 340 m_pcDepthMapGenerator->updateDepthMap( rpcPic ); … … 356 344 Bool bLFCrossTileBoundary = (pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)? 357 345 (pcSlice->getPPS()->getLFCrossTileBoundaryFlag()):(pcSlice->getPPS()->getSPS()->getLFCrossTileBoundaryFlag()); 358 #if DBL_CONTROL359 346 if (pcSlice->getPPS()->getDeblockingFilterControlPresent()) 360 347 { 361 #endif362 348 if(pcSlice->getSPS()->getUseDF()) 363 349 { … … 372 358 } 373 359 } 374 #if DBL_CONTROL375 360 } 376 361 m_pcLoopFilter->setCfg(pcSlice->getPPS()->getDeblockingFilterControlPresent(), pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary); 377 #else378 m_pcLoopFilter->setCfg(pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary);379 #endif380 362 m_pcLoopFilter->loopFilterPic( rpcPic ); 381 363 … … 392 374 if(pcSlice->getSaoEnabledFlag()) 393 375 { 394 #if SAO_UNIT_INTERLEAVING395 376 if (pcSlice->getSaoInterleavingFlag()) 396 377 { … … 402 383 } 403 384 m_pcSAO->setSaoInterleavingFlag(pcSlice->getAPS()->getSaoInterleavingFlag()); 404 #endif405 385 m_pcSAO->createPicSaoInfo(rpcPic, m_uiILSliceCount); 406 386 m_pcSAO->SAOProcess(rpcPic, pcSlice->getAPS()->getSaoParam()); … … 413 393 if( pcSlice->getSPS()->getUseALF() ) 414 394 { 415 #if LCU_SYNTAX_ALF416 395 if( (pcSlice->getSPS()->getUseALFCoefInSlice())?(true):(pcSlice->getAlfEnabledFlag())) 417 #else 418 if(pcSlice->getAlfEnabledFlag()) 419 #endif 420 { 421 422 #if LCU_SYNTAX_ALF 396 { 397 423 398 if(!pcSlice->getSPS()->getUseALFCoefInSlice()) 424 399 { … … 427 402 m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount, pcSlice->getSliceQp()); 428 403 m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, m_vAlfCUCtrlSlices, pcSlice->getSPS()->getUseALFCoefInSlice()); 429 #else430 m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount);431 m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, pcSlice->getAPS()->getAlfParam(), m_vAlfCUCtrlSlices);432 #endif433 404 m_pcAdaptiveLoopFilter->PCMLFDisableProcess(rpcPic); 434 405 m_pcAdaptiveLoopFilter->destroyPicAlfInfo(); 435 406 } 436 #if LCU_SYNTAX_ALF437 407 m_pcAdaptiveLoopFilter->resetLCUAlfInfo(); //reset all LCU ALFParam->alf_flag = 0 438 #endif439 408 } 440 409 … … 511 480 m_vAlfCUCtrlSlices.clear(); 512 481 } 482 fflush(stdout); 513 483 } 514 484 -
trunk/source/Lib/TLibDecoder/TDecGop.h
r56 r296 90 90 TComDepthMapGenerator* m_pcDepthMapGenerator; 91 91 #endif 92 #if H HI_INTER_VIEW_RESIDUAL_PRED92 #if H3D_IVRP 93 93 TComResidualGenerator* m_pcResidualGenerator; 94 94 #endif … … 101 101 bool m_pictureDigestEnabled; ///< if true, handle picture_digest SEI messages 102 102 AlfCUCtrlInfo m_cAlfCUCtrlOneSlice; 103 #if LCU_SYNTAX_ALF104 103 AlfParamSet m_alfParamSetPilot; 105 #endif106 104 107 105 public: … … 120 118 ,TComDepthMapGenerator* pcDepthMapGenerator 121 119 #endif 122 #if H HI_INTER_VIEW_RESIDUAL_PRED120 #if H3D_IVRP 123 121 ,TComResidualGenerator* pcResidualGenerator 124 122 #endif … … 131 129 void setPictureDigestEnabled(bool enabled) { m_pictureDigestEnabled = enabled; } 132 130 AlfCUCtrlInfo& getAlfCuCtrlParam() { return m_cAlfCUCtrlOneSlice; } 133 #if LCU_SYNTAX_ALF134 131 AlfParamSet& getAlfParamSet() {return m_alfParamSetPilot;} 135 #endif136 132 137 133 private: 138 #if LCU_SYNTAX_ALF139 134 Void patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr = 0); 140 #endif141 135 142 136 -
trunk/source/Lib/TLibDecoder/TDecSbac.cpp
r189 r296 62 62 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 63 63 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 64 #if H HI_INTER_VIEW_RESIDUAL_PRED64 #if H3D_IVRP 65 65 , m_cResPredFlagSCModel ( 1, 1, NUM_RES_PRED_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 66 66 #endif … … 87 87 , m_cALFUvlcSCModel ( 1, 1, NUM_ALF_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 88 88 , m_cALFSvlcSCModel ( 1, 1, NUM_ALF_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 89 #if AMP_CTX90 89 , m_cCUAMPSCModel ( 1, 1, NUM_CU_AMP_CTX , m_contextModels + m_numContextModels, m_numContextModels) 91 #else92 , m_cCUXPosiSCModel ( 1, 1, NUM_CU_X_POS_CTX , m_contextModels + m_numContextModels, m_numContextModels)93 , m_cCUYPosiSCModel ( 1, 1, NUM_CU_Y_POS_CTX , m_contextModels + m_numContextModels, m_numContextModels)94 #endif95 90 , m_cSaoFlagSCModel ( 1, 1, NUM_SAO_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 96 91 , m_cSaoUvlcSCModel ( 1, 1, NUM_SAO_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 97 92 , m_cSaoSvlcSCModel ( 1, 1, NUM_SAO_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 98 #if SAO_UNIT_INTERLEAVING99 93 , m_cSaoMergeLeftSCModel ( 1, 1, NUM_SAO_MERGE_LEFT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 100 94 , m_cSaoMergeUpSCModel ( 1, 1, NUM_SAO_MERGE_UP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 101 95 , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 102 #endif103 96 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 104 97 , m_cDmmFlagSCModel ( 1, 1, NUM_DMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 166 159 m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); 167 160 m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); 168 #if H HI_INTER_VIEW_RESIDUAL_PRED161 #if H3D_IVRP 169 162 m_cResPredFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RES_PRED_FLAG ); 170 163 #endif 171 164 m_cCUAlfCtrlFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG ); 172 165 m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); 173 #if AMP_CTX174 166 m_cCUAMPSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_AMP_POS ); 175 #else176 m_cCUXPosiSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_X_POS );177 m_cCUYPosiSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_Y_POS );178 #endif179 167 m_cCUPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PRED_MODE ); 180 168 m_cCUIntraPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE ); … … 199 187 m_cSaoUvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_UVLC ); 200 188 m_cSaoSvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_SVLC ); 201 #if SAO_UNIT_INTERLEAVING202 189 m_cSaoMergeLeftSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG ); 203 190 m_cSaoMergeUpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); 204 191 m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); 205 #endif206 192 207 193 m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); … … 260 246 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); 261 247 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); 262 #if H HI_INTER_VIEW_RESIDUAL_PRED248 #if H3D_IVRP 263 249 m_cResPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG ); 264 250 #endif 265 251 m_cCUAlfCtrlFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG ); 266 252 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 267 #if AMP_CTX268 253 m_cCUAMPSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS ); 269 #else270 m_cCUXPosiSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CU_X_POS );271 m_cCUYPosiSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CU_Y_POS );272 #endif273 254 m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); 274 255 m_cCUIntraPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE ); … … 293 274 m_cSaoUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC ); 294 275 m_cSaoSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC ); 295 #if SAO_UNIT_INTERLEAVING296 276 m_cSaoMergeLeftSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG ); 297 277 m_cSaoMergeUpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); 298 278 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 299 #endif300 279 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 301 280 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX … … 449 428 } 450 429 451 #if EIGHT_BITS_RICE_CODE452 430 ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 23 ) ]; 453 #else454 ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 15 ) ];455 #endif456 431 457 432 return; … … 470 445 { 471 446 UInt uiSymbol; 472 #if BURST_IPCM473 447 Int numSubseqIPCM = 0; 474 448 Bool readPCMSampleFlag = false; … … 490 464 } 491 465 } 492 #else 493 m_pcTDecBinIf->decodeBinTrm(uiSymbol); 494 #endif 495 496 #if BURST_IPCM 466 497 467 if (readPCMSampleFlag == true) 498 #else499 if (uiSymbol)500 #endif501 468 { 502 469 Bool bIpcmFlag = true; 503 470 504 #if !BURST_IPCM505 m_pcTDecBinIf->decodePCMAlignBits();506 #endif507 471 508 472 pcCU->setPartSizeSubParts ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); … … 568 532 } 569 533 570 #if BURST_IPCM571 534 pcCU->setNumSucIPCM( pcCU->getNumSucIPCM() - 1); 572 535 if(pcCU->getNumSucIPCM() == 0) … … 574 537 m_pcTDecBinIf->resetBac(); 575 538 } 576 #else577 m_pcTDecBinIf->resetBac();578 #endif579 539 } 580 540 } … … 664 624 { 665 625 UInt uiNumCand = MRG_MAX_NUM_CANDS; 666 #if !MRG_IDX_CTX_RED667 UInt auiCtx[4] = { 0, 1, 2, 3 };668 #endif669 626 UInt uiUnaryIdx = 0; 670 627 uiNumCand = pcCU->getSlice()->getMaxNumMergeCand(); … … 678 635 { 679 636 UInt uiSymbol = 0; 680 #if MRG_IDX_CTX_RED681 637 if ( uiUnaryIdx==0 ) 682 638 { … … 687 643 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 688 644 } 689 #else690 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, auiCtx[uiUnaryIdx] ) );691 #endif692 645 if( uiSymbol == 0 ) 693 646 { … … 717 670 } 718 671 719 #if H HI_INTER_VIEW_RESIDUAL_PRED672 #if H3D_IVRP 720 673 Void 721 674 TDecSbac::parseResPredFlag( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) … … 728 681 #endif 729 682 730 #if H HI_INTER_VIEW_MOTION_PRED683 #if H3D_IVMP 731 684 Void TDecSbac::parseMVPIdx ( Int& riMVPIdx, Int iNumAMVPCands ) 732 685 { … … 762 715 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); 763 716 717 #if HHI_QTLPC_RAU_OFF_C0160 718 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 719 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC()) 720 #else 764 721 if(bDepthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC()) 722 #endif 765 723 { 766 724 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); … … 804 762 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); 805 763 764 #if HHI_QTLPC_RAU_OFF_C0160 765 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 766 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC()) 767 #else 806 768 if(bDepthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC()) 769 #endif 807 770 { 808 771 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); … … 869 832 if (eMode == SIZE_2NxN) 870 833 { 871 #if AMP_CTX872 834 m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); 873 #else874 m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUYPosiSCModel.get( 0, 0, 0 ));875 #endif876 835 if (uiSymbol == 0) 877 836 { 878 #if AMP_CTX879 837 m_pcTDecBinIf->decodeBinEP(uiSymbol); 880 #else881 m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUYPosiSCModel.get( 0, 0, 1 ));882 #endif883 838 eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD); 884 839 } … … 886 841 else if (eMode == SIZE_Nx2N) 887 842 { 888 #if AMP_CTX889 843 m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); 890 #else891 m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUXPosiSCModel.get( 0, 0, 0 ));892 #endif893 844 if (uiSymbol == 0) 894 845 { 895 #if AMP_CTX896 846 m_pcTDecBinIf->decodeBinEP(uiSymbol); 897 #else898 m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUXPosiSCModel.get( 0, 0, 1 ));899 #endif900 847 eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N); 901 848 } … … 970 917 #if HHI_DMM_PRED_TEX 971 918 if( intraPredMode == DMM_WEDGE_PREDTEX_D_IDX ) { xParseWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 919 #if LGE_DMM3_SIMP_C0044 920 if( intraPredMode == DMM_WEDGE_PREDTEX_IDX ) { xParseWedgePredTexInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 921 #endif 972 922 if( intraPredMode == DMM_CONTOUR_PREDTEX_D_IDX ) { xParseContourPredTexDeltaInfo( pcCU, uiAbsPartIdx, uiDepth ); } 973 923 #endif … … 975 925 else 976 926 { 977 #endif978 #if !LOGI_INTRA_NAME_3MPM979 Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx);980 927 #endif 981 928 … … 990 937 #endif 991 938 992 #if LOGI_INTRA_NAME_3MPM993 939 Int uiPreds[3] = {-1, -1, -1}; 994 #else995 Int uiPreds[2] = {-1, -1};996 #endif997 940 Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); 998 941 #if LGE_EDGE_INTRA_A0070 … … 1005 948 { 1006 949 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 1007 #if LOGI_INTRA_NAME_3MPM1008 950 if (uiSymbol) 1009 951 { … … 1011 953 uiSymbol++; 1012 954 } 1013 #endif1014 955 intraPredMode = uiPreds[uiSymbol]; 1015 956 } … … 1018 959 intraPredMode = 0; 1019 960 1020 #if LOGI_INTRA_NAME_3MPM1021 961 1022 962 m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 ); … … 1047 987 std::swap(uiPreds[1], uiPreds[2]); 1048 988 } 1049 #else1050 m_pcTDecBinIf->decodeBinsEP( uiSymbol, g_aucIntraModeBitsAng[iIntraIdx] - 1 );1051 intraPredMode = uiSymbol;1052 1053 if ( intraPredMode == 31 )1054 {1055 m_pcTDecBinIf->decodeBinEP( uiSymbol );1056 intraPredMode += uiSymbol;1057 }1058 #endif1059 989 #if LGE_EDGE_INTRA_A0070 1060 990 if ( intraPredMode != EDGE_INTRA_IDX) … … 1145 1075 { 1146 1076 UInt uiIPredMode; 1147 #if CHROMA_MODE_CODING1148 1077 m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 ); 1149 #else1150 xReadUnaryMaxSymbol( uiIPredMode, m_cCUChromaPredSCModel.get( 0, 0 ) + 1, 0, 3 );1151 #endif1152 1078 UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ]; 1153 1079 pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir ); … … 1217 1143 ContextModel *pCtx = m_cCUMvdSCModel.get( 0 ); 1218 1144 1219 #if H0111_MVD_L1_ZERO1220 1145 if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3) 1221 1146 { … … 1225 1150 else 1226 1151 { 1227 #endif1228 1152 1229 1153 m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx ); … … 1268 1192 } 1269 1193 1270 #if H0111_MVD_L1_ZERO 1271 } 1272 #endif 1194 } 1273 1195 1274 1196 const TComMv cMv( uiHorSign ? -Int( uiHorAbs ): uiHorAbs, uiVerSign ? -Int( uiVerAbs ) : uiVerAbs ); … … 1310 1232 Void TDecSbac::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1311 1233 { 1312 #if H0736_AVC_STYLE_QP_RANGE1313 1234 Int qp; 1314 #endif1315 1235 UInt uiDQp; 1316 1236 Int iDQp; … … 1320 1240 if ( uiDQp == 0 ) 1321 1241 { 1322 #if H0736_AVC_STYLE_QP_RANGE1323 1242 qp = pcCU->getRefQP(uiAbsPartIdx); 1324 #else1325 uiDQp = pcCU->getRefQP(uiAbsPartIdx);1326 #endif1327 1243 } 1328 1244 else 1329 1245 { 1330 1246 UInt uiSign; 1331 #if H0736_AVC_STYLE_QP_RANGE1332 1247 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 1333 #else1334 UInt uiQpBdOffsetY = 6*(g_uiBitIncrement + g_uiBitDepth - 8);1335 #endif1336 1248 m_pcTDecBinIf->decodeBinEP(uiSign); 1337 1249 1338 #if H0736_AVC_STYLE_QP_RANGE1339 1250 UInt uiMaxAbsDQpMinus1 = 24 + (qpBdOffsetY/2) + (uiSign); 1340 #else1341 UInt uiMaxAbsDQpMinus1 = 24 + (uiQpBdOffsetY/2) + (uiSign);1342 #endif1343 1251 UInt uiAbsDQpMinus1; 1344 1252 xReadUnaryMaxSymbol (uiAbsDQpMinus1, &m_cCUDeltaQpSCModel.get( 0, 0, 1 ), 1, uiMaxAbsDQpMinus1); … … 1351 1259 } 1352 1260 1353 #if H0736_AVC_STYLE_QP_RANGE1354 1261 qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY; 1355 #else1356 #if LOSSLESS_CODING1357 uiDQp = (pcCU->getRefQP(uiAbsPartIdx) + iDQp + 52) % 52;1358 #else1359 uiDQp = pcCU->getRefQP(uiAbsPartIdx) + iDQp;1360 #endif1361 #endif1362 1262 } 1363 1263 1364 1264 UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ; 1365 1265 UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; 1366 #if H0736_AVC_STYLE_QP_RANGE1367 1266 pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); 1368 #else1369 pcCU->setQPSubParts( uiDQp, uiAbsQpCUPartIdx, uiQpCUDepth );1370 #endif1371 1267 } 1372 1268 … … 1409 1305 1410 1306 // posX 1411 #if LAST_CTX_REDUCTION1412 1307 Int widthCtx = eTType ? 4 : width; 1413 1308 const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ widthCtx ] * ( g_aucConvertToBit[ widthCtx ] + 3 ) ); 1414 #else1415 const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ width ] * ( g_aucConvertToBit[ width ] + 3 ) );1416 #endif1417 1309 for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ ) 1418 1310 { 1419 #if LAST_CTX_REDUCTION1420 1311 if ( eTType ) 1421 1312 { … … 1424 1315 else 1425 1316 { 1426 #endif1427 1317 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + puiCtxIdxX[ uiPosLastX ] ) ); 1428 #if LAST_CTX_REDUCTION 1429 } 1430 #endif 1318 } 1431 1319 if( !uiLast ) 1432 1320 { … … 1436 1324 1437 1325 // posY 1438 #if LAST_CTX_REDUCTION1439 1326 Int heightCtx = eTType? 4 : height; 1440 1327 const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ heightCtx ] * ( g_aucConvertToBit[ heightCtx ] + 3 ) ); 1441 #else1442 const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ height ] * ( g_aucConvertToBit[ height ] + 3 ) );1443 #endif1444 1328 for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ ) 1445 1329 { 1446 #if LAST_CTX_REDUCTION1447 1330 if (eTType) 1448 1331 { … … 1451 1334 else 1452 1335 { 1453 #endif1454 1336 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + puiCtxIdxY[ uiPosLastY ] ) ); 1455 #if LAST_CTX_REDUCTION 1456 } 1457 #endif 1337 } 1458 1338 if( !uiLast ) 1459 1339 { … … 1575 1455 UInt uiGoRiceParam = 0; 1576 1456 1577 #if MULTIBITS_DATA_HIDING1578 1457 UInt const tsig = pcCU->getSlice()->getPPS()->getTSIG(); 1579 1458 #if LOSSLESS_CODING … … 1591 1470 #endif 1592 1471 UInt absSum = 0; 1593 #endif // MULTIBITS_DATA_HIDING1594 1472 1595 1473 UInt uiSigCoeffGroupFlag[ MLS_GRP_NUM ]; … … 1600 1478 { 1601 1479 scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0 ]; 1602 #if MULTILEVEL_SIGMAP_EXT1603 1480 if( uiLog2BlockSize == 3 ) 1604 1481 { … … 1609 1486 scanCG = g_sigLastScanCG32x32; 1610 1487 } 1611 #endif1612 1488 } 1613 1489 else … … 1622 1498 Int numNonZero = 0; 1623 1499 1624 #if MULTIBITS_DATA_HIDING1625 1500 Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE; 1626 #endif1627 1501 1628 1502 Int pos[SCAN_SET_SIZE]; 1629 1503 if( iScanPosSig == (Int) uiScanPosLast ) 1630 1504 { 1631 #if MULTIBITS_DATA_HIDING1632 1505 lastNZPosInCG = iScanPosSig; 1633 1506 firstNZPosInCG = iScanPosSig; 1634 #endif1635 1507 iScanPosSig--; 1636 1508 pos[ numNonZero ] = uiBlkPosLast; … … 1638 1510 } 1639 1511 1640 #if !MULTILEVEL_SIGMAP_EXT1641 if( blockType > 3 )1642 {1643 #endif1644 1512 // decode significant_coeffgroup_flag 1645 1513 Int iCGBlkPos = scanCG[ iSubSet ]; 1646 1514 Int iCGPosY = iCGBlkPos / uiNumBlkSide; 1647 1515 Int iCGPosX = iCGBlkPos - (iCGPosY * uiNumBlkSide); 1648 #if MULTILEVEL_SIGMAP_EXT1649 1516 if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) ) 1650 1517 { … … 1652 1519 iCGPosX = (uiScanIdx == SCAN_VER ? iCGBlkPos : 0); 1653 1520 } 1654 #endif1655 #if !REMOVE_INFER_SIGGRP1656 Bool bInferredCGFlag = false;1657 #endif1658 #if REMOVE_INFER_SIGGRP1659 1521 if( iSubSet == iLastScanSet || iSubSet == 0) 1660 #else1661 if( iSubSet == iLastScanSet )1662 #endif1663 1522 { 1664 1523 uiSigCoeffGroupFlag[ iCGBlkPos ] = 1; … … 1666 1525 else 1667 1526 { 1668 #if !REMOVE_INFER_SIGGRP1669 #if MULTILEVEL_SIGMAP_EXT1670 if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight) && ( iSubSet ) )1671 #else1672 if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight) && ( iSubSet ) )1673 #endif1674 {1675 #endif1676 1527 UInt uiSigCoeffGroup; 1677 #if MULTILEVEL_SIGMAP_EXT1678 1528 UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight ); 1679 #else1680 UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight );1681 #endif1682 1529 m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] ); 1683 1530 uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup; 1684 #if !REMOVE_INFER_SIGGRP1685 }1686 else1687 {1688 uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;1689 bInferredCGFlag = true;1690 }1691 #endif1692 1531 } 1693 1532 … … 1703 1542 if( uiSigCoeffGroupFlag[ iCGBlkPos ] ) 1704 1543 { 1705 #if REMOVE_INFER_SIGGRP1706 1544 if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero ) 1707 #else1708 if( iScanPosSig > iSubPos || bInferredCGFlag || numNonZero )1709 #endif1710 1545 { 1711 1546 uiCtxSig = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType ); … … 1722 1557 pos[ numNonZero ] = uiBlkPos; 1723 1558 numNonZero ++; 1724 #if MULTIBITS_DATA_HIDING1725 1559 if( lastNZPosInCG == -1 ) 1726 1560 { … … 1728 1562 } 1729 1563 firstNZPosInCG = iScanPosSig; 1730 #endif1731 1564 } 1732 1565 } 1733 #if !MULTILEVEL_SIGMAP_EXT1734 }1735 else1736 {1737 for( ; iScanPosSig >= iSubPos; iScanPosSig-- )1738 {1739 UInt uiBlkPos = scan[ iScanPosSig ];1740 UInt uiPosY = uiBlkPos >> uiLog2BlockSize;1741 UInt uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockSize );1742 UInt uiSig = 0;1743 UInt uiCtxSig = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );1744 m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] );1745 pcCoef[ uiBlkPos ] = uiSig;1746 if( uiSig )1747 {1748 pos[ numNonZero ] = uiBlkPos;1749 numNonZero ++;1750 #if MULTIBITS_DATA_HIDING1751 if( lastNZPosInCG == -1 )1752 {1753 lastNZPosInCG = iScanPosSig;1754 }1755 firstNZPosInCG = iScanPosSig;1756 #endif1757 }1758 }1759 }1760 #endif1761 1566 1762 1567 1763 1568 if( numNonZero ) 1764 1569 { 1765 #if MULTIBITS_DATA_HIDING1766 1570 Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= (Int)tsig ); 1767 1571 absSum = 0; 1768 #endif // MULTIBITS_DATA_HIDING1769 1572 1770 1573 UInt c1 = 1; 1771 #if !RESTRICT_GR1GR2FLAG_NUMBER1772 UInt c2 = 0;1773 #endif1774 #if LEVEL_CTX_LUMA_RED1775 1574 UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0; 1776 #else1777 UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 3 : 0;1778 #endif1779 1575 UInt uiBin; 1780 1576 … … 1782 1578 { 1783 1579 uiCtxSet++; 1784 #if !LEVEL_CTX_LUMA_RED1785 if(eTType==TEXT_LUMA && uiNumOne > 3)1786 {1787 uiCtxSet++;1788 }1789 #endif1790 1580 } 1791 1581 … … 1794 1584 Int absCoeff[SCAN_SET_SIZE]; 1795 1585 1796 #if RESTRICT_GR1GR2FLAG_NUMBER1797 1586 for ( Int i = 0; i < numNonZero; i++) absCoeff[i] = 1; 1798 1587 Int numC1Flag = min(numNonZero, C1FLAG_NUMBER); … … 1800 1589 1801 1590 for( Int idx = 0; idx < numC1Flag; idx++ ) 1802 #else1803 for( Int idx = 0; idx < numNonZero; idx++ )1804 #endif1805 1591 { 1806 1592 m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c1] ); … … 1808 1594 { 1809 1595 c1 = 0; 1810 #if RESTRICT_GR1GR2FLAG_NUMBER1811 1596 if (firstC2FlagIdx == -1) 1812 1597 { 1813 1598 firstC2FlagIdx = idx; 1814 1599 } 1815 #endif1816 1600 } 1817 1601 else if( (c1 < 3) && (c1 > 0) ) … … 1824 1608 if (c1 == 0) 1825 1609 { 1826 #if RESTRICT_GR1GR2FLAG_NUMBER1827 1610 baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet; 1828 1611 if ( firstC2FlagIdx != -1) … … 1831 1614 absCoeff[ firstC2FlagIdx ] = uiBin + 2; 1832 1615 } 1833 #else 1834 baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + 3 * uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + 3 * uiCtxSet; 1616 } 1617 1618 UInt coeffSigns; 1619 if ( signHidden && beValid ) 1620 { 1621 m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 ); 1622 coeffSigns <<= 32 - (numNonZero-1); 1623 } 1624 else 1625 { 1626 m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero ); 1627 coeffSigns <<= 32 - numNonZero; 1628 } 1629 1630 Int iFirstCoeff2 = 1; 1631 if (c1 == 0 || numNonZero > C1FLAG_NUMBER) 1632 { 1835 1633 for( Int idx = 0; idx < numNonZero; idx++ ) 1836 1634 { 1837 if( absCoeff[ idx ] == 2 )1838 {1839 m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c2] );1840 absCoeff[ idx ] = uiBin + 2;1841 c2 += (c2 < 2);1842 uiNumOne++;1843 }1844 }1845 #endif1846 }1847 1848 #if MULTIBITS_DATA_HIDING1849 UInt coeffSigns;1850 if ( signHidden && beValid )1851 {1852 m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 );1853 coeffSigns <<= 32 - (numNonZero-1);1854 }1855 else1856 {1857 m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );1858 coeffSigns <<= 32 - numNonZero;1859 }1860 #else1861 UInt coeffSigns;1862 m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );1863 coeffSigns <<= 32 - numNonZero;1864 #endif1865 1866 #if RESTRICT_GR1GR2FLAG_NUMBER1867 Int iFirstCoeff2 = 1;1868 if (c1 == 0 || numNonZero > C1FLAG_NUMBER)1869 #else1870 if (c1 == 0)1871 #endif1872 {1873 for( Int idx = 0; idx < numNonZero; idx++ )1874 {1875 #if RESTRICT_GR1GR2FLAG_NUMBER1876 1635 UInt baseLevel = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2) : 1; 1877 1636 … … 1888 1647 uiNumOne++; 1889 1648 } 1890 #else1891 if( absCoeff[ idx ] == 3 )1892 {1893 UInt uiLevel;1894 xReadGoRiceExGolomb( uiLevel, uiGoRiceParam );1895 absCoeff[ idx ] = uiLevel + 3;1896 }1897 #endif1898 1649 } 1899 1650 } … … 1902 1653 { 1903 1654 Int blkPos = pos[ idx ]; 1904 #if MULTIBITS_DATA_HIDING1905 1655 // Signs applied later. 1906 1656 pcCoef[ blkPos ] = absCoeff[ idx ]; … … 1919 1669 coeffSigns <<= 1; 1920 1670 } 1921 #else1922 Int sign = static_cast<Int>( coeffSigns ) >> 31;1923 pcCoef[ blkPos ] = ( absCoeff[ idx ] ^ sign ) - sign;1924 coeffSigns <<= 1;1925 #endif1926 1671 } 1927 1672 } … … 1936 1681 1937 1682 1938 #if SAO_UNIT_INTERLEAVING1939 1683 Void TDecSbac::parseSaoUvlc (UInt& ruiVal) 1940 1684 { … … 2173 1917 } 2174 1918 } 2175 #endif2176 1919 2177 1920 /** … … 2204 1947 } 2205 1948 2206 #if OL_FLUSH2207 1949 Void TDecSbac::decodeFlush ( ) 2208 1950 { … … 2212 1954 2213 1955 } 2214 #endif2215 1956 2216 1957 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX || (LGE_EDGE_INTRA_A0070 && LGE_EDGE_INTRA_DELTA_DC) … … 2412 2153 #endif 2413 2154 #if HHI_DMM_PRED_TEX 2155 #if LGE_DMM3_SIMP_C0044 2156 Void TDecSbac::xParseWedgePredTexInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2157 { 2158 Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx); 2159 Int iBits = g_aucWedgeTexPredBitsListIdx[iIntraIdx]; 2160 2161 UInt uiSymbol, uiTabIdx = 0; 2162 for ( Int i = 0; i < iBits; i++ ) 2163 { 2164 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 3) ); 2165 uiTabIdx += ( uiSymbol && i == 0 ) ? 1 : 0; 2166 uiTabIdx += ( uiSymbol && i == 1 ) ? 2 : 0; 2167 uiTabIdx += ( uiSymbol && i == 2 ) ? 4 : 0; 2168 uiTabIdx += ( uiSymbol && i == 3 ) ? 8 : 0; 2169 uiTabIdx += ( uiSymbol && i == 4 ) ? 16 : 0; 2170 uiTabIdx += ( uiSymbol && i == 5 ) ? 32 : 0; 2171 uiTabIdx += ( uiSymbol && i == 6 ) ? 64 : 0; 2172 uiTabIdx += ( uiSymbol && i == 7 ) ? 128 : 0; 2173 uiTabIdx += ( uiSymbol && i == 8 ) ? 256 : 0; 2174 uiTabIdx += ( uiSymbol && i == 9 ) ? 512 : 0; 2175 uiTabIdx += ( uiSymbol && i == 10 ) ? 1024 : 0; 2176 } 2177 2178 pcCU->setWedgePredTexIntraTabIdxSubParts( uiTabIdx, uiAbsPartIdx, uiDepth ); 2179 } 2180 #endif 2181 2414 2182 Void TDecSbac::xParseWedgePredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2415 2183 { 2184 #if LGE_DMM3_SIMP_C0044 2185 xParseWedgePredTexInfo( pcCU, uiAbsPartIdx, uiDepth ); 2186 #endif 2416 2187 UInt uiDC1, uiDC2; 2417 2188 xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); -
trunk/source/Lib/TLibDecoder/TDecSbac.h
r210 r296 74 74 Void xCopyFrom ( TDecSbac* pSrc ); 75 75 Void xCopyContextsFrom ( TDecSbac* pSrc ); 76 #if OL_FLUSH77 76 Void decodeFlush(); 78 #endif79 77 80 78 #if CABAC_INIT_FLAG … … 90 88 Void parseVPS ( TComVPS* pcVPS ) {} 91 89 #endif 92 #if HHI_MPI 90 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 93 91 Void parseSPS ( TComSPS* pcSPS, Bool bIsDepth ) {} 94 92 #else 95 93 Void parseSPS ( TComSPS* pcSPS ) {} 96 94 #endif 97 #if TILES_OR_ENTROPY_SYNC_IDC98 95 Void parsePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet ) {} 99 #else100 Void parsePPS ( TComPPS* pcPPS ) {}101 #endif102 96 Void parseAPS ( TComAPS* pAPS ) {} 103 97 void parseSEI(SEImessages&) {} 104 98 105 #if LCU_SYNTAX_ALF 99 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 100 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) {} 101 #else 106 102 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) {} 107 #else108 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl ) {}109 103 #endif 110 104 111 105 Void parseTerminatingBit ( UInt& ruiBit ); 112 #if H HI_INTER_VIEW_MOTION_PRED106 #if H3D_IVMP 113 107 Void parseMVPIdx ( Int& riMVPIdx, Int iNumAMVPCands ); 114 108 #else … … 116 110 #endif 117 111 118 #if SAO_UNIT_INTERLEAVING119 112 Void parseSaoUvlc ( UInt& ruiVal ); 120 113 Void parseSaoSvlc ( Int& riVal ); … … 125 118 Void parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag); 126 119 Void parseSaoOffset (SaoLcuParam* psSaoLcuParam); 127 #endif128 120 129 121 #if RWTH_SDC_DLT_B0036 … … 148 140 #endif 149 141 #if HHI_DMM_PRED_TEX 142 #if LGE_DMM3_SIMP_C0044 143 Void xParseWedgePredTexInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 144 #endif 150 145 Void xParseWedgePredTexDeltaInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 151 146 Void xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 178 173 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 179 174 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); 180 #if H HI_INTER_VIEW_RESIDUAL_PRED175 #if H3D_IVRP 181 176 Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); 182 177 #endif … … 221 216 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 222 217 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; 223 #if H HI_INTER_VIEW_RESIDUAL_PRED218 #if H3D_IVRP 224 219 ContextModel3DBuffer m_cResPredFlagSCModel; 225 220 #endif … … 249 244 ContextModel3DBuffer m_cALFUvlcSCModel; 250 245 ContextModel3DBuffer m_cALFSvlcSCModel; 251 #if AMP_CTX252 246 ContextModel3DBuffer m_cCUAMPSCModel; 253 #else254 ContextModel3DBuffer m_cCUXPosiSCModel;255 ContextModel3DBuffer m_cCUYPosiSCModel;256 #endif257 247 ContextModel3DBuffer m_cSaoFlagSCModel; 258 248 ContextModel3DBuffer m_cSaoUvlcSCModel; 259 249 ContextModel3DBuffer m_cSaoSvlcSCModel; 260 #if SAO_UNIT_INTERLEAVING261 250 ContextModel3DBuffer m_cSaoMergeLeftSCModel; 262 251 ContextModel3DBuffer m_cSaoMergeUpSCModel; 263 252 ContextModel3DBuffer m_cSaoTypeIdxSCModel; 264 #endif265 253 266 254 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX -
trunk/source/Lib/TLibDecoder/TDecSlice.cpp
r210 r296 148 148 UInt uiCol=0, uiLin=0, uiSubStrm=0; 149 149 150 #if !REMOVE_TILE_DEPENDENCE151 Int iBreakDep;152 #endif153 150 UInt uiTileCol; 154 151 UInt uiTileStartLCU; … … 163 160 pcCU = rpcPic->getCU( iCUAddr ); 164 161 pcCU->initCU( rpcPic, iCUAddr ); 165 #if !REMOVE_TILE_DEPENDENCE166 iBreakDep = rpcPic->getPicSym()->getTileBoundaryIndependenceIdr();167 #endif168 162 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(iCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // what column of tiles are we in? 169 163 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr(); … … 175 169 uiLin = iCUAddr / uiWidthInLCUs; 176 170 // inherit from TR if necessary, select substream to use. 177 #if WPP_SIMPLIFICATION178 171 if( iSymbolMode && pcSlice->getPPS()->getNumSubstreams() > 1 ) 179 #else 180 if( iSymbolMode && pcSlice->getPPS()->getEntropyCodingSynchro() ) 181 #endif 182 { 183 #if !REMOVE_TILE_DEPENDENCE 184 #if WPP_SIMPLIFICATION 185 if (iBreakDep && pcSlice->getPPS()->getNumSubstreams() > 1) 186 #else 187 if (iBreakDep && pcSlice->getPPS()->getEntropyCodingSynchro()) 188 #endif 189 #else 190 #if WPP_SIMPLIFICATION 172 { 191 173 if (pcSlice->getPPS()->getNumSubstreams() > 1) 192 #else193 if (pcSlice->getPPS()->getEntropyCodingSynchro())194 #endif195 #endif196 174 { 197 175 // independent tiles => substreams are "per tile". iNumSubstreams has already been multiplied. … … 207 185 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] ); 208 186 // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line. 209 #if WPP_SIMPLIFICATION210 187 if (pcSlice->getPPS()->getNumSubstreams() > 1 && uiCol == uiTileLCUX) 211 #else212 if (pcSlice->getPPS()->getEntropyCodingSynchro() && uiCol == uiTileLCUX)213 #endif214 188 { 215 189 // We'll sync if the TR is available. … … 217 191 UInt uiWidthInCU = rpcPic->getFrameWidthInCU(); 218 192 TComDataCU *pcCUTR = NULL; 219 #if WPP_SIMPLIFICATION220 193 if ( pcCUUp && ((iCUAddr%uiWidthInCU+1) < uiWidthInCU) ) 221 194 { 222 195 pcCUTR = rpcPic->getCU( iCUAddr - uiWidthInCU + 1 ); 223 196 } 224 #else225 if ( pcCUUp && ((iCUAddr%uiWidthInCU+pcSlice->getPPS()->getEntropyCodingSynchro()) < uiWidthInCU) )226 {227 pcCUTR = rpcPic->getCU( iCUAddr - uiWidthInCU + pcSlice->getPPS()->getEntropyCodingSynchro() );228 }229 #endif230 197 UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1); 231 198 … … 233 200 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 234 201 ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr()) || 235 #if !REMOVE_TILE_DEPENDENCE236 (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))237 #else238 202 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr))) 239 #endif240 203 ))|| 241 204 (true/*bEnforceEntropySliceRestriction*/ && 242 205 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 243 206 ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr()) || 244 #if !REMOVE_TILE_DEPENDENCE245 (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))246 #else247 207 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr))) 248 #endif249 208 )) 250 209 ) … … 260 219 pcSbacDecoder->load(&pcSbacDecoders[uiSubStrm]); //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders) 261 220 } 262 #if WPP_SIMPLIFICATION263 221 else if ( iSymbolMode && pcSlice->getPPS()->getNumSubstreams() <= 1 ) 264 #else265 else if ( iSymbolMode && !pcSlice->getPPS()->getEntropyCodingSynchro() )266 #endif267 222 { 268 223 // Set variables to appropriate values to avoid later code change. … … 273 228 (iCUAddr!=0) && (iCUAddr!=rpcPic->getPicSym()->getPicSCUAddr(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceCurStartCUAddr())/rpcPic->getNumPartInCU())) // !1st in frame && !1st in slice 274 229 { 275 #if WPP_SIMPLIFICATION276 230 if (pcSlice->getPPS()->getNumSubstreams() > 1) 277 #else278 if (pcSlice->getPPS()->getEntropyCodingSynchro())279 #endif280 231 { 281 232 // We're crossing into another tile, tiles are independent. … … 330 281 } 331 282 332 #if !REMOVE_TILE_DEPENDENCE333 if ( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )334 {335 // Synchronize cabac probabilities with LCU among Tiles336 if( (uiTileLCUX != 0) &&337 (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) )338 {339 TComDataCU *pcCULeft = pcCU->getCULeft();340 UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);341 342 if ( (true/*bEnforceSliceRestriction*/ &&343 ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||344 ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr())345 )346 )||347 (true/*bEnforceEntropySliceRestriction*/ &&348 ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||349 ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr())350 )351 )352 )353 {354 // Left not available.355 }356 else357 {358 // Left is available, we use it.359 pcSbacDecoders[uiSubStrm].loadContexts( &m_pcBufferLowLatSbacDecoders[uiTileCol-1] );360 pcSbacDecoder->loadContexts(&pcSbacDecoders[uiSubStrm]); //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders)361 }362 }363 }364 #endif365 283 366 284 … … 368 286 g_bJustDoIt = g_bEncDecTraceEnable; 369 287 #endif 370 #if SAO_UNIT_INTERLEAVING371 288 if ( pcSlice->getSPS()->getUseSAO() && pcSlice->getSaoInterleavingFlag() && pcSlice->getSaoEnabledFlag() ) 372 289 { … … 384 301 pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, pcSlice->getAPS()->getSaoParam(),pcCU, cuAddrInSlice, cuAddrUpInSlice, pcSlice->getSPS()->getLFCrossSliceBoundaryFlag() ); 385 302 } 386 #endif387 303 388 304 m_pcCuDecoder->decodeCU ( pcCU, uiIsLast ); … … 394 310 if( iSymbolMode ) 395 311 { 396 #if OL_FLUSH397 312 /*If at the end of a LCU line but not at the end of a substream, perform CABAC flush*/ 398 #if WPP_SIMPLIFICATION399 313 if (!uiIsLast && pcSlice->getPPS()->getNumSubstreams() > 1) 400 #else 401 if (!uiIsLast && pcSlice->getPPS()->getCabacIstateReset()) 402 #endif 403 { 404 #if !REMOVE_TILE_DEPENDENCE 405 if ((iBreakDep && (uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight)) 406 || (!iBreakDep && (uiCol == uiWidthInLCUs-1) && (uiLin+iNumSubstreams < pcCU->getPic()->getFrameHeightInCU()))) 407 #else 314 { 408 315 if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight)) 409 #endif410 316 { 411 317 m_pcEntropyDecoder->decodeFlush(); 412 318 } 413 319 } 414 #endif415 320 pcSbacDecoders[uiSubStrm].load(pcSbacDecoder); 416 321 417 322 //Store probabilities of second LCU in line into buffer 418 #if WPP_SIMPLIFICATION419 323 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiCol == uiTileLCUX+1)) 420 #else421 if (pcSlice->getPPS()->getEntropyCodingSynchro() && (uiCol == uiTileLCUX+pcSlice->getPPS()->getEntropyCodingSynchro()))422 #endif423 324 { 424 325 m_pcBufferSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] ); … … 426 327 427 328 } 428 #if !REMOVE_TILE_DEPENDENCE429 if ( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )430 {431 pcSbacDecoders[uiSubStrm].load(pcSbacDecoder);432 //Store probabilties for next tile433 if( (uiLin == (rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr() / uiWidthInLCUs )) &&434 (uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU()) )435 {436 m_pcBufferLowLatSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] );437 }438 }439 #endif440 329 } 441 330 -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r210 r296 59 59 m_aaiCodedScale [ uiId ] = new Int [ MAX_VIEW_NUM ]; 60 60 } 61 62 #if MERL_VSP_C0152 63 xCreateLUTs( (UInt)MAX_VIEW_NUM, (UInt)MAX_VIEW_NUM, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 64 m_iLog2Precision = LOG2_DISP_PREC_LUT; 65 m_uiBitDepthForLUT = 8; // fixed 66 #endif 61 67 } 62 68 … … 72 78 delete [] m_aiViewOrderIndex; 73 79 delete [] m_aiViewReceived; 80 81 #if MERL_VSP_C0152 82 xDeleteArray( m_adBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 ); 83 xDeleteArray( m_aiBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 ); 84 #endif 74 85 } 75 86 … … 85 96 m_uiMaxViewId = 0; 86 97 } 98 99 #if MERL_VSP_C0152 100 Void 101 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT) 102 { 103 //AOF( m_uiBitDepthForLUT == 8 ); 104 //AOF(radLUT == NULL && raiLUT == NULL ); 105 106 uiNumberSourceViews = Max( 1, uiNumberSourceViews ); 107 uiNumberTargetViews = Max( 1, uiNumberTargetViews ); 108 109 radLUT = new Double***[ uiNumberSourceViews ]; 110 raiLUT = new Int ***[ uiNumberSourceViews ]; 111 112 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) 113 { 114 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ]; 115 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ]; 116 117 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) 118 { 119 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ]; 120 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ]; 121 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ]; 122 123 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ]; 124 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ]; 125 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ]; 126 } 127 } 128 } 129 130 Void 131 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT) 132 { 133 Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 ); 134 Int iLog2DivChroma = iLog2DivLuma + 1; 135 136 iOffset <<= m_uiBitDepthForLUT; 137 138 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma )); 139 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma )); 140 141 // offsets including rounding offsets 142 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 ); 143 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); 144 145 146 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) 147 { 148 149 // real-valued look-up tables 150 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); 151 Double dShiftChroma = dShiftLuma / 2; 152 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; 153 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma; 154 155 // integer-valued look-up tables 156 Int64 iTempScale = (Int64)uiDepthValue * iScale; 157 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma; 158 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma; 159 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; 160 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; 161 162 // maximum deviation 163 //dMaxDispDev = Max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) ); 164 //dMaxRndDispDvL = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) ); 165 //dMaxRndDispDvC = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) ); 166 } 167 168 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 169 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 170 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 171 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 172 } 173 #endif // end MERL_VSP_C0152 87 174 88 175 Void … … 167 254 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId ]; 168 255 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId ]; 256 #if MERL_VSP_C0152 257 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 258 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 259 #endif 169 260 } 170 261 else … … 174 265 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ]; 175 266 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ]; 267 #if MERL_VSP_C0152 268 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 269 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 270 #endif 176 271 } 177 272 } … … 188 283 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId ]; 189 284 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId ]; 285 #if MERL_VSP_C0152 286 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 287 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 288 #endif 190 289 } 191 290 } … … 254 353 m_iMaxRefPicNum = 0; 255 354 m_uiValidPS = 0; 256 #if SONY_COLPIC_AVAILABILITY257 m_iViewOrderIdx = 0;258 #endif259 355 #if ENC_DEC_TRACE 260 g_hTrace = fopen( "TraceDec.txt", "wb" );356 if(!g_hTrace) g_hTrace = fopen( "TraceDec.txt", "wb" ); 261 357 g_bJustDoIt = g_bEncDecTraceDisable; 262 358 g_nSymbolCounter = 0; … … 277 373 { 278 374 #if ENC_DEC_TRACE 279 fclose( g_hTrace ); 375 if(g_hTrace) fclose( g_hTrace ); 376 g_hTrace=NULL; 280 377 #endif 281 378 } … … 301 398 m_cDepthMapGenerator.destroy(); 302 399 #endif 303 #if H HI_INTER_VIEW_RESIDUAL_PRED400 #if H3D_IVRP 304 401 m_cResidualGenerator.destroy(); 305 402 #endif 403 306 404 } 307 405 … … 317 415 , &m_cDepthMapGenerator 318 416 #endif 319 #if H HI_INTER_VIEW_RESIDUAL_PRED417 #if H3D_IVRP 320 418 , &m_cResidualGenerator 321 419 #endif … … 331 429 #endif 332 430 #endif 333 #if H HI_INTER_VIEW_RESIDUAL_PRED431 #if H3D_IVRP 334 432 m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator ); 335 433 #endif … … 367 465 } 368 466 369 #if H HI_INTER_VIEW_RESIDUAL_PRED467 #if H3D_IVRP 370 468 Void 371 469 TDecTop::deleteExtraPicBuffers( Int iPoc ) … … 427 525 xUpdateGopSize(pcSlice); 428 526 429 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER430 527 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 431 #else432 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxNumberOfReferencePictures()+pcSlice->getSPS()->getNumReorderFrames() + 1; // +1 to have space for the picture currently being decoded433 #endif434 528 435 529 #if DEPTH_MAP_GENERATION … … 618 712 } 619 713 620 #if !LCU_SYNTAX_ALF621 // create ALF temporary buffer622 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );623 #endif624 714 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 625 715 m_cLoopFilter. create( g_uiMaxCUDepth ); 626 716 } 627 717 628 #if SKIPFRAME_BUGFIX629 718 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) 630 #else631 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay )632 #endif633 719 { 634 720 TComPic*& pcPic = m_pcPic; … … 687 773 } 688 774 689 #if SONY_COLPIC_AVAILABILITY690 m_apcSlicePilot->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx());691 #endif692 693 #if NAL_REF_FLAG694 775 m_apcSlicePilot->setReferenced(nalu.m_nalRefFlag); 776 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 777 778 // ALF CU parameters should be part of the slice header -> needs to be fixed 779 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 780 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet(),m_apcSlicePilot->getVPS()->getDepthFlag(nalu.m_layerId)); 695 781 #else 696 m_apcSlicePilot->setReferenced(nalu.m_nalRefIDC != NAL_REF_IDC_PRIORITY_LOWEST);697 #endif698 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);699 700 // ALF CU parameters should be part of the slice header -> needs to be fixed701 #if LCU_SYNTAX_ALF702 782 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet()); 703 #else704 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam() );705 783 #endif 706 784 // byte align … … 718 796 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence) 719 797 { 720 #if START_DECODING_AT_CRA721 798 if (m_prevPOC >= m_pocRandomAccess) 722 799 { … … 725 802 } 726 803 m_prevPOC = m_apcSlicePilot->getPOC(); 727 #else728 m_prevPOC = m_apcSlicePilot->getPOC();729 return true;730 #endif731 804 } 732 805 // actual decoding starts here … … 748 821 } 749 822 //detect lost reference picture and insert copy of earlier frame. 750 #if START_DECODING_AT_CRA751 823 while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess) > 0) 752 #else753 while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true) > 0)754 #endif755 824 { 756 825 xCreateLostPicture(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), false)-1); … … 764 833 xGetNewPicBuffer (m_apcSlicePilot, pcPic); 765 834 766 #if SONY_COLPIC_AVAILABILITY 767 pcPic->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx() ); 768 #endif 769 835 #if INTER_VIEW_VECTOR_SCALING_C0115 836 pcPic->setViewOrderIdx( m_apcSlicePilot->getVPS()->getViewOrderIdx(nalu.m_layerId) ); // will be changed to view_id 837 #endif 770 838 /* transfer any SEI messages that have been received to the picture */ 771 839 pcPic->setSEIs(m_SEIs); … … 787 855 } 788 856 #endif 789 #if H HI_INTER_VIEW_RESIDUAL_PRED857 #if H3D_IVRP 790 858 m_cResidualGenerator.create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement ); 791 859 #endif … … 800 868 UInt i, j, p; 801 869 802 #if !REMOVE_TILE_DEPENDENCE803 //set the TileBoundaryIndependenceIdr804 if(pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)805 {806 pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getTileBoundaryIndependenceIdr() );807 }808 else809 {810 pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getSPS()->getTileBoundaryIndependenceIdr() );811 }812 #endif813 870 814 871 if( pcSlice->getPPS()->getColumnRowInfoPresent() == 1 ) … … 992 1049 #endif 993 1050 994 #if SONY_COLPIC_AVAILABILITY1051 #if INTER_VIEW_VECTOR_SCALING_C0115 995 1052 #if VIDYO_VPS_INTEGRATION 996 pcSlice->setViewOrderIdx( pcSlice->getVPS()->getViewOrderIdx(nalu.m_layerId) ); 1053 pcSlice->setViewOrderIdx( pcSlice->getVPS()->getViewOrderIdx(nalu.m_layerId) ); // will be changed to view_id 997 1054 #else 998 1055 pcSlice->setViewOrderIdx( pcPic->getViewOrderIdx() ); 999 1056 #endif 1057 #endif 1058 1059 #if INTER_VIEW_VECTOR_SCALING_C0115 1060 pcSlice->setIVScalingFlag( pcSlice->getVPS()->getIVScalingFlag()); 1000 1061 #endif 1001 1062 … … 1111 1172 #endif 1112 1173 1174 #if MERL_VSP_C0152 // set BW LUT 1175 if( m_pcCamParsCollector ) // Initialize the LUT elements 1176 { 1177 m_pcCamParsCollector->setSlice( pcSlice ); 1178 } 1179 if( pcSlice->getViewId() !=0 ) 1180 { 1181 TComPic* pcBaseTxtPic = m_tAppDecTop->getPicFromView( 0, pcSlice->getPOC(), false ); // get base view reconstructed texture 1182 TComPic* pcBaseDepthPic = m_tAppDecTop->getPicFromView( 0, pcSlice->getPOC(), true ); // get base view reconstructed depth 1183 pcSlice->setRefPicBaseTxt(pcBaseTxtPic); 1184 pcSlice->setRefPicBaseDepth(pcBaseDepthPic); 1185 } 1186 getTAppDecTop()->setBWVSPLUT( pcSlice, pcSlice->getViewId(), pcSlice->getPOC() ); // get the LUT for backward warping 1187 #endif 1188 1113 1189 // Decode a picture 1114 1190 m_cGopDecoder.decompressGop(nalu.m_Bitstream, pcPic, false); … … 1149 1225 { 1150 1226 TComSPS* sps = new TComSPS(); 1151 #if RPS_IN_SPS1152 1227 TComRPSList* rps = new TComRPSList(); 1153 1228 sps->setRPSList(rps); 1154 #endif 1155 #if HHI_MPI 1229 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 1156 1230 m_cEntropyDecoder.decodeSPS( sps, m_isDepth ); 1157 1231 #else … … 1159 1233 #endif 1160 1234 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1161 #if LCU_SYNTAX_ALF1162 1235 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 1163 #endif1164 1236 } 1165 1237 1166 1238 Void TDecTop::xDecodePPS() 1167 1239 { 1168 #if !RPS_IN_SPS1169 TComRPSList* rps = new TComRPSList();1170 #endif1171 1240 TComPPS* pps = new TComPPS(); 1172 #if !RPS_IN_SPS1173 pps->setRPSList(rps);1174 #endif1175 #if TILES_OR_ENTROPY_SYNC_IDC1176 1241 m_cEntropyDecoder.decodePPS( pps, &m_parameterSetManagerDecoder ); 1177 #else1178 m_cEntropyDecoder.decodePPS( pps );1179 #endif1180 1242 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 1181 1243 … … 1230 1292 case NAL_UNIT_CODED_SLICE: 1231 1293 case NAL_UNIT_CODED_SLICE_IDR: 1232 #if H0566_TLA1233 1294 #if !QC_REM_IDV_B0046 1234 1295 case NAL_UNIT_CODED_SLICE_IDV: … … 1236 1297 case NAL_UNIT_CODED_SLICE_CRA: 1237 1298 case NAL_UNIT_CODED_SLICE_TLA: 1238 #else1239 case NAL_UNIT_CODED_SLICE_CDR:1240 #endif1241 1299 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); 1242 1300 break; … … 1259 1317 sps = pSPSV0; 1260 1318 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1261 #if LCU_SYNTAX_ALF1262 1319 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 1263 #endif1264 1320 } 1265 1321 … … 1296 1352 else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. 1297 1353 { 1298 #if H0566_TLA1299 1354 if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) 1300 #else1301 if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR )1302 #endif1303 1355 { 1304 1356 m_pocRandomAccess = m_apcSlicePilot->getPOC(); // set the POC random access since we need to skip the reordered pictures in CRA. … … 1310 1362 else 1311 1363 { 1312 #if START_DECODING_AT_CRA1313 1364 static bool warningMessage = false; 1314 1365 if(!warningMessage) … … 1318 1369 } 1319 1370 return true; 1320 #else1321 printf("\nUnsafe random access point. Decoder may crash.");1322 m_pocRandomAccess = 0;1323 #endif1324 1371 } 1325 1372 } … … 1342 1389 m_cSAO.allocSaoParam(pAPS->getSaoParam()); 1343 1390 pAPS->createAlfParam(); 1344 #if !LCU_SYNTAX_ALF1345 m_cAdaptiveLoopFilter.allocALFParam(pAPS->getAlfParam());1346 #endif1347 1391 } 1348 1392 -
trunk/source/Lib/TLibDecoder/TDecTop.h
r210 r296 77 77 Bool isInitialized() const { return m_bInitialized; } 78 78 79 #if MERL_VSP_C0152 80 Int**** getBaseViewShiftLUTI() { return m_aiBaseViewShiftLUT; } 81 #endif 79 82 private: 80 83 Bool xIsComplete (); … … 97 100 Int m_iLastPOC; 98 101 UInt m_uiMaxViewId; 102 103 #if MERL_VSP_C0152 104 UInt m_uiBitDepthForLUT; 105 UInt m_iLog2Precision; 106 UInt m_uiInputBitDepth; 107 // look-up tables 108 Double**** m_adBaseViewShiftLUT; ///< Disparity LUT 109 Int**** m_aiBaseViewShiftLUT; ///< Disparity LUT 110 Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT); 111 Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT); 112 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 ); 113 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2 ); 114 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize ); 115 #endif 116 99 117 }; 118 119 #if MERL_VSP_C0152 120 template <class T> 121 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 ) 122 { 123 if( rpt ) 124 { 125 for( UInt uiK = 0; uiK < uiSize1; uiK++ ) 126 { 127 for( UInt uiL = 0; uiL < uiSize2; uiL++ ) 128 { 129 for( UInt uiM = 0; uiM < uiSize3; uiM++ ) 130 { 131 delete[] rpt[ uiK ][ uiL ][ uiM ]; 132 } 133 delete[] rpt[ uiK ][ uiL ]; 134 } 135 delete[] rpt[ uiK ]; 136 } 137 delete[] rpt; 138 } 139 rpt = NULL; 140 }; 141 142 143 template <class T> 144 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 ) 145 { 146 if( rpt ) 147 { 148 for( UInt uiK = 0; uiK < uiSize1; uiK++ ) 149 { 150 for( UInt uiL = 0; uiL < uiSize2; uiL++ ) 151 { 152 delete[] rpt[ uiK ][ uiL ]; 153 } 154 delete[] rpt[ uiK ]; 155 } 156 delete[] rpt; 157 } 158 rpt = NULL; 159 }; 160 161 162 template <class T> 163 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize ) 164 { 165 if( rpt ) 166 { 167 for( UInt uiK = 0; uiK < uiSize; uiK++ ) 168 { 169 delete[] rpt[ uiK ]; 170 } 171 delete[] rpt; 172 } 173 rpt = NULL; 174 }; 175 176 #endif 100 177 101 178 /// decoder class … … 118 195 119 196 SEImessages *m_SEIs; ///< "all" SEI messages. If not NULL, we own the object. 120 121 #if SONY_COLPIC_AVAILABILITY122 Int m_iViewOrderIdx;123 #endif124 197 125 198 // functional classes … … 140 213 TComDepthMapGenerator m_cDepthMapGenerator; 141 214 #endif 142 #if H HI_INTER_VIEW_RESIDUAL_PRED215 #if H3D_IVRP 143 216 TComResidualGenerator m_cResidualGenerator; 144 217 #endif … … 176 249 Void xCopyVPS( TComVPS* pVPSV0); 177 250 #endif 178 #if H HI_INTER_VIEW_RESIDUAL_PRED251 #if H3D_IVRP 179 252 Void deleteExtraPicBuffers ( Int iPoc ); 180 253 #endif … … 186 259 Int getViewId() { return m_viewId ;} 187 260 Void setIsDepth( Bool isDepth ) { m_isDepth = isDepth; } 188 189 #if SONY_COLPIC_AVAILABILITY190 Void setViewOrderIdx(Int i) { m_iViewOrderIdx = i ;}191 Int getViewOrderIdx() { return m_iViewOrderIdx ; }192 #endif193 261 194 262 #if DEPTH_MAP_GENERATION … … 206 274 ParameterSetManagerDecoder* xGetParaSetDec () {return &m_parameterSetManagerDecoder;} 207 275 #endif 276 208 277 protected: 209 278 Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); … … 213 282 Void decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); }; 214 283 Void xActivateParameterSets(); 215 #if SKIPFRAME_BUGFIX216 284 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); 217 #else218 Bool xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay);219 #endif220 285 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 221 286 Void xDecodeVPS(); -
trunk/source/Lib/TLibEncoder/NALwrite.cpp
r210 r296 56 56 57 57 bsNALUHeader.write(0,1); // forbidden_zero_flag 58 #if NAL_REF_FLAG59 58 bsNALUHeader.write(nalu.m_nalRefFlag? 1 : 0, 1); // nal_ref_flag 60 59 bsNALUHeader.write(nalu.m_nalUnitType, 6); // nal_unit_type 61 #else62 bsNALUHeader.write(nalu.m_nalRefIDC, 2); // nal_ref_idc63 bsNALUHeader.write(nalu.m_nalUnitType, 5); // nal_unit_type64 #endif65 60 66 61 #if QC_MVHEVC_B0046 … … 72 67 bsNALUHeader.write(nalu.m_layerId + 1, 5); // layer_id_plus1 73 68 #else 74 #if H038875 69 bsNALUHeader.write(nalu.m_temporalId, 3); // temporal_id 76 70 // bsNALUHeader.write(1, 5); // reserved_one_5bits 77 71 bsNALUHeader.write(nalu.m_viewId+1,4); 78 72 bsNALUHeader.write(nalu.m_isDepth,1); 79 #else80 switch (nalu.m_nalUnitType)81 {82 case NAL_UNIT_CODED_SLICE:83 case NAL_UNIT_CODED_SLICE_IDR:84 #if H0566_TLA85 #if !QC_REM_IDV_B004686 case NAL_UNIT_CODED_SLICE_IDV:87 #endif88 case NAL_UNIT_CODED_SLICE_CRA:89 case NAL_UNIT_CODED_SLICE_TLA:90 #else91 case NAL_UNIT_CODED_SLICE_CDR:92 #endif93 bsNALUHeader.write(nalu.m_temporalId, 3); // temporal_id94 bsNALUHeader.write(nalu.m_OutputFlag, 1); // output_flag95 // bsNALUHeader.write(1, 4); // reserved_one_4bits96 bsNALUHeader.write(nalu.m_viewId+1,3);97 bsNALUHeader.write(nalu.m_isDepth,1);98 break;99 default: break;100 }101 #endif102 73 #endif 103 74 #endif … … 209 180 { 210 181 naluDest.m_nalUnitType = naluSrc.m_nalUnitType; 211 #if NAL_REF_FLAG212 182 naluDest.m_nalRefFlag = naluSrc.m_nalRefFlag; 213 #else214 naluDest.m_nalRefIDC = naluSrc.m_nalRefIDC;215 #endif216 183 #if !VIDYO_VPS_INTEGRATION 217 184 naluDest.m_viewId = naluSrc.m_viewId; … … 223 190 #else 224 191 225 #if !H0388226 naluDest.m_OutputFlag = naluSrc.m_OutputFlag;227 #endif228 192 #endif 229 193 naluDest.m_Bitstream = naluSrc.m_Bitstream; -
trunk/source/Lib/TLibEncoder/NALwrite.h
r210 r296 54 54 * written to the bitstream. 55 55 */ 56 #if H038857 56 OutputNALUnit( 58 57 NalUnitType nalUnitType, 59 #if NAL_REF_FLAG60 58 Bool nalRefFlag, 61 #else62 NalRefIdc nalRefIDC,63 #endif64 59 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 65 60 unsigned layerId, … … 69 64 #endif 70 65 unsigned temporalID = 0) 71 #if NAL_REF_FLAG72 66 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 73 67 : NALUnit(nalUnitType, nalRefFlag, layerId, temporalID) … … 75 69 : NALUnit(nalUnitType, nalRefFlag, viewId, isDepth, temporalID) 76 70 #endif 77 #else78 #if VIDYO_VPS_INTEGRATION79 : NALUnit(nalUnitType, nalRefIDC, layerId, temporalID)80 #else81 : NALUnit(nalUnitType, nalRefIDC, viewId, isDepth, temporalID)82 #endif83 #endif84 71 , m_Bitstream() 85 72 {} 86 #else87 OutputNALUnit(88 NalUnitType nalUnitType,89 NalRefIdc nalRefIDC,90 Int viewId,91 Bool isDepth,92 unsigned temporalID = 0,93 bool outputFlag = true)94 : NALUnit(nalUnitType, nalRefIDC, viewId, isDepth, temporalID, outputFlag)95 , m_Bitstream()96 {}97 #endif98 73 99 74 OutputNALUnit(const NALUnit& src) -
trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.cpp
r56 r296 47 47 // Constants 48 48 // ==================================================================================================================== 49 #if LCU_SYNTAX_ALF50 49 #define ALF_NUM_OF_REDESIGN 1 51 #else52 #define ALF_NUM_OF_REDESIGN 353 #endif54 50 // ==================================================================================================================== 55 51 // Tables 56 52 // ==================================================================================================================== 57 #if LCU_SYNTAX_ALF58 53 const Int TEncAdaptiveLoopFilter::m_alfNumPartsInRowTab[5] = 59 54 { … … 82 77 341, //level 4 83 78 }; 84 #endif85 79 // ==================================================================================================================== 86 80 // Constructor / destructor 87 81 // ==================================================================================================================== 88 82 89 #if LCU_SYNTAX_ALF90 83 ///AlfCorrData 91 84 AlfCorrData::AlfCorrData() … … 376 369 return *this; 377 370 } 378 #endif379 371 380 372 381 373 TEncAdaptiveLoopFilter::TEncAdaptiveLoopFilter() 382 374 { 383 #if !LCU_SYNTAX_ALF384 m_ppdAlfCorr = NULL;385 m_ppdAlfCorrCb = NULL;386 m_ppdAlfCorrCr = NULL;387 m_pdDoubleAlfCoeff = NULL;388 #endif389 375 m_pcEntropyCoder = NULL; 390 #if !LCU_SYNTAX_ALF391 m_pcBestAlfParam = NULL;392 m_pcTempAlfParam = NULL;393 #endif394 376 m_pcPicYuvBest = NULL; 395 377 m_pcPicYuvTmp = NULL; 396 #if !LCU_SYNTAX_ALF397 pcAlfParamShape0 = NULL;398 pcAlfParamShape1 = NULL;399 pcPicYuvRecShape0 = NULL;400 pcPicYuvRecShape1 = NULL;401 m_pcSliceYuvTmp = NULL;402 #endif403 378 404 379 m_iALFMaxNumberFilters = NO_FILTERS; … … 411 386 // ==================================================================================================================== 412 387 413 #if LCU_SYNTAX_ALF414 388 /** convert Level Row Col to Idx 415 389 * \param level, row, col … … 799 773 } 800 774 801 #else802 803 /** create ALF global buffers804 * \param iALFEncodePassReduction 0: 16-pass encoding, 1: 1-pass encoding, 2: 2-pass encoding805 * This function is used to create the filter buffers to perform time-delay filtering.806 */807 Void TEncAdaptiveLoopFilter::createAlfGlobalBuffers(Int iALFEncodePassReduction)808 {809 if(iALFEncodePassReduction)810 {811 Int iNumOfBuffer = m_iGOPSize +1;812 813 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)814 {815 m_mergeTableSavedMethods[i] = new Int*[iNumOfBuffer];816 m_aiFilterCoeffSavedMethods[i] = new Int**[iNumOfBuffer];817 for(Int j=0; j< iNumOfBuffer; j++)818 {819 m_mergeTableSavedMethods[i][j] = new Int[NO_VAR_BINS];820 m_aiFilterCoeffSavedMethods[i][j] = new Int*[NO_VAR_BINS];821 for(Int k=0; k< NO_VAR_BINS; k++)822 {823 m_aiFilterCoeffSavedMethods[i][j][k] = new Int[ALF_MAX_NUM_COEF];824 }825 }826 m_iPreviousFilterShapeMethods[i] = new Int[iNumOfBuffer];827 }828 829 }830 }831 /** destroy ALF global buffers832 * This function is used to destroy the filter buffers.833 */834 835 Void TEncAdaptiveLoopFilter::destroyAlfGlobalBuffers()836 {837 if(m_iALFEncodePassReduction)838 {839 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)840 {841 for(Int j=0; j< m_iGOPSize+1; j++)842 {843 for(Int k=0; k< NO_VAR_BINS; k++)844 {845 delete[] m_aiFilterCoeffSavedMethods[i][j][k];846 }847 delete[] m_aiFilterCoeffSavedMethods[i][j];848 delete[] m_mergeTableSavedMethods[i][j];849 }850 delete[] m_aiFilterCoeffSavedMethods[i];851 delete[] m_iPreviousFilterShapeMethods[i];852 delete[] m_mergeTableSavedMethods[i];853 854 }855 856 }857 858 }859 #endif860 775 /** 861 776 \param pcPic picture (TComPic) pointer … … 865 780 { 866 781 m_pcEntropyCoder = pcEntropyCoder; 867 #if !LCU_SYNTAX_ALF868 xInitParam();869 #endif870 782 xCreateTmpAlfCtrlFlags(); 871 783 … … 876 788 m_pcPicYuvTmp->createLuma(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); 877 789 m_pcPicYuvBest = pcPic->getPicYuvPred(); 878 #if !LCU_SYNTAX_ALF879 m_pcBestAlfParam = new ALFParam;880 m_pcTempAlfParam = new ALFParam;881 allocALFParam(m_pcBestAlfParam);882 allocALFParam(m_pcTempAlfParam);883 pcPicYuvRecShape0 = new TComPicYuv();884 pcPicYuvRecShape0->createLuma(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);885 886 pcPicYuvRecShape1 = new TComPicYuv();887 pcPicYuvRecShape1->createLuma(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);888 889 pcAlfParamShape0 = new ALFParam;890 pcAlfParamShape1 = new ALFParam;891 892 allocALFParam(pcAlfParamShape0);893 allocALFParam(pcAlfParamShape1);894 895 // init qc_filter896 initMatrix4D_double(&m_EGlobalSym, NUM_ALF_FILTER_SHAPE+1, NO_VAR_BINS, MAX_SQR_FILT_LENGTH, MAX_SQR_FILT_LENGTH);897 initMatrix3D_double(&m_yGlobalSym, NUM_ALF_FILTER_SHAPE+1, NO_VAR_BINS, MAX_SQR_FILT_LENGTH);898 #endif899 790 initMatrix_int(&m_filterCoeffSymQuant, NO_VAR_BINS, ALF_MAX_NUM_COEF); 900 #if !LCU_SYNTAX_ALF901 m_pixAcc = (double *) calloc(NO_VAR_BINS, sizeof(double));902 #endif903 791 initMatrix_Pel(&m_maskImg, m_img_height, m_img_width); 904 792 initMatrix_double(&m_E_temp, MAX_SQR_FILT_LENGTH, MAX_SQR_FILT_LENGTH);// … … 913 801 initMatrix_int(&m_FilterCoeffQuantTemp, NO_VAR_BINS, ALF_MAX_NUM_COEF);// 914 802 915 #if LCU_SYNTAX_ALF916 803 m_tempALFp = new ALFParam(ALF_Y); 917 #else918 m_tempALFp = new ALFParam;919 allocALFParam(m_tempALFp);920 if( m_bUseNonCrossALF )921 {922 m_pcSliceYuvTmp = new TComPicYuv();923 m_pcSliceYuvTmp->create(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);924 }925 #endif926 804 } 927 805 928 806 Void TEncAdaptiveLoopFilter::endALFEnc() 929 807 { 930 #if !LCU_SYNTAX_ALF931 xUninitParam();932 #endif933 808 xDestroyTmpAlfCtrlFlags(); 934 809 … … 938 813 m_pcPic = NULL; 939 814 m_pcEntropyCoder = NULL; 940 #if !LCU_SYNTAX_ALF941 freeALFParam(m_pcBestAlfParam);942 freeALFParam(m_pcTempAlfParam);943 delete m_pcBestAlfParam;944 delete m_pcTempAlfParam;945 946 pcPicYuvRecShape0->destroyLuma();947 delete pcPicYuvRecShape0;948 pcPicYuvRecShape0 = NULL;949 950 pcPicYuvRecShape1->destroyLuma();951 delete pcPicYuvRecShape1;952 pcPicYuvRecShape1 = NULL;953 954 freeALFParam(pcAlfParamShape0);955 freeALFParam(pcAlfParamShape1);956 957 delete pcAlfParamShape0;958 delete pcAlfParamShape1;959 960 // delete qc filters961 destroyMatrix4D_double(m_EGlobalSym, NUM_ALF_FILTER_SHAPE+1, NO_VAR_BINS);962 destroyMatrix3D_double(m_yGlobalSym, NUM_ALF_FILTER_SHAPE+1);963 #endif964 815 destroyMatrix_int(m_filterCoeffSymQuant); 965 #if !LCU_SYNTAX_ALF966 free(m_pixAcc);967 #endif968 816 destroyMatrix_Pel(m_maskImg); 969 817 destroyMatrix3D_double(m_E_merged, NO_VAR_BINS); … … 980 828 destroyMatrix_int(m_FilterCoeffQuantTemp); 981 829 982 #if LCU_SYNTAX_ALF983 830 delete m_tempALFp; 984 #else 985 freeALFParam(m_tempALFp); 986 delete m_tempALFp; 987 988 if(m_bUseNonCrossALF) 989 { 990 m_pcSliceYuvTmp->destroy(); 991 delete m_pcSliceYuvTmp; 992 m_pcSliceYuvTmp = NULL; 993 } 994 #endif 995 } 996 997 #if LCU_SYNTAX_ALF 831 } 832 998 833 999 834 /** Assign output ALF parameters … … 2762 2597 #endif 2763 2598 2764 #if ALF_SINGLE_FILTER_SHAPE2765 2599 calcCorrOneCompRegionChma(pPicOrg, pPicSrc, stride, ypos, xpos, height, width, alfCorr->ECorr[0], alfCorr->yCorr[0], isLastBlock); 2766 #endif2767 2600 } 2768 2601 } … … 2822 2655 #endif 2823 2656 2824 #if ALF_SINGLE_FILTER_SHAPE2825 2657 calcCorrOneCompRegionLuma(pPicOrg, pPicSrc, stride, ypos, xpos, height, width, alfCorr->ECorr, alfCorr->yCorr, alfCorr->pixAcc, forceCollection, isLastBlock); 2826 #endif2827 2658 } 2828 2659 } … … 2838 2669 2839 2670 2840 #if ALF_SINGLE_FILTER_SHAPE2841 2671 /** Gather correlations for one region for chroma component 2842 2672 * \param [in] imgOrg picture buffer for original picture … … 3086 2916 3087 2917 } 3088 #endif 3089 3090 #else 3091 3092 3093 #if ALF_CHROMA_LAMBDA 3094 /** 3095 \param pcAlfParam ALF parameter 3096 \param [out] pvAlfCtrlParam ALF CU control parameters container for slices 3097 \param dLambdaLuma luma lambda value for RD cost computation 3098 \param dLambdaChroma chroma lambda value for RD cost computation 3099 \retval ruiDist distortion 3100 \retval ruiBits required bits 3101 \retval ruiMaxAlfCtrlDepth optimal partition depth 3102 */ 3103 #if HHI_INTERVIEW_SKIP 3104 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip) 3105 #else 3106 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits) 3107 3108 #endif 3109 #else 3110 /** 3111 \param pcAlfParam ALF parameter 3112 \param dLambda lambda value for RD cost computation 3113 \retval ruiDist distortion 3114 \retval ruiBits required bits 3115 \retval ruiMaxAlfCtrlDepth optimal partition depth 3116 */ 3117 #if HHI_INTERVIEW_SKIP 3118 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip) 3119 #else 3120 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits) 3121 3122 #endif 3123 #endif 3124 { 3125 3126 // set lambda 3127 #if ALF_CHROMA_LAMBDA 3128 m_dLambdaLuma = dLambdaLuma; 3129 m_dLambdaChroma = dLambdaChroma; 3130 #else 3131 m_dLambdaLuma = dLambda; 3132 m_dLambdaChroma = dLambda; 3133 #endif 3134 3135 m_lcuHeight = m_pcPic->getSlice(0)->getSPS()->getMaxCUHeight(); 3136 3137 #if ALF_SINGLE_FILTER_SHAPE 3138 m_lineIdxPadBot = m_lcuHeight - 4 - 3; // DFRegion, Vertical Taps 3139 #else 3140 m_lineIdxPadBot = m_lcuHeight - 4 - 4; // DFRegion, Vertical Taps 3141 #endif 3142 m_lineIdxPadTop = m_lcuHeight - 4; // DFRegion 3143 3144 m_lcuHeightChroma = m_lcuHeight>>1; 3145 #if ALF_SINGLE_FILTER_SHAPE 3146 m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps 3147 #else 3148 m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps 3149 #endif 3150 m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ; // DFRegion 3151 3152 TComPicYuv* pcPicOrg = m_pcPic->getPicYuvOrg(); 3153 3154 // extend image for filtering 3155 TComPicYuv* pcPicYuvRec = m_pcPic->getPicYuvRec(); 3156 TComPicYuv* pcPicYuvExtRec = m_pcTempPicYuv; 3157 #if HHI_INTERVIEW_SKIP 3158 TComPicYuv* pcUsedPelMap = m_pcPic->getUsedPelsMap() ; 3159 if(bInterviewSkip) 3160 assert( pcUsedPelMap ) ; 3161 #endif 3162 3163 pcPicYuvRec->copyToPic(pcPicYuvExtRec); 3164 if(!m_bUseNonCrossALF) 3165 { 3166 pcPicYuvExtRec->setBorderExtension( false ); 3167 pcPicYuvExtRec->extendPicBorder (); 3168 } 3169 3170 // set min cost 3171 UInt64 uiMinRate = MAX_INT; 3172 UInt64 uiMinDist = MAX_INT; 3173 Double dMinCost = MAX_DOUBLE; 3174 3175 UInt64 uiOrigRate; 3176 UInt64 uiOrigDist; 3177 Double dOrigCost; 3178 3179 // calc original cost 3180 #if HHI_INTERVIEW_SKIP 3181 xCalcRDCost( pcPicOrg, pcPicYuvRec, pcUsedPelMap, NULL, uiOrigRate, uiOrigDist, dOrigCost ); 3182 #else 3183 xCalcRDCost( pcPicOrg, pcPicYuvRec, NULL, uiOrigRate, uiOrigDist, dOrigCost ); 3184 #endif 3185 m_pcBestAlfParam->alf_flag = 0; 3186 // initialize temp_alfps 3187 m_pcTempAlfParam->alf_flag = 1; 3188 m_pcTempAlfParam->chroma_idc = 0; 3189 3190 m_bAlfCUCtrlEnabled = (pvAlfCtrlParam != NULL)?true:false; 3191 if(m_bAlfCUCtrlEnabled) 3192 { 3193 m_vBestAlfCUCtrlParam.resize(m_uiNumSlicesInPic); 3194 for(Int s=0; s< m_uiNumSlicesInPic; s++) 3195 { 3196 m_vBestAlfCUCtrlParam[s].cu_control_flag = 0; 3197 } 3198 } 3199 else 3200 { 3201 m_vBestAlfCUCtrlParam.clear(); 3202 } 3203 3204 setALFEncodingParam(m_pcPic); 3205 3206 // adaptive in-loop wiener filtering 3207 #if HHI_INTERVIEW_SKIP 3208 xEncALFLuma( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, uiMinRate, uiMinDist, dMinCost, bInterviewSkip ); 3209 #else 3210 xEncALFLuma( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, uiMinRate, uiMinDist, dMinCost ); 3211 #endif 3212 3213 // cu-based filter on/off control 3214 #if HHI_INTERVIEW_SKIP 3215 xCUAdaptiveControl_qc( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, pcUsedPelMap, uiMinRate, uiMinDist, dMinCost ); 3216 #else 3217 xCUAdaptiveControl_qc( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, uiMinRate, uiMinDist, dMinCost ); 3218 #endif 3219 3220 // compare RD cost to non-ALF case 3221 if( dMinCost < dOrigCost ) 3222 { 3223 m_pcBestAlfParam->alf_flag = 1; 3224 3225 ruiBits = uiMinRate; 3226 ruiDist = uiMinDist; 3227 } 3228 else 3229 { 3230 m_pcBestAlfParam->alf_flag = 0; 3231 3232 uiMinRate = uiOrigRate; 3233 uiMinDist = uiOrigDist; 3234 3235 m_pcEntropyCoder->setAlfCtrl(false); 3236 if(m_bAlfCUCtrlEnabled) 3237 { 3238 for(Int s=0; s< m_uiNumSlicesInPic; s++) 3239 { 3240 m_vBestAlfCUCtrlParam[s].cu_control_flag = 0; 3241 } 3242 } 3243 pcPicYuvExtRec->copyToPicLuma(pcPicYuvRec); 3244 3245 ruiBits = uiOrigRate; 3246 ruiDist = uiOrigDist; 3247 } 3248 // if ALF works 3249 if( m_pcBestAlfParam->alf_flag ) 3250 { 3251 // do additional ALF process for chroma 3252 xFilterTapDecisionChroma( uiMinRate, pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, ruiDist, ruiBits ); 3253 } 3254 3255 // copy to best storage 3256 copyALFParam(pcAlfParam, m_pcBestAlfParam); 3257 3258 if(m_bAlfCUCtrlEnabled) 3259 { 3260 for(Int s=0; s< m_uiNumSlicesInPic; s++) 3261 { 3262 (*pvAlfCtrlParam)[s]= m_vBestAlfCUCtrlParam[s]; 3263 } 3264 } 3265 } 3266 #endif 2918 3267 2919 3268 2920 /** PCM LF disable process. … … 3284 2936 // Private member functions 3285 2937 // ==================================================================================================================== 3286 #if !LCU_SYNTAX_ALF3287 Void TEncAdaptiveLoopFilter::xInitParam()3288 {3289 Int i, j;3290 3291 if (m_ppdAlfCorr != NULL)3292 {3293 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3294 {3295 for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)3296 {3297 m_ppdAlfCorr[i][j] = 0;3298 }3299 }3300 }3301 else3302 {3303 m_ppdAlfCorr = new Double*[ALF_MAX_NUM_COEF];3304 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3305 {3306 m_ppdAlfCorr[i] = new Double[ALF_MAX_NUM_COEF+1];3307 for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)3308 {3309 m_ppdAlfCorr[i][j] = 0;3310 }3311 }3312 }3313 3314 if (m_pdDoubleAlfCoeff != NULL)3315 {3316 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3317 {3318 m_pdDoubleAlfCoeff[i] = 0;3319 }3320 }3321 else3322 {3323 m_pdDoubleAlfCoeff = new Double[ALF_MAX_NUM_COEF];3324 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3325 {3326 m_pdDoubleAlfCoeff[i] = 0;3327 }3328 }3329 if (m_ppdAlfCorrCb != NULL)3330 {3331 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3332 {3333 for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)3334 {3335 m_ppdAlfCorrCb[i][j] = 0;3336 }3337 }3338 }3339 else3340 {3341 m_ppdAlfCorrCb = new Double*[ALF_MAX_NUM_COEF];3342 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3343 {3344 m_ppdAlfCorrCb[i] = new Double[ALF_MAX_NUM_COEF+1];3345 for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)3346 {3347 m_ppdAlfCorrCb[i][j] = 0;3348 }3349 }3350 }3351 3352 if (m_ppdAlfCorrCr != NULL)3353 {3354 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3355 {3356 for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)3357 {3358 m_ppdAlfCorrCr[i][j] = 0;3359 }3360 }3361 }3362 else3363 {3364 m_ppdAlfCorrCr = new Double*[ALF_MAX_NUM_COEF];3365 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3366 {3367 m_ppdAlfCorrCr[i] = new Double[ALF_MAX_NUM_COEF+1];3368 for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)3369 {3370 m_ppdAlfCorrCr[i][j] = 0;3371 }3372 }3373 }3374 }3375 3376 Void TEncAdaptiveLoopFilter::xUninitParam()3377 {3378 Int i;3379 3380 if (m_ppdAlfCorr != NULL)3381 {3382 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3383 {3384 delete[] m_ppdAlfCorr[i];3385 m_ppdAlfCorr[i] = NULL;3386 }3387 delete[] m_ppdAlfCorr;3388 m_ppdAlfCorr = NULL;3389 }3390 3391 if (m_pdDoubleAlfCoeff != NULL)3392 {3393 delete[] m_pdDoubleAlfCoeff;3394 m_pdDoubleAlfCoeff = NULL;3395 }3396 if (m_ppdAlfCorrCb != NULL)3397 {3398 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3399 {3400 delete[] m_ppdAlfCorrCb[i];3401 m_ppdAlfCorrCb[i] = NULL;3402 }3403 delete[] m_ppdAlfCorrCb;3404 m_ppdAlfCorrCb = NULL;3405 }3406 3407 if (m_ppdAlfCorrCr != NULL)3408 {3409 for (i = 0; i < ALF_MAX_NUM_COEF; i++)3410 {3411 delete[] m_ppdAlfCorrCr[i];3412 m_ppdAlfCorrCr[i] = NULL;3413 }3414 delete[] m_ppdAlfCorrCr;3415 m_ppdAlfCorrCr = NULL;3416 }3417 }3418 #endif3419 2938 Void TEncAdaptiveLoopFilter::xCreateTmpAlfCtrlFlags() 3420 2939 { … … 3512 3031 } 3513 3032 3514 #if !LCU_SYNTAX_ALF3515 3516 Void TEncAdaptiveLoopFilter::xCalcCorrelationFunc(Int ypos, Int xpos, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int iWidth, Int iHeight, Int iOrgStride, Int iCmpStride, Bool bSymmCopyBlockMatrix)3517 {3518 Int yposEnd = ypos + iHeight -1;3519 Int xposEnd = xpos + iWidth -1;3520 Int N = m_sqrFiltLengthTab[filtNo];3521 3522 Int imgHeightChroma = m_img_height>>1;3523 Int yLineInLCU;3524 Int paddingline ;3525 3526 Int ELocal[ALF_MAX_NUM_COEF];3527 Pel *pImgPad1, *pImgPad2, *pImgPad3, *pImgPad4;3528 Int i, j, k, l;3529 Int yLocal;3530 3531 pImgPad += (ypos*iCmpStride);3532 pImgOrg += (ypos*iOrgStride);3533 3534 switch(filtNo)3535 {3536 #if !ALF_SINGLE_FILTER_SHAPE3537 case ALF_STAR5x5:3538 {3539 for (i= ypos; i<= yposEnd; i++)3540 {3541 yLineInLCU = i % m_lcuHeightChroma;3542 3543 if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )3544 {3545 pImgPad1 = pImgPad + iCmpStride;3546 pImgPad2 = pImgPad - iCmpStride;3547 pImgPad3 = pImgPad + 2*iCmpStride;3548 pImgPad4 = pImgPad - 2*iCmpStride;3549 }3550 else if (yLineInLCU < m_lineIdxPadTopChroma)3551 {3552 paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;3553 pImgPad1 = pImgPad + min(paddingline, 1)*iCmpStride;3554 pImgPad2 = pImgPad - iCmpStride;3555 pImgPad3 = pImgPad + min(paddingline, 2)*iCmpStride;3556 pImgPad4 = pImgPad - 2*iCmpStride;3557 }3558 else3559 {3560 paddingline = yLineInLCU - m_lineIdxPadTopChroma ;3561 pImgPad1 = pImgPad + iCmpStride;3562 pImgPad2 = pImgPad - min(paddingline, 1)*iCmpStride;3563 pImgPad3 = pImgPad + 2*iCmpStride;3564 pImgPad4 = pImgPad - min(paddingline, 2)*iCmpStride;3565 }3566 3567 if ( (yLineInLCU == m_lineIdxPadTopChroma || yLineInLCU == m_lineIdxPadTopChroma-1) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )3568 {3569 pImgPad+= iCmpStride;3570 pImgOrg+= iOrgStride;3571 continue;3572 }3573 else3574 {3575 for (j= xpos; j<= xposEnd; j++)3576 {3577 memset(ELocal, 0, N*sizeof(Int));3578 3579 ELocal[0] = (pImgPad3[j+2] + pImgPad4[j-2]);3580 ELocal[1] = (pImgPad3[j ] + pImgPad4[j ]);3581 ELocal[2] = (pImgPad3[j-2] + pImgPad4[j+2]);3582 3583 ELocal[3] = (pImgPad1[j+1] + pImgPad2[j-1]);3584 ELocal[4] = (pImgPad1[j ] + pImgPad2[j ]);3585 ELocal[5] = (pImgPad1[j-1] + pImgPad2[j+1]);3586 3587 ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]);3588 ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]);3589 ELocal[8] = (pImgPad[j ]);3590 3591 yLocal= (Int)pImgOrg[j];3592 3593 for(k=0; k<N; k++)3594 {3595 m_ppdAlfCorr[k][k] += ELocal[k]*ELocal[k];3596 for(l=k+1; l<N; l++)3597 {3598 m_ppdAlfCorr[k][l] += ELocal[k]*ELocal[l];3599 }3600 3601 m_ppdAlfCorr[k][N] += yLocal*ELocal[k];3602 }3603 }3604 pImgPad+= iCmpStride;3605 pImgOrg+= iOrgStride;3606 }3607 3608 }3609 }3610 break;3611 case ALF_CROSS9x9:3612 {3613 Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8;3614 #else3615 case ALF_CROSS9x7_SQUARE3x3:3616 {3617 Pel *pImgPad5, *pImgPad6;3618 #endif3619 for (i= ypos; i<= yposEnd; i++)3620 {3621 yLineInLCU = i % m_lcuHeightChroma;3622 3623 if (yLineInLCU<2 && i> 2)3624 {3625 paddingline = yLineInLCU + 2 ;3626 pImgPad1 = pImgPad + iCmpStride;3627 pImgPad2 = pImgPad - iCmpStride;3628 pImgPad3 = pImgPad + 2*iCmpStride;3629 pImgPad4 = pImgPad - 2*iCmpStride;3630 pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*iCmpStride;3631 pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*iCmpStride;;3632 #if !ALF_SINGLE_FILTER_SHAPE3633 pImgPad7 = (paddingline < 4) ? pImgPad : pImgPad + 4*iCmpStride;3634 pImgPad8 = (paddingline < 4) ? pImgPad : pImgPad - min(paddingline, 4)*iCmpStride;;3635 #endif3636 }3637 else if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )3638 {3639 pImgPad1 = pImgPad + iCmpStride;3640 pImgPad2 = pImgPad - iCmpStride;3641 pImgPad3 = pImgPad + 2*iCmpStride;3642 pImgPad4 = pImgPad - 2*iCmpStride;3643 pImgPad5 = pImgPad + 3*iCmpStride;3644 pImgPad6 = pImgPad - 3*iCmpStride;3645 #if !ALF_SINGLE_FILTER_SHAPE3646 pImgPad7 = pImgPad + 4*iCmpStride;3647 pImgPad8 = pImgPad - 4*iCmpStride;3648 #endif3649 }3650 else if (yLineInLCU < m_lineIdxPadTopChroma)3651 {3652 paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;3653 pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad + min(paddingline, 1)*iCmpStride;3654 pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad - iCmpStride;3655 pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + min(paddingline, 2)*iCmpStride;3656 pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - 2*iCmpStride;3657 pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + min(paddingline, 3)*iCmpStride;3658 pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - 3*iCmpStride;3659 #if !ALF_SINGLE_FILTER_SHAPE3660 pImgPad7 = (paddingline < 4) ? pImgPad : pImgPad + min(paddingline, 4)*iCmpStride;3661 pImgPad8 = (paddingline < 4) ? pImgPad : pImgPad - 4*iCmpStride;3662 #endif3663 }3664 else3665 {3666 paddingline = yLineInLCU - m_lineIdxPadTopChroma ;3667 pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad + iCmpStride;3668 pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad - min(paddingline, 1)*iCmpStride;3669 pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + 2*iCmpStride;3670 pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - min(paddingline, 2)*iCmpStride;3671 pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*iCmpStride;3672 pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*iCmpStride;3673 #if !ALF_SINGLE_FILTER_SHAPE3674 pImgPad7 = (paddingline < 4) ? pImgPad : pImgPad + 4*iCmpStride;3675 pImgPad8 = (paddingline < 4) ? pImgPad : pImgPad - min(paddingline, 4)*iCmpStride;3676 #endif3677 }3678 3679 for (j= xpos; j<= xposEnd; j++)3680 {3681 memset(ELocal, 0, N*sizeof(Int));3682 #if ALF_SINGLE_FILTER_SHAPE3683 ELocal[0] = (pImgPad5[j]+pImgPad6[j]);3684 ELocal[1] = (pImgPad3[j]+pImgPad4[j]);3685 ELocal[2] = (pImgPad1[j-1]+pImgPad2[j+1]);3686 ELocal[3] = (pImgPad1[j]+pImgPad2[j]);3687 ELocal[4] = (pImgPad1[j+1]+pImgPad2[j-1]);3688 ELocal[5] = (pImgPad[j+4]+pImgPad[j-4]);3689 ELocal[6] = (pImgPad[j+3]+pImgPad[j-3]);3690 ELocal[7] = (pImgPad[j+2]+pImgPad[j-2]);3691 ELocal[8] = (pImgPad[j+1]+pImgPad[j-1]);3692 ELocal[9] = (pImgPad[j ]);3693 #else3694 ELocal[0] = (pImgPad7[j] + pImgPad8[j]);3695 3696 ELocal[1] = (pImgPad5[j] + pImgPad6[j]);3697 3698 ELocal[2] = (pImgPad3[j] + pImgPad4[j]);3699 3700 ELocal[3] = (pImgPad1[j] + pImgPad2[j]);3701 3702 ELocal[4] = (pImgPad[j+4] + pImgPad[j-4]);3703 ELocal[5] = (pImgPad[j+3] + pImgPad[j-3]);3704 ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]);3705 ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]);3706 ELocal[8] = (pImgPad[j ] );3707 #endif3708 yLocal= (Int)pImgOrg[j];3709 3710 for(k=0; k<N; k++)3711 {3712 m_ppdAlfCorr[k][k] += ELocal[k]*ELocal[k];3713 for(l=k+1; l<N; l++)3714 {3715 m_ppdAlfCorr[k][l] += ELocal[k]*ELocal[l];3716 }3717 3718 m_ppdAlfCorr[k][N] += yLocal*ELocal[k];3719 }3720 }3721 pImgPad+= iCmpStride;3722 pImgOrg+= iOrgStride;3723 }3724 3725 }3726 break;3727 default:3728 {3729 printf("Not a supported filter shape\n");3730 assert(0);3731 exit(1);3732 }3733 }3734 3735 if(bSymmCopyBlockMatrix)3736 {3737 for(j=0; j<N-1; j++)3738 {3739 for(i=j+1; i<N; i++)3740 {3741 m_ppdAlfCorr[i][j] = m_ppdAlfCorr[j][i];3742 }3743 }3744 }3745 }3746 3747 #endif3748 3033 #if IBDI_DISTORTION 3749 3034 #if HHI_INTERVIEW_SKIP … … 3946 3231 Int *nc; 3947 3232 const Int *pFiltMag; 3948 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3233 #if LCUALF_QP_DEPENDENT_BITS 3949 3234 Int alfPrecisionBit = getAlfPrecisionBit( m_alfQP ); 3950 3235 #endif 3951 3236 3952 3237 N = m_sqrFiltLengthTab[tap]; 3953 #if ALF_SINGLE_FILTER_SHAPE3954 3238 pFiltMag = weightsShape1Sym; 3955 #else3956 // star shape3957 if(tap == 0)3958 {3959 pFiltMag = weightsShape0Sym;3960 }3961 // cross shape3962 else3963 {3964 pFiltMag = weightsShape1Sym;3965 }3966 #endif3967 3239 3968 3240 dh = new Double[N]; 3969 3241 nc = new Int[N]; 3970 3242 3971 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3243 #if LCUALF_QP_DEPENDENT_BITS 3972 3244 max_value = (1<<(1+alfPrecisionBit))-1; 3973 3245 min_value = 0-(1<<(1+alfPrecisionBit)); … … 3983 3255 if(h[i]>=0.0) 3984 3256 { 3985 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3257 #if LCUALF_QP_DEPENDENT_BITS 3986 3258 qh[i] = (Int)( h[i]*(1<<alfPrecisionBit)+0.5); 3987 3259 #else … … 3991 3263 else 3992 3264 { 3993 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3265 #if LCUALF_QP_DEPENDENT_BITS 3994 3266 qh[i] = -(Int)(-h[i]*(1<<alfPrecisionBit)+0.5); 3995 3267 #else … … 3998 3270 } 3999 3271 4000 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3272 #if LCUALF_QP_DEPENDENT_BITS 4001 3273 dh[i] = (Double)qh[i]/(Double)(1<<alfPrecisionBit) - h[i]; 4002 3274 #else … … 4010 3282 4011 3283 // modification of quantized filter coefficients 4012 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3284 #if LCUALF_QP_DEPENDENT_BITS 4013 3285 total_gain = (Int)(dbl_total_gain*(1<<alfPrecisionBit)+0.5); 4014 3286 #else … … 4082 3354 nc = NULL; 4083 3355 } 4084 #if !LCU_SYNTAX_ALF4085 Void TEncAdaptiveLoopFilter::xClearFilterCoefInt(Int* qh, Int N)4086 {4087 // clear4088 memset( qh, 0, sizeof( Int ) * N );4089 4090 // center pos4091 qh[N-1] = 1<<ALF_NUM_BIT_SHIFT;4092 }4093 /** Calculate RD cost4094 * \param [in] pAlfParam ALF parameters4095 * \param [out] ruiRate coding bits4096 * \param [in] uiDist distortion4097 * \param [out] rdCost rate-distortion cost4098 * \param [in] pvAlfCUCtrlParam ALF CU control parameters4099 */4100 Void TEncAdaptiveLoopFilter::xCalcRDCost(ALFParam* pAlfParam, UInt64& ruiRate, UInt64 uiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam)4101 {4102 if(pAlfParam != NULL)4103 {4104 m_pcEntropyCoder->resetEntropy();4105 m_pcEntropyCoder->resetBits();4106 m_pcEntropyCoder->encodeAlfParam(pAlfParam);4107 4108 ruiRate = m_pcEntropyCoder->getNumberOfWrittenBits();4109 4110 if(pvAlfCUCtrlParam != NULL)4111 {4112 for(UInt s=0; s< m_uiNumSlicesInPic; s++)4113 {4114 if(!m_pcPic->getValidSlice(s))4115 {4116 continue;4117 }4118 m_pcEntropyCoder->resetEntropy();4119 m_pcEntropyCoder->resetBits();4120 m_pcEntropyCoder->encodeAlfCtrlParam( (*pvAlfCUCtrlParam)[s], m_uiNumCUsInFrame);4121 ruiRate += m_pcEntropyCoder->getNumberOfWrittenBits();4122 }4123 }4124 else4125 {4126 ruiRate += m_uiNumSlicesInPic;4127 }4128 }4129 else4130 {4131 ruiRate = 1;4132 }4133 4134 rdCost = (Double)(ruiRate) * m_dLambdaLuma + (Double)(uiDist);4135 }4136 4137 /** Calculate RD cost4138 * \param [in] pcPicOrg original picture buffer4139 * \param [in] pcPicCmp compared picture buffer4140 * \param [in] pAlfParam ALF parameters4141 * \param [out] ruiRate coding bits4142 * \param [out] ruiDist distortion4143 * \param [out] rdCost rate-distortion cost4144 * \param [in] pvAlfCUCtrlParam ALF CU control parameters4145 */4146 #if HHI_INTERVIEW_SKIP4147 Void TEncAdaptiveLoopFilter::xCalcRDCost(TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, TComPicYuv* pcUsedPelMap, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam)4148 #else4149 Void TEncAdaptiveLoopFilter::xCalcRDCost(TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam)4150 #endif4151 {4152 if(pAlfParam != NULL)4153 {4154 m_pcEntropyCoder->resetEntropy();4155 m_pcEntropyCoder->resetBits();4156 m_pcEntropyCoder->encodeAlfParam(pAlfParam);4157 4158 ruiRate = m_pcEntropyCoder->getNumberOfWrittenBits();4159 4160 if(pvAlfCUCtrlParam != NULL)4161 {4162 for(UInt s=0; s< m_uiNumSlicesInPic; s++)4163 {4164 if(! m_pcPic->getValidSlice(s))4165 {4166 continue;4167 }4168 m_pcEntropyCoder->resetEntropy();4169 m_pcEntropyCoder->resetBits();4170 m_pcEntropyCoder->encodeAlfCtrlParam( (*pvAlfCUCtrlParam)[s], m_uiNumCUsInFrame);4171 ruiRate += m_pcEntropyCoder->getNumberOfWrittenBits();4172 }4173 4174 }4175 else4176 {4177 ruiRate += m_uiNumSlicesInPic;4178 }4179 }4180 else4181 {4182 ruiRate = 1;4183 }4184 4185 ruiDist = xCalcSSD(pcPicOrg->getLumaAddr(), pcPicCmp->getLumaAddr(), pcPicOrg->getWidth(), pcPicOrg->getHeight(), pcPicOrg->getStride());4186 rdCost = (Double)(ruiRate) * m_dLambdaLuma + (Double)(ruiDist);4187 }4188 /** Calculate RD cost for chroma ALF4189 * \param pcPicOrg original picture buffer4190 * \param pcPicCmp compared picture buffer4191 * \param pAlfParam ALF parameters4192 * \returns ruiRate bitrate4193 * \returns uiDist distortion4194 * \returns rdCost RD cost4195 */4196 Void TEncAdaptiveLoopFilter::xCalcRDCostChroma(TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost)4197 {4198 if(pAlfParam->chroma_idc)4199 {4200 ruiRate = xCalcRateChroma(pAlfParam);4201 }4202 ruiDist = 0;4203 ruiDist += xCalcSSD(pcPicOrg->getCbAddr(), pcPicCmp->getCbAddr(), (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride());4204 ruiDist += xCalcSSD(pcPicOrg->getCrAddr(), pcPicCmp->getCrAddr(), (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride());4205 rdCost = (Double)(ruiRate) * m_dLambdaChroma + (Double)(ruiDist);4206 }4207 4208 Void TEncAdaptiveLoopFilter::xFilteringFrameChroma(ALFParam* pcAlfParam, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)4209 {4210 Int filtNo = pcAlfParam->filter_shape_chroma;4211 Int *coeff = pcAlfParam->coeff_chroma;4212 Int iChromaFormatShift = 1; //4:2:04213 4214 if ((pcAlfParam->chroma_idc>>1)&0x01)4215 {4216 if(!m_bUseNonCrossALF)4217 {4218 Int iStride = pcPicRest->getCStride();4219 Pel* pDec = pcPicDec->getCbAddr();4220 Pel* pRest = pcPicRest->getCbAddr();4221 4222 filterChroma(pRest, pDec, iStride, 0, (Int)(m_img_height>>1) -1, 0, (Int)(m_img_width>>1)-1, filtNo, coeff);4223 }4224 else4225 {4226 xFilterChromaSlices(ALF_Cb, pcPicDec, pcPicRest, coeff, filtNo, iChromaFormatShift);4227 }4228 }4229 if ((pcAlfParam->chroma_idc)&0x01)4230 {4231 if(!m_bUseNonCrossALF)4232 {4233 Int iStride = pcPicRest->getCStride();4234 Pel* pDec = pcPicDec->getCrAddr();4235 Pel* pRest = pcPicRest->getCrAddr();4236 4237 filterChroma(pRest, pDec, iStride, 0, (Int)(m_img_height>>1) -1, 0, (Int)(m_img_width>>1)-1, filtNo, coeff);4238 }4239 else4240 {4241 xFilterChromaSlices(ALF_Cr, pcPicDec, pcPicRest, coeff, filtNo, iChromaFormatShift);4242 }4243 }4244 4245 if(pcAlfParam->chroma_idc<3)4246 {4247 if(pcAlfParam->chroma_idc==1)4248 {4249 pcPicDec->copyToPicCb(pcPicRest);4250 }4251 if(pcAlfParam->chroma_idc==2)4252 {4253 pcPicDec->copyToPicCr(pcPicRest);4254 }4255 }4256 4257 }4258 #endif4259 #if LCU_SYNTAX_ALF4260 3356 /** Restore the not-filtered pixels 4261 3357 * \param [in] imgDec picture buffer before filtering … … 4264 3360 */ 4265 3361 Void TEncAdaptiveLoopFilter::xCopyDecToRestCUs(Pel* imgDec, Pel* imgRest, Int stride) 4266 #else4267 /** Restore the not-filtered pixels4268 * \param pcPicDec picture buffer before filtering4269 * \param pcPicRest picture buffer after filtering4270 */4271 Void TEncAdaptiveLoopFilter::xCopyDecToRestCUs(TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)4272 #endif4273 3362 { 4274 3363 4275 3364 if(m_uiNumSlicesInPic > 1) 4276 3365 { 4277 #if LCU_SYNTAX_ALF4278 3366 Pel* pPicDecLuma = imgDec; 4279 3367 Pel* pPicRestLuma = imgRest; 4280 #else4281 Pel* pPicDecLuma = pcPicDec->getLumaAddr();4282 Pel* pPicRestLuma = pcPicRest->getLumaAddr();4283 Int stride = pcPicDec->getStride();4284 #endif4285 3368 UInt SUWidth = m_pcPic->getMinCUWidth(); 4286 3369 UInt SUHeight = m_pcPic->getMinCUHeight(); … … 4335 3418 { 4336 3419 TComDataCU* pcCU = m_pcPic->getCU( uiCUAddr ); 4337 #if LCU_SYNTAX_ALF4338 3420 xCopyDecToRestCU(pcCU, 0, 0, imgDec, imgRest, stride); 4339 #else 4340 xCopyDecToRestCU(pcCU, 0, 0, pcPicDec, pcPicRest); 4341 #endif 4342 } 4343 } 4344 4345 #if LCU_SYNTAX_ALF 3421 } 3422 } 3423 4346 3424 Void TEncAdaptiveLoopFilter::xCopyDecToRestCU(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Pel* imgDec, Pel* imgRest, Int stride) 4347 #else4348 Void TEncAdaptiveLoopFilter::xCopyDecToRestCU(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)4349 #endif4350 3425 { 4351 3426 Bool bBoundary = false; … … 4369 3444 4370 3445 if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) 4371 #if LCU_SYNTAX_ALF4372 3446 xCopyDecToRestCU(pcCU, uiAbsPartIdx, uiDepth+1, imgDec, imgRest, stride); 4373 #else4374 xCopyDecToRestCU(pcCU, uiAbsPartIdx, uiDepth+1, pcPicDec, pcPicRest);4375 #endif4376 3447 } 4377 3448 return; … … 4380 3451 if (!pcCU->getAlfCtrlFlag(uiAbsPartIdx)) 4381 3452 { 4382 #if !LCU_SYNTAX_ALF4383 UInt uiCUAddr = pcCU->getAddr();4384 #endif4385 3453 Int iWidth = pcCU->getWidth(uiAbsPartIdx); 4386 3454 Int iHeight = pcCU->getHeight(uiAbsPartIdx); 4387 #if LCU_SYNTAX_ALF4388 3455 copyPixelsInOneRegion(imgRest, imgDec, stride, (Int)uiTPelY, iHeight, (Int)uiLPelX, iWidth); 4389 #else4390 Pel* pRec = pcPicDec->getLumaAddr(uiCUAddr, uiAbsPartIdx);4391 Pel* pFilt = pcPicRest->getLumaAddr(uiCUAddr, uiAbsPartIdx);4392 4393 Int iRecStride = pcPicDec->getStride();4394 Int iFiltStride = pcPicRest->getStride();4395 4396 for (Int y = 0; y < iHeight; y++)4397 {4398 for (Int x = 0; x < iWidth; x++)4399 {4400 pFilt[x] = pRec[x];4401 }4402 pRec += iRecStride;4403 pFilt += iFiltStride;4404 }4405 #endif4406 3456 } 4407 3457 } … … 4426 3476 Void TEncAdaptiveLoopFilter::predictALFCoeffLumaEnc(ALFParam* pcAlfParam, Int **pfilterCoeffSym, Int filter_shape) 4427 3477 { 4428 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3478 #if LCUALF_QP_DEPENDENT_BITS 4429 3479 Int alfPrecisionBit = getAlfPrecisionBit( m_alfQP ); 4430 3480 #endif … … 4442 3492 if((pcAlfParam->predMethod==0)|(ind==0)) 4443 3493 { 4444 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3494 #if LCUALF_QP_DEPENDENT_BITS 4445 3495 coeffPred = ((1<<alfPrecisionBit)-sum) >> 2; 4446 3496 #else … … 4465 3515 if((pcAlfParam->predMethod==0)|(ind==0)) 4466 3516 { 4467 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS3517 #if LCUALF_QP_DEPENDENT_BITS 4468 3518 coeffPred = (1<<alfPrecisionBit)-sum; 4469 3519 #else … … 4600 3650 *pDepthInt=NULL, kMinTab[MAX_SCAN_VAL], bitsCoeffScan[MAX_SCAN_VAL][MAX_EXP_GOLOMB], 4601 3651 minKStart, minBitsKStart, bitsKStart; 4602 #if ALF_SINGLE_FILTER_SHAPE4603 3652 Int minScanVal = MIN_SCAN_POS_CROSS; 4604 #else4605 int minScanVal = (fl==ALF_STAR5x5) ? 0 : MIN_SCAN_POS_CROSS;4606 #endif4607 3653 pDepthInt = pDepthIntTabShapes[fl]; 4608 3654 … … 4672 3718 // Coding parameters 4673 3719 // len += lengthFilterCodingParams(minKStart, maxScanVal, kMinTab, createBitstream); 4674 #if LCU_SYNTAX_ALF4675 3720 if (filters_per_group == 1) 4676 3721 { … … 4680 3725 else 4681 3726 { 4682 #endif4683 3727 len += (3 + maxScanVal); 4684 3728 … … 4686 3730 len += lengthFilterCoeffs(sqrFiltLength, filters_per_group, pDepthInt, pDiffQFilterCoeffIntPP, 4687 3731 kMinTab, createBitstream); 4688 #if LCU_SYNTAX_ALF 4689 } 4690 #endif 3732 } 4691 3733 4692 3734 return len; … … 4735 3777 { 4736 3778 scanPos = pDepthInt[i] - 1; 4737 #if LCU_SYNTAX_ALF4738 3779 Int k = (filters_per_group == 1) ? kMinTab[i] : kMinTab[scanPos]; 4739 3780 bit_cnt += lengthGolomb(abs(FilterCoeff[ind][i]), k); 4740 #else4741 bit_cnt += lengthGolomb(abs(FilterCoeff[ind][i]), kMinTab[scanPos]);4742 #endif4743 3781 } 4744 3782 } … … 4746 3784 } 4747 3785 4748 #if !LCU_SYNTAX_ALF 4749 4750 Void TEncAdaptiveLoopFilter::xEncALFLuma ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost ) 4751 { 4752 //pcPicDec: extended decoded 4753 //pcPicRest: original decoded: filtered signal will be stored 4754 4755 UInt64 uiRate; 4756 UInt64 uiDist; 4757 Double dCost; 4758 Int LumaStride = pcPicOrg->getStride(); 4759 Pel* pOrg = pcPicOrg->getLumaAddr(); 4760 Pel* pRest = pcPicRest->getLumaAddr(); 4761 Pel* pDec = pcPicDec->getLumaAddr(); 4762 4763 Double dMinMethodCost = MAX_DOUBLE; 4764 UInt64 uiMinMethodDist = MAX_UINT; 4765 UInt64 uiMinMethodRate = MAX_UINT; 4766 Int iBestClassMethod = ALF_RA; 4767 Double adExtraCostReduction[NUM_ALF_CLASS_METHOD]; 4768 ALFParam cFrmAlfParam [NUM_ALF_CLASS_METHOD]; 4769 ALFParam* pcAlfParam = NULL; 4770 4771 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++) 4772 { 4773 pcAlfParam = &(cFrmAlfParam[i]); 4774 allocALFParam(pcAlfParam); 4775 4776 pcAlfParam->alf_flag = 1; 4777 pcAlfParam->chroma_idc = 0; 4778 4779 switch(i) 4780 { 4781 case ALF_RA: 4782 { 4783 adExtraCostReduction[i] = (double)(m_img_height * m_img_width) * m_dLambdaLuma * 2.0 / 4096.0; 4784 } 4785 break; 4786 case ALF_BA: 4787 { 4788 adExtraCostReduction[i] = 0.0; 4789 } 4790 break; 4791 default: 4792 { 4793 printf("Not a support adaptation method\n"); 4794 assert(0); 4795 exit(-1); 4796 } 4797 } 4798 } 4799 4800 4801 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++) 4802 { 4803 m_uiVarGenMethod = i; 4804 4805 pcAlfParam = &(cFrmAlfParam[m_uiVarGenMethod]); 4806 m_varImg = m_varImgMethods[m_uiVarGenMethod]; 4807 4808 pcAlfParam->alf_pcr_region_flag = m_uiVarGenMethod; 4809 4810 setInitialMask(pcPicOrg, pcPicDec); 4811 4812 if(m_iALFEncodePassReduction == 0) 4813 { 4814 static Int best_filter_shape = 0; 4815 if (m_uiVarGenMethod == 0) 4816 { 4817 UInt64 MinRate_Shape0 = MAX_INT; 4818 UInt64 MinDist_Shape0 = MAX_INT; 4819 Double MinCost_Shape0 = MAX_DOUBLE; 4820 4821 UInt64 MinRate_Shape1 = MAX_INT; 4822 UInt64 MinDist_Shape1 = MAX_INT; 4823 Double MinCost_Shape1 = MAX_DOUBLE; 4824 4825 #if ALF_SINGLE_FILTER_SHAPE 4826 Int filter_shape = 0; 4827 #else 4828 for (Int filter_shape = 0; filter_shape < 2 ;filter_shape ++) 4829 #endif 4830 { 4831 pcAlfParam->filter_shape = filter_shape; 4832 pcAlfParam->num_coeff = m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[filter_shape]; 4833 xFirstFilteringFrameLuma(pOrg, pDec, m_pcPicYuvTmp->getLumaAddr(), pcAlfParam, pcAlfParam->filter_shape, LumaStride); 4834 xCalcRDCost(pcPicOrg, m_pcPicYuvTmp, pcAlfParam, uiRate, uiDist, dCost); 4835 if (filter_shape == 0) 4836 { 4837 // copy Shape0 4838 MinRate_Shape0 = uiRate; 4839 MinDist_Shape0 = uiDist; 4840 MinCost_Shape0 = dCost; 4841 m_pcPicYuvTmp->copyToPicLuma(pcPicYuvRecShape0); 4842 copyALFParam(pcAlfParamShape0, pcAlfParam); 4843 } 4844 else //if (filter_shape == 1) 4845 { 4846 // copy Shape1 4847 MinRate_Shape1 = uiRate; 4848 MinDist_Shape1 = uiDist; 4849 MinCost_Shape1 = dCost; 4850 m_pcPicYuvTmp->copyToPicLuma(pcPicYuvRecShape1); 4851 copyALFParam(pcAlfParamShape1, pcAlfParam); 4852 } 4853 } 4854 4855 if (MinCost_Shape0 <= MinCost_Shape1) 4856 { 4857 pcPicYuvRecShape0->copyToPicLuma(m_pcPicYuvTmp); 4858 copyALFParam(pcAlfParam, pcAlfParamShape0); 4859 uiRate = MinRate_Shape0; 4860 uiDist = MinDist_Shape0; 4861 dCost = MinCost_Shape0; 4862 best_filter_shape = 0; 4863 } 4864 else //if (MinCost_Shape1 < MinCost_Shape0) 4865 { 4866 pcPicYuvRecShape1->copyToPicLuma(m_pcPicYuvTmp); 4867 copyALFParam(pcAlfParam, pcAlfParamShape1); 4868 uiRate = MinRate_Shape1; 4869 uiDist = MinDist_Shape1; 4870 dCost = MinCost_Shape1; 4871 best_filter_shape = 1; 4872 } 4873 } 4874 else 4875 { 4876 pcAlfParam->filter_shape = best_filter_shape; 4877 pcAlfParam->num_coeff = m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[best_filter_shape]; 4878 xFirstFilteringFrameLuma(pOrg, pDec, m_pcPicYuvTmp->getLumaAddr(), pcAlfParam, best_filter_shape, LumaStride); 4879 xCalcRDCost(pcPicOrg, m_pcPicYuvTmp, pcAlfParam, uiRate, uiDist, dCost); 4880 } 4881 } 4882 else 4883 { 4884 decideFilterShapeLuma(pOrg, pDec, LumaStride, pcAlfParam, uiRate, uiDist, dCost); 4885 } 4886 4887 dCost -= adExtraCostReduction[m_uiVarGenMethod]; 4888 4889 if(dCost < dMinMethodCost) 4890 { 4891 iBestClassMethod = m_uiVarGenMethod; 4892 dMinMethodCost = dCost; 4893 uiMinMethodRate= uiRate; 4894 uiMinMethodDist = uiDist; 4895 4896 if(m_iALFEncodePassReduction == 0) 4897 { 4898 m_pcPicYuvTmp->copyToPicLuma(pcPicRest); 4899 } 4900 } 4901 } 4902 4903 m_uiVarGenMethod = iBestClassMethod; 4904 dMinMethodCost += adExtraCostReduction[m_uiVarGenMethod]; 4905 m_varImg= m_varImgMethods[m_uiVarGenMethod]; 4906 4907 pcAlfParam = &(cFrmAlfParam[m_uiVarGenMethod]); 4908 4909 ALFParam cAlfParamWithBestMethod; 4910 allocALFParam(&cAlfParamWithBestMethod); 4911 4912 4913 if(m_iALFEncodePassReduction ==0) 4914 { 4915 copyALFParam(&cAlfParamWithBestMethod, pcAlfParam); 4916 } 4917 else 4918 { 4919 cAlfParamWithBestMethod.alf_flag = 1; 4920 cAlfParamWithBestMethod.chroma_idc = 0; 4921 cAlfParamWithBestMethod.alf_pcr_region_flag = m_uiVarGenMethod; 4922 cAlfParamWithBestMethod.filter_shape= pcAlfParam->filter_shape; 4923 cAlfParamWithBestMethod.num_coeff = m_sqrFiltLengthTab[cAlfParamWithBestMethod.filter_shape]; 4924 decodeFilterSet(pcAlfParam, m_varIndTab, m_filterCoeffSym); 4925 if(!m_bUseNonCrossALF) 4926 { 4927 filterLuma(pRest, pDec, LumaStride, 0, m_img_height-1, 0, m_img_width-1, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg); 4928 } 4929 else 4930 { 4931 xfilterSlicesEncoder(pDec, pRest, LumaStride, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg); 4932 } 4933 xcodeFiltCoeff(m_filterCoeffSym, pcAlfParam->filter_shape, m_varIndTab, pcAlfParam->filters_per_group,&cAlfParamWithBestMethod); 4934 4935 xCalcRDCost(pcPicOrg, pcPicRest, &cAlfParamWithBestMethod, uiMinMethodRate, uiMinMethodDist, dMinMethodCost); 4936 4937 } 4938 4939 if(dMinMethodCost < rdMinCost ) 4940 { 4941 ruiMinRate = uiMinMethodRate; 4942 ruiMinDist = uiMinMethodDist; 4943 rdMinCost = dMinMethodCost; 4944 copyALFParam(m_pcBestAlfParam, &cAlfParamWithBestMethod); 4945 } 4946 4947 freeALFParam(&cAlfParamWithBestMethod); 4948 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++) 4949 { 4950 freeALFParam(&cFrmAlfParam[i]); 4951 } 4952 } 4953 4954 4955 4956 Void TEncAdaptiveLoopFilter::xFirstFilteringFrameLuma(Pel* imgOrg, Pel* imgDec, Pel* imgRest, ALFParam* ALFp, Int filtNo, Int stride) 4957 { 4958 if(!m_bUseNonCrossALF) 4959 { 4960 xstoreInBlockMatrix(0, 0, m_img_height, m_img_width, true, true, imgOrg, imgDec, filtNo, stride); 4961 } 4962 else 4963 { 4964 xstoreInBlockMatrixforSlices(imgOrg, imgDec, filtNo, stride); 4965 } 4966 4967 4968 xFilteringFrameLuma(imgOrg, imgDec, imgRest, ALFp, filtNo, stride); 4969 } 4970 4971 Void TEncAdaptiveLoopFilter::xstoreInBlockMatrix(Int ypos, Int xpos, Int iheight, Int iwidth, Bool bResetBlockMatrix, Bool bSymmCopyBlockMatrix, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int stride) 4972 { 4973 4974 Pel regionOfInterested = (m_iDesignCurrentFilter ==1)?(1):(0); 4975 Int sqrFiltLength = (filtNo == 2)?((Int)(MAX_SQR_FILT_LENGTH)):(m_sqrFiltLengthTab[filtNo]); 4976 Int yposEnd = ypos + iheight -1; 4977 Int xposEnd = xpos + iwidth -1; 4978 Double ***EShape = m_EGlobalSym[filtNo]; 4979 Double **yShape = m_yGlobalSym[filtNo]; 4980 4981 Int ELocal[MAX_SQR_FILT_LENGTH]; 4982 Pel *pImgPad1, *pImgPad2, *pImgPad3, *pImgPad4; 4983 Int i,j,k,l,varInd, yLocal; 4984 double **E,*yy; 4985 4986 static Int numValidPels; 4987 if(bResetBlockMatrix) 4988 { 4989 numValidPels = 0; 4990 memset( m_pixAcc, 0,sizeof(double)*NO_VAR_BINS); 4991 for (varInd=0; varInd<NO_VAR_BINS; varInd++) 4992 { 4993 memset(yShape[varInd],0,sizeof(double)*MAX_SQR_FILT_LENGTH); 4994 for (k=0; k<sqrFiltLength; k++) 4995 { 4996 memset(EShape[varInd][k],0,sizeof(double)*MAX_SQR_FILT_LENGTH); 4997 } 4998 } 4999 for (i = 0; i < m_img_height; i++) 5000 { 5001 for (j = 0; j < m_img_width; j++) 5002 { 5003 if (m_maskImg[i][j] == regionOfInterested) 5004 { 5005 numValidPels++; 5006 } 5007 } 5008 } 5009 } 5010 5011 Int yLineInLCU; 5012 Int paddingLine ; 5013 5014 pImgPad += (ypos* stride); 5015 pImgOrg += (ypos* stride); 5016 5017 switch(filtNo) 5018 { 5019 #if !ALF_SINGLE_FILTER_SHAPE 5020 case ALF_STAR5x5: 5021 { 5022 for (i= ypos; i<= yposEnd; i++) 5023 { 5024 yLineInLCU = i % m_lcuHeight; 5025 5026 if (yLineInLCU < m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height ) 5027 { 5028 pImgPad1 = pImgPad + stride; 5029 pImgPad2 = pImgPad - stride; 5030 pImgPad3 = pImgPad + 2*stride; 5031 pImgPad4 = pImgPad - 2*stride; 5032 } 5033 else if (yLineInLCU < m_lineIdxPadTop) 5034 { 5035 paddingLine = - yLineInLCU + m_lineIdxPadTop - 1; 5036 pImgPad1 = pImgPad + min(paddingLine, 1)*stride; 5037 pImgPad2 = pImgPad - stride; 5038 pImgPad3 = pImgPad + min(paddingLine, 2)*stride; 5039 pImgPad4 = pImgPad - 2*stride; 5040 } 5041 else 5042 { 5043 paddingLine = yLineInLCU - m_lineIdxPadTop; 5044 pImgPad1 = pImgPad + stride; 5045 pImgPad2 = pImgPad - min(paddingLine, 1)*stride; 5046 pImgPad3 = pImgPad + 2*stride; 5047 pImgPad4 = pImgPad - min(paddingLine, 2)*stride; 5048 } 5049 5050 if ( (yLineInLCU == m_lineIdxPadTop || yLineInLCU == m_lineIdxPadTop-1) && i-yLineInLCU+m_lcuHeight < m_img_height ) 5051 { 5052 pImgPad+= stride; 5053 pImgOrg+= stride; 5054 continue; 5055 } 5056 else 5057 { 5058 for (j= xpos; j<= xposEnd; j++) 5059 { 5060 if ( (m_maskImg[i][j] == regionOfInterested) || (numValidPels == 0) ) 5061 { 5062 varInd = m_varImg[i/VAR_SIZE_H][j/VAR_SIZE_W]; 5063 memset(ELocal, 0, 10*sizeof(Int)); 5064 5065 ELocal[0] = (pImgPad3[j+2] + pImgPad4[j-2]); 5066 ELocal[1] = (pImgPad3[j ] + pImgPad4[j ]); 5067 ELocal[2] = (pImgPad3[j-2] + pImgPad4[j+2]); 5068 5069 ELocal[3] = (pImgPad1[j+1] + pImgPad2[j-1]); 5070 ELocal[4] = (pImgPad1[j ] + pImgPad2[j ]); 5071 ELocal[5] = (pImgPad1[j-1] + pImgPad2[j+1]); 5072 5073 ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]); 5074 ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]); 5075 ELocal[8] = (pImgPad[j ]); 5076 5077 yLocal= pImgOrg[j]; 5078 m_pixAcc[varInd]+=(yLocal*yLocal); 5079 E= EShape[varInd]; 5080 yy= yShape[varInd]; 5081 5082 for (k=0; k<10; k++) 5083 { 5084 for (l=k; l<10; l++) 5085 { 5086 E[k][l]+=(double)(ELocal[k]*ELocal[l]); 5087 } 5088 yy[k]+=(double)(ELocal[k]*yLocal); 5089 } 5090 5091 } 5092 } 5093 pImgPad+= stride; 5094 pImgOrg+= stride; 5095 } 5096 } 5097 } 5098 break; 5099 case ALF_CROSS9x9: 5100 { 5101 Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8; 5102 #else 5103 case ALF_CROSS9x7_SQUARE3x3: 5104 { 5105 Pel *pImgPad5, *pImgPad6; 5106 #endif 5107 for (i= ypos; i<= yposEnd; i++) 5108 { 5109 yLineInLCU = i % m_lcuHeight; 5110 5111 if (yLineInLCU<m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height) 5112 { 5113 pImgPad1 = pImgPad + stride; 5114 pImgPad2 = pImgPad - stride; 5115 pImgPad3 = pImgPad + 2*stride; 5116 pImgPad4 = pImgPad - 2*stride; 5117 pImgPad5 = pImgPad + 3*stride; 5118 pImgPad6 = pImgPad - 3*stride; 5119 #if !ALF_SINGLE_FILTER_SHAPE 5120 pImgPad7 = pImgPad + 4*stride; 5121 pImgPad8 = pImgPad - 4*stride; 5122 #endif 5123 } 5124 else if (yLineInLCU<m_lineIdxPadTop) 5125 { 5126 paddingLine = - yLineInLCU + m_lineIdxPadTop - 1; 5127 pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad + min(paddingLine, 1)*stride; 5128 pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad - stride; 5129 pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + min(paddingLine, 2)*stride; 5130 pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - 2*stride; 5131 pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + min(paddingLine, 3)*stride; 5132 pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - 3*stride; 5133 #if !ALF_SINGLE_FILTER_SHAPE 5134 pImgPad7 = (paddingLine < 4) ? pImgPad : pImgPad + min(paddingLine, 4)*stride; 5135 pImgPad8 = (paddingLine < 4) ? pImgPad : pImgPad - 4*stride; 5136 #endif 5137 } 5138 else 5139 { 5140 paddingLine = yLineInLCU - m_lineIdxPadTop; 5141 pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad + stride; 5142 pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad - min(paddingLine, 1)*stride; 5143 pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + 2*stride; 5144 pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - min(paddingLine, 2)*stride; 5145 pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + 3*stride; 5146 pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - min(paddingLine, 3)*stride; 5147 #if !ALF_SINGLE_FILTER_SHAPE 5148 pImgPad7 = (paddingLine < 4) ? pImgPad : pImgPad + 4*stride; 5149 pImgPad8 = (paddingLine < 4) ? pImgPad : pImgPad - min(paddingLine, 4)*stride; 5150 #endif 5151 } 5152 5153 for (j= xpos; j<= xposEnd; j++) 5154 { 5155 if ( (m_maskImg[i][j] == regionOfInterested) || (numValidPels == 0) ) 5156 { 5157 varInd = m_varImg[i/VAR_SIZE_H][j/VAR_SIZE_W]; 5158 5159 #if ALF_SINGLE_FILTER_SHAPE 5160 memset(ELocal, 0, (sqrFiltLength+1)*sizeof(Int)); 5161 5162 ELocal[0] = (pImgPad5[j]+pImgPad6[j]); 5163 ELocal[1] = (pImgPad3[j]+pImgPad4[j]); 5164 ELocal[2] = (pImgPad1[j-1]+pImgPad2[j+1]); 5165 ELocal[3] = (pImgPad1[j]+pImgPad2[j]); 5166 ELocal[4] = (pImgPad1[j+1]+pImgPad2[j-1]); 5167 ELocal[5] = (pImgPad[j+4]+pImgPad[j-4]); 5168 ELocal[6] = (pImgPad[j+3]+pImgPad[j-3]); 5169 ELocal[7] = (pImgPad[j+2]+pImgPad[j-2]); 5170 ELocal[8] = (pImgPad[j+1]+pImgPad[j-1]); 5171 ELocal[9] = (pImgPad[j ]); 5172 #else 5173 memset(ELocal, 0, 10*sizeof(Int)); 5174 5175 ELocal[0] = (pImgPad7[j] + pImgPad8[j]); 5176 5177 ELocal[1] = (pImgPad5[j] + pImgPad6[j]); 5178 5179 ELocal[2] = (pImgPad3[j] + pImgPad4[j]); 5180 5181 ELocal[3] = (pImgPad1[j] + pImgPad2[j]); 5182 5183 ELocal[4] = (pImgPad[j+4] + pImgPad[j-4]); 5184 ELocal[5] = (pImgPad[j+3] + pImgPad[j-3]); 5185 ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]); 5186 ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]); 5187 ELocal[8] = (pImgPad[j ] ); 5188 #endif 5189 yLocal= pImgOrg[j]; 5190 m_pixAcc[varInd]+=(yLocal*yLocal); 5191 E= EShape[varInd]; 5192 yy= yShape[varInd]; 5193 5194 #if ALF_SINGLE_FILTER_SHAPE 5195 for (k=0; k<(sqrFiltLength+1); k++) 5196 { 5197 for (l=k; l<(sqrFiltLength+1); l++) 5198 { 5199 E[k][l]+=(double)(ELocal[k]*ELocal[l]); 5200 } 5201 yy[k]+=(double)(ELocal[k]*yLocal); 5202 } 5203 #else 5204 for (k=0; k<10; k++) 5205 { 5206 for (l=k; l<10; l++) 5207 { 5208 E[k][l]+=(double)(ELocal[k]*ELocal[l]); 5209 } 5210 yy[k]+=(double)(ELocal[k]*yLocal); 5211 } 5212 #endif 5213 } 5214 } 5215 pImgPad+= stride; 5216 pImgOrg+= stride; 5217 } 5218 5219 } 5220 break; 5221 default: 5222 { 5223 printf("Not a supported filter shape\n"); 5224 assert(0); 5225 exit(1); 5226 } 5227 } 5228 5229 if(bSymmCopyBlockMatrix) 5230 { 5231 for (varInd=0; varInd<NO_VAR_BINS; varInd++) 5232 { 5233 double **pE = EShape[varInd]; 5234 for (k=1; k<sqrFiltLength; k++) 5235 { 5236 for (l=0; l<k; l++) 5237 { 5238 pE[k][l]=pE[l][k]; 5239 } 5240 } 5241 } 5242 } 5243 } 5244 5245 5246 Void TEncAdaptiveLoopFilter::xFilteringFrameLuma(Pel* imgOrg, Pel* imgPad, Pel* imgFilt, ALFParam* ALFp, Int filtNo, Int stride) 5247 { 5248 static double **ySym, ***ESym; 5249 Int filters_per_fr; 5250 Int lambdaVal = (Int) m_dLambdaLuma; 5251 lambdaVal = lambdaVal * (1<<(2*g_uiBitIncrement)); 5252 5253 ESym=m_EGlobalSym[filtNo]; 5254 ySym=m_yGlobalSym[filtNo]; 5255 5256 xfindBestFilterVarPred(ySym, ESym, m_pixAcc, m_filterCoeffSym, m_filterCoeffSymQuant, filtNo, &filters_per_fr,m_varIndTab, NULL, m_varImg, m_maskImg, NULL, lambdaVal); 5257 5258 if(!m_bUseNonCrossALF) 5259 { 5260 filterLuma(imgFilt, imgPad, stride, 0, m_img_height-1, 0, m_img_width-1, ALFp->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg); 5261 } 5262 else 5263 { 5264 xfilterSlicesEncoder(imgPad, imgFilt, stride, filtNo, m_filterCoeffSym, m_varIndTab, m_varImg); 5265 } 5266 5267 xcodeFiltCoeff(m_filterCoeffSymQuant, filtNo, m_varIndTab, filters_per_fr,ALFp); 5268 } 5269 #endif 5270 5271 #if LCU_SYNTAX_ALF 3786 5272 3787 Void TEncAdaptiveLoopFilter::xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant, Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val, Int numMaxFilters) 5273 #else5274 Void TEncAdaptiveLoopFilter::xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant, Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val)5275 #endif5276 3788 { 5277 3789 Int filters_per_fr, firstFilt, interval[NO_VAR_BINS][2], intervalBest[NO_VAR_BINS][2]; … … 5305 3817 5306 3818 lagrangian=xfindBestCoeffCodMethod(filterCoeffSymQuant, filter_shape, sqrFiltLength, filters_per_fr, errorForce0CoeffTab, lambda_val); 5307 #if LCU_SYNTAX_ALF5308 3819 if (lagrangian<lagrangianMin || firstFilt==1 || filters_per_fr == numMaxFilters) 5309 #else5310 if (lagrangian<lagrangianMin || firstFilt==1 || filters_per_fr == m_iALFMaxNumberFilters)5311 #endif5312 3820 { 5313 3821 firstFilt=0; … … 5319 3827 filters_per_fr--; 5320 3828 } 5321 #if !ALF_16_BA_GROUPS5322 if ( (m_uiVarGenMethod == ALF_BA) && ((*filters_per_fr_best) > 1) )5323 {5324 Int iLastFilter = (*filters_per_fr_best)-1;5325 if (intervalBest[iLastFilter][0] == NO_VAR_BINS-1)5326 {5327 intervalBest[iLastFilter-1][1] = NO_VAR_BINS-1;5328 (*filters_per_fr_best) = iLastFilter;5329 }5330 }5331 #endif5332 3829 findFilterCoeff(ESym, ySym, pixAcc, filterCoeffSym, filterCoeffSymQuant, intervalBest, 5333 3830 varIndTab, sqrFiltLength, (*filters_per_fr_best), weights, errorForce0CoeffTab); … … 5489 3986 * \param [in,out]vAlfCUCtrlParam ALF CU control parameters 5490 3987 */ 5491 #if LCU_SYNTAX_ALF5492 3988 #if HHI_INTERVIEW_SKIP 5493 3989 Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlags(UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Pel* imgUsed, Int stride, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam) … … 5495 3991 Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlags(UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Int stride, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam) 5496 3992 #endif 5497 #else5498 #if HHI_INTERVIEW_SKIP5499 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlags_qc(UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, TComPicYuv* pUsedPelMap, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)5500 #else5501 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlags_qc(UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)5502 #endif5503 #endif5504 3993 { 5505 3994 ruiDist = 0; … … 5520 4009 { 5521 4010 TComDataCU* pcCU = m_pcPic->getCU( CUAddr ); 5522 #if LCU_SYNTAX_ALF5523 4011 #if HHI_INTERVIEW_SKIP 5524 4012 setCUAlfCtrlFlag(pcCU, 0, 0, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, imgUsed, stride, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag); 5525 4013 #else 5526 4014 setCUAlfCtrlFlag(pcCU, 0, 0, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, stride, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag); 5527 #endif5528 #else5529 #if HHI_INTERVIEW_SKIP5530 xSetCUAlfCtrlFlag_qc(pcCU, 0, 0, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest,imgUsed, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag);5531 #else5532 xSetCUAlfCtrlFlag_qc(pcCU, 0, 0, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag);5533 #endif5534 4015 #endif 5535 4016 } … … 5569 4050 } 5570 4051 5571 #if LCU_SYNTAX_ALF5572 4052 #if HHI_INTERVIEW_SKIP 5573 4053 Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Pel* imgUsed, Int stride, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag) 5574 4054 #else 5575 4055 Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Int stride, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag) 5576 #endif5577 #else5578 #if HHI_INTERVIEW_SKIP5579 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlag_qc(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, TComPicYuv* pcUsedPelMap, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag)5580 #else5581 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlag_qc(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag)5582 #endif5583 4056 #endif 5584 4057 { … … 5603 4076 5604 4077 if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) 5605 #if LCU_SYNTAX_ALF5606 4078 #if HHI_INTERVIEW_SKIP 5607 4079 setCUAlfCtrlFlag(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, imgUsed, stride, ruiDist, vCUCtrlFlag); … … 5609 4081 setCUAlfCtrlFlag(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, stride, ruiDist, vCUCtrlFlag); 5610 4082 #endif 5611 #else5612 #if HHI_INTERVIEW_SKIP5613 xSetCUAlfCtrlFlag_qc(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest, imgUsed, ruiDist, vCUCtrlFlag);5614 #else5615 xSetCUAlfCtrlFlag_qc(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest, ruiDist, vCUCtrlFlag);5616 #endif5617 #endif5618 4083 } 5619 4084 return; … … 5624 4089 return; 5625 4090 } 5626 #if !LCU_SYNTAX_ALF5627 UInt uiCUAddr = pcCU->getAddr();5628 #endif5629 4091 UInt64 uiRecSSD = 0; 5630 4092 UInt64 uiFiltSSD = 0; … … 5661 4123 } 5662 4124 5663 #if LCU_SYNTAX_ALF5664 4125 Int offset = uiTPelY*stride + uiLPelX; 5665 4126 Pel* pOrg = imgOrg + offset; … … 5679 4140 uiFiltSSD += xCalcSSD( pOrg, pFilt, iWidth, iHeight, stride ); 5680 4141 #endif 5681 #else5682 Pel* pOrg = pcPicOrg->getLumaAddr(uiCUAddr, uiAbsPartIdx);5683 Pel* pRec = pcPicDec->getLumaAddr(uiCUAddr, uiAbsPartIdx);5684 Pel* pFilt = pcPicRest->getLumaAddr(uiCUAddr, uiAbsPartIdx);5685 5686 #if HHI_INTERVIEW_SKIP5687 Pel* pUsed = pcUsedPelMap->getLumaAddr(uiCUAddr, uiAbsPartIdx);5688 uiRecSSD += xCalcSSD( pOrg, pRec, pUsed, iWidth, iHeight, pcPicOrg->getStride() );5689 uiFiltSSD += xCalcSSD( pOrg, pFilt, pUsed, iWidth, iHeight, pcPicOrg->getStride() );5690 #else5691 uiRecSSD += xCalcSSD( pOrg, pRec, iWidth, iHeight, pcPicOrg->getStride() );5692 uiFiltSSD += xCalcSSD( pOrg, pFilt, iWidth, iHeight, pcPicOrg->getStride() );5693 #endif5694 #endif5695 4142 if (uiFiltSSD < uiRecSSD) 5696 4143 { … … 5699 4146 vCUCtrlFlag.push_back(1); 5700 4147 5701 #if LCU_SYNTAX_ALF5702 4148 for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(m_img_height-1)) ;i++) 5703 4149 { 5704 4150 for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(m_img_width-1)) ;j++) 5705 4151 { 5706 #else5707 for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(pcPicOrg->getHeight()-1)) ;i++)5708 {5709 for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(pcPicOrg->getWidth()-1)) ;j++)5710 {5711 #endif5712 4152 m_maskImg[i][j]=1; 5713 4153 } … … 5719 4159 pcCU->setAlfCtrlFlagSubParts(0, uiAbsPartIdx, uiSetDepth); 5720 4160 vCUCtrlFlag.push_back(0); 5721 #if LCU_SYNTAX_ALF5722 4161 for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(m_img_height-1)) ;i++) 5723 4162 { 5724 4163 for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(m_img_width-1)) ;j++) 5725 4164 { 5726 #else5727 for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(pcPicOrg->getHeight()-1)) ;i++)5728 {5729 for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(pcPicOrg->getWidth()-1)) ;j++)5730 {5731 #endif5732 4165 m_maskImg[i][j]=0; 5733 4166 } … … 5736 4169 } 5737 4170 5738 #if !LCU_SYNTAX_ALF5739 5740 Void TEncAdaptiveLoopFilter::xReDesignFilterCoeff_qc(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, Bool bReadCorr)5741 {5742 Int tap = m_pcTempAlfParam->filter_shape;5743 Int LumaStride = pcPicOrg->getStride();5744 Pel* pOrg = pcPicOrg->getLumaAddr();5745 Pel* pDec = pcPicDec->getLumaAddr();5746 Pel* pRest = pcPicRest->getLumaAddr();5747 xFirstFilteringFrameLuma(pOrg, pDec, pRest, m_pcTempAlfParam, tap, LumaStride);5748 5749 if (m_iALFEncodePassReduction)5750 {5751 if(!m_iUsePreviousFilter)5752 {5753 saveFilterCoeffToBuffer(m_filterCoeffSym, m_pcTempAlfParam->filters_per_group, m_varIndTab, m_pcTempAlfParam->alf_pcr_region_flag, tap);5754 }5755 }5756 }5757 5758 Void TEncAdaptiveLoopFilter::xCUAdaptiveControl_qc(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost)5759 {5760 if(!m_bAlfCUCtrlEnabled) return;5761 Bool bChanged = false;5762 std::vector<AlfCUCtrlInfo> vAlfCUCtrlParamTemp(m_vBestAlfCUCtrlParam);5763 5764 Pel** maskImgTemp;5765 5766 if(m_iALFEncodePassReduction == 2)5767 {5768 initMatrix_Pel(&maskImgTemp, m_img_height, m_img_width);5769 }5770 5771 m_pcEntropyCoder->setAlfCtrl(true);5772 5773 UInt uiBestDepth = 0;5774 5775 ALFParam cFrmAlfParam;5776 allocALFParam(&cFrmAlfParam);5777 copyALFParam(&cFrmAlfParam, m_pcBestAlfParam);5778 5779 for (UInt uiDepth = 0; uiDepth < g_uiMaxCUDepth; uiDepth++)5780 {5781 m_pcEntropyCoder->setMaxAlfCtrlDepth(uiDepth);5782 pcPicRest->copyToPicLuma(m_pcPicYuvTmp);5783 copyALFParam(m_pcTempAlfParam, &cFrmAlfParam);5784 5785 for (UInt uiRD = 0; uiRD <= m_iALFNumOfRedesign; uiRD++)5786 {5787 if (uiRD)5788 {5789 // re-design filter coefficients5790 xReDesignFilterCoeff_qc(pcPicOrg, pcPicDec, m_pcPicYuvTmp, true); //use filtering of mine5791 }5792 5793 UInt64 uiRate, uiDist;5794 Double dCost;5795 //m_pcPicYuvTmp: filtered signal, pcPicDec: orig reconst5796 xSetCUAlfCtrlFlags_qc(uiDepth, pcPicOrg, pcPicDec, m_pcPicYuvTmp, uiDist, vAlfCUCtrlParamTemp);5797 xCalcRDCost(m_pcTempAlfParam, uiRate, uiDist, dCost, &vAlfCUCtrlParamTemp);5798 if (dCost < rdMinCost)5799 {5800 bChanged = true;5801 m_vBestAlfCUCtrlParam = vAlfCUCtrlParamTemp;5802 uiBestDepth = uiDepth;5803 rdMinCost = dCost;5804 ruiMinDist = uiDist;5805 ruiMinRate = uiRate;5806 m_pcPicYuvTmp->copyToPicLuma(m_pcPicYuvBest);5807 copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);5808 //save maskImg5809 xCopyTmpAlfCtrlFlagsFrom();5810 if(m_iALFEncodePassReduction == 2)5811 {5812 ::memcpy(maskImgTemp[0], m_maskImg[0], sizeof(Pel)*m_img_height* m_img_width);5813 }5814 }5815 }5816 }5817 5818 if(bChanged)5819 {5820 if(m_iALFEncodePassReduction == 2)5821 {5822 UInt uiDepth = uiBestDepth;5823 ::memcpy(m_maskImg[0], maskImgTemp[0], sizeof(Pel)*m_img_height* m_img_width);5824 xCopyTmpAlfCtrlFlagsTo();5825 5826 copyALFParam(&cFrmAlfParam, m_pcBestAlfParam);5827 5828 m_pcEntropyCoder->setAlfCtrl(true);5829 m_pcEntropyCoder->setMaxAlfCtrlDepth(uiDepth);5830 copyALFParam(m_pcTempAlfParam, &cFrmAlfParam);5831 5832 xReDesignFilterCoeff_qc(pcPicOrg, pcPicDec, m_pcPicYuvTmp, true); //use filtering of mine5833 5834 UInt64 uiRate, uiDist;5835 Double dCost;5836 xSetCUAlfCtrlFlags_qc(uiDepth, pcPicOrg, pcPicDec, m_pcPicYuvTmp, uiDist, vAlfCUCtrlParamTemp);5837 xCalcRDCost(m_pcTempAlfParam, uiRate, uiDist, dCost, &vAlfCUCtrlParamTemp);5838 if (dCost < rdMinCost)5839 {5840 rdMinCost = dCost;5841 ruiMinDist = uiDist;5842 ruiMinRate = uiRate;5843 m_pcPicYuvTmp->copyToPicLuma(m_pcPicYuvBest);5844 copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);5845 xCopyTmpAlfCtrlFlagsFrom();5846 m_vBestAlfCUCtrlParam = vAlfCUCtrlParamTemp;5847 }5848 }5849 5850 m_pcEntropyCoder->setAlfCtrl(true);5851 m_pcEntropyCoder->setMaxAlfCtrlDepth(uiBestDepth);5852 xCopyTmpAlfCtrlFlagsTo();5853 5854 m_pcPicYuvBest->copyToPicLuma(pcPicRest);//copy m_pcPicYuvBest to pcPicRest5855 xCopyDecToRestCUs(pcPicDec, pcPicRest); //pcPicRest = pcPicDec5856 }5857 else5858 {5859 m_pcEntropyCoder->setAlfCtrl(false);5860 m_pcEntropyCoder->setMaxAlfCtrlDepth(0);5861 }5862 freeALFParam(&cFrmAlfParam);5863 5864 if(m_iALFEncodePassReduction == 2)5865 {5866 destroyMatrix_Pel(maskImgTemp);5867 }5868 }5869 5870 #endif5871 4171 5872 4172 #define ROUND(a) (((a) < 0)? (int)((a) - 0.5) : (int)((a) + 0.5)) … … 6242 4542 { 6243 4543 double error; 6244 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS4544 #if LCUALF_QP_DEPENDENT_BITS 6245 4545 Int factor = (1<<(getAlfPrecisionBit(m_alfQP))); 6246 4546 #else … … 6384 4684 } 6385 4685 6386 #if !LCU_SYNTAX_ALF6387 6388 /** Save redesigned filter set to buffer6389 * \param filterCoeffPrevSelected filter set buffer6390 */6391 Void TEncAdaptiveLoopFilter::saveFilterCoeffToBuffer(Int **filterSet, Int numFilter, Int* mergeTable, Int mode, Int filtNo)6392 {6393 Int iBufferIndex = m_iCurrentPOC % m_iGOPSize;6394 6395 static Bool bFirst = true;6396 static Bool* pbFirstAccess;6397 if(bFirst)6398 {6399 pbFirstAccess = new Bool[NUM_ALF_CLASS_METHOD];6400 for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)6401 {6402 pbFirstAccess[i]= true;6403 }6404 bFirst = false;6405 }6406 6407 if(iBufferIndex == 0)6408 {6409 if(pbFirstAccess[mode])6410 {6411 //store merge table6412 ::memcpy(m_mergeTableSavedMethods[mode][m_iGOPSize], mergeTable, sizeof(Int)*NO_VAR_BINS);6413 //store coefficients6414 for(Int varInd=0; varInd< numFilter; varInd++)6415 {6416 ::memcpy(m_aiFilterCoeffSavedMethods[mode][m_iGOPSize][varInd],filterSet[varInd], sizeof(Int)*ALF_MAX_NUM_COEF );6417 }6418 //store filter shape6419 m_iPreviousFilterShapeMethods[mode][m_iGOPSize]= filtNo;6420 6421 pbFirstAccess[mode] = false;6422 }6423 6424 6425 //store merge table6426 ::memcpy(m_mergeTableSavedMethods[mode][0 ], m_mergeTableSavedMethods[mode][m_iGOPSize], sizeof(Int)*NO_VAR_BINS);6427 ::memcpy(m_mergeTableSavedMethods[mode][m_iGOPSize], mergeTable, sizeof(Int)*NO_VAR_BINS);6428 6429 //store coefficients6430 for(Int varInd=0; varInd< NO_VAR_BINS; varInd++)6431 {6432 ::memcpy(m_aiFilterCoeffSavedMethods[mode][0][varInd],m_aiFilterCoeffSavedMethods[mode][m_iGOPSize][varInd], sizeof(Int)*ALF_MAX_NUM_COEF );6433 }6434 6435 for(Int varInd=0; varInd< numFilter; varInd++)6436 {6437 ::memcpy(m_aiFilterCoeffSavedMethods[mode][m_iGOPSize][varInd],filterSet[varInd], sizeof(Int)*ALF_MAX_NUM_COEF );6438 }6439 6440 //store filter shape6441 m_iPreviousFilterShapeMethods[mode][0]= m_iPreviousFilterShapeMethods[mode][m_iGOPSize];6442 m_iPreviousFilterShapeMethods[mode][m_iGOPSize]= filtNo;6443 }6444 else6445 {6446 6447 //store merge table6448 ::memcpy(m_mergeTableSavedMethods[mode][iBufferIndex], mergeTable, sizeof(Int)*NO_VAR_BINS);6449 6450 //store coefficients6451 for(Int varInd=0; varInd< numFilter; varInd++)6452 {6453 ::memcpy(m_aiFilterCoeffSavedMethods[mode][iBufferIndex][varInd],filterSet[varInd], sizeof(Int)*ALF_MAX_NUM_COEF );6454 }6455 //store filter_shape6456 m_iPreviousFilterShapeMethods[mode][iBufferIndex]= filtNo;6457 6458 }6459 }6460 6461 6462 /** set initial m_maskImg with previous (time-delayed) filters6463 * \param pcPicOrg original picture6464 * \param pcPicDec reconstructed picture after deblocking6465 */6466 Void TEncAdaptiveLoopFilter::setMaskWithTimeDelayedResults(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec)6467 {6468 6469 static Pel** bestImgMask;6470 static Bool bFirst = true;6471 if(bFirst)6472 {6473 initMatrix_Pel(&bestImgMask, m_img_height, m_img_width);6474 bFirst = false;6475 }6476 6477 Pel* pDec = pcPicDec->getLumaAddr();6478 Pel* pOrg = pcPicOrg->getLumaAddr();6479 Pel* pRest = m_pcPicYuvTmp->getLumaAddr();6480 Int LumaStride = pcPicOrg->getStride();6481 Int*** pppCoeffSaved = m_aiFilterCoeffSavedMethods [m_uiVarGenMethod];6482 Int** ppMergeTableSaved = m_mergeTableSavedMethods [m_uiVarGenMethod];6483 Int* pFilterShapeSaved = m_iPreviousFilterShapeMethods[m_uiVarGenMethod];6484 Int iBufIdx;6485 6486 UInt64 uiRate, uiDist;6487 Double dCost, dMinCost = MAX_DOUBLE;6488 ALFParam cAlfParam;6489 allocALFParam(&cAlfParam);6490 cAlfParam.alf_flag = 0;6491 cAlfParam.chroma_idc = 0;6492 6493 //filter frame with the previous time-delayed filters6494 Int filtNo;6495 Int maxDepth = (pcPicOrg->getWidth() < 1000) ?(2):(g_uiMaxCUDepth);6496 m_pcEntropyCoder->setAlfCtrl(true);6497 m_pcTempAlfParam->alf_flag = 1;6498 m_pcTempAlfParam->alf_pcr_region_flag = m_uiVarGenMethod;6499 6500 for (Int index=0; index<2; index++)6501 {6502 iBufIdx = setFilterIdx(index);6503 filtNo = m_pcTempAlfParam->filter_shape = pFilterShapeSaved[iBufIdx];6504 #if ALF_SINGLE_FILTER_SHAPE6505 assert(filtNo == ALF_CROSS9x7_SQUARE3x3);6506 #else6507 assert(filtNo == ALF_STAR5x5 || filtNo == ALF_CROSS9x9);6508 #endif6509 m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[filtNo];6510 if(!m_bUseNonCrossALF)6511 {6512 filterLuma(pRest, pDec, LumaStride, 0, m_img_height-1, 0, m_img_width-1, filtNo, pppCoeffSaved[iBufIdx], ppMergeTableSaved[iBufIdx], m_varImg);6513 }6514 else6515 {6516 xfilterSlicesEncoder(pDec, pRest, LumaStride, filtNo, pppCoeffSaved[iBufIdx], ppMergeTableSaved[iBufIdx], m_varImg);6517 }6518 6519 for (UInt uiDepth = 0; uiDepth < maxDepth; uiDepth++)6520 {6521 m_pcEntropyCoder->setMaxAlfCtrlDepth(uiDepth);6522 std::vector<AlfCUCtrlInfo> vAlfCUCtrlParamTemp(m_uiNumSlicesInPic);6523 xSetCUAlfCtrlFlags_qc(uiDepth, pcPicOrg, pcPicDec, m_pcPicYuvTmp, uiDist, vAlfCUCtrlParamTemp);6524 m_pcEntropyCoder->resetEntropy();6525 m_pcEntropyCoder->resetBits();6526 xEncodeCUAlfCtrlFlags(vAlfCUCtrlParamTemp);6527 uiRate = m_pcEntropyCoder->getNumberOfWrittenBits();6528 dCost = (Double)(uiRate) * m_dLambdaLuma + (Double)(uiDist);6529 6530 if (dCost < dMinCost)6531 {6532 dMinCost = dCost;6533 copyALFParam(&cAlfParam, m_pcTempAlfParam);6534 ::memcpy(bestImgMask[0], m_maskImg[0], sizeof(Pel)*m_img_height* m_img_width);6535 }6536 }6537 }6538 filtNo = cAlfParam.filter_shape;6539 6540 6541 ::memcpy(m_maskImg[0], bestImgMask[0], sizeof(Pel)*m_img_height* m_img_width);6542 6543 m_pcEntropyCoder->setAlfCtrl(false);6544 m_pcEntropyCoder->setMaxAlfCtrlDepth(0);6545 6546 // generate filters for future reference6547 m_iDesignCurrentFilter = 0;6548 6549 int filters_per_fr;6550 int lambda_val = (Int)m_dLambdaLuma;6551 6552 lambda_val = lambda_val * (1<<(2*g_uiBitIncrement));6553 6554 if(!m_bUseNonCrossALF)6555 {6556 xstoreInBlockMatrix(0, 0, m_img_height, m_img_width, true, true, pOrg, pDec, cAlfParam.filter_shape, LumaStride);6557 }6558 else6559 {6560 xstoreInBlockMatrixforSlices(pOrg, pDec, cAlfParam.filter_shape, LumaStride);6561 }6562 xfindBestFilterVarPred(m_yGlobalSym[filtNo], m_EGlobalSym[filtNo], m_pixAcc,6563 m_filterCoeffSym, m_filterCoeffSymQuant,6564 filtNo, &filters_per_fr,6565 m_varIndTab, NULL, m_varImg, m_maskImg, NULL, lambda_val);6566 6567 saveFilterCoeffToBuffer(m_filterCoeffSym, filters_per_fr, m_varIndTab, cAlfParam.alf_pcr_region_flag, filtNo);6568 m_iDesignCurrentFilter = 1;6569 6570 freeALFParam(&cAlfParam);6571 6572 }6573 6574 6575 /** set ALF encoding parameters6576 * \param pcPic picture pointer6577 */6578 Void TEncAdaptiveLoopFilter::setALFEncodingParam(TComPic *pcPic)6579 {6580 if(m_iALFEncodePassReduction)6581 {6582 m_iALFNumOfRedesign = 0;6583 m_iCurrentPOC = m_pcPic->getPOC();6584 if((pcPic->getSlice(0)->getSliceType() == I_SLICE) || (m_iGOPSize==8 && (m_iCurrentPOC % 4 == 0)))6585 {6586 m_iUsePreviousFilter = 0;6587 }6588 else6589 {6590 m_iUsePreviousFilter = 1;6591 }6592 }6593 else6594 {6595 m_iALFNumOfRedesign = ALF_NUM_OF_REDESIGN;6596 }6597 m_iDesignCurrentFilter = 1;6598 6599 }6600 6601 /** set filter buffer index6602 * \param index the processing order of time-delayed filtering6603 */6604 Int TEncAdaptiveLoopFilter::setFilterIdx(Int index)6605 {6606 Int iBufIdx;6607 6608 if (m_iGOPSize == 8)6609 {6610 switch(m_iCurrentPOC % m_iGOPSize)6611 {6612 case 0:6613 {6614 iBufIdx = (index == 0)?0:m_iGOPSize;6615 }6616 break;6617 case 1:6618 {6619 iBufIdx = (index == 0)?0:2;6620 }6621 break;6622 case 2:6623 {6624 iBufIdx = (index == 0)?0:4;6625 }6626 break;6627 case 3:6628 {6629 iBufIdx = (index == 0)?2:4;6630 }6631 break;6632 case 4:6633 {6634 iBufIdx = (index == 0)?0:m_iGOPSize;6635 }6636 break;6637 case 5:6638 {6639 iBufIdx = (index == 0)?4:6;6640 }6641 break;6642 case 6:6643 {6644 iBufIdx = (index == 0)?4:m_iGOPSize;6645 }6646 break;6647 case 7:6648 {6649 iBufIdx = (index == 0)?6:m_iGOPSize;6650 }6651 break;6652 default:6653 {6654 printf("error\n");6655 assert(0);6656 }6657 }6658 }6659 else6660 {6661 iBufIdx = (index == 0)?0:m_iGOPSize;6662 }6663 6664 return iBufIdx;6665 }6666 6667 6668 /** set initial m_maskImg6669 * \param pcPicOrg original picture pointer6670 * \param pcPicDec reconstructed picture pointer6671 */6672 Void TEncAdaptiveLoopFilter::setInitialMask(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec)6673 {6674 Int Height = pcPicOrg->getHeight();6675 Int Width = pcPicOrg->getWidth();6676 Int LumaStride = pcPicOrg->getStride();6677 Pel* pDec = pcPicDec->getLumaAddr();6678 6679 calcVar(m_varImg, pDec, LumaStride, m_uiVarGenMethod);6680 6681 if(!m_iALFEncodePassReduction || !m_iUsePreviousFilter)6682 {6683 for(Int y=0; y<Height; y++)6684 {6685 for(Int x=0; x<Width; x++)6686 {6687 m_maskImg[y][x] = 1;6688 }6689 }6690 }6691 else6692 {6693 setMaskWithTimeDelayedResults(pcPicOrg, pcPicDec);6694 }6695 }6696 6697 6698 6699 /** Estimate RD cost of all filter size & store the best one6700 * \param ImgOrg original picture6701 * \param ImgDec reconstructed picture after deblocking6702 * \param Sride line buffer size of picture buffer6703 * \param pcAlfSaved the best Alf parameters6704 * \returns ruiDist estimated distortion6705 * \returns ruiRate required bits6706 * \returns rdCost estimated R-D cost6707 */6708 6709 Void TEncAdaptiveLoopFilter::decideFilterShapeLuma(Pel* ImgOrg, Pel* ImgDec, Int Stride, ALFParam* pcAlfSaved, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost)6710 {6711 static Double **ySym, ***ESym;6712 Int lambda_val = ((Int) m_dLambdaLuma) * (1<<(2*g_uiBitIncrement));6713 Int filtNo, filters_per_fr;6714 Int64 iEstimatedDist;6715 UInt64 uiRate;6716 Double dEstimatedCost, dEstimatedMinCost = MAX_DOUBLE;;6717 6718 UInt uiBitShift = (g_uiBitIncrement<<1);6719 Int64 iEstimateDistBeforeFilter;6720 Int* coeffNoFilter[NUM_ALF_FILTER_SHAPE][NO_VAR_BINS];6721 for(Int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE; filter_shape++)6722 {6723 for(Int i=0; i< NO_VAR_BINS; i++)6724 {6725 coeffNoFilter[filter_shape][i]= new Int[ALF_MAX_NUM_COEF];6726 ::memset(coeffNoFilter[filter_shape][i], 0, sizeof(Int)*ALF_MAX_NUM_COEF);6727 coeffNoFilter[filter_shape][i][ m_sqrFiltLengthTab[filter_shape]-1 ] = (1 << ((Int)ALF_NUM_BIT_SHIFT));6728 }6729 }6730 6731 m_pcTempAlfParam->alf_flag = 1;6732 m_pcTempAlfParam->chroma_idc = 0;6733 m_pcTempAlfParam->alf_pcr_region_flag = m_uiVarGenMethod;6734 6735 for (int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE ;filter_shape ++)6736 {6737 m_pcTempAlfParam->filter_shape = filtNo = filter_shape;6738 m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[filtNo] ;6739 6740 ESym = m_EGlobalSym [filtNo];6741 ySym = m_yGlobalSym [filtNo];6742 6743 if(!m_bUseNonCrossALF)6744 {6745 xstoreInBlockMatrix(0, 0, m_img_height, m_img_width, true, true, ImgOrg, ImgDec, filter_shape, Stride);6746 }6747 else6748 {6749 xstoreInBlockMatrixforSlices(ImgOrg, ImgDec, filter_shape, Stride);6750 }6751 xfindBestFilterVarPred(ySym, ESym, m_pixAcc, m_filterCoeffSym, m_filterCoeffSymQuant, filtNo, &filters_per_fr, m_varIndTab, NULL, m_varImg, m_maskImg, NULL, lambda_val);6752 6753 //estimate R-D cost6754 uiRate = xcodeFiltCoeff(m_filterCoeffSymQuant, filtNo, m_varIndTab, filters_per_fr, m_pcTempAlfParam);6755 iEstimatedDist = xEstimateFiltDist(filters_per_fr, m_varIndTab, ESym, ySym, m_filterCoeffSym, m_pcTempAlfParam->num_coeff);6756 iEstimateDistBeforeFilter = xEstimateFiltDist(filters_per_fr, m_varIndTab, ESym, ySym, coeffNoFilter[filter_shape], m_pcTempAlfParam->num_coeff);6757 iEstimatedDist -= iEstimateDistBeforeFilter;6758 dEstimatedCost = (Double)(uiRate) * m_dLambdaLuma + (Double)(iEstimatedDist);6759 6760 if(dEstimatedCost < dEstimatedMinCost)6761 {6762 dEstimatedMinCost = dEstimatedCost;6763 copyALFParam(pcAlfSaved, m_pcTempAlfParam);6764 iEstimatedDist += iEstimateDistBeforeFilter;6765 6766 for(Int i=0; i< filters_per_fr; i++ )6767 {6768 iEstimatedDist += (((Int64)m_pixAcc_merged[i]) >> uiBitShift);6769 }6770 ruiDist = (iEstimatedDist > 0)?((UInt64)iEstimatedDist):(0);6771 rdCost = dEstimatedMinCost + (Double)(ruiDist);6772 ruiRate = uiRate;6773 }6774 }6775 6776 if (!m_iUsePreviousFilter)6777 {6778 decodeFilterSet(pcAlfSaved, m_varIndTab, m_filterCoeffSym);6779 saveFilterCoeffToBuffer(m_filterCoeffSym, pcAlfSaved->filters_per_group, m_varIndTab, pcAlfSaved->alf_pcr_region_flag, pcAlfSaved->filter_shape);6780 }6781 6782 if( m_iUsePreviousFilter )6783 {6784 UInt64 uiOffRegionDistortion = 0;6785 Int iPelDiff;6786 Pel* pOrgTemp = (Pel*)ImgOrg;6787 Pel* pDecTemp = (Pel*)ImgDec;6788 for(Int y=0; y< m_img_height; y++)6789 {6790 for(Int x=0; x< m_img_width; x++)6791 {6792 if(m_maskImg[y][x] == 0)6793 {6794 iPelDiff = pOrgTemp[x] - pDecTemp[x];6795 uiOffRegionDistortion += (UInt64)( (iPelDiff*iPelDiff) >> uiBitShift );6796 }6797 }6798 pOrgTemp += Stride;6799 pDecTemp += Stride;6800 6801 ruiDist += uiOffRegionDistortion;6802 rdCost += (Double)uiOffRegionDistortion;6803 }6804 }6805 6806 #if !ALF_SINGLE_FILTER_SHAPE6807 // if ALF_STAR5x5 is selected, the distortion of 2 skipped lines per LCU should be added.6808 if(pcAlfSaved->filter_shape == ALF_STAR5x5)6809 {6810 Int iPelDiff;6811 UInt64 uiSkipPelsDistortion = 0;6812 Pel *pOrgTemp, *pDecTemp;6813 for(Int y= m_lineIdxPadTop-1; y< m_img_height - m_lcuHeight ; y += m_lcuHeight)6814 {6815 pOrgTemp = ImgOrg + y*Stride;6816 pDecTemp = ImgDec + y*Stride;6817 for(Int x=0; x< m_img_width; x++)6818 {6819 if(m_maskImg[y][x] == 1)6820 {6821 iPelDiff = pOrgTemp[x] - pDecTemp[x];6822 uiSkipPelsDistortion += (UInt64)( (iPelDiff*iPelDiff) >> uiBitShift );6823 }6824 }6825 6826 pOrgTemp += Stride;6827 pDecTemp += Stride;6828 for(Int x=0; x< m_img_width; x++)6829 {6830 if(m_maskImg[y+1][x] == 1)6831 {6832 iPelDiff = pOrgTemp[x] - pDecTemp[x];6833 uiSkipPelsDistortion += (UInt64)( (iPelDiff*iPelDiff) >> uiBitShift );6834 }6835 }6836 }6837 ruiDist += uiSkipPelsDistortion;6838 rdCost += (Double)uiSkipPelsDistortion;6839 }6840 #endif6841 6842 for(Int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE; filter_shape++)6843 {6844 for(Int i=0; i< NO_VAR_BINS; i++)6845 {6846 delete[] coeffNoFilter[filter_shape][i];6847 }6848 }6849 }6850 6851 6852 #endif6853 4686 6854 4687 /** Estimate filtering distortion by correlation values and filter coefficients … … 6867 4700 Int64 iDist; 6868 4701 Double dDist, dsum; 6869 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS4702 #if LCUALF_QP_DEPENDENT_BITS 6870 4703 Int alfPrecisionBit = getAlfPrecisionBit( m_alfQP ); 6871 4704 #endif … … 6873 4706 for(i=0; i< iFiltLength; i++) 6874 4707 { 6875 #if LCU _SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS4708 #if LCUALF_QP_DEPENDENT_BITS 6876 4709 pdcoeff[i]= (Double)piCoeff[i] / (Double)(1<<alfPrecisionBit); 6877 4710 #else … … 6908 4741 6909 4742 6910 #if !LCU_SYNTAX_ALF6911 6912 /** Estimate total filtering cost of all groups6913 * \param filters_per_fr number of filters for the slice6914 * \param VarIndTab merge index of all groups6915 * \param pppdE auto-correlation matrix pointer for all groups6916 * \param ppdy cross-correlation array pointer for all groups6917 * \returns estimated distortion6918 */6919 Int64 TEncAdaptiveLoopFilter::xEstimateFiltDist(Int filters_per_fr, Int* VarIndTab,6920 Double*** pppdE, Double** ppdy,6921 Int** ppiCoeffSet, Int iFiltLength)6922 6923 {6924 Int64 iDist;6925 Double** ppdDstE;6926 Double** ppdSrcE;6927 Double* pdDsty;6928 Double* pdSrcy;6929 Int f, j, i, varInd;6930 Int* piCoeff;6931 6932 //clean m_E_merged & m_y_merged6933 for(f=0; f< filters_per_fr; f++)6934 {6935 for(j =0; j < iFiltLength; j++)6936 {6937 //clean m_E_merged one line6938 for(i=0; i < iFiltLength; i++)6939 {6940 m_E_merged[f][j][i] = 0;6941 }6942 6943 //clean m_y_merged6944 m_y_merged[f][j] = 0;6945 }6946 m_pixAcc_merged[f] = 0;6947 }6948 6949 6950 //merge correlation values6951 for (varInd=0; varInd< NO_VAR_BINS; varInd++)6952 {6953 ppdSrcE = pppdE[varInd];6954 ppdDstE = m_E_merged[ VarIndTab[varInd] ];6955 6956 pdSrcy = ppdy[varInd];6957 pdDsty = m_y_merged[ VarIndTab[varInd] ];6958 6959 for(j=0; j< iFiltLength; j++)6960 {6961 for(i=0; i< iFiltLength; i++)6962 {6963 ppdDstE[j][i] += ppdSrcE[j][i];6964 }6965 6966 pdDsty[j] += pdSrcy[j];6967 }6968 m_pixAcc_merged[ VarIndTab[varInd] ] += m_pixAcc[varInd];6969 6970 }6971 6972 //estimate distortion reduction by using FFDE (JCTVC-C143)6973 iDist = 0;6974 for(f=0; f< filters_per_fr; f++)6975 {6976 piCoeff = ppiCoeffSet[f];6977 ppdDstE = m_E_merged [f];6978 pdDsty = m_y_merged [f];6979 6980 iDist += xFastFiltDistEstimation(ppdDstE, pdDsty, piCoeff, iFiltLength);6981 }6982 6983 6984 return iDist;6985 6986 }6987 6988 /** Calculate ALF grouping indices for ALF slices6989 * \param varmap grouping indices buffer6990 * \param imgY_Dec picture buffer6991 * \param pad_size (max. filter tap)/26992 * \param fl VAR_SIZE6993 * \param img_stride picture buffer stride6994 */6995 Void TEncAdaptiveLoopFilter::xfilterSlicesEncoder(Pel* ImgDec, Pel* ImgRest, Int iStride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg)6996 {6997 Pel* pPicSrc = (Pel *)ImgDec;6998 Pel* pPicSlice = m_pcSliceYuvTmp->getLumaAddr();6999 7000 for(UInt s=0; s< m_uiNumSlicesInPic; s++)7001 {7002 if(!m_pcPic->getValidSlice(s))7003 {7004 continue;7005 }7006 std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];7007 7008 for(Int t=0; t< (Int)vpSliceTileAlfLCU.size(); t++)7009 {7010 std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];7011 copyRegion(vpAlfLCU, pPicSlice, pPicSrc, iStride);7012 extendRegionBorder(vpAlfLCU, pPicSlice, iStride);7013 filterLumaRegion(vpAlfLCU, pPicSlice, ImgRest, iStride, filtNo, filterCoeff, mergeTable, varImg);7014 }7015 }7016 }7017 7018 /** Calculate block autocorrelations and crosscorrelations for ALF slices7019 * \param ImgOrg original picture7020 * \param ImgDec picture before filtering7021 * \param tap filter tap size7022 * \param iStride picture buffer stride7023 */7024 Void TEncAdaptiveLoopFilter::xstoreInBlockMatrixforSlices(Pel* ImgOrg, Pel* ImgDec, Int tap, Int iStride)7025 {7026 Pel* pPicSrc = (Pel *)ImgDec;7027 Pel* pPicSlice = m_pcSliceYuvTmp->getLumaAddr();7028 7029 UInt iLastValidSliceID =0;7030 for(UInt s=0; s< m_uiNumSlicesInPic; s++)7031 {7032 if(m_pcPic->getValidSlice(s))7033 {7034 iLastValidSliceID = s;7035 }7036 }7037 7038 for(UInt s=0; s<= iLastValidSliceID; s++)7039 {7040 if(!m_pcPic->getValidSlice(s))7041 {7042 continue;7043 }7044 std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];7045 Int numValidTilesInSlice = (Int)vpSliceTileAlfLCU.size();7046 for(Int t=0; t< numValidTilesInSlice; t++)7047 {7048 std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];7049 copyRegion(vpAlfLCU, pPicSlice, pPicSrc, iStride);7050 extendRegionBorder(vpAlfLCU, pPicSlice, iStride);7051 xstoreInBlockMatrixforRegion(vpAlfLCU, ImgOrg, pPicSlice, tap, iStride, (s==0)&&(t==0), (s== iLastValidSliceID)&&(t==numValidTilesInSlice-1));7052 }7053 }7054 }7055 7056 /** Calculate block autocorrelations and crosscorrelations for one ALF region7057 * \param vpAlfLCU ALF LCU data container7058 * \param ImgOrg original picture7059 * \param ImgDec picture before filtering7060 * \param tap filter tap size7061 * \param iStride picture buffer stride7062 * \param bFirstSlice true for the first processing slice of the picture7063 * \param bLastSlice true for the last processing slice of the picture7064 */7065 Void TEncAdaptiveLoopFilter::xstoreInBlockMatrixforRegion(std::vector< AlfLCUInfo* > &vpAlfLCU,7066 Pel* ImgOrg, Pel* ImgDec,7067 Int tap, Int iStride,7068 Bool bFirstSlice,7069 Bool bLastSlice7070 )7071 {7072 7073 UInt uiNumLCUs = (UInt)vpAlfLCU.size();7074 Int iHeight, iWidth;7075 Int ypos, xpos;7076 Bool bFirstLCU, bLastLCU;7077 Bool bFirstSGU, bLastSGU;7078 UInt numSGUs;7079 7080 for(UInt i=0; i< uiNumLCUs; i++)7081 {7082 bFirstLCU = (i==0);7083 bLastLCU = (i== uiNumLCUs -1);7084 AlfLCUInfo& cAlfLCU = *(vpAlfLCU[i]);7085 numSGUs = cAlfLCU.numSGU;7086 for(UInt j=0; j< numSGUs; j++)7087 {7088 bFirstSGU= (j ==0);7089 bLastSGU = (j == numSGUs -1);7090 7091 ypos = (Int)(cAlfLCU[j].posY );7092 xpos = (Int)(cAlfLCU[j].posX );7093 iHeight = (Int)(cAlfLCU[j].height);7094 iWidth = (Int)(cAlfLCU[j].width );7095 7096 xstoreInBlockMatrix(ypos, xpos, iHeight, iWidth,7097 (bFirstSlice && bFirstLCU && bFirstSGU),(bLastSlice && bLastLCU && bLastSGU),7098 ImgOrg, ImgDec,tap, iStride);7099 }7100 }7101 }7102 7103 7104 /** Calculate autocorrelations and crosscorrelations for chroma slices7105 * \param ComponentID Cb or Cr7106 * \param pOrg original picture7107 * \param pCmp picture before filtering7108 * \param iTap filter tap size7109 * \param iOrgStride picture buffer stride for pOrg7110 * \param iCmpStride picture buffer stride for pCmp7111 */7112 Void TEncAdaptiveLoopFilter::xCalcCorrelationFuncforChromaSlices(Int ComponentID, Pel* pOrg, Pel* pCmp, Int iTap, Int iOrgStride, Int iCmpStride)7113 {7114 7115 assert(iOrgStride == iCmpStride);7116 7117 Pel* pPicSrc = pCmp;7118 Pel* pPicSlice = (ComponentID == ALF_Cb)?(m_pcSliceYuvTmp->getCbAddr()):(m_pcSliceYuvTmp->getCrAddr());7119 Int chromaFormatShift = 1;7120 7121 UInt iLastValidSliceID =0;7122 for(UInt s=0; s< m_uiNumSlicesInPic; s++)7123 {7124 if(m_pcPic->getValidSlice(s))7125 {7126 iLastValidSliceID = s;7127 }7128 }7129 7130 for(UInt s=0; s<= iLastValidSliceID; s++)7131 {7132 if(!m_pcPic->getValidSlice(s))7133 {7134 continue;7135 }7136 std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];7137 Int numValidTilesInSlice = (Int)vpSliceTileAlfLCU.size();7138 for(Int t=0; t< numValidTilesInSlice; t++)7139 {7140 std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];7141 copyRegion(vpAlfLCU, pPicSlice, pPicSrc, iCmpStride, chromaFormatShift);7142 extendRegionBorder(vpAlfLCU, pPicSlice, iCmpStride, chromaFormatShift);7143 xCalcCorrelationFuncforChromaRegion(vpAlfLCU, pOrg, pPicSlice, iTap, iCmpStride,(s== iLastValidSliceID)&&(t== numValidTilesInSlice-1), chromaFormatShift);7144 }7145 }7146 }7147 7148 /** Calculate autocorrelations and crosscorrelations for one chroma slice7149 * \param vpAlfLCU ALF LCU data container7150 * \param pOrg original picture7151 * \param pCmp picture before filtering7152 * \param iTap filter tap size7153 * \param iStride picture buffer stride7154 * \param bLastSlice the last processing slice of picture7155 */7156 Void TEncAdaptiveLoopFilter::xCalcCorrelationFuncforChromaRegion(std::vector< AlfLCUInfo* > &vpAlfLCU, Pel* pOrg, Pel* pCmp, Int filtNo, Int iStride, Bool bLastSlice, Int iFormatShift)7157 {7158 UInt uiNumLCUs = (UInt)vpAlfLCU.size();7159 7160 Int iHeight, iWidth;7161 Int ypos, xpos;7162 Bool bLastLCU;7163 Bool bLastSGU;7164 UInt numSGUs;7165 7166 for(UInt i=0; i< uiNumLCUs; i++)7167 {7168 bLastLCU = (i== uiNumLCUs -1);7169 7170 AlfLCUInfo& cAlfLCU = *(vpAlfLCU[i]);7171 numSGUs = cAlfLCU.numSGU;7172 for(UInt j=0; j< numSGUs; j++)7173 {7174 bLastSGU = (j == numSGUs -1);7175 ypos = (Int)(cAlfLCU[j].posY >> iFormatShift);7176 xpos = (Int)(cAlfLCU[j].posX >> iFormatShift);7177 iHeight = (Int)(cAlfLCU[j].height >> iFormatShift);7178 iWidth = (Int)(cAlfLCU[j].width >> iFormatShift);7179 xCalcCorrelationFunc(ypos, xpos, pOrg, pCmp, filtNo, iWidth, iHeight, iStride, iStride, (bLastSlice && bLastLCU && bLastSGU) );7180 }7181 }7182 }7183 7184 // ====================================================================================================================7185 // Protected member functions7186 // ====================================================================================================================7187 7188 Void TEncAdaptiveLoopFilter::xFilterTapDecisionChroma( UInt64 uiLumaRate, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, UInt64& ruiBits )7189 {7190 Int iShape, num_coeff;7191 Int64 iOrgDistCb, iOrgDistCr, iFiltDistCb, iFiltDistCr, iDist;7192 Bool bChanged = false;7193 Int* qh = m_pcTempAlfParam->coeff_chroma;7194 7195 UInt64 uiMinRate = uiLumaRate;7196 UInt64 uiMinDist = MAX_INT;7197 Double dMinCost = MAX_DOUBLE;7198 Double dLocalMinCost = MAX_DOUBLE;7199 7200 copyALFParam(m_pcTempAlfParam, m_pcBestAlfParam);7201 xCalcRDCostChroma(pcPicOrg, pcPicRest, m_pcTempAlfParam, uiMinRate, uiMinDist, dMinCost);7202 7203 #if ALF_SINGLE_FILTER_SHAPE7204 iShape = 0;7205 #else7206 for(iShape = 0; iShape < 2; iShape++)7207 #endif7208 {7209 // set global variables7210 num_coeff = m_sqrFiltLengthTab[iShape];7211 m_pcTempAlfParam->chroma_idc = 3;7212 m_pcTempAlfParam->filter_shape_chroma = iShape;7213 m_pcTempAlfParam->num_coeff_chroma = num_coeff;7214 7215 // keep original corr pointer7216 Double **ppdTmpCorr = m_ppdAlfCorr;7217 7218 // calc Cb matrix7219 m_pcTempAlfParam->chroma_idc = 2;7220 m_ppdAlfCorr = m_ppdAlfCorrCb;7221 for(Int i=0; i<ALF_MAX_NUM_COEF; i++)7222 {7223 ::memset(m_ppdAlfCorr[i], 0, sizeof(Double) * (ALF_MAX_NUM_COEF + 1));7224 }7225 Pel *pOrg = pcPicOrg->getCbAddr();7226 Pel *pCmp = pcPicDec->getCbAddr();7227 if(!m_bUseNonCrossALF)7228 {7229 xCalcCorrelationFunc(0, 0, pOrg, pCmp, iShape, (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride(), pcPicDec->getCStride(), true);7230 }7231 else7232 {7233 xCalcCorrelationFuncforChromaSlices(ALF_Cb, pOrg, pCmp, iShape, pcPicOrg->getCStride(), pcPicDec->getCStride());7234 }7235 7236 // calc Cr matrix7237 m_pcTempAlfParam->chroma_idc = 1;7238 m_ppdAlfCorr = m_ppdAlfCorrCr;7239 for(Int i=0; i<ALF_MAX_NUM_COEF; i++)7240 {7241 ::memset(m_ppdAlfCorr[i], 0, sizeof(Double) * (ALF_MAX_NUM_COEF + 1));7242 }7243 pOrg = pcPicOrg->getCrAddr();7244 pCmp = pcPicDec->getCrAddr();7245 if(!m_bUseNonCrossALF)7246 {7247 xCalcCorrelationFunc(0, 0, pOrg, pCmp, iShape, (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride(), pcPicDec->getCStride(), true);7248 }7249 else7250 {7251 xCalcCorrelationFuncforChromaSlices(ALF_Cr, pOrg, pCmp, iShape, pcPicOrg->getCStride(), pcPicDec->getCStride());7252 }7253 7254 // restore original corr pointer7255 m_ppdAlfCorr = ppdTmpCorr;7256 7257 // calc original dist7258 memset(qh, 0, sizeof(Int)*num_coeff);7259 qh[num_coeff-1] = 1<<((Int)ALF_NUM_BIT_SHIFT);7260 iOrgDistCb = xFastFiltDistEstimationChroma(m_ppdAlfCorrCb, qh, num_coeff);7261 iOrgDistCr = xFastFiltDistEstimationChroma(m_ppdAlfCorrCr, qh, num_coeff);7262 7263 for(Int iCmp=1; iCmp<=3; iCmp++)7264 {7265 m_pcTempAlfParam->chroma_idc = iCmp;7266 xCalcALFCoeffChroma(iCmp, iShape, qh);7267 iFiltDistCb = ((iCmp>>1)&0x1) ? xFastFiltDistEstimationChroma(m_ppdAlfCorrCb, qh, num_coeff) : iOrgDistCb;7268 iFiltDistCr = ((iCmp) &0x1) ? xFastFiltDistEstimationChroma(m_ppdAlfCorrCr, qh, num_coeff) : iOrgDistCr;7269 iDist = iFiltDistCb + iFiltDistCr;7270 UInt64 uiRate = xCalcRateChroma(m_pcTempAlfParam);7271 Double dCost = (Double)iDist + m_dLambdaChroma * (Double)uiRate;7272 if(dCost < dLocalMinCost)7273 {7274 dLocalMinCost = dCost;7275 copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);7276 bChanged = true;7277 }7278 }7279 }7280 copyALFParam(m_pcTempAlfParam, m_pcBestAlfParam);7281 if(!bChanged)7282 {7283 m_pcBestAlfParam->chroma_idc = 0;7284 return;7285 }7286 7287 // Adaptive in-loop wiener filtering for chroma7288 xFilteringFrameChroma(m_pcTempAlfParam, pcPicOrg, pcPicDec, pcPicRest);7289 7290 // filter on/off decision for chroma7291 Int iCWidth = (pcPicOrg->getWidth()>>1);7292 Int iCHeight = (pcPicOrg->getHeight()>>1);7293 Int iCStride = pcPicOrg->getCStride();7294 UInt64 uiFiltDistCb = xCalcSSD(pcPicOrg->getCbAddr(), pcPicRest->getCbAddr(), iCWidth, iCHeight, iCStride);7295 UInt64 uiFiltDistCr = xCalcSSD(pcPicOrg->getCrAddr(), pcPicRest->getCrAddr(), iCWidth, iCHeight, iCStride);7296 UInt64 uiOrgDistCb = xCalcSSD(pcPicOrg->getCbAddr(), pcPicDec->getCbAddr(), iCWidth, iCHeight, iCStride);7297 UInt64 uiOrgDistCr = xCalcSSD(pcPicOrg->getCrAddr(), pcPicDec->getCrAddr(), iCWidth, iCHeight, iCStride);7298 if(((m_pcTempAlfParam->chroma_idc)>>1 & 0x1) && (uiOrgDistCb<=uiFiltDistCb))7299 {7300 m_pcTempAlfParam->chroma_idc -= 2;7301 pcPicDec->copyToPicCb(pcPicRest);7302 }7303 if(((m_pcTempAlfParam->chroma_idc) & 0x1) && (uiOrgDistCr<=uiFiltDistCr))7304 {7305 m_pcTempAlfParam->chroma_idc -= 1;7306 pcPicDec->copyToPicCr(pcPicRest);7307 }7308 7309 if(m_pcTempAlfParam->chroma_idc)7310 {7311 UInt64 uiRate, uiDist;7312 Double dCost;7313 xCalcRDCostChroma(pcPicOrg, pcPicRest, m_pcTempAlfParam, uiRate, uiDist, dCost);7314 7315 if( dCost < dMinCost )7316 {7317 copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);7318 predictALFCoeffChroma(m_pcBestAlfParam);7319 7320 ruiBits += uiRate;7321 ruiDist += uiDist;7322 }7323 else7324 {7325 m_pcBestAlfParam->chroma_idc = 0;7326 7327 if((m_pcTempAlfParam->chroma_idc>>1)&0x01)7328 {7329 pcPicDec->copyToPicCb(pcPicRest);7330 }7331 if(m_pcTempAlfParam->chroma_idc&0x01)7332 {7333 pcPicDec->copyToPicCr(pcPicRest);7334 }7335 7336 ruiBits += uiMinRate;7337 ruiDist += uiMinDist;7338 }7339 }7340 else7341 {7342 m_pcBestAlfParam->chroma_idc = 0;7343 7344 ruiBits += uiMinRate;7345 ruiDist += uiMinDist;7346 7347 pcPicDec->copyToPicCb(pcPicRest);7348 pcPicDec->copyToPicCr(pcPicRest);7349 }7350 }7351 7352 Int64 TEncAdaptiveLoopFilter::xFastFiltDistEstimationChroma(Double** ppdCorr, Int* piCoeff, Int iSqrFiltLength)7353 {7354 Double pdcoeff[ALF_MAX_NUM_COEF];7355 Int i,j;7356 Int64 iDist;7357 Double dDist, dsum;7358 for(i=0; i< iSqrFiltLength; i++)7359 {7360 pdcoeff[i]= (Double)piCoeff[i] / (Double)(1<< ((Int)ALF_NUM_BIT_SHIFT) );7361 }7362 7363 dDist =0;7364 for(i=0; i< iSqrFiltLength; i++)7365 {7366 dsum= ((Double)ppdCorr[i][i]) * pdcoeff[i];7367 for(j=i+1; j< iSqrFiltLength; j++)7368 {7369 dsum += (Double)(2*ppdCorr[i][j])* pdcoeff[j];7370 }7371 7372 dDist += ((dsum - 2.0 * ppdCorr[i][iSqrFiltLength])* pdcoeff[i] );7373 }7374 7375 UInt uiShift = g_uiBitIncrement<<1;7376 if(dDist < 0)7377 {7378 iDist = -(((Int64)(-dDist + 0.5)) >> uiShift);7379 }7380 else //dDist >=07381 {7382 iDist= ((Int64)(dDist+0.5)) >> uiShift;7383 }7384 7385 return iDist;7386 }7387 7388 Void TEncAdaptiveLoopFilter::xCalcALFCoeffChroma(Int iChromaIdc, Int iShape, Int* piCoeff)7389 {7390 Int iSqrFiltLength = m_sqrFiltLengthTab[iShape];7391 7392 for(Int i=0; i<iSqrFiltLength; i++)7393 {7394 memset(m_ppdAlfCorr[i], 0, sizeof(Double)*(iSqrFiltLength + 1));7395 }7396 7397 // retrive7398 if((iChromaIdc>>1) & 0x1)7399 {7400 for(Int i=0; i<iSqrFiltLength; i++)7401 {7402 for(Int j=i; j<iSqrFiltLength+1; j++)7403 {7404 m_ppdAlfCorr[i][j] += m_ppdAlfCorrCb[i][j];7405 }7406 }7407 }7408 if(iChromaIdc & 0x1)7409 {7410 for(Int i=0; i<iSqrFiltLength; i++)7411 {7412 for(Int j=i; j<iSqrFiltLength+1; j++)7413 {7414 m_ppdAlfCorr[i][j] += m_ppdAlfCorrCr[i][j];7415 }7416 }7417 }7418 7419 // copy7420 for(Int i=1; i<iSqrFiltLength; i++)7421 {7422 for(Int j=0; j<i; j++)7423 {7424 m_ppdAlfCorr[i][j] = m_ppdAlfCorr[j][i];7425 }7426 }7427 7428 Double *corr = new Double[iSqrFiltLength];7429 for(Int i=0; i<iSqrFiltLength; i++)7430 {7431 corr[i] = m_ppdAlfCorr[i][iSqrFiltLength];7432 }7433 7434 // calc coeff7435 gnsSolveByChol(m_ppdAlfCorr, corr, m_pdDoubleAlfCoeff, iSqrFiltLength);7436 xQuantFilterCoef(m_pdDoubleAlfCoeff, piCoeff, iShape, g_uiBitDepth + g_uiBitIncrement);7437 delete [] corr;7438 }7439 7440 UInt64 TEncAdaptiveLoopFilter::xCalcRateChroma(ALFParam* pAlfParam)7441 {7442 UInt64 uiRate;7443 Int* piTmpCoef;7444 piTmpCoef = new Int[ALF_MAX_NUM_COEF];7445 memcpy(piTmpCoef, pAlfParam->coeff_chroma, sizeof(Int)*pAlfParam->num_coeff_chroma);7446 7447 predictALFCoeffChroma(pAlfParam);7448 7449 m_pcEntropyCoder->resetEntropy();7450 m_pcEntropyCoder->resetBits();7451 m_pcEntropyCoder->encodeAlfParam(pAlfParam);7452 uiRate = m_pcEntropyCoder->getNumberOfWrittenBits();7453 if (m_vBestAlfCUCtrlParam.size() != 0)7454 {7455 for(UInt s=0; s< m_uiNumSlicesInPic; s++)7456 {7457 if(!m_pcPic->getValidSlice(s))7458 {7459 continue;7460 }7461 m_pcEntropyCoder->resetEntropy();7462 m_pcEntropyCoder->resetBits();7463 m_pcEntropyCoder->encodeAlfCtrlParam( m_vBestAlfCUCtrlParam[s], m_uiNumCUsInFrame);7464 uiRate += m_pcEntropyCoder->getNumberOfWrittenBits();7465 }7466 }7467 else7468 {7469 uiRate += m_uiNumSlicesInPic;7470 }7471 memcpy(pAlfParam->coeff_chroma, piTmpCoef, sizeof(int)*pAlfParam->num_coeff_chroma);7472 delete[] piTmpCoef;7473 piTmpCoef = NULL;7474 7475 return uiRate;7476 }7477 #endif7478 4743 7479 4744 //! \} -
trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.h
r56 r296 49 49 //! \{ 50 50 51 #if LCU_SYNTAX_ALF52 51 #define LCUALF_FILTER_BUDGET_CONTROL_ENC 1 //!< filter budget control 53 52 #define LCUALF_AVOID_USING_BOTTOM_LINES_ENCODER 1 //!< avoid using LCU bottom lines when lcu-based encoder RDO is used 54 #endif55 53 56 54 // ==================================================================================================================== … … 58 56 // ==================================================================================================================== 59 57 60 #if LCU_SYNTAX_ALF61 58 /// correlation info 62 59 struct AlfCorrData … … 110 107 }; 111 108 112 #endif113 109 114 110 … … 120 116 /// variables for correlation calculation 121 117 /// 122 #if !LCU_SYNTAX_ALF123 Double** m_ppdAlfCorr;124 Double* m_pdDoubleAlfCoeff;125 Double** m_ppdAlfCorrCb;126 Double** m_ppdAlfCorrCr;127 double ***m_yGlobalSym;128 double ****m_EGlobalSym;129 double *m_pixAcc;130 #endif131 118 double **m_y_merged; 132 119 double ***m_E_merged; … … 134 121 double *m_y_temp; 135 122 double **m_E_temp; 136 #if LCU_SYNTAX_ALF137 123 static const Int m_alfNumPartsInRowTab[5]; 138 124 static const Int m_alfNumPartsLevelTab[5]; … … 154 140 Int m_alfUsedFilterNum; 155 141 #endif 156 #endif157 142 158 143 /// 159 144 /// ALF parameters 160 145 /// 161 #if !LCU_SYNTAX_ALF162 ALFParam* m_pcBestAlfParam;163 ALFParam* m_pcTempAlfParam;164 ALFParam* pcAlfParamShape0;165 ALFParam* pcAlfParamShape1;166 #endif167 146 ALFParam *m_tempALFp; 168 147 … … 172 151 TComPicYuv* m_pcPicYuvBest; 173 152 TComPicYuv* m_pcPicYuvTmp; 174 #if !LCU_SYNTAX_ALF175 TComPicYuv* pcPicYuvRecShape0;176 TComPicYuv* pcPicYuvRecShape1;177 #endif178 153 179 154 /// … … 186 161 Int **m_diffFilterCoeffQuant; 187 162 Int **m_FilterCoeffQuantTemp; 188 #if !LCU_SYNTAX_ALF189 Int** m_mergeTableSavedMethods[NUM_ALF_CLASS_METHOD];190 Int*** m_aiFilterCoeffSavedMethods[NUM_ALF_CLASS_METHOD]; //!< time-delayed filter set buffer191 Int* m_iPreviousFilterShapeMethods[NUM_ALF_CLASS_METHOD];192 #endif193 163 /// 194 164 /// coding control parameters … … 196 166 Double m_dLambdaLuma; 197 167 Double m_dLambdaChroma; 198 #if !LCU_SYNTAX_ALF199 Int m_iUsePreviousFilter; //!< for N-pass encoding- 1: time-delayed filtering is allowed. 0: not allowed.200 Int m_iDesignCurrentFilter; //!< for N-pass encoding- 1: design filters for current slice. 0: design filters for future slice reference201 Int m_iGOPSize; //!< GOP size202 Int m_iCurrentPOC; //!< POC203 #endif204 168 Int m_iALFEncodePassReduction; //!< 0: 16-pass encoding, 1: 1-pass encoding, 2: 2-pass encoding 205 169 … … 221 185 private: 222 186 223 #if LCU_SYNTAX_ALF224 187 Void disableComponentAlfParam(Int compIdx, AlfParamSet* alfParamSet, AlfUnitParam* alfUnitPic); 225 188 Void copyAlfParamSet(AlfParamSet* dst, AlfParamSet* src); … … 252 215 Void xCopyDecToRestCUs( Pel* imgDec, Pel* imgRest, Int stride ); 253 216 Void xCopyDecToRestCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Pel* imgDec, Pel* imgRest, Int stride ); 254 #if ALF_SINGLE_FILTER_SHAPE255 217 Void calcCorrOneCompRegionChma(Pel* imgOrg, Pel* imgPad, Int stride, Int yPos, Int xPos, Int height, Int width, Double **eCorr, Double *yCorr, Bool isSymmCopyBlockMatrix); //!< Calculate correlations for chroma 256 218 Void calcCorrOneCompRegionLuma(Pel* imgOrg, Pel* imgPad, Int stride, Int yPos, Int xPos, Int height, Int width, Double ***eCorr, Double **yCorr, Double *pixAcc, Bool isforceCollection, Bool isSymmCopyBlockMatrix); 257 #endif258 219 259 220 //LCU-based mode decision … … 291 252 Void transferToAlfParamSet(Int compIdx, AlfUnitParam* alfUnitPic, AlfParamSet* & alfParamSet); 292 253 Int calculateAlfParamSetRateRDO(Int compIdx, AlfParamSet* alfParamSet, std::vector<AlfCUCtrlInfo>* alfCUCtrlParam); 293 #endif294 #if !LCU_SYNTAX_ALF295 // init / uninit internal variables296 Void xInitParam ();297 Void xUninitParam ();298 #endif299 254 // ALF on/off control related functions 300 255 Void xCreateTmpAlfCtrlFlags (); … … 305 260 Void xEncodeCUAlfCtrlFlags (std::vector<AlfCUCtrlInfo> &vAlfCUCtrlParam); 306 261 Void xEncodeCUAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth); 307 #if !LCU_SYNTAX_ALF308 Void xCUAdaptiveControl_qc ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost );309 Void xSetCUAlfCtrlFlags_qc (UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam);310 Void xSetCUAlfCtrlFlag_qc (TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag);311 312 // functions related to correlation computation313 Void xstoreInBlockMatrix(Int ypos, Int xpos, Int iheight, Int iwidth, Bool bResetBlockMatrix, Bool bSymmCopyBlockMatrix, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int stride); //!< Calculate correlations for luma314 Void xstoreInBlockMatrixforRegion(std::vector< AlfLCUInfo* > &vpAlfLCU, Pel* ImgOrg, Pel* ImgDec, Int tap, Int iStride, Bool bFirstSlice, Bool bLastSlice); //!< Calculate block autocorrelations and crosscorrelations for one ALF slice315 Void xstoreInBlockMatrixforSlices (Pel* ImgOrg, Pel* ImgDec, Int tap, Int iStride); //!< Calculate block autocorrelations and crosscorrelations for ALF slices316 Void xCalcCorrelationFunc(Int ypos, Int xpos, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int iWidth, Int iHeight, Int iOrgStride, Int iCmpStride, Bool bSymmCopyBlockMatrix); //!< Calculate correlations for chroma317 Void xCalcCorrelationFuncforChromaRegion(std::vector< AlfLCUInfo* > &vpAlfLCU, Pel* pOrg, Pel* pCmp, Int filtNo, Int iStride, Bool bLastSlice, Int iFormatShift); //!< Calculate autocorrelations and crosscorrelations for one chroma slice318 Void xCalcCorrelationFuncforChromaSlices (Int ComponentID, Pel* pOrg, Pel* pCmp, Int iTap, Int iOrgStride, Int iCmpStride); //!< Calculate autocorrelations and crosscorrelations for chroma slices319 #endif320 262 // functions related to filtering 321 263 Void xFilterCoefQuickSort ( Double *coef_data, Int *coef_num, Int upper, Int lower ); 322 264 Void xQuantFilterCoef ( Double* h, Int* qh, Int tap, int bit_depth ); 323 #if !LCU_SYNTAX_ALF324 Void xClearFilterCoefInt ( Int* qh, Int N );325 Void xCopyDecToRestCUs ( TComPicYuv* pcPicDec, TComPicYuv* pcPicRest );326 Void xCopyDecToRestCU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest );327 Void xFilteringFrameChroma (ALFParam* pcAlfParam, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest);328 Int setFilterIdx(Int index); //!< set filter buffer index329 Void setInitialMask(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec); //!< set initial m_maskImg330 Void saveFilterCoeffToBuffer(Int **filterSet, Int numFilter, Int* mergeTable, Int mode, Int filtNo); //!< save filter coefficients to buffer331 Void setMaskWithTimeDelayedResults(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec); //!< set initial m_maskImg with previous (time-delayed) filters332 Void decideFilterShapeLuma(Pel* ImgOrg, Pel* ImgDec, Int Stride, ALFParam* pcAlfSaved, UInt64& ruiRate, UInt64& ruiDist,Double& rdCost); //!< Estimate RD cost of all filter size & store the best one333 Void xFilterTapDecisionChroma (UInt64 uiLumaRate, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, UInt64& ruiBits);334 Int64 xFastFiltDistEstimationChroma (Double** ppdCorr, Int* piCoeff, Int iSqrFiltLength);335 Void xfilterSlicesEncoder(Pel* ImgDec, Pel* ImgRest, Int iStride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg); //!< Calculate ALF grouping indices for ALF slices336 Void setALFEncodingParam(TComPic *pcPic); //!< set ALF encoding parameters337 Void xReDesignFilterCoeff_qc (TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, Bool bReadCorr);338 Void xFirstFilteringFrameLuma (Pel* imgOrg, Pel* imgDec, Pel* imgRest, ALFParam* ALFp, Int filtNo, Int stride);339 Void xFilteringFrameLuma(Pel* imgOrg, Pel* imgPad, Pel* imgFilt, ALFParam* ALFp, Int filtNo, Int stride);340 Void xEncALFLuma ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost ); //!< estimate adaptation mode and filter shape341 #endif342 265 // distortion / misc functions 343 266 #if HHI_INTERVIEW_SKIP … … 346 269 UInt64 xCalcSSD ( Pel* pOrg, Pel* pCmp, Int iWidth, Int iHeight, Int iStride ); 347 270 #endif 348 #if !LCU_SYNTAX_ALF349 #if HHI_INTERVIEW_SKIP350 Void xCalcRDCost ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);351 Void xCalcRDCost ( ALFParam* pAlfParam, UInt64& ruiRate, UInt64 uiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);352 Void xCalcRDCostChroma ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost );353 #else354 Void xCalcRDCost ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);355 Void xCalcRDCost ( ALFParam* pAlfParam, UInt64& ruiRate, UInt64 uiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);356 Void xCalcRDCostChroma ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost );357 #endif358 #endif359 271 Int64 xFastFiltDistEstimation(Double** ppdE, Double* pdy, Int* piCoeff, Int iFiltLength); //!< Estimate filtering distortion by correlation values and filter coefficients 360 #if !LCU_SYNTAX_ALF361 Int64 xEstimateFiltDist (Int filters_per_fr, Int* VarIndTab, Double*** pppdE, Double** ppdy, Int** ppiCoeffSet, Int iFiltLength); //!< Estimate total filtering cost of all groups362 UInt64 xCalcRateChroma (ALFParam* pAlfParam);363 Void xCalcALFCoeffChroma (Int iChromaIdc, Int iShape, Int* piCoeff);364 #endif365 272 366 273 /// code filter coefficients 367 274 UInt xcodeFiltCoeff(Int **filterCoeffSymQuant, Int filter_shape, Int varIndTab[], Int filters_per_fr_best, ALFParam* ALFp); 368 #if LCU_SYNTAX_ALF369 275 Void xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant,Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val, Int numMaxFilters = NO_FILTERS); 370 #else371 Void xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant,Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val);372 #endif373 276 double xfindBestCoeffCodMethod(int **filterCoeffSymQuant, int filter_shape, int sqrFiltLength, int filters_per_fr, double errorForce0CoeffTab[NO_VAR_BINS][2], double lambda); 374 277 Int xsendAllFiltersPPPred(int **FilterCoeffQuant, int filter_shape, int sqrFiltLength, int filters_per_group, int createBistream, ALFParam* ALFp); … … 400 303 Void startALFEnc(TComPic* pcPic, TEncEntropy* pcEntropyCoder); //!< allocate temporal memory 401 304 Void endALFEnc(); //!< destroy temporal memory 402 #if LCU_SYNTAX_ALF403 305 #if ALF_CHROMA_LAMBDA 404 306 #if HHI_INTERVIEW_SKIP … … 418 320 Void resetPicAlfUnit(); 419 321 Void setAlfCoefInSlice(Bool b) {m_alfCoefInSlice = b;} 420 #else421 #if ALF_CHROMA_LAMBDA422 #if HHI_INTERVIEW_SKIP423 Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip); //!< estimate ALF parameters424 #else425 Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits); //!< estimate ALF parameters426 #endif427 #else428 #if HHI_INTERVIEW_SKIP429 Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip); //!< estimate ALF parameters430 #else431 Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits); //!< estimate ALF parameters432 #endif433 #endif434 435 Void setGOPSize(Int val) { m_iGOPSize = val; } //!< set GOP size436 #endif437 322 Void setALFEncodePassReduction (Int iVal) {m_iALFEncodePassReduction = iVal;} //!< set N-pass encoding. 0: 16(14)-pass encoding, 1: 1-pass encoding, 2: 2-pass encoding 438 323 439 324 Void setALFMaxNumberFilters (Int iVal) {m_iALFMaxNumberFilters = iVal;} //!< set ALF Max Number of Filters 440 325 441 #if LCU_SYNTAX_ALF442 326 Void createAlfGlobalBuffers(); //!< create ALF global buffers 443 327 Void initPicQuadTreePartition(Bool isPicBasedEncode); 444 #else445 Void createAlfGlobalBuffers(Int iALFEncodePassReduction); //!< create ALF global buffers446 #endif447 328 Void destroyAlfGlobalBuffers(); //!< destroy ALF global buffers 448 329 Void PCMLFDisableProcess (TComPic* pcPic); -
trunk/source/Lib/TLibEncoder/TEncBinCoder.h
r56 r296 56 56 virtual Void finish () = 0; 57 57 virtual Void copyState ( TEncBinIf* pcTEncBinIf ) = 0; 58 #if OL_FLUSH59 58 virtual Void flush () = 0; 60 #endif61 59 62 60 virtual Void encodeFlush (Bool bEnd) = 0; 63 61 64 62 virtual Void resetBac () = 0; 65 #if BURST_IPCM66 63 virtual Void encodeNumSubseqIPCM( Int numSubseqIPCM ) = 0; 67 #endif68 64 virtual Void encodePCMAlignBits() = 0; 69 65 virtual Void xWritePCMCode ( UInt uiCode, UInt uiLength ) = 0; -
trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
r56 r296 105 105 } 106 106 107 #if OL_FLUSH108 107 Void TEncBinCABAC::flush() 109 108 { … … 117 116 start(); 118 117 } 119 #endif120 118 121 119 /** Reset BAC register and counter values. … … 127 125 } 128 126 129 #if BURST_IPCM130 127 /** Encode # of subsequent IPCM blocks. 131 128 * \param numSubseqIPCM … … 153 150 } 154 151 } 155 #endif156 152 157 153 /** Encode PCM alignment zero bits. … … 160 156 Void TEncBinCABAC::encodePCMAlignBits() 161 157 { 162 #if !BURST_IPCM163 finish();164 m_pcTComBitIf->write( 1, 1 ); // stop bit165 #endif166 158 m_pcTComBitIf->writeAlignZero(); // pcm align zero 167 159 } -
trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.h
r56 r296 57 57 Void finish (); 58 58 Void copyState ( TEncBinIf* pcTEncBinIf ); 59 #if OL_FLUSH60 59 Void flush (); 61 #endif62 60 63 61 Void resetBac (); 64 #if BURST_IPCM65 62 Void encodeNumSubseqIPCM( Int numSubseqIPCM ); 66 #endif67 63 Void encodePCMAlignBits(); 68 64 Void xWritePCMCode ( UInt uiCode, UInt uiLength ); -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r210 r296 161 161 //DF flag 162 162 WRITE_FLAG(pcAPS->getLoopFilterOffsetInAPS()?1:0, "aps_deblocking_filter_flag"); 163 #if !SAO_UNIT_INTERLEAVING 164 //SAO flag 165 WRITE_FLAG( pcAPS->getSaoEnabled()?1:0, "aps_sample_adaptive_offset_flag"); 166 #endif 167 #if !LCU_SYNTAX_ALF 168 //ALF flag 169 WRITE_FLAG( pcAPS->getAlfEnabled()?1:0, "aps_adaptive_loop_filter_flag"); 170 #endif 171 } 172 #if LCU_SYNTAX_ALF 163 } 173 164 Void TEncCavlc::codeAPSAlflag(UInt uiCode) 174 165 { 175 166 WRITE_FLAG(uiCode, "aps_adaptive_loop_filter_flag"); 176 167 } 177 #endif178 168 179 169 Void TEncCavlc::codeDFFlag(UInt uiCode, const Char *pSymbolName) … … 186 176 } 187 177 188 #if RPS_IN_SPS189 178 Void TEncCavlc::codeShortTermRefPicSet( TComSPS* pcSPS, TComReferencePictureSet* rps ) 190 #else191 Void TEncCavlc::codeShortTermRefPicSet( TComPPS* pcPPS, TComReferencePictureSet* rps )192 #endif193 179 { 194 180 #if PRINT_RPS_INFO … … 245 231 xTracePPSHeader (pcPPS); 246 232 #endif 247 #if !RPS_IN_SPS248 TComRPSList* rpsList = pcPPS->getRPSList();249 #endif250 233 251 234 WRITE_UVLC( pcPPS->getPPSId(), "pic_parameter_set_id" ); 252 235 WRITE_UVLC( pcPPS->getSPSId(), "seq_parameter_set_id" ); 253 236 254 #if MULTIBITS_DATA_HIDING255 237 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 256 238 if( pcPPS->getSignHideFlag() ) … … 258 240 WRITE_CODE(pcPPS->getTSIG(), 4, "sign_hiding_threshold"); 259 241 } 260 #endif261 242 #if CABAC_INIT_FLAG 262 243 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); 263 #endif264 #if !RPS_IN_SPS265 // RPS is put before entropy_coding_mode_flag266 // since entropy_coding_mode_flag will probably be removed from the WD267 TComReferencePictureSet* rps;268 269 WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" );270 for(UInt i=0; i < rpsList->getNumberOfReferencePictureSets(); i++)271 {272 rps = rpsList->getReferencePictureSet(i);273 codeShortTermRefPicSet(pcPPS,rps);274 }275 WRITE_FLAG( pcPPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_present_flag" );276 244 #endif 277 245 // entropy_coding_mode_flag … … 280 248 if (pcPPS->getEntropyCodingMode()) 281 249 { 282 #if !WPP_SIMPLIFICATION 283 WRITE_UVLC( pcPPS->getEntropyCodingSynchro(), "entropy_coding_synchro" ); 284 WRITE_FLAG( pcPPS->getCabacIstateReset() ? 1 : 0, "cabac_istate_reset" ); 285 #endif 286 #if !TILES_OR_ENTROPY_SYNC_IDC 287 #if !WPP_SIMPLIFICATION 288 if ( pcPPS->getEntropyCodingSynchro() ) 289 #endif 290 { 291 WRITE_UVLC( pcPPS->getNumSubstreams()-1, "num_substreams_minus1" ); 292 } 293 #endif 294 } 295 #if !H0566_TLA 296 WRITE_UVLC( pcPPS->getNumTLayerSwitchingFlags(), "num_temporal_layer_switching_point_flags" ); 297 for( UInt i = 0; i < pcPPS->getNumTLayerSwitchingFlags(); i++ ) 298 { 299 WRITE_FLAG( pcPPS->getTLayerSwitchingFlag( i ) ? 1 : 0 , "temporal_layer_switching_point_flag" ); 300 } 301 #endif 250 } 302 251 // num_ref_idx_l0_default_active_minus1 303 252 // num_ref_idx_l1_default_active_minus1 … … 313 262 WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) 314 263 WRITE_CODE( pcPPS->getWPBiPredIdc(), 2, "weighted_bipred_idc" ); // Use of Weighting Bi-Prediction (B_SLICE) 315 #if H0388316 264 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); 317 #endif318 #if TILES_OR_ENTROPY_SYNC_IDC319 265 if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==1) 320 266 { 321 #endif322 267 WRITE_FLAG( pcPPS->getColumnRowInfoPresent(), "tile_info_present_flag" ); 323 268 WRITE_FLAG( pcPPS->getTileBehaviorControlPresentFlag(), "tile_control_present_flag"); … … 347 292 if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0) 348 293 { 349 #if !REMOVE_TILE_DEPENDENCE350 WRITE_FLAG( pcPPS->getTileBoundaryIndependenceIdr(), "tile_boundary_independence_flag" );351 if(pcPPS->getTileBoundaryIndependenceIdr() == 1)352 {353 #endif354 294 WRITE_FLAG( pcPPS->getLFCrossTileBoundaryFlag()?1 : 0, "loop_filter_across_tile_flag"); 355 #if !REMOVE_TILE_DEPENDENCE 356 } 357 #endif 358 } 359 } 360 #if TILES_OR_ENTROPY_SYNC_IDC 295 } 296 } 361 297 } 362 298 else if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==2) … … 364 300 WRITE_UVLC( pcPPS->getNumSubstreams()-1, "num_substreams_minus1" ); 365 301 } 366 #endif 367 368 #if DBL_CONTROL 302 369 303 WRITE_FLAG( pcPPS->getDeblockingFilterControlPresent()?1 : 0, "deblocking_filter_control_present_flag"); 370 #endif371 #if PARALLEL_MERGE372 304 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); 373 #endif374 305 WRITE_FLAG( 0, "pps_extension_flag" ); 375 306 } … … 498 429 } 499 430 } 431 #if INTER_VIEW_VECTOR_SCALING_C0115 432 WRITE_FLAG( pcVPS->getIVScalingFlag(), "inter_view_vector_scaling_flag" ); 433 #endif 500 434 } 501 435 … … 508 442 #endif 509 443 #endif 510 #if HHI_MPI 444 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 511 445 Void TEncCavlc::codeSPS( TComSPS* pcSPS, Bool bIsDepth ) 512 446 #else … … 528 462 WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (), "pic_width_in_luma_samples" ); 529 463 WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); 530 #if PIC_CROPPING531 464 WRITE_FLAG( pcSPS->getPicCroppingFlag(), "pic_cropping_flag" ); 532 465 if (pcSPS->getPicCroppingFlag()) … … 537 470 WRITE_UVLC( pcSPS->getPicCropBottomOffset(), "pic_crop_bottom_offset" ); 538 471 } 539 #endif540 472 541 473 #if FULL_NBIT … … 563 495 564 496 WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); 565 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER566 497 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 567 498 { … … 570 501 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "max_latency_increase[i]" ); 571 502 } 572 #else573 WRITE_UVLC( pcSPS->getMaxNumberOfReferencePictures(), "max_num_ref_pics" );574 WRITE_UVLC( pcSPS->getNumReorderFrames(), "num_reorder_frames" );575 WRITE_UVLC(pcSPS->getMaxDecFrameBuffering(), "max_dec_frame_buffering" );576 WRITE_UVLC(pcSPS->getMaxLatencyIncrease(), "max_latency_increase" );577 #endif578 503 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 579 504 … … 586 511 } 587 512 588 #if H0412_REF_PIC_LIST_RESTRICTION589 513 WRITE_FLAG( pcSPS->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag" ); 590 514 if( pcSPS->getRestrictedRefPicListsFlag() ) … … 592 516 WRITE_FLAG( pcSPS->getListsModificationPresentFlag(), "lists_modification_present_flag" ); 593 517 } 594 #endif595 518 WRITE_UVLC( log2MinCUSize - 3, "log2_min_coding_block_size_minus3" ); 596 519 WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth, "log2_diff_max_min_coding_block_size" ); … … 618 541 WRITE_FLAG( pcSPS->getUseSAO() ? 1 : 0, "sample_adaptive_offset_enabled_flag"); 619 542 WRITE_FLAG( pcSPS->getUseALF () ? 1 : 0, "adaptive_loop_filter_enabled_flag"); 620 #if LCU_SYNTAX_ALF621 543 if(pcSPS->getUseALF()) 622 544 { 623 545 WRITE_FLAG( (pcSPS->getUseALFCoefInSlice()) ? 1 : 0, "alf_coef_in_slice_flag"); 624 546 } 625 #endif626 547 627 548 if( pcSPS->getUsePCM() ) … … 634 555 WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0, "temporal_id_nesting_flag" ); 635 556 636 #if RPS_IN_SPS637 557 TComRPSList* rpsList = pcSPS->getRPSList(); 638 558 TComReferencePictureSet* rps; … … 645 565 } 646 566 WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_present_flag" ); 647 #endif648 #if !PIC_CROPPING649 //!!!KS: Syntax not in WD !!!650 651 xWriteUvlc ( pcSPS->getPad (0) );652 xWriteUvlc ( pcSPS->getPad (1) );653 #endif654 567 // AMVP mode for each depth 655 568 for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++) … … 658 571 } 659 572 660 #if TILES_WPP_ENTRY_POINT_SIGNALLING661 573 Int tilesOrEntropyCodingSyncIdc = 0; 662 574 if ( pcSPS->getNumColumnsMinus1() > 0 || pcSPS->getNumRowsMinus1() > 0) … … 670 582 pcSPS->setTilesOrEntropyCodingSyncIdc( tilesOrEntropyCodingSyncIdc ); 671 583 WRITE_CODE(tilesOrEntropyCodingSyncIdc, 2, "tiles_or_entropy_coding_sync_idc"); 672 #endif 673 674 #if TILES_OR_ENTROPY_SYNC_IDC 584 675 585 if(tilesOrEntropyCodingSyncIdc == 1) 676 586 { 677 #endif678 587 WRITE_UVLC( pcSPS->getNumColumnsMinus1(), "num_tile_columns_minus1" ); 679 588 WRITE_UVLC( pcSPS->getNumRowsMinus1(), "num_tile_rows_minus1" ); … … 694 603 if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0) 695 604 { 696 #if !REMOVE_TILE_DEPENDENCE697 WRITE_FLAG( pcSPS->getTileBoundaryIndependenceIdr(), "tile_boundary_independence_flag" );698 if(pcSPS->getTileBoundaryIndependenceIdr() == 1)699 {700 #endif701 605 WRITE_FLAG( pcSPS->getLFCrossTileBoundaryFlag()?1 : 0, "loop_filter_across_tile_flag"); 702 #if !REMOVE_TILE_DEPENDENCE 703 } 704 #endif 705 } 706 #if TILES_OR_ENTROPY_SYNC_IDC 707 } 708 #endif 606 } 607 } 709 608 WRITE_FLAG( 1, "sps_extension_flag" ); 710 609 #if !QC_MVHEVC_B0046 … … 792 691 WRITE_SVLC( pcSPS->getPdmOffset ()[ uiId ], "Pdm_offset" ); 793 692 } 794 #if H HI_INTER_VIEW_MOTION_PRED693 #if H3D_IVMP 795 694 WRITE_UVLC( pcSPS->getMultiviewMvPredMode(), "multi_view_mv_pred_mode" ); 796 695 #endif 797 #if H HI_INTER_VIEW_RESIDUAL_PRED696 #if H3D_IVRP 798 697 WRITE_FLAG ( pcSPS->getMultiviewResPredMode(), "multi_view_residual_pred_mode" ); 799 698 #endif … … 866 765 if (address==0) 867 766 { 868 if( pcSlice->getSPS()->getViewId() && !pcSlice->getIsDepth() ) 767 if( pcSlice->getSPS()->getViewId() 768 #if !LGE_ILLUCOMP_DEPTH_C0046 769 && !pcSlice->getIsDepth() 770 #endif 771 ) 869 772 { 870 773 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "applying IC flag" ); … … 889 792 WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "pic_parameter_set_id" ); 890 793 #endif 891 #if H0388892 794 if( pcSlice->getPPS()->getOutputFlagPresentFlag() ) 893 795 { 894 796 WRITE_FLAG( pcSlice->getPicOutputFlag() ? 1 : 0, "pic_output_flag" ); 895 797 } 896 #endif897 798 #if QC_REM_IDV_B0046 898 799 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_IDR && pcSlice->getViewId() == 0) … … 917 818 { 918 819 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); 919 #if RPS_IN_SPS920 820 codeShortTermRefPicSet(pcSlice->getSPS(), rps); 921 #else922 codeShortTermRefPicSet(pcSlice->getPPS(), rps);923 #endif924 821 } 925 822 else … … 928 825 WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" ); 929 826 } 930 #if RPS_IN_SPS931 827 if(pcSlice->getSPS()->getLongTermRefsPresent()) 932 #else933 if(pcSlice->getPPS()->getLongTermRefsPresent())934 #endif935 828 { 936 829 WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics"); 937 830 Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC(); 938 831 Int prev = 0; 939 #if LTRP_MULT940 832 Int prevDeltaPocLt=0; 941 833 Int currDeltaPocLt=0; 942 #endif943 834 for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--) 944 835 { 945 836 WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt"); 946 837 947 #if LTRP_MULT948 838 currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt; 949 839 … … 976 866 } 977 867 prevDeltaPocLt=currDeltaPocLt; 978 #endif979 868 prev = rps->getDeltaPOC(i); 980 869 WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); … … 988 877 { 989 878 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); 990 #if RPS_IN_SPS991 879 codeShortTermRefPicSet(pcSlice->getSPS(), rps); 992 #else993 codeShortTermRefPicSet(pcSlice->getPPS(), rps);994 #endif995 880 } 996 881 else … … 999 884 WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" ); 1000 885 } 1001 #if RPS_IN_SPS1002 886 if(pcSlice->getSPS()->getLongTermRefsPresent()) 1003 #else1004 if(pcSlice->getPPS()->getLongTermRefsPresent())1005 #endif1006 887 { 1007 888 WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics"); 1008 889 Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC(); 1009 890 Int prev = 0; 1010 #if LTRP_MULT1011 891 Int prevDeltaPocLt=0; 1012 892 Int currDeltaPocLt=0; 1013 #endif1014 893 for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--) 1015 894 { 1016 895 WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt"); 1017 896 1018 #if LTRP_MULT1019 897 currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt; 1020 898 … … 1047 925 } 1048 926 prevDeltaPocLt=currDeltaPocLt; 1049 #endif1050 927 prev = rps->getDeltaPOC(i); 1051 928 WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); … … 1059 936 if (pcSlice->getSPS()->getUseALF()) 1060 937 { 1061 #if !LCU_SYNTAX_ALF1062 if (pcSlice->getAlfEnabledFlag())1063 {1064 assert (pcSlice->getAPS()->getAlfEnabled());1065 }1066 #endif1067 938 WRITE_FLAG( pcSlice->getAlfEnabledFlag(), "ALF on/off flag in slice header" ); 1068 939 } 1069 940 if (pcSlice->getSPS()->getUseSAO()) 1070 941 { 1071 #if SAO_UNIT_INTERLEAVING1072 942 WRITE_FLAG( pcSlice->getSaoInterleavingFlag(), "SAO interleaving flag" ); 1073 #endif1074 943 assert (pcSlice->getSaoEnabledFlag() == pcSlice->getAPS()->getSaoEnabled()); 1075 944 WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "SAO on/off flag in slice header" ); 1076 #if SAO_UNIT_INTERLEAVING1077 945 if (pcSlice->getSaoInterleavingFlag()&&pcSlice->getSaoEnabledFlag() ) 1078 946 { … … 1080 948 WRITE_FLAG( pcSlice->getAPS()->getSaoParam()->bSaoFlag[2], "SAO on/off flag for Cr in slice header" ); 1081 949 } 1082 #endif1083 950 } 1084 951 WRITE_UVLC( pcSlice->getAPS()->getAPSID(), "aps_id"); … … 1103 970 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 1104 971 } 1105 #if H0412_REF_PIC_LIST_RESTRICTION1106 972 if( pcSlice->getSPS()->getListsModificationPresentFlag() ) 1107 973 { 1108 #endif1109 974 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 1110 #if H0137_0138_LIST_MODIFICATION1111 975 if( !pcSlice->isIntra() ) 1112 976 { … … 1151 1015 } 1152 1016 } 1153 #else 1154 if(!pcSlice->isIntra()) 1155 { 1156 WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0() ? 1 : 0, "ref_pic_list_modification_flag" ); 1157 for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL0(); i++) 1158 { 1159 WRITE_UVLC( refPicListModification->getListIdcL0(i), "ref_pic_list_modification_idc"); 1160 WRITE_UVLC( refPicListModification->getRefPicSetIdxL0(i), "ref_pic_set_idx"); 1161 } 1162 if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0()) 1163 WRITE_UVLC( 3, "ref_pic_list_modification_idc"); 1164 } 1165 if(pcSlice->isInterB()) 1166 { 1167 WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1() ? 1 : 0, "ref_pic_list_modification_flag" ); 1168 for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL1(); i++) 1169 { 1170 WRITE_UVLC( refPicListModification->getListIdcL1(i), "ref_pic_list_modification_idc"); 1171 WRITE_UVLC( refPicListModification->getRefPicSetIdxL1(i), "ref_pic_set_idx"); 1172 } 1173 if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1()) 1174 WRITE_UVLC( 3, "ref_pic_list_modification_idc"); 1175 } 1176 #endif 1177 } 1178 #if H0412_REF_PIC_LIST_RESTRICTION 1179 } 1180 #endif 1017 } 1018 } 1181 1019 // ref_pic_list_combination( ) 1182 1020 // maybe move to own function? … … 1188 1026 WRITE_UVLC( pcSlice->getNumRefIdx(REF_PIC_LIST_C) - 1, "num_ref_idx lc_active_minus1"); 1189 1027 1190 #if H0412_REF_PIC_LIST_RESTRICTION1191 1028 if( pcSlice->getSPS()->getListsModificationPresentFlag() ) 1192 1029 { 1193 #endif1194 1030 WRITE_FLAG( pcSlice->getRefPicListModificationFlagLC() ? 1 : 0, "ref_pic_list_modification_flag_lc" ); 1195 1031 if(pcSlice->getRefPicListModificationFlagLC()) … … 1198 1034 { 1199 1035 WRITE_FLAG( pcSlice->getListIdFromIdxOfLC(i), "pic_from_list_0_flag" ); 1200 #if H0137_0138_LIST_MODIFICATION1201 1036 if (((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_0) && pcSlice->getNumRefIdx( REF_PIC_LIST_0 )>1 ) || ((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_1) && pcSlice->getNumRefIdx( REF_PIC_LIST_1 )>1 ) ) 1202 1037 { 1203 1038 WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i), "ref_idx_list_curr" ); 1204 1039 } 1205 #else1206 WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i), "ref_idx_list_curr" );1207 #endif1208 1040 } 1209 1041 } 1210 #if H0412_REF_PIC_LIST_RESTRICTION 1211 } 1212 #endif 1042 } 1213 1043 } 1214 1044 } 1215 1045 1216 #if H0111_MVD_L1_ZERO1217 1046 if (pcSlice->isInterB()) 1218 1047 { 1219 1048 WRITE_FLAG( pcSlice->getMvdL1ZeroFlag() ? 1 : 0, "mvd_l1_zero_flag"); 1220 1049 } 1221 #endif1222 1050 1223 1051 if(pcSlice->getPPS()->getEntropyCodingMode() && !pcSlice->isIntra()) … … 1242 1070 Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); 1243 1071 WRITE_SVLC( iCode, "slice_qp_delta" ); 1244 #if DBL_CONTROL1245 1072 if (pcSlice->getPPS()->getDeblockingFilterControlPresent()) 1246 1073 { … … 1249 1076 WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag"); 1250 1077 } 1251 #else1252 WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag");1253 #endif1254 1078 if (!pcSlice->getInheritDblParamFromAPS()) 1255 1079 { … … 1261 1085 } 1262 1086 } 1263 #if DBL_CONTROL 1264 } 1265 #endif 1087 } 1266 1088 if ( pcSlice->getSliceType() == B_SLICE ) 1267 1089 { … … 1299 1121 } 1300 1122 1301 #if ( HHI_MPI || H HI_INTER_VIEW_MOTION_PRED)1302 #if ( HHI_MPI && H HI_INTER_VIEW_MOTION_PRED)1123 #if ( HHI_MPI || H3D_IVMP ) 1124 #if ( HHI_MPI && H3D_IVMP ) 1303 1125 const int iExtraMergeCandidates = ( pcSlice->getSPS()->getUseMVI() || pcSlice->getSPS()->getMultiviewMvPredMode() ) ? 1 : 0; 1304 1126 #elif HHI_MPI 1305 1127 const int iExtraMergeCandidates = pcSlice->getSPS()->getUseMVI() ? 1 : 0; 1128 #elif MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 1129 const int iExtraMergeCandidates = ( pcSlice->getIsDepth() || pcSlice->getSPS()->getMultiviewMvPredMode() ) ? 1 : 0; 1306 1130 #else 1307 1131 const int iExtraMergeCandidates = pcSlice->getSPS()->getMultiviewMvPredMode() ? 1 : 0; … … 1332 1156 \param pcSlice Where we find the substream size information. 1333 1157 */ 1334 #if TILES_WPP_ENTRY_POINT_SIGNALLING1335 1158 Void TEncCavlc::codeTilesWPPEntryPoint( TComSlice* pSlice ) 1336 1159 { … … 1432 1255 delete [] entryPointOffset; 1433 1256 } 1434 #else1435 Void TEncCavlc::codeSliceHeaderSubstreamTable( TComSlice* pcSlice )1436 {1437 UInt uiNumSubstreams = pcSlice->getPPS()->getNumSubstreams();1438 UInt*puiSubstreamSizes = pcSlice->getSubstreamSizes();1439 1440 // Write header information for all substreams except the last.1441 for (UInt ui = 0; ui+1 < uiNumSubstreams; ui++)1442 {1443 UInt uiNumbits = puiSubstreamSizes[ui];1444 1445 //the 2 first bits are used to give the size of the header1446 if ( uiNumbits < (1<<8) )1447 {1448 xWriteCode(0, 2 );1449 xWriteCode(uiNumbits, 8 );1450 }1451 else if ( uiNumbits < (1<<16) )1452 {1453 xWriteCode(1, 2 );1454 xWriteCode(uiNumbits, 16 );1455 }1456 else if ( uiNumbits < (1<<24) )1457 {1458 xWriteCode(2, 2 );1459 xWriteCode(uiNumbits, 24 );1460 }1461 else if ( uiNumbits < (1<<31) )1462 {1463 xWriteCode(3, 2 );1464 xWriteCode(uiNumbits, 32 );1465 }1466 else1467 {1468 printf("Error in codeSliceHeaderTable\n");1469 exit(-1);1470 }1471 }1472 }1473 #endif1474 1257 1475 1258 Void TEncCavlc::codeTerminatingBit ( UInt uilsLast ) … … 1481 1264 } 1482 1265 1483 #if H HI_INTER_VIEW_MOTION_PRED1266 #if H3D_IVMP 1484 1267 Void TEncCavlc::codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList, Int iNum ) 1485 1268 #else … … 1510 1293 } 1511 1294 1512 #if H HI_INTER_VIEW_RESIDUAL_PRED1295 #if H3D_IVRP 1513 1296 Void 1514 1297 TEncCavlc::codeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 1590 1373 } 1591 1374 1592 #if BURST_IPCM1593 1375 /** Code I_PCM information. 1594 1376 * \param pcCU pointer to CU … … 1602 1384 assert(0); 1603 1385 } 1604 #else1605 /** Code I_PCM information.1606 * \param pcCU pointer to CU1607 * \param uiAbsPartIdx CU index1608 * \returns Void1609 *1610 * If I_PCM flag indicates that the CU is I_PCM, code its PCM alignment bits and codes.1611 */1612 Void TEncCavlc::codeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx)1613 {1614 UInt uiIPCM = (pcCU->getIPCMFlag(uiAbsPartIdx) == true)? 1 : 0;1615 1616 xWriteFlag(uiIPCM);1617 1618 if (uiIPCM)1619 {1620 xWritePCMAlignZero();1621 1622 UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();1623 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx;1624 UInt uiChromaOffset = uiLumaOffset>>2;1625 1626 Pel* piPCMSample;1627 UInt uiWidth;1628 UInt uiHeight;1629 UInt uiSampleBits;1630 UInt uiX, uiY;1631 1632 piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset;1633 uiWidth = pcCU->getWidth(uiAbsPartIdx);1634 uiHeight = pcCU->getHeight(uiAbsPartIdx);1635 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();1636 1637 for(uiY = 0; uiY < uiHeight; uiY++)1638 {1639 for(uiX = 0; uiX < uiWidth; uiX++)1640 {1641 UInt uiSample = piPCMSample[uiX];1642 1643 xWriteCode(uiSample, uiSampleBits);1644 }1645 piPCMSample += uiWidth;1646 }1647 1648 piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;1649 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;1650 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;1651 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1652 1653 for(uiY = 0; uiY < uiHeight; uiY++)1654 {1655 for(uiX = 0; uiX < uiWidth; uiX++)1656 {1657 UInt uiSample = piPCMSample[uiX];1658 1659 xWriteCode(uiSample, uiSampleBits);1660 }1661 piPCMSample += uiWidth;1662 }1663 1664 piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;1665 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;1666 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;1667 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1668 1669 for(uiY = 0; uiY < uiHeight; uiY++)1670 {1671 for(uiX = 0; uiX < uiWidth; uiX++)1672 {1673 UInt uiSample = piPCMSample[uiX];1674 1675 xWriteCode(uiSample, uiSampleBits);1676 }1677 piPCMSample += uiWidth;1678 }1679 }1680 }1681 #endif1682 1386 1683 1387 Void TEncCavlc::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 1710 1414 Int iDQp = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx ); 1711 1415 1712 #if H0736_AVC_STYLE_QP_RANGE1713 1416 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 1714 1417 iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2); 1715 #endif1716 1418 1717 1419 xWriteSvlc( iDQp ); … … 1744 1446 xWriteSvlc( iCode ); 1745 1447 } 1746 #if LCU_SYNTAX_ALF1747 1448 /** Code the fixed length code (smaller than one max value) in OSALF 1748 1449 * \param idx: coded value … … 1769 1470 } 1770 1471 } 1771 #endif1772 1472 1773 1473 Void TEncCavlc::codeSaoFlag( UInt uiCode ) … … 1785 1485 xWriteSvlc( iCode ); 1786 1486 } 1787 #if SAO_UNIT_INTERLEAVING1788 1487 /** Code SAO run. 1789 1488 * \param uiCode … … 1809 1508 WRITE_CODE( uiCode, uiLength, "sao_run_diff"); 1810 1509 } 1811 #endif1812 1510 1813 1511 Void TEncCavlc::estBit( estBitsSbacStruct* pcEstBitsCabac, Int width, Int height, TextType eTType ) … … 2114 1812 Void TEncCavlc::xCodeScalingList(TComScalingList* scalingList, UInt sizeId, UInt listId) 2115 1813 { 2116 #if SCALING_LIST2117 1814 Int coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); 2118 1815 UInt* scan = g_auiFrameScanXY [ (sizeId == 0)? 1 : 2]; 2119 #else2120 Int coefNum = (Int)g_scalingListSize[sizeId];2121 UInt* scan = g_auiFrameScanXY [ sizeId + 1];2122 #endif2123 1816 Int nextCoef = SCALING_LIST_START_VALUE; 2124 1817 Int data; 2125 1818 Int *src = scalingList->getScalingListAddress(sizeId, listId); 2126 #if SCALING_LIST2127 1819 if(sizeId > SCALING_LIST_8x8 && scalingList->getUseDefaultScalingMatrixFlag(sizeId,listId)) 2128 1820 { … … 2155 1847 } 2156 1848 } 2157 #else2158 for(Int i=0;i<coefNum;i++)2159 {2160 data = src[scan[i]] - nextCoef;2161 nextCoef = src[scan[i]];2162 if(data > 127)2163 {2164 data = data - 256;2165 }2166 if(data < -128)2167 {2168 data = data + 256;2169 }2170 2171 WRITE_SVLC( data, "delta_coef");2172 }2173 #endif2174 1849 } 2175 1850 Bool TComScalingList::checkPredMode(UInt sizeId, UInt listId) … … 2177 1852 for(Int predListIdx = (Int)listId -1 ; predListIdx >= 0; predListIdx--) 2178 1853 { 2179 #if SCALING_LIST2180 1854 if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix 2181 1855 && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value 2182 #else2183 if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*(Int)g_scalingListSize[sizeId])) // check value of matrix2184 #endif2185 1856 { 2186 1857 setRefMatrixId(sizeId, listId, predListIdx); -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r210 r296 88 88 Void xWriteUnaryMaxSymbol ( UInt uiSymbol, UInt uiMaxSymbol ); 89 89 90 #if RPS_IN_SPS91 90 Void codeShortTermRefPicSet ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS ); 92 #else93 Void codeShortTermRefPicSet ( TComPPS* pcPPS, TComReferencePictureSet* pcRPS );94 #endif95 91 96 92 UInt xConvertToUInt ( Int iValue ) { return ( iValue <= 0) ? -iValue<<1 : (iValue<<1)-1; } … … 118 114 #endif 119 115 120 #if HHI_MPI 116 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 121 117 Void codeSPS ( TComSPS* pcSPS, Bool bIsDepth ); 122 118 #else … … 129 125 Void codeTileMarkerFlag(TComSlice* pcSlice); 130 126 131 #if TILES_WPP_ENTRY_POINT_SIGNALLING132 127 Void codeTilesWPPEntryPoint( TComSlice* pSlice ); 133 #else134 Void codeSliceHeaderSubstreamTable( TComSlice* pcSlice );135 #endif136 128 Void codeTerminatingBit ( UInt uilsLast ); 137 129 Void codeSliceFinish (); … … 139 131 Void encodeStart () {} 140 132 141 #if H HI_INTER_VIEW_MOTION_PRED133 #if H3D_IVMP 142 134 Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList, Int iNum ); 143 135 #else … … 148 140 Void codeAlfSvlc ( Int iCode ); 149 141 Void codeAlfCtrlDepth(); 150 #if LCU_SYNTAX_ALF151 142 Void codeAPSAlflag(UInt uiCode); 152 143 Void codeAlfFixedLengthIdx( UInt idx, UInt numFilterSetsInBuffer); 153 #endif154 144 Void codeSaoFlag ( UInt uiCode ); 155 145 Void codeSaoUvlc ( UInt uiCode ); 156 146 Void codeSaoSvlc ( Int iCode ); 157 #if SAO_UNIT_INTERLEAVING158 147 Void codeSaoRun ( UInt uiCode, UInt maxValue ); 159 148 Void codeSaoMergeLeft ( UInt uiCode, UInt compIdx ){;} … … 161 150 Void codeSaoTypeIdx ( UInt uiCode ){ xWriteUvlc(uiCode );} 162 151 Void codeSaoUflc ( UInt uiCode ){ assert(uiCode < 32); xWriteCode(uiCode, 5);} 163 #endif164 152 165 153 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 169 157 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 170 158 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 171 #if H HI_INTER_VIEW_RESIDUAL_PRED159 #if H3D_IVRP 172 160 Void codeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 173 161 #endif … … 189 177 Void codePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 190 178 191 #if BURST_IPCM192 179 Void codeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, Int numIPCM, Bool firstIPCMFlag); 193 #else194 Void codeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx );195 #endif196 180 197 181 Void codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx ); -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r210 r296 109 109 Int m_iSourceWidth; 110 110 Int m_iSourceHeight; 111 #if PIC_CROPPING112 111 Int m_croppingMode; 113 112 Int m_cropLeft; … … 115 114 Int m_cropTop; 116 115 Int m_cropBottom; 117 #endif118 116 Int m_iFrameToBeEncoded; 119 117 Double m_adLambdaModifier[ MAX_TLAYER ]; … … 125 123 GOPEntryMvc m_GOPList[MAX_GOP+1]; 126 124 Int m_extraRPSs; 127 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER128 125 Int m_maxDecPicBuffering[MAX_TLAYER]; 129 126 Int m_numReorderPics[MAX_TLAYER]; 130 #else131 Int m_maxNumberOfReferencePictures;132 Int m_numReorderFrames;133 #endif134 127 135 128 Int m_iQP; // if (AdaptiveQP == OFF) … … 142 135 // TODO: We need to have a common sliding mechanism used by both the encoder and decoder 143 136 144 #if H0566_TLA145 137 Int m_maxTempLayer; ///< Max temporal layer 146 #else147 Bool m_bTLayering; ///< indicates whether temporal IDs are set based on the hierarchical coding structure148 Bool m_abTLayerSwitchingFlag[MAX_TLAYER]; ///< temporal layer switching flags corresponding to temporal layer149 #endif150 138 Bool m_bDisInter4x4; 151 139 Bool m_useAMP; … … 163 151 Int m_loopFilterBetaOffsetDiv2; 164 152 Int m_loopFilterTcOffsetDiv2; 165 #if DBL_CONTROL166 153 Bool m_DeblockingFilterControlPresent; 167 #endif168 154 Bool m_bUseSAO; 169 155 #if LGE_ILLUCOMP_B0045 170 156 Bool m_bUseIC; 171 157 #endif 172 #if SAO_UNIT_INTERLEAVING 158 #if INTER_VIEW_VECTOR_SCALING_C0115 159 Bool m_bUseIVS; 160 #endif 173 161 Int m_maxNumOffsetsPerPic; 174 162 Bool m_saoInterleavingFlag; 175 #endif176 163 177 164 //====== Lossless ======== … … 229 216 230 217 Int m_iALFMaxNumberFilters; 231 #if LCU_SYNTAX_ALF232 218 Bool m_bALFParamInSlice; 233 219 Bool m_bALFPicBasedEncode; 234 #endif235 220 236 221 Bool m_bUseASR; … … 239 224 Bool m_bLCMod; 240 225 Bool m_bUseRDOQ; 241 #if !PIC_CROPPING242 Bool m_bUsePAD;243 #endif244 226 Bool m_bUseFastEnc; 245 227 Bool m_bUseEarlyCU; 246 228 247 #if FAST_DECISION_FOR_MRG_RD_COST248 229 Bool m_useFastDecisionForMerge; 249 #endif250 230 Bool m_bUseCbfFastMode; 251 231 Bool m_bUseLMChroma; … … 305 285 306 286 Bool m_bEnableTMVP; 307 #if MULTIBITS_DATA_HIDING308 287 Int m_signHideFlag; 309 288 Int m_signHidingThreshold; 310 #endif311 289 312 290 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 … … 349 327 #endif 350 328 351 #if H HI_INTER_VIEW_MOTION_PRED329 #if H3D_IVMP 352 330 UInt m_uiMultiviewMvPredMode; 353 331 UInt m_uiMultiviewMvRegMode; 354 332 Double m_dMultiviewMvRegLambdaScale; 355 333 #endif 356 #if H HI_INTER_VIEW_RESIDUAL_PRED334 #if H3D_IVRP 357 335 UInt m_uiMultiviewResPredMode; 358 336 #endif … … 383 361 Void setSourceWidth ( Int i ) { m_iSourceWidth = i; } 384 362 Void setSourceHeight ( Int i ) { m_iSourceHeight = i; } 385 #if PIC_CROPPING386 363 Void setCroppingMode ( Int i ) { m_croppingMode = i; } 387 364 Void setCropLeft ( Int i ) { m_cropLeft = i; } … … 389 366 Void setCropTop ( Int i ) { m_cropTop = i; } 390 367 Void setCropBottom ( Int i ) { m_cropBottom = i; } 391 #endif392 368 Void setFrameToBeEncoded ( Int i ) { m_iFrameToBeEncoded = i; } 393 369 … … 399 375 Void setExtraRPSs ( Int i ) { m_extraRPSs = i; } 400 376 GOPEntryMvc getGOPEntry ( Int i ) { return m_GOPList[i]; } 401 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER402 377 Void setMaxDecPicBuffering ( UInt u, UInt tlayer ) { m_maxDecPicBuffering[tlayer] = u; } 403 378 Void setNumReorderPics ( Int i, UInt tlayer ) { m_numReorderPics[tlayer] = i; } 404 #else405 Void setMaxNumberOfReferencePictures ( Int u ) { m_maxNumberOfReferencePictures = u; }406 Void setNumReorderFrames ( Int i ) { m_numReorderFrames = i; }407 #endif408 379 409 380 #if HHI_INTERVIEW_SKIP … … 423 394 Void setMaxRefPicNum ( Int iMaxRefPicNum ) { m_iMaxRefPicNum = iMaxRefPicNum; } 424 395 425 #if H0566_TLA426 396 Bool getMaxTempLayer () { return m_maxTempLayer; } 427 397 Void setMaxTempLayer ( Int maxTempLayer ) { m_maxTempLayer = maxTempLayer; } 428 #else429 Bool getTLayering () { return m_bTLayering; }430 Void setTLayering ( Bool bTLayering ) { m_bTLayering = bTLayering; }431 Bool getTLayerSwitchingFlag ( UInt uiTLayer ) { assert (uiTLayer < MAX_TLAYER ); return m_abTLayerSwitchingFlag[uiTLayer]; }432 Void setTLayerSwitchingFlag ( Bool* pbTLayerSwitchingFlag ) { for ( Int i = 0; i < MAX_TLAYER; i++ ) m_abTLayerSwitchingFlag[i] = pbTLayerSwitchingFlag[i]; }433 #endif434 398 435 399 Bool getDisInter4x4 () { return m_bDisInter4x4; } … … 444 408 #endif 445 409 446 #if H HI_INTER_VIEW_MOTION_PRED410 #if H3D_IVMP 447 411 Void setMultiviewMvPredMode ( UInt u ) { m_uiMultiviewMvPredMode = u; } 448 412 Void setMultiviewMvRegMode ( UInt u ) { m_uiMultiviewMvRegMode = u; } 449 413 Void setMultiviewMvRegLambdaScale ( Double d) { m_dMultiviewMvRegLambdaScale = d; } 450 414 #endif 451 #if H HI_INTER_VIEW_RESIDUAL_PRED415 #if H3D_IVRP 452 416 Void setMultiviewResPredMode ( UInt u ) { m_uiMultiviewResPredMode = u; } 453 417 #endif … … 467 431 Void setLoopFilterBetaOffset ( Int i ) { m_loopFilterBetaOffsetDiv2 = i; } 468 432 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 469 #if DBL_CONTROL470 433 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 471 #endif472 434 473 435 //====== Motion search ======== … … 479 441 Void setVerticalDisparitySearchRange ( Int i ) { m_iVerticalDisparitySearchRange = i; } 480 442 #endif 481 #if H HI_INTER_VIEW_MOTION_PRED443 #if H3D_IVMP 482 444 UInt getMultiviewMvRegMode () { return m_uiMultiviewMvRegMode; } 483 445 Double getMultiviewMvRegLambdaScale () { return m_dMultiviewMvRegLambdaScale; } … … 524 486 Int getSourceWidth () { return m_iSourceWidth; } 525 487 Int getSourceHeight () { return m_iSourceHeight; } 526 #if PIC_CROPPING527 488 Int getCroppingMode () { return m_croppingMode; } 528 489 Int getCropLeft () { return m_cropLeft; } … … 530 491 Int getCropTop () { return m_cropTop; } 531 492 Int getCropBottom () { return m_cropBottom; } 532 #endif533 493 Int getFrameToBeEncoded () { return m_iFrameToBeEncoded; } 534 494 void setLambdaModifier ( UInt uiIndex, Double dValue ) { m_adLambdaModifier[ uiIndex ] = dValue; } … … 539 499 UInt getDecodingRefreshType () { return m_uiDecodingRefreshType; } 540 500 Int getGOPSize () { return m_iGOPSize; } 541 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER542 501 Int getMaxDecPicBuffering (UInt tlayer) { return m_maxDecPicBuffering[tlayer]; } 543 502 Int getNumReorderPics (UInt tlayer) { return m_numReorderPics[tlayer]; } 544 #else545 Int getMaxNumberOfReferencePictures () { return m_maxNumberOfReferencePictures; }546 Int geNumReorderFrames () { return m_numReorderFrames; }547 #endif548 503 Int getQP () { return m_iQP; } 549 504 … … 562 517 Int getLoopFilterBetaOffset () { return m_loopFilterBetaOffsetDiv2; } 563 518 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 564 #if DBL_CONTROL565 519 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 566 #endif567 520 568 521 //==== Motion search ======== … … 607 560 Void setLCMod ( Bool b ) { m_bLCMod = b; } 608 561 Void setUseRDOQ ( Bool b ) { m_bUseRDOQ = b; } 609 #if !PIC_CROPPING610 Void setUsePAD ( Bool b ) { m_bUsePAD = b; }611 #endif612 562 #if HHI_VSO 613 563 Void setUseVSO ( Bool b ) { m_bUseVSO = b; } … … 621 571 Void setUseFastEnc ( Bool b ) { m_bUseFastEnc = b; } 622 572 Void setUseEarlyCU ( Bool b ) { m_bUseEarlyCU = b; } 623 #if FAST_DECISION_FOR_MRG_RD_COST624 573 Void setUseFastDecisionForMerge ( Bool b ) { m_useFastDecisionForMerge = b; } 625 #endif626 574 Void setUseCbfFastMode ( Bool b ) { m_bUseCbfFastMode = b; } 627 575 Void setUseConstrainedIntraPred ( Bool b ) { m_bUseConstrainedIntraPred = b; } … … 642 590 Void setALFMaxNumberFilters (Int i) { m_iALFMaxNumberFilters = i; } 643 591 Int getALFMaxNumberFilters () { return m_iALFMaxNumberFilters; } 644 #if LCU_SYNTAX_ALF645 592 Void setALFParamInSlice (Bool b) {m_bALFParamInSlice = b;} 646 593 Bool getALFParamInSlice () {return m_bALFParamInSlice;} 647 594 Void setALFPicBasedEncode (Bool b) {m_bALFPicBasedEncode = b;} 648 595 Bool getALFPicBasedEncode () {return m_bALFPicBasedEncode;} 649 #endif650 596 651 597 Bool getUseLComb () { return m_bUseLComb; } 652 598 Bool getLCMod () { return m_bLCMod; } 653 599 Bool getUseRDOQ () { return m_bUseRDOQ; } 654 #if !PIC_CROPPING655 Bool getUsePAD () { return m_bUsePAD; }656 #endif657 600 658 601 #if HHI_VSO … … 666 609 Bool getUseFastEnc () { return m_bUseFastEnc; } 667 610 Bool getUseEarlyCU () { return m_bUseEarlyCU; } 668 #if FAST_DECISION_FOR_MRG_RD_COST669 611 Bool getUseFastDecisionForMerge () { return m_useFastDecisionForMerge; } 670 #endif671 612 Bool getUseCbfFastMode () { return m_bUseCbfFastMode; } 672 613 Bool getUseConstrainedIntraPred () { return m_bUseConstrainedIntraPred; } … … 714 655 Bool getUseIC () {return m_bUseIC;} 715 656 #endif 716 #if SAO_UNIT_INTERLEAVING 657 #if INTER_VIEW_VECTOR_SCALING_C0115 658 Void setUseIVS ( Bool bVal ) {m_bUseIVS = bVal;} 659 Bool getUseIVS () {return m_bUseIVS;} 660 #endif 717 661 Void setMaxNumOffsetsPerPic (Int iVal) { m_maxNumOffsetsPerPic = iVal; } 718 662 Int getMaxNumOffsetsPerPic () { return m_maxNumOffsetsPerPic; } 719 663 Void setSaoInterleavingFlag (bool bVal) { m_saoInterleavingFlag = bVal; } 720 664 Bool getSaoInterleavingFlag () { return m_saoInterleavingFlag; } 721 #endif722 665 Void setTileBehaviorControlPresentFlag ( Int i ) { m_iTileBehaviorControlPresentFlag = i; } 723 666 Int getTileBehaviorControlPresentFlag () { return m_iTileBehaviorControlPresentFlag; } … … 728 671 Void setUniformSpacingIdr ( Int i ) { m_iUniformSpacingIdr = i; } 729 672 Int getUniformSpacingIdr () { return m_iUniformSpacingIdr; } 730 #if !REMOVE_TILE_DEPENDENCE731 Void setTileBoundaryIndependenceIdr ( Int i ) { m_iTileBoundaryIndependenceIdr = i; }732 Int getTileBoundaryIndependenceIdr () { return m_iTileBoundaryIndependenceIdr; }733 #endif734 673 Void setNumColumnsMinus1 ( Int i ) { m_iNumColumnsMinus1 = i; } 735 674 Int getNumColumnsMinus1 () { return m_iNumColumnsMinus1; } … … 827 766 Void setEnableTMVP ( Bool b ) { m_bEnableTMVP = b; } 828 767 Bool getEnableTMVP () { return m_bEnableTMVP; } 829 #if MULTIBITS_DATA_HIDING830 768 Void setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; } 831 769 Void setTSIG( Int tsig ) { m_signHidingThreshold = tsig; } 832 770 Int getSignHideFlag() { return m_signHideFlag; } 833 771 Int getTSIG() { return m_signHidingThreshold; } 834 #endif835 772 #if VIDYO_VPS_INTEGRATION |QC_MVHEVC_B0046 836 773 Void setLayerId ( UInt layerId ) { m_layerId = layerId; } … … 869 806 Void setCodedOffset ( Int** p ) { m_aaiCodedOffset = p; } 870 807 871 #if SONY_COLPIC_AVAILABILITY872 Int getViewOrderIdx () { return m_iViewOrderIdx; } 808 #if INTER_VIEW_VECTOR_SCALING_C0115 809 Int getViewOrderIdx () { return m_iViewOrderIdx; } // will be changed to view_id 873 810 #endif 874 811 }; -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r189 r296 72 72 m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1]; 73 73 m_ppcOrigYuv = new TComYuv*[m_uhTotalDepth-1]; 74 #if H HI_INTER_VIEW_RESIDUAL_PRED74 #if H3D_IVRP 75 75 m_ppcResPredTmp = new TComYuv*[m_uhTotalDepth-1]; 76 76 #endif … … 101 101 102 102 m_ppcOrigYuv [i] = new TComYuv; m_ppcOrigYuv [i]->create(uiWidth, uiHeight); 103 #if H HI_INTER_VIEW_RESIDUAL_PRED103 #if H3D_IVRP 104 104 m_ppcResPredTmp [i] = new TComYuv; m_ppcResPredTmp [i]->create(uiWidth, uiHeight); 105 105 #endif … … 107 107 108 108 m_bEncodeDQP = false; 109 #if BURST_IPCM110 109 m_checkBurstIPCMFlag = false; 111 #endif112 110 113 111 // initialize partition order. … … 168 166 m_ppcOrigYuv[i]->destroy(); delete m_ppcOrigYuv[i]; m_ppcOrigYuv[i] = NULL; 169 167 } 170 #if H HI_INTER_VIEW_RESIDUAL_PRED168 #if H3D_IVRP 171 169 if(m_ppcResPredTmp[i]) 172 170 { … … 221 219 m_ppcOrigYuv = NULL; 222 220 } 223 #if H HI_INTER_VIEW_RESIDUAL_PRED221 #if H3D_IVRP 224 222 if(m_ppcResPredTmp) 225 223 { … … 285 283 } 286 284 287 #if BURST_IPCM288 285 TComPic* pcPic = pcCU->getPic(); 289 286 Bool checkBurstIPCMFlag = (pcPic->getSlice(0)->getSPS()->getUsePCM())? true : false; … … 293 290 pcCU->setNumSucIPCM(0); 294 291 pcCU->setLastCUSucIPCMFlag(false); 295 #endif296 292 297 293 // Encode CU data 298 294 xEncodeCU( pcCU, 0, 0 ); 299 295 300 #if OL_FLUSH301 296 bool bTerminateSlice = bForceTerminate; 302 297 UInt uiCUAddr = pcCU->getAddr(); 303 298 /* If at the end of an LCU line but not at the end of a substream, perform CABAC flush */ 304 #if WPP_SIMPLIFICATION305 299 if (!bTerminateSlice && pcCU->getSlice()->getPPS()->getNumSubstreams() > 1) 306 #else307 if (!bTerminateSlice && pcCU->getSlice()->getPPS()->getCabacIstateReset())308 #endif309 300 { 310 301 Int iNumSubstreams = pcCU->getSlice()->getPPS()->getNumSubstreams(); … … 312 303 UInt uiCol = uiCUAddr % uiWidthInLCUs; 313 304 UInt uiLin = uiCUAddr / uiWidthInLCUs; 314 #if !REMOVE_TILE_DEPENDENCE315 Int iBreakDep = pcCU->getPic()->getPicSym()->getTileBoundaryIndependenceIdr();316 #endif317 305 UInt uiTileStartLCU = pcCU->getPic()->getPicSym()->getTComTile(pcCU->getPic()->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr(); 318 306 UInt uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; … … 321 309 UInt uiTileHeight = pcCU->getPic()->getPicSym()->getTComTile(pcCU->getPic()->getPicSym()->getTileIdxMap(uiCUAddr))->getTileHeight(); 322 310 Int iNumSubstreamsPerTile = iNumSubstreams; 323 #if !REMOVE_TILE_DEPENDENCE 324 #if WPP_SIMPLIFICATION 325 if (iBreakDep && pcCU->getSlice()->getPPS()->getNumSubstreams() > 1) 326 #else 327 if (iBreakDep && pcCU->getSlice()->getPPS()->getEntropyCodingSynchro()) 328 #endif 311 if (pcCU->getSlice()->getPPS()->getNumSubstreams() > 1) 312 { 329 313 iNumSubstreamsPerTile /= pcCU->getPic()->getPicSym()->getNumTiles(); 330 if ((iBreakDep && (uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))331 || (!iBreakDep && (uiCol == uiWidthInLCUs-1) && (uiLin+iNumSubstreams < pcCU->getPic()->getFrameHeightInCU())))314 } 315 if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight)) 332 316 { 333 317 m_pcEntropyCoder->encodeFlush(); 334 318 } 335 #else 336 #if WPP_SIMPLIFICATION 337 if (pcCU->getSlice()->getPPS()->getNumSubstreams() > 1) 338 #else 339 if (pcCU->getSlice()->getPPS()->getEntropyCodingSynchro()) 340 #endif 341 { 342 iNumSubstreamsPerTile /= pcCU->getPic()->getPicSym()->getNumTiles(); 343 } 344 if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight)) 345 { 346 m_pcEntropyCoder->encodeFlush(); 347 } 348 #endif 349 } 350 #endif // OL_FLUSH 319 } 351 320 } 352 321 … … 458 427 Bool bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType() == I_SLICE); 459 428 429 #if HHI_QTLPC_RAU_OFF_C0160 430 Bool rapPic = (rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 431 #endif 432 460 433 Bool bTry2NxN = true; 461 434 Bool bTryNx2N = true; … … 494 467 495 468 #if LGE_ILLUCOMP_B0045 496 Bool bICEnabled = (!rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewId()); 469 Bool bICEnabled = ( 470 #if !LGE_ILLUCOMP_DEPTH_C0046 471 !rpcTempCU->getSlice()->getIsDepth() && 472 #endif 473 rpcTempCU->getSlice()->getViewId()); 497 474 498 475 bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC(); … … 548 525 #if LOSSLESS_CODING 549 526 Bool isAddLowestQP = false; 550 #if H0736_AVC_STYLE_QP_RANGE551 527 Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(); 552 #else553 Int lowestQP = 0;554 #endif555 528 #endif 556 529 … … 558 531 { 559 532 Int idQP = m_pcEncCfg->getMaxDeltaQP(); 560 #if H0736_AVC_STYLE_QP_RANGE561 533 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP ); 562 534 iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP ); … … 568 540 569 541 } 570 #endif571 #else572 iMinQP = Clip3( MIN_QP, MAX_QP, iBaseQP-idQP );573 iMaxQP = Clip3( MIN_QP, MAX_QP, iBaseQP+idQP );574 #if LOSSLESS_CODING575 if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )576 {577 isAddLowestQP = true;578 iMinQP = iMinQP - 1;579 }580 #endif581 542 #endif 582 543 } … … 612 573 #if OL_QTLIMIT_PREDCODING_B0068 613 574 //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU 575 576 #if HHI_QTLPC_RAU_OFF_C0160 577 if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC()) 578 #else 614 579 if(depthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC()) 580 #endif 615 581 { 616 582 TComDataCU* pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() ); //Corresponding texture LCU … … 635 601 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 636 602 { 637 #if HHI_INTER_VIEW_RESIDUAL_PRED 603 #if H3D_IVRP 604 #if MTK_MDIVRP_C0138 605 Bool bResPredAvailable = false; 606 UInt uiResPrdId = 0; 607 #else 638 608 // check availability of residual prediction 639 609 Bool bResPredAvailable = false; … … 643 613 if( bResPredAllowed ) 644 614 { 645 bResPredAvailable = rpcBestCU->getResidualSamples( 0, 646 #if QC_SIMPLIFIEDIVRP_M24938 647 true , 648 #endif 649 m_ppcResPredTmp[uiDepth] ); 615 bResPredAvailable = rpcBestCU->getResidualSamples( 0, true , m_ppcResPredTmp[uiDepth] ); 650 616 } 651 617 652 618 for( UInt uiResPrdId = 0; uiResPrdId < ( bResPredAvailable ? 2 : 1 ); uiResPrdId++ ) 619 #endif 653 620 { 654 621 Bool bResPredFlag = ( uiResPrdId > 0 ); … … 660 627 #endif 661 628 #endif 662 #if H HI_INTER_VIEW_RESIDUAL_PRED629 #if H3D_IVRP 663 630 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 664 631 #endif … … 691 658 if ( !bEarlySkip ) 692 659 { 693 #if H HI_INTER_VIEW_RESIDUAL_PRED660 #if H3D_IVRP 694 661 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 662 #endif 663 #if FIX_LGE_ILLUCOMP_B0045 664 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 695 665 #endif 696 666 #if HHI_INTERVIEW_SKIP