Changeset 296 in 3DVCSoftware


Ignore:
Timestamp:
20 Feb 2013, 22:07:43 (11 years ago)
Author:
tech
Message:

Reintegrated branch 5.1-dev0 rev. 295.

Location:
trunk
Files:
101 edited

Legend:

Unmodified
Added
Removed
  • trunk/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg

    r210 r296  
    157157SignHideFlag                   : 1                                 # sign hiding
    158158SignHideThreshold              : 4                                 # sign hiding threshold
    159 IlluCompEnable                 : 1                                 # illumination compensation (0: OFF, 1: ON)
     159IlluCompEnable                 : 1 1                               # illumination compensation (0: OFF, 1: ON)
    160160
    161161#============ PCM ================
  • trunk/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg

    r210 r296  
    161161SignHideFlag                   : 1                                 # sign hiding
    162162SignHideThreshold              : 4                                 # sign hiding threshold
    163 IlluCompEnable                 : 1                                 # illumination compensation (0: OFF, 1: ON)
     163IlluCompEnable                 : 1 1                               # illumination compensation (0: OFF, 1: ON)
    164164
    165165#============ PCM ================
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r210 r296  
    9696#endif
    9797
    98 #if SONY_COLPIC_AVAILABILITY
    99   m_tDecTop[0]->setViewOrderIdx(0);
    100 #endif
    10198  Int                 viewDepthId = 0;
    10299  Int                 previousViewDepthId  = 0;
     
    111108    newPicture[i] = false;
    112109#if FLEX_CODING_ORDER_M23723
    113 #if  FIX_FCO_COMP_WARNING
    114110    m_fcoOrder[i] = ' ';
    115 #else
    116     m_fcoOrder[i]=NULL;
    117 #endif
    118111#endif
    119112
     
    302295      if( ( viewDepthId == 0 && (viewDepthId != previousViewDepthId) ) || m_tDecTop.size() == 1 )
    303296      {
    304 #if HHI_INTER_VIEW_RESIDUAL_PRED
     297#if H3D_IVRP
    305298        for( Int i = 0; i < m_tDecTop.size(); i++ )
    306299        {
     
    376369      if(newPicture[viewDepthId])
    377370      {
    378 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    379371        xWriteOutput( pcListPic[viewDepthId], viewDepthId, nalu.m_temporalId );
    380 #else
    381         xWriteOutput( pcListPic[viewDepthId], viewDepthId );
    382 #endif
    383372      }
    384373    }
     
    447436}
    448437
    449 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    450438Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId )
    451 #else
    452 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId )
    453 #endif
    454439{
    455440  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
     
    470455  {
    471456    TComPic* pcPic = *(iterPic);
    472 #if PIC_CROPPING
    473457    TComSPS *sps = pcPic->getSlice(0)->getSPS();
    474 #endif
    475458   
    476 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    477459    if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getSlice(0)->getSPS()->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[viewDepthId]))
    478 #else
    479     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getSlice(0)->getSPS()->getNumReorderFrames() && pcPic->getPOC() > m_pocLastDisplay[viewDepthId]))
    480 #endif
    481460    {
    482461      // write to file
     
    484463      if ( m_pchReconFile )
    485464      {
    486 #if PIC_CROPPING
    487465        m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
    488 #else
    489         m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
    490 #endif
    491466      }
    492467     
     
    533508  {
    534509    TComPic* pcPic = *(iterPic);
    535 #if PIC_CROPPING
    536510    TComSPS *sps = pcPic->getSlice(0)->getSPS();
    537 #endif
    538511
    539512    if ( pcPic->getOutputMark() )
     
    542515      if ( m_pchReconFile )
    543516      {
    544 #if PIC_CROPPING
    545517        m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
    546 #else
    547         m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
    548 #endif
    549518      }
    550519     
     
    764733#endif
    765734}
     735
     736#if MERL_VSP_C0152
     737Void 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
    766751//! \}
  • trunk/source/App/TAppDecoder/TAppDecTop.h

    r210 r296  
    112112#endif
    113113
     114#if MERL_VSP_C0152
     115  Void  setBWVSPLUT( TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc   );
     116#endif
     117
    114118protected:
    115119//  Void  xCreateDecLib     (); ///< create internal classes
     
    117121//  Void  xInitDecLib       (); ///< initialize decoder class
    118122 
    119 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    120123  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId); ///< write YUV to file
    121 #else
    122   Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< write YUV to file
    123 #endif
    124124  Void  xFlushOutput      ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< flush all remaining decoded pictures to file
    125125
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r210 r296  
    220220 
    221221  /* 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")
    244242  ("InputBitDepth",         m_uiInputBitDepth, 8u, "bit-depth of input file")
    245243  ("BitDepth",              m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth")
    246244  ("OutputBitDepth",        m_uiOutputBitDepth, 0u, "bit-depth of output file")
    247245  ("InternalBitDepth",      m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)")
    248 #if !PIC_CROPPING
    249   ("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 #endif
    253246  ("FrameRate,-fr",         m_iFrameRate,        0, "Frame rate")
    254247  ("FrameSkip,-fs",         m_FrameSkip,         0u, "Number of frames to skip at start of input YUV")
    255248  ("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")
    257250 
    258251  ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
     
    279272  ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CRA 2:IDR)")
    280273  ("GOPSize,g",      m_iGOPSize,      1, "GOP size of temporal structure")
    281 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    282   ("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 #endif
    285274  ("ListCombination,-lc", m_bUseLComb, true, "combined reference list flag for uni-prediction in B-slices")
    286275  ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation")
     
    321310  ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], MAX_QP + 1, "QP offset of temporal layer 3")
    322311 
    323 #if !H0566_TLA
    324   ("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 #endif
    331312
    332313  /* Entropy coding parameters */
     
    340321  ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 )
    341322#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
    342326  ("IlluCompEnable",                  m_bUseIC                  , true         , "Use illumination compensation for inter-view prediction" )
    343327#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
    345332  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, true)
    346 #endif
    347333
    348334  /* Camera Paremetes */
     
    391377  ("PredDepthMapGen",  m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" )
    392378#endif
    393 #if HHI_INTER_VIEW_MOTION_PRED
     379#if H3D_IVMP
    394380  ("MultiviewMvPred",  m_uiMultiviewMvPredMode,    (UInt)0, "usage of predicted depth maps" )
    395381  ("MultiviewMvRegMode",        m_uiMultiviewMvRegMode,         (UInt)0, "regularization mode for multiview motion vectors" )
    396382  ("MultiviewMvRegLambdaScale", m_dMultiviewMvRegLambdaScale, (Double)0, "lambda scale for multiview motion vector regularization" )
    397383#endif
    398 #if HHI_INTER_VIEW_RESIDUAL_PRED
     384#if H3D_IVRP
    399385  ("MultiviewResPred", m_uiMultiviewResPredMode,   (UInt)0, "usage of inter-view residual prediction" )
    400386#endif
     
    405391  ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF")
    406392  ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO")
    407 #if SAO_UNIT_INTERLEAVING
    408393  ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "2048: default")   
    409394  ("SAOInterleaving", m_saoInterleavingFlag, false, "0: SAO Picture Mode, 1: SAO Interleaving ")   
    410 #endif
    411395
    412396  ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding")
    413397
    414398  ("ALFMaxNumFilter,-ALFMNF", m_iALFMaxNumberFilters, 16, "16: No Constrained, 1-15: Constrained max number of filter")
    415 #if LCU_SYNTAX_ALF
    416399  ("ALFParamInSlice", m_bALFParamInSlice, false, "ALF parameters in 0: APS, 1: slice header")
    417400  ("ALFPicBasedEncode", m_bALFPicBasedEncode, true, "ALF picture-based encoding 0: false, 1: true")
    418 #endif
    419401
    420402    ("SliceMode",            m_iSliceMode,           0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes")
     
    439421    ("TileInfoPresentFlag",         m_iColumnRowInfoPresent,         1,          "0: tiles parameters are NOT present in the PPS. 1: tiles parameters are present in the PPS")
    440422    ("UniformSpacingIdc",           m_iUniformSpacingIdr,            0,          "Indicates if the column and row boundaries are distributed uniformly")
    441 #if !REMOVE_TILE_DEPENDENCE
    442     ("TileBoundaryIndependenceIdc", m_iTileBoundaryIndependenceIdr,  1,          "Indicates if the column and row boundaries break the prediction")
    443 #endif
    444423    ("NumTileColumnsMinus1",        m_iNumColumnsMinus1,             0,          "Number of columns in a picture minus 1")
    445424    ("ColumnWidthArray",            cfg_ColumnWidth,                 string(""), "Array containing ColumnWidth values in units of LCU")
     
    456435    ("ScalingList",                 m_useScalingListId,              0,          "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile")
    457436    ("ScalingListFile",             cfg_ScalingListFile,             string(""), "Scaling list file name")
    458 #if MULTIBITS_DATA_HIDING
    459437    ("SignHideFlag,-SBH",                m_signHideFlag, 1)
    460438    ("SignHideThreshold,-TSIG",          m_signHidingThreshold,         4)
    461 #endif
    462439#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    463440  ("DMM",                         m_bUseDMM,                       false,      "depth model modes flag")
     
    477454  ("FEN", m_bUseFastEnc, false, "fast encoder setting")
    478455  ("ECU", m_bUseEarlyCU, false, "Early CU setting")
    479 #if FAST_DECISION_FOR_MRG_RD_COST
    480456  ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost")
    481 #endif
    482457  ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
    483458#if HHI_INTERVIEW_SKIP
     
    617592  }
    618593
    619 #if PIC_CROPPING
    620594  switch (m_croppingMode)
    621595  {
     
    667641    }
    668642  }
    669 #else
    670 
    671   // compute source padding size
    672   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 #endif
    687643 
    688644  // allocate slice-based dQP values
     
    890846  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
    891847  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
    892 #if H0736_AVC_STYLE_QP_RANGE
    893848  xConfirmPara( m_aiQP[0] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[0] > 51,         "QP exceeds supported range (-QpBDOffsety to 51)" );
    894849  if ( m_aiQP.size() >= 2 )
     
    896851    xConfirmPara( m_aiQP[1] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[1] > 51,       "QP depth exceeds supported range (-QpBDOffsety to 51)" );
    897852  }
    898 #else
    899   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 #endif
    905853  xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2,             "ALFEncodePassReduction must be equal to 0, 1 or 2");
    906 #if LCU_SYNTAX_ALF
    907854  xConfirmPara( m_iALFMaxNumberFilters < 1,                                                 "ALFMaxNumFilter should be larger than 1"); 
    908 #else
    909   xConfirmPara( m_iALFMaxNumberFilters < 1 || m_iALFMaxNumberFilters > 16,                  "ALFMaxNumFilter exceeds supported range (1 to 16)"); 
    910 #endif
    911855  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13,          "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)");
    912856  xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13,              "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)");
     
    934878  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    935879  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
    936 #if PIC_CROPPING
    937880  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
    938881  xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame height must be a multiple of the minimum CU size");
    939 #else
    940   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 #endif
    943882 
    944883  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
     
    967906  xConfirmPara    ( m_uiPredDepthMapGeneration >= 2 && !m_bUsingDepthMaps,            "PredDepthMapGen >= 2 requires CodeDepthMaps = 1" );
    968907#endif
    969 #if HHI_INTER_VIEW_MOTION_PRED
     908#if H3D_IVMP
    970909  xConfirmPara    ( m_uiMultiviewMvPredMode > 7,                                      "MultiviewMvPred must be less than or equal to 7" );
    971910  xConfirmPara    ( m_uiMultiviewMvPredMode > 0 && m_uiPredDepthMapGeneration == 0 ,  "MultiviewMvPred > 0 requires PredDepthMapGen > 0" );
     
    977916  }
    978917#endif
    979 #if HHI_INTER_VIEW_RESIDUAL_PRED
     918#if H3D_IVRP
    980919  xConfirmPara    ( m_uiMultiviewResPredMode > 1,                                     "MultiviewResPred must be less than or equal to 1" );
    981920  xConfirmPara    ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" );
     
    998937  }
    999938#if ADAPTIVE_QP_SELECTION
    1000 #if H0736_AVC_STYLE_QP_RANGE
    1001939  xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[0] < 0,                                              "AdaptiveQpSelection must be disabled when QP < 0.");
    1002940  xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[1] < 0,                                              "AdaptiveQpSelection must be disabled when QP < 0.");
    1003941  xConfirmPara( m_bUseAdaptQpSelect == true && (m_iChromaQpOffset !=0 || m_iChromaQpOffset2nd != 0 ),  "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0.");
    1004 #endif
    1005942#endif
    1006943
     
    1013950  }
    1014951
    1015 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    1016952  xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" );
    1017 #endif
    1018953  if (m_iSliceMode!=0)
    1019954  {
    1020955    xConfirmPara( m_iSliceArgument < 1 ,         "SliceArgument should be larger than or equal to 1" );
    1021956  }
    1022 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    1023957  if (m_iSliceMode==3)
    1024958  {
    1025959    xConfirmPara( m_iSliceGranularity > 0 ,      "When SliceMode == 3 is chosen, the SliceGranularity must be 0" );
    1026960  }
    1027 #endif
    1028961  xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" );
    1029962  if (m_iEntropySliceMode!=0)
     
    1035968  xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" );
    1036969
    1037 #if NO_COMBINED_PARALLEL
    1038970  bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 );
    1039971  xConfirmPara( tileFlag && m_iEntropySliceMode,            "Tile and Entropy Slice can not be applied together");
    1040972  xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
    1041973  xConfirmPara( m_iWaveFrontSynchro && m_iEntropySliceMode, "Wavefront and Entropy Slice can not be applied together"); 
    1042 #endif
    1043974
    1044975  // max CU width and height should be power of 2
     
    12321163      for( Int i = 0; i < MAX_GOP; i++ ) { isOK[i] = false; }
    12331164      Int numOK = 0;
    1234 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1235       Int numReorderFramesRequired=0;
    1236       m_maxNumberOfReferencePictures=0;
    1237       Int lastDisp = -1;
    1238 #endif
    12391165      m_extraRPSs[viewId] = 0;
    12401166      //start looping through frames in coding order until we can verify that the GOP structure is correct.
     
    14201346            }
    14211347          }
    1422 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1423           if(m_maxNumberOfReferencePictures<numRefs)
    1424           {
    1425             m_maxNumberOfReferencePictures=numRefs;
    1426           }
    1427 #endif
    14281348          refList[numRefs] = curPOC;
    14291349          numRefs++;
    1430 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1431           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 #endif
    14521350        }
    14531351        checkGOP++;
    14541352      }
    1455 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1456       if (m_numReorderFrames == -1)
    1457       {
    1458         m_numReorderFrames = numReorderFramesRequired;
    1459       }
    1460 #endif
    14611353      xConfirmPara( errorGOP, "Invalid GOP structure given" );
    1462 #if H0566_TLA
    14631354      m_maxTempLayer[viewId] = 1;
    1464 #endif
    14651355      for( Int i = 0; i < m_iGOPSize; i++ )
    14661356      {
    1467 #if H0566_TLA
    14681357        if( m_GOPListsMvc[viewId][i].m_temporalId >= m_maxTempLayer[viewId] )
    14691358        {
    14701359          m_maxTempLayer[viewId] = m_GOPListsMvc[viewId][i].m_temporalId + 1;
    14711360        }
    1472 #endif
    14731361        xConfirmPara( m_GOPListsMvc[viewId][i].m_sliceType != 'B' && m_GOPListsMvc[viewId][i].m_sliceType != 'P', "Slice type must be equal to B or P" );
    14741362      }
    14751363
    1476 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    14771364      for( Int i = 0; i < MAX_TLAYER; i++ )
    14781365      {
     
    15311418        m_maxDecPicBuffering[viewId][MAX_TLAYER-1] = m_numReorderPics[viewId][MAX_TLAYER-1];
    15321419      }
    1533 #endif
    1534 
    1535 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
     1420
    15361421      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 #else
    1538       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 #endif
    15411422    }
    15421423  }
     
    16481529    }
    16491530  }
    1650 #if PIC_CROPPING
    16511531  printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate );
    1652 #else
    1653   printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate );
    1654 #endif
    16551532  printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    16561533  printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded );
     
    17201597 
    17211598  printf("TOOL CFG General: "); 
    1722 #if LCU_SYNTAX_ALF
    17231599  printf("ALFMNF:%d ", m_iALFMaxNumberFilters);
    17241600  printf("ALFInSlice:%d ", m_bALFParamInSlice);
    17251601  printf("ALFPicEnc:%d ", m_bALFPicBasedEncode);
    1726 #endif
    17271602  printf("IBD:%d ", !!g_uiBitIncrement);
    17281603  printf("HAD:%d ", m_bUseHADME           );
     
    17301605  printf("SQP:%d ", m_uiDeltaQpRD         );
    17311606  printf("ASR:%d ", m_bUseASR             );
    1732 #if !PIC_CROPPING
    1733   printf("PAD:%d ", m_bUsePAD             );
    1734 #endif
    17351607  printf("LComb:%d ", m_bUseLComb         );
    17361608  printf("LCMod:%d ", m_bLCMod         );
    17371609  printf("FEN:%d ", m_bUseFastEnc         );
    17381610  printf("ECU:%d ", m_bUseEarlyCU         );
    1739 #if FAST_DECISION_FOR_MRG_RD_COST
    17401611  printf("FDM:%d ", m_useFastDecisionForMerge );
    1741 #endif
    17421612  printf("CFM:%d ", m_bUseCbfFastMode         );
    17431613  printf("RQT:%d ", 1     );
     
    17541624  }
    17551625  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    1756 #if BURST_IPCM
    17571626  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    1758 #else
    1759   printf("PCM:%d ", ((1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    1760 #endif
    1761 #if SAO_UNIT_INTERLEAVING
    17621627  printf("SAOInterleaving:%d ", (m_saoInterleavingFlag)?(1):(0));
    1763 #endif
    17641628#if LOSSLESS_CODING
    17651629  printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 );
     
    17671631  printf("WPP:%d ", (Int)m_bUseWeightPred);
    17681632  printf("WPB:%d ", m_uiBiPredIdc);
    1769 #if !REMOVE_TILE_DEPENDENCE
    1770   printf("TileBoundaryIndependence:%d ", m_iTileBoundaryIndependenceIdr );
    1771 #endif
    17721633  printf("TileLocationInSliceHdr:%d ", m_iTileLocationInSliceHeaderFlag);
    17731634  printf("TileMarker:%d", m_iTileMarkerFlag);
     
    17921653#endif
    17931654
    1794 #if MULTIBITS_DATA_HIDING
    17951655  printf(" SignBitHidingFlag:%d SignBitHidingThreshold:%d", m_signHideFlag, m_signHidingThreshold);
    1796 #endif
    17971656  printf("\n");
    17981657  printf("TOOL CFG VIDEO  : ");
     
    18041663#endif
    18051664#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
    18061668  printf("IlluCompEnable: %d ", m_bUseIC);
    18071669#endif
    1808 
     1670#endif
     1671#if INTER_VIEW_VECTOR_SCALING_C0115
     1672  printf("IVSEnable: %d ", m_bUseIVS);
     1673#endif
    18091674  printf("\n");
    18101675
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r210 r296  
    7373  Int       m_iSourceWidth;                                   ///< source width in pixel
    7474  Int       m_iSourceHeight;                                  ///< source height in pixel
    75 #if PIC_CROPPING
    7675  Int       m_croppingMode;
    7776  Int       m_cropLeft;
     
    7978  Int       m_cropTop;
    8079  Int       m_cropBottom;
    81 #endif
    8280  Int       m_iFrameToBeEncoded;                              ///< number of encoded frames
    83 #if !PIC_CROPPING
    84   Bool      m_bUsePAD;                                        ///< flag for using source padding
    85 #endif
    8681  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    8782 
     
    10095  Int       m_extraRPSs[MAX_VIEW_NUM];
    10196  GOPEntryMvc m_GOPListsMvc[MAX_VIEW_NUM][MAX_GOP+1];
    102 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    10397  Int       m_numReorderPics[MAX_VIEW_NUM][MAX_TLAYER];       ///< total number of reorder pictures
    10498  Int       m_maxDecPicBuffering[MAX_VIEW_NUM][MAX_TLAYER];   ///< total number of reference pictures needed for decoding
    105 #else
    106   Int       m_numReorderFrames;                               ///< total number of reorder pictures
    107   Int       m_maxNumberOfReferencePictures;                   ///< total number of reference pictures needed for decoding
    108 #endif
    10999  Bool      m_bUseLComb;                                      ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)
    110100  Bool      m_bLCMod;                                         ///< flag for specifying whether the combined reference list for uni-prediction in B-slices is uploaded explicitly
     
    136126  Int       m_iQPAdaptationRange;                             ///< dQP range by QP adaptation
    137127 
    138 #if H0566_TLA
    139128  Int       m_maxTempLayer[MAX_VIEW_NUM];                     ///< Max temporal layer
    140 #else
    141   Bool      m_bTLayering;                                     ///< indicates whether temporal IDs are set based on the hierarchical coding structure
    142   Bool      m_abTLayerSwitchingFlag[MAX_TLAYER];              ///< temporal layer switching flags corresponding to each temporal layer
    143 #endif
    144129
    145130  // coding unit (CU) definition
     
    170155  vector<Bool> m_abUseSAO;
    171156#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
    172160  Bool      m_bUseIC;                                     ///< flag for using illumination compensation for inter-view prediction
    173161#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
    175166  Int       m_maxNumOffsetsPerPic;                            ///< SAO maximun number of offset per picture
    176167  Bool      m_saoInterleavingFlag;                            ///< SAO interleaving flag
    177 #endif
    178168  // coding tools (loop filter)
    179169  vector<Bool> m_abUseALF;                                    ///< flag for using adaptive loop filter [0] - video, [1] - depth
     
    181171 
    182172  Int       m_iALFMaxNumberFilters;                           ///< ALF Max Number Filters in one picture
    183 #if LCU_SYNTAX_ALF
    184173  Bool      m_bALFParamInSlice;
    185174  Bool      m_bALFPicBasedEncode;
    186 #endif
    187175
    188176  vector<Bool> m_abLoopFilterDisable;                         ///< flag for using deblocking filter filter [0] - video, [1] - depth
     
    190178  Int       m_loopFilterBetaOffsetDiv2;                     ///< beta offset for deblocking filter
    191179  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
    192 #if DBL_CONTROL
    193180  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
    194 #endif
    195181 
    196182  Bool      m_bUseLMChroma;                                  ///< JL: Chroma intra prediction based on luma signal
     
    226212  UInt      m_uiPredDepthMapGeneration;                       ///< using of (virtual) depth maps for texture coding
    227213#endif
    228 #if HHI_INTER_VIEW_MOTION_PRED
     214#if H3D_IVMP
    229215  UInt      m_uiMultiviewMvPredMode;                          ///< usage of predictors for multi-view mv prediction
    230216  UInt      m_uiMultiviewMvRegMode;                           ///< regularization for multiview motion vectors
    231217  Double    m_dMultiviewMvRegLambdaScale;                     ///< lambda scale for multiview motion vectors regularization
    232218#endif
    233 #if HHI_INTER_VIEW_RESIDUAL_PRED
     219#if H3D_IVRP
    234220  UInt      m_uiMultiviewResPredMode;          ///< using multiview residual prediction
    235221#endif
    236222
    237 #if FAST_DECISION_FOR_MRG_RD_COST
    238223  Bool      m_useFastDecisionForMerge;         ///< flag for using Fast Decision Merge RD-Cost
    239 #endif
    240224  Bool      m_bUseCbfFastMode;                 ///< flag for using Cbf Fast PU Mode Decision
    241225  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
     
    250234  Int       m_iColumnRowInfoPresent;
    251235  Int       m_iUniformSpacingIdr;
    252 #if !REMOVE_TILE_DEPENDENCE
    253   Int       m_iTileBoundaryIndependenceIdr;
    254 #endif
    255236  Int       m_iNumColumnsMinus1;
    256237  char*     m_pchColumnWidth;
     
    280261#endif
    281262
    282 #if MULTIBITS_DATA_HIDING
    283263  Int       m_signHideFlag;
    284264  Int       m_signHidingThreshold;
    285 #endif
    286265#if HHI_MPI
    287266  Bool      m_bUseMVI;  ///< flag for using Motion Vector Inheritance for depth map coding
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r210 r296  
    9797    m_acTEncTopList[iViewIdx]->setSourceWidth                  ( m_iSourceWidth );
    9898    m_acTEncTopList[iViewIdx]->setSourceHeight                 ( m_iSourceHeight );
    99 #if PIC_CROPPING
    10099    m_acTEncTopList[iViewIdx]->setCroppingMode                 ( m_croppingMode );
    101100    m_acTEncTopList[iViewIdx]->setCropLeft                     ( m_cropLeft );
     
    103102    m_acTEncTopList[iViewIdx]->setCropTop                      ( m_cropTop );
    104103    m_acTEncTopList[iViewIdx]->setCropBottom                   ( m_cropBottom );
    105 #endif
    106104    m_acTEncTopList[iViewIdx]->setFrameToBeEncoded             ( m_iFrameToBeEncoded );
    107105    m_acTEncTopList[iViewIdx]->setViewId                       ( iViewIdx );
     
    121119    m_cVPS.setDependentFlag                                    ( iViewIdx ? true:false, layerId );
    122120    m_cVPS.setDependentLayer                                   ( layerId - (m_bUsingDepthMaps ? 2:1), layerId );
     121#if INTER_VIEW_VECTOR_SCALING_C0115
     122    m_cVPS.setIVScalingFlag                                    ( m_bUseIVS );
     123#endif
    123124#endif
    124125   
     
    135136    m_acTEncTopList[iViewIdx]->setGopList                      ( m_GOPListsMvc[iViewIdx] );
    136137    m_acTEncTopList[iViewIdx]->setExtraRPSs                    ( m_extraRPSs[iViewIdx] );
    137 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    138138    for(Int i = 0; i < MAX_TLAYER; i++)
    139139    {
     
    141141      m_acTEncTopList[iViewIdx]->setMaxDecPicBuffering         ( m_maxDecPicBuffering[iViewIdx][i], i );
    142142    }
    143 #else
    144     m_acTEncTopList[iViewIdx]->setNumReorderFrames             ( m_numReorderFrames );
    145     m_acTEncTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures );
    146 #endif
    147143    for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    148144    {
     
    154150    m_acTEncTopList[iViewIdx]->setPad                          ( m_aiPad );
    155151   
    156 #if H0566_TLA
    157152    m_acTEncTopList[iViewIdx]->setMaxTempLayer                 ( m_maxTempLayer[iViewIdx] );
    158 #else
    159     m_acTEncTopList[iViewIdx]->setTLayering                    ( m_bTLayering );
    160     m_acTEncTopList[iViewIdx]->setTLayerSwitchingFlag          ( m_abTLayerSwitchingFlag );
    161 #endif
    162153
    163154    m_acTEncTopList[iViewIdx]->setDisInter4x4                  ( m_bDisInter4x4);
     
    173164    m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    174165    m_acTEncTopList[iViewIdx]->setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    175 #if DBL_CONTROL
    176166    m_acTEncTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    177 #endif
    178167
    179168  //====== Motion search ========
     
    198187#if LOSSLESS_CODING
    199188    Int lowestQP;
    200 #if H0736_AVC_STYLE_QP_RANGE
    201189    lowestQP =  - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) );
    202 #else
    203     lowestQP = 0;
    204 #endif
    205190    if ((m_iMaxDeltaQP == 0 ) && (m_aiQP[0] == lowestQP) && (m_useLossless == true))
    206191    {
     
    232217    m_acTEncTopList[iViewIdx]->setPdmOffset                    (       m_cCameraData.getPdmOffset        () );
    233218#endif
    234 #if HHI_INTER_VIEW_MOTION_PRED
     219#if H3D_IVMP
    235220    m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode          ( m_uiMultiviewMvPredMode );
    236221    m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode           ( iViewIdx ? m_uiMultiviewMvRegMode       : 0   );
    237222    m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale    ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 );
    238223#endif
    239 #if HHI_INTER_VIEW_RESIDUAL_PRED
     224#if H3D_IVRP
    240225    m_acTEncTopList[iViewIdx]->setMultiviewResPredMode         ( m_uiMultiviewResPredMode );
    241226#endif
     
    257242    m_acTEncTopList[iViewIdx]->setdQPs                         ( m_aidQP        );
    258243    m_acTEncTopList[iViewIdx]->setUseRDOQ                      ( m_abUseRDOQ[0] );
    259 #if !PIC_CROPPING
    260     m_acTEncTopList[iViewIdx]->setUsePAD                       ( m_bUsePAD      );
    261 #endif
    262244    m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    263245    m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
     
    266248    m_acTEncTopList[iViewIdx]->setUseFastEnc                   ( m_bUseFastEnc  );
    267249    m_acTEncTopList[iViewIdx]->setUseEarlyCU                   ( m_bUseEarlyCU  );
    268 #if FAST_DECISION_FOR_MRG_RD_COST
    269250    m_acTEncTopList[iViewIdx]->setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    270 #endif
    271251    m_acTEncTopList[iViewIdx]->setUseCbfFastMode               ( m_bUseCbfFastMode  );
    272252#if HHI_INTERVIEW_SKIP
     
    301281      m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) );
    302282    }
    303 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    304283    if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE)
    305284    {
    306285      m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument );
    307286    }
    308 #endif
    309287    m_acTEncTopList[iViewIdx]->setSliceGranularity        ( m_iSliceGranularity         );
    310288    if(m_iSliceMode == 0 )
     
    315293    m_acTEncTopList[iViewIdx]->setUseSAO               ( m_abUseSAO[0]     );
    316294#if LGE_ILLUCOMP_B0045
     295#if LGE_ILLUCOMP_DEPTH_C0046
     296    m_acTEncTopList[iViewIdx]->setUseIC                ( m_abUseIC[0]      );
     297#else
    317298    m_acTEncTopList[iViewIdx]->setUseIC                ( m_bUseIC          );
    318299#endif
    319 #if SAO_UNIT_INTERLEAVING
     300#endif
     301#if INTER_VIEW_VECTOR_SCALING_C0115
     302    m_acTEncTopList[iViewIdx]->setUseIVS               ( m_bUseIVS          );
     303#endif
    320304    m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    321305    m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag);
    322 #endif
    323306    m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    324307    m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
     
    328311    m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent       ( m_iColumnRowInfoPresent );
    329312    m_acTEncTopList[iViewIdx]->setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    330 #if !REMOVE_TILE_DEPENDENCE
    331     m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );
    332 #endif
    333313    m_acTEncTopList[iViewIdx]->setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
    334314    m_acTEncTopList[iViewIdx]->setNumRowsMinus1              ( m_iNumRowsMinus1 );
     
    347327    m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset         ( m_dMaxTileMarkerOffset );
    348328    m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag );
    349 #if !REMOVE_TILE_DEPENDENCE
    350     if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1)
    351 #else
    352329    if(uiTilesCount == 1)
    353 #endif
    354330    {
    355331      m_bLFCrossTileBoundaryFlag = true;
     
    366342    m_acTEncTopList[iViewIdx]->setUseScalingListId           ( m_useScalingListId  );
    367343    m_acTEncTopList[iViewIdx]->setScalingListFile            ( m_scalingListFile   );
    368 #if MULTIBITS_DATA_HIDING
    369344    m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag);
    370345    m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold);
    371 #endif
    372 
    373 #if LCU_SYNTAX_ALF
     346
    374347    if(uiTilesCount > 1)
    375348    {
     
    379352    m_acTEncTopList[iViewIdx]->setALFParamInSlice              ( m_bALFParamInSlice);
    380353    m_acTEncTopList[iViewIdx]->setALFPicBasedEncode            ( m_bALFPicBasedEncode);
    381 #endif
    382354
    383355    //====== Depth tools ========
     
    435407      m_acTEncDepthTopList[iViewIdx]->setSourceWidth                  ( m_iSourceWidth );
    436408      m_acTEncDepthTopList[iViewIdx]->setSourceHeight                 ( m_iSourceHeight );
    437 #if PIC_CROPPING
    438409      m_acTEncDepthTopList[iViewIdx]->setCroppingMode                 ( m_croppingMode );
    439410      m_acTEncDepthTopList[iViewIdx]->setCropLeft                     ( m_cropLeft );
     
    441412      m_acTEncDepthTopList[iViewIdx]->setCropTop                      ( m_cropTop );
    442413      m_acTEncDepthTopList[iViewIdx]->setCropBottom                   ( m_cropBottom );
    443 #endif
    444414      m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded             ( m_iFrameToBeEncoded );
    445415      m_acTEncDepthTopList[iViewIdx]->setViewId                       ( iViewIdx );
     
    470440      m_acTEncDepthTopList[iViewIdx]->setGopList                      ( m_GOPListsMvc[iViewIdx] );
    471441      m_acTEncDepthTopList[iViewIdx]->setExtraRPSs                    ( m_extraRPSs[iViewIdx] );
    472 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    473442      for(Int i = 0; i < MAX_TLAYER; i++)
    474443      {
     
    476445        m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering         ( m_maxDecPicBuffering[iViewIdx][i], i );
    477446      }
    478 #else
    479       m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames             ( m_numReorderFrames );
    480       m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures );
    481 #endif
    482447      for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    483448      {
     
    489454      m_acTEncDepthTopList[iViewIdx]->setPad                          ( m_aiPad );
    490455
    491 #if H0566_TLA
    492456      m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer                 ( m_maxTempLayer[iViewIdx] );
    493 #else
    494       m_acTEncDepthTopList[iViewIdx]->setTLayering                    ( m_bTLayering );
    495       m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag          ( m_abTLayerSwitchingFlag );
    496 #endif
    497457
    498458      m_acTEncDepthTopList[iViewIdx]->setDisInter4x4                  ( m_bDisInter4x4);
     
    508468      m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    509469      m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    510 #if DBL_CONTROL
    511470      m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    512 #endif
    513471
    514472      //====== Motion search ========
     
    550508      m_acTEncDepthTopList[iViewIdx]->setdQPs                         ( m_aidQPdepth   );
    551509      m_acTEncDepthTopList[iViewIdx]->setUseRDOQ                      ( m_abUseRDOQ[1] );
    552 #if !PIC_CROPPING
    553       m_acTEncDepthTopList[iViewIdx]->setUsePAD                       ( m_bUsePAD      );
    554 #endif
    555510      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    556511      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
     
    559514      m_acTEncDepthTopList[iViewIdx]->setUseFastEnc                   ( m_bUseFastEnc  );
    560515      m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU                   ( m_bUseEarlyCU  );
    561 #if FAST_DECISION_FOR_MRG_RD_COST
    562516      m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    563 #endif
    564517      m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode               ( m_bUseCbfFastMode  );
    565518#if HHI_INTERVIEW_SKIP
     
    595548      m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration       ( 0 );
    596549#endif
    597 #if HHI_INTER_VIEW_MOTION_PRED
     550#if H3D_IVMP
    598551      m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode          ( 0 );
    599552      m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode           ( 0 );
    600553      m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale    ( 0.0 );
    601554#endif
    602 #if HHI_INTER_VIEW_RESIDUAL_PRED
     555#if H3D_IVRP
    603556      m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode         ( 0 );
    604557#endif
     
    623576        m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) );
    624577      }
    625 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    626578      if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE)
    627579      {
    628580        m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument );
    629581      }
    630 #endif
    631582      m_acTEncDepthTopList[iViewIdx]->setSliceGranularity        ( m_iSliceGranularity         );
    632583      if(m_iSliceMode == 0 )
     
    639590      m_acTEncDepthTopList[iViewIdx]->setUseIC                ( false     );
    640591#endif
    641 #if SAO_UNIT_INTERLEAVING
     592#if INTER_VIEW_VECTOR_SCALING_C0115
     593     m_acTEncDepthTopList[iViewIdx]->setUseIVS                ( m_bUseIVS );
     594#endif
    642595      m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    643596      m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag);
    644 #endif
    645597      m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    646598      m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
     
    650602      m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent       ( m_iColumnRowInfoPresent );
    651603      m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    652 #if !REMOVE_TILE_DEPENDENCE
    653       m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );
    654 #endif
    655604      m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
    656605      m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1              ( m_iNumRowsMinus1 );
     
    669618      m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset         ( m_dMaxTileMarkerOffset );
    670619      m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag );
    671 #if !REMOVE_TILE_DEPENDENCE
    672       if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1)
    673 #else
    674620      if(uiTilesCount == 1)
    675 #endif
    676621      {
    677622        m_bLFCrossTileBoundaryFlag = true;
     
    688633      m_acTEncDepthTopList[iViewIdx]->setUseScalingListId           ( m_useScalingListId  );
    689634      m_acTEncDepthTopList[iViewIdx]->setScalingListFile            ( m_scalingListFile   );
    690 #if MULTIBITS_DATA_HIDING
    691635      m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag);
    692636      m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold);
    693 #endif
    694 
    695 #if LCU_SYNTAX_ALF
     637
    696638      if(uiTilesCount > 1)
    697639      {
     
    701643      m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice              ( m_bALFParamInSlice);
    702644      m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode            ( m_bALFPicBasedEncode);
    703 #endif
    704645
    705646  //====== Depth tools ========
     
    728669  }
    729670
    730 #if HHI_INTER_VIEW_MOTION_PRED
     671#if H3D_IVMP
    731672  else if( m_uiMultiviewMvRegMode )
    732673  {
     
    815756      m_acTEncDepthTopList[iViewIdx]->create();
    816757    }
    817 #if HHI_INTER_VIEW_MOTION_PRED
     758#if H3D_IVMP
    818759    else if( m_uiMultiviewMvRegMode )
    819760    {
     
    931872  TComPicYuv*       pcPicYuvRec = NULL;
    932873  TComPicYuv*       pcDepthPicYuvRec = NULL;
    933  
     874
    934875  // initialize internal class & member variables
    935876  xInitLibCfg();
     
    962903  pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    963904
    964 #if HHI_INTER_VIEW_MOTION_PRED
     905#if H3D_IVMP
    965906  if( m_uiMultiviewMvRegMode )
    966907  {
     
    982923        m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad );
    983924     
    984 #if HHI_INTER_VIEW_MOTION_PRED
     925#if H3D_IVMP
    985926        if( m_uiMultiviewMvRegMode && iViewIdx )
    986927        {
     
    989930#endif
    990931
    991 #if HHI_INTER_VIEW_MOTION_PRED
     932#if H3D_IVMP
    992933        m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg, ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) );
    993934#else
     
    1033974      if ( iNextPoc < m_iFrameToBeEncoded )
    1034975      {
    1035       m_cCameraData.update( iNextPoc );
     976        m_cCameraData.update( iNextPoc );
    1036977      }
    1037978#endif
     
    10961037#endif
    10971038        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
    10981052        // call encoding function for one frame
    10991053        m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId );
     
    11031057        {
    11041058          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
    11051070          // call encoding function for one depth frame
    11061071          m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId );
     
    11141079#endif
    11151080
    1116 #if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED
     1081#if HHI_INTERVIEW_SKIP || H3D_IVMP || H3D_IVRP
    11171082      for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
    11181083      {
     
    11471112 
    11481113#if !QC_MVHEVC_B0046
    1149 #if FIX_DEL_NULLPTR
    11501114  if ( pcPdmDepthOrg != NULL && m_uiMultiviewMvRegMode )
    1151 #else
    1152   if ( pcPdmDepthOrg != NULL )
    1153 #endif
    11541115  {
    11551116    pcPdmDepthOrg->destroy();
     
    12921253        if (m_pchReconFileList[iViewIdx])
    12931254        {
    1294 #if PIC_CROPPING
    12951255          m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom );
    1296 #else
    1297           m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad );
    1298 #endif
    12991256        }
    13001257      }
     
    13031260        if (m_pchDepthReconFileList[iViewIdx])
    13041261        {
    1305 #if PIC_CROPPING
    13061262          m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom );
    1307 #else
    1308           m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad );
    1309 #endif
    13101263        }
    13111264      }
     
    13601313    {
    13611314    case NAL_UNIT_CODED_SLICE:
    1362 #if H0566_TLA
    13631315#if !QC_REM_IDV_B0046
    13641316    case NAL_UNIT_CODED_SLICE_IDV:
     
    13661318    case NAL_UNIT_CODED_SLICE_TLA:
    13671319    case NAL_UNIT_CODED_SLICE_CRA:
    1368 #else
    1369     case NAL_UNIT_CODED_SLICE_DATAPART_A:
    1370     case NAL_UNIT_CODED_SLICE_DATAPART_B:
    1371     case NAL_UNIT_CODED_SLICE_CDR:
    1372 #endif
    13731320    case NAL_UNIT_CODED_SLICE_IDR:
    13741321    case NAL_UNIT_SPS:
     
    16341581#endif
    16351582
     1583#if MERL_VSP_C0152
     1584Void 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
    16361610//! \}
  • trunk/source/App/TAppEncoder/TAppEncTop.h

    r210 r296  
    9999  TRenTop  m_cUsedPelsRenderer;                               ///< renderer for used pels map
    100100#endif
     101
    101102protected:
    102103  // initialization
     
    165166#endif
    166167
     168#if MERL_VSP_C0152
     169  Void setBWVSPLUT( Int iCodedViewIdx, Int gopId, Bool isDepth);
     170#endif
    167171};// END CLASS DEFINITION TAppEncTop
    168172
  • trunk/source/App/TAppRenderer/TAppRendererTop.cpp

    r210 r296  
    429429      // Write Output
    430430
    431 #if PIC_CROPPING
    432431      m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 );
    433 #else
    434       m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, aiPad );
    435 #endif
    436432    }
    437433    iFrame++;
     
    665661
    666662          // Write Output
    667 #if PIC_CROPPING
    668663          m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, 0 ,0 ,0, 0 );
    669 #else
    670           m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iModelNum]->write( pcPicYuvSynthOut, aiPad );
    671 #endif
    672664        }
    673665      }
     
    867859
    868860      // Write Output
    869 #if PIC_CROPPING
    870861      m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, 0, 0, 0, 0 );
    871 #else
    872       m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, aiPad );
    873 #endif
    874862    }
    875863    iFrame++;
     
    998986
    999987      // Write Output
    1000 #if PIC_CROPPING
    1001988      m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, 0, 0, 0 );
    1002 #else
    1003       m_apcTVideoIOYuvSynthOutput[iViewIdx-1]->write( pcPicYuvSynthOut, aiPad );
    1004 #endif
    1005989
    1006990    }
  • trunk/source/Lib/TAppCommon/TAppComCamPara.cpp

    r106 r296  
    8989}
    9090
    91 
    9291Void
    9392TAppComCamPara::xCreate2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray )
     
    928927}
    929928
    930 
    931929Void
    932930TAppComCamPara::xSetShiftParametersAndLUT( UInt uiFrame )
  • trunk/source/Lib/TAppCommon/TAppComCamPara.h

    r102 r296  
    107107  Int****             m_aiSynthViewShiftLUT;                   ///< Disparity LUT
    108108
    109 
    110109protected:
    111110  // create and delete arrays
     
    143142  Void  xSetShiftParametersAndLUT ( UInt uiNumViewDim1, UInt uiNumViewDim2, UInt uiFrame, Bool bExternalReference, Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams );
    144143  Void  xSetShiftParametersAndLUT ( UInt uiFrame );
    145 
    146144
    147145  // getting conversion parameters for disparity to virtual depth conversion
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r211 r296  
    128128#define MAX_VIEW_NUM                10
    129129
    130 #if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED )
     130#if ( H3D_IVMP || H3D_IVRP )
    131131#define DEPTH_MAP_GENERATION        1
    132132#define PDM_REMOVE_DEPENDENCE       1      //bug-fix for DMDV JCT2-A0095
     
    140140#define PDM_MERGE_POS                     0         // position of pdm in merge list (0..4)
    141141
    142 #if QC_MRG_CANS_B0048
    143 #if OL_DISMV_POS_B0069
     142#if H3D_IVMP
    144143#define DMV_MERGE_POS                     4
    145144#else
    146145#define DMV_MERGE_POS                     1
    147146#endif
    148 #endif
    149 
    150 #if SAIT_IMPROV_MOTION_PRED_M24829&!QC_MULTI_DIS_CAN_A0097
     147
     148#if H3D_IVMP&!H3D_NBDV
    151149#define PDM_AMVP_POS                      0         // position of pdm in amvp list  (0..3)
    152150#else
     
    424422// AMVP: advanced motion vector prediction
    425423#define AMVP_MAX_NUM_CANDS          2           ///< max number of final candidates
    426 #if HHI_INTER_VIEW_MOTION_PRED
     424#if H3D_IVMP
    427425#define AMVP_MAX_NUM_CANDS_MEM      4           ///< max number of candidates
    428426#else
     
    431429// MERGE
    432430#define MRG_MAX_NUM_CANDS           5
    433 #if HHI_INTER_VIEW_MOTION_PRED
     431#if H3D_IVMP
    434432#define MRG_MAX_NUM_CANDS_MEM       (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction
    435433#endif
     
    439437
    440438// Explicit temporal layer QP offset
    441 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    442439#define MAX_TLAYER                  8           ///< max number of temporal layer
    443 #else
    444 #define MAX_TLAYER                  4           ///< max number of temporal layer
    445 #endif
    446440#define HB_LAMBDA_FOR_LDC           1           ///< use of B-style lambda for non-key pictures in low-delay mode
    447441
     
    468462#define MAX_NUM_REF_PICS 16
    469463
    470 #if !NAL_REF_FLAG
    471 enum NalRefIdc
    472 {
    473   NAL_REF_IDC_PRIORITY_LOWEST = 0,
    474   NAL_REF_IDC_PRIORITY_LOW,
    475   NAL_REF_IDC_PRIORITY_HIGH,
    476   NAL_REF_IDC_PRIORITY_HIGHEST
    477 };
    478 #endif
    479464
    480465enum NalUnitType
     
    482467  NAL_UNIT_UNSPECIFIED_0 = 0,
    483468  NAL_UNIT_CODED_SLICE,
    484 #if H0566_TLA
    485469#if QC_REM_IDV_B0046
    486470  NAL_UNIT_RESERVED,
     
    490474  NAL_UNIT_CODED_SLICE_TLA,
    491475  NAL_UNIT_CODED_SLICE_CRA,
    492 #else
    493   NAL_UNIT_CODED_SLICE_DATAPART_A,
    494   NAL_UNIT_CODED_SLICE_DATAPART_B,
    495   NAL_UNIT_CODED_SLICE_CDR,
    496 #endif
    497476  NAL_UNIT_CODED_SLICE_IDR,
    498477  NAL_UNIT_SEI,
  • trunk/source/Lib/TLibCommon/ContextModel.cpp

    r56 r296  
    5656Void ContextModel::init( Int qp, Int initValue )
    5757{
    58 #if H0736_AVC_STYLE_QP_RANGE
    5958  qp = Clip3(0, 51, qp);
    60 #endif
    6159
    62 #if CABAC_LINEAR_INIT
    6360  Int  slope      = (initValue>>4)*5 - 45;
    6461  Int  offset     = ((initValue&15)<<3)-16;
     
    6663  UInt mpState    = (initState >= 64 );
    6764  m_ucState       = ( (mpState? (initState - 64):(63 - initState)) <<1) + mpState;
    68 #else
    69   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 #endif
    8165}
    8266
     
    143127#endif
    144128};
    145 #if !CABAC_LINEAR_INIT
    146 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 #endif
    150129//! \}
  • trunk/source/Lib/TLibCommon/ContextModel.h

    r56 r296  
    103103  static UChar m_nextState[128][2];
    104104#endif
    105 #if !CABAC_LINEAR_INIT
    106   static const Int m_slopes[16];
    107   static const Int m_segOffset[8];
    108   static const Int m_accumulatedSegOffset[8];
    109 #endif
    110105#if CABAC_INIT_FLAG
    111106  UInt          m_binsCoded;
  • trunk/source/Lib/TLibCommon/ContextTables.h

    r189 r296  
    5757
    5858#define NUM_MERGE_FLAG_EXT_CTX        1       ///< number of context models for merge flag of merge extended
    59 #if MRG_IDX_CTX_RED
    6059#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
    6662#define NUM_RES_PRED_FLAG_CTX         4       ///< number of context for residual prediction flag
    6763#endif
     
    6965#define NUM_ALF_CTRL_FLAG_CTX         1       ///< number of context models for ALF control flag
    7066#define NUM_PART_SIZE_CTX             4       ///< number of context models for partition size
    71 #if AMP_CTX
    7267#define NUM_CU_AMP_CTX                1       ///< number of context models for partition size (AMP)
    73 #else
    74 #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 #endif
    7768#define NUM_PRED_MODE_CTX             1       ///< number of context models for prediction mode
    7869
     
    9586#define NUM_SIG_FLAG_CTX_LUMA         27      ///< number of context models for luma sig flag
    9687#define NUM_SIG_FLAG_CTX_CHROMA       21      ///< number of context models for chroma sig flag
    97 #if LAST_CTX_REDUCTION
    9888#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
    10490#define NUM_ONE_FLAG_CTX              24      ///< number of context models for greater than 1 flag
    10591#define NUM_ONE_FLAG_CTX_LUMA         16      ///< number of context models for greater than 1 flag of luma
    10692#define NUM_ONE_FLAG_CTX_CHROMA        8      ///< number of context models for greater than 1 flag of chroma
    107 #if RESTRICT_GR1GR2FLAG_NUMBER
    10893#define NUM_ABS_FLAG_CTX               6      ///< number of context models for greater than 2 flag
    10994#define NUM_ABS_FLAG_CTX_LUMA          4      ///< number of context models for greater than 2 flag of luma
    11095#define NUM_ABS_FLAG_CTX_CHROMA        2      ///< number of context models for greater than 2 flag of chroma
    111 #else
    112 #define NUM_ABS_FLAG_CTX              18      ///< number of context models for greater than 2 flag
    113 #define NUM_ABS_FLAG_CTX_LUMA         12      ///< number of context models for greater than 2 flag of luma
    114 #define NUM_ABS_FLAG_CTX_CHROMA        6      ///< number of context models for greater than 2 flag of chroma
    115 #endif
    116 #else
    117 #define NUM_ONE_FLAG_CTX              32      ///< number of context models for greater than 1 flag
    118 #define NUM_ONE_FLAG_CTX_LUMA         24      ///< number of context models for greater than 1 flag of luma
    119 #define NUM_ONE_FLAG_CTX_CHROMA        8      ///< number of context models for greater than 1 flag of chroma
    120 #if RESTRICT_GR1GR2FLAG_NUMBER
    121 #define NUM_ABS_FLAG_CTX               8      ///< number of context models for greater than 2 flag
    122 #define NUM_ABS_FLAG_CTX_LUMA          6      ///< number of context models for greater than 2 flag of luma
    123 #define NUM_ABS_FLAG_CTX_CHROMA        2      ///< number of context models for greater than 2 flag of chroma
    124 #else
    125 #define NUM_ABS_FLAG_CTX              24      ///< number of context models for greater than 2 flag
    126 #define NUM_ABS_FLAG_CTX_LUMA         18      ///< number of context models for greater than 2 flag of luma
    127 #define NUM_ABS_FLAG_CTX_CHROMA        6      ///< number of context models for greater than 2 flag of chroma
    128 #endif
    129 #endif
    13096
    13197#define NUM_MVP_IDX_CTX               2       ///< number of context models for MVP index
     
    138104#define NUM_SAO_UVLC_CTX              2       ///< number of context models for SAO UVLC
    139105#define NUM_SAO_SVLC_CTX              3       ///< number of context models for SAO SVLC
    140 #if SAO_UNIT_INTERLEAVING
    141106#define NUM_SAO_RUN_CTX               3       ///< number of context models for AO SVLC (filter coeff.)
    142107#define NUM_SAO_MERGE_LEFT_FLAG_CTX   3       ///< number of context models for AO SVLC (filter coeff.)
    143108#define NUM_SAO_MERGE_UP_FLAG_CTX     1       ///< number of context models for AO SVLC (filter coeff.)
    144109#define NUM_SAO_TYPE_IDX_CTX          2       ///< number of context models for AO SVLC (filter coeff.)
    145 #endif
    146 #if CABAC_LINEAR_INIT
    147110#define CNU                          154      ///< dummy initialization value for unused context models 'Context model Not Used'
    148 #else
    149 #define CNU                          119      ///< dummy initialization value for unused context models 'Context model Not Used'
    150 #endif
    151111
    152112#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    153113#define NUM_DMM_FLAG_CTX              1       ///< number of context models for DMM flag
    154114#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
    155118#define NUM_DMM_DATA_CTX              3       ///< number of context models for DMM data
     119#endif
    156120#endif
    157121
     
    177141
    178142// initial probability for split flag
    179 #if CABAC_LINEAR_INIT
    180143static const UChar
    181144INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] = 
     
    223186INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] = 
    224187{
    225 #if MRG_IDX_CTX_RED
    226188  { CNU, },
    227189  { 122, },
    228190  { 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
    237194static const UChar
    238195INIT_RES_PRED_FLAG[3][NUM_RES_PRED_FLAG_CTX] =
     
    252209};
    253210
    254 #if AMP_CTX
    255211static const UChar
    256212INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] = 
     
    260216  { 154, },
    261217};
    262 #else
    263 static const UChar
    264 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 UChar
    272 INIT_CU_Y_POS[3][NUM_CU_Y_POS_CTX] = 
    273 {
    274   { CNU,  CNU, },
    275   { 154,  154, },
    276   { 154,  139, },
    277 };
    278 #endif
    279218
    280219static const UChar
     
    354293};
    355294
    356 #if LAST_CTX_REDUCTION
    357295static const UChar
    358296INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] = 
     
    368306  },
    369307};
    370 #else
    371 static const UChar
    372 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 #endif
    385308
    386309static const UChar
     
    406329};
    407330
    408 #if LEVEL_CTX_LUMA_RED
    409331static const UChar
    410332INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
     
    415337};
    416338
    417 #if RESTRICT_GR1GR2FLAG_NUMBER
    418339static const UChar
    419340INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
     
    423344  { 107,  167,   91,  107,  107,  167, },
    424345};
    425 #else
    426 static const UChar
    427 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 #endif
    434 #else
    435 static const UChar
    436 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_NUMBER
    444 static const UChar
    445 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 #else
    452 static const UChar
    453 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 #endif
    460 #endif
    461346
    462347static const UChar
     
    516401};
    517402
    518 #if SAO_UNIT_INTERLEAVING
    519403static const UChar
    520404INIT_SAO_MERGE_LEFT_FLAG[3][NUM_SAO_MERGE_LEFT_FLAG_CTX] =
     
    540424  { 200,  140, },
    541425};
    542 #endif
    543426
    544427static const UChar
     
    549432{ CNU,  153,  138,  138,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU, },
    550433};
     434
     435#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     436#if FIX_DMM_CTX_INIT_C0034
     437static const UChar
    551438#else
     439static const Short
     440#endif
     441INIT_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
    552455static 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
     457static const Short
     458#endif
     459INIT_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
    570473static 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 flag
    588 static const UChar
    589 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 flag
    606 static const UChar
    607 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 UChar
    624 INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] =
    625 {
    626 #if MRG_IDX_CTX_RED
    627   {
    628     CNU,
    629    
    630   },
    631   {
    632     100,
    633    
    634   },
    635   {
    636     116,
    637   },
    638474#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 };
     475static const Short
     476#endif
     477INIT_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  }
    685489#else
    686 // initial probability for AMP split position (X)
    687 static const UChar
    688 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 UChar
    706 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 #endif
    722 // initial probability for prediction mode
    723 static const UChar
    724 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 luma
    741 static const UChar
    742 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 chroma
    759 static const UChar
    760 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 direction
    777 static const UChar
    778 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 difference
    795 static const UChar
    796 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 index
    813 static const UChar
    814 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 dQP
    831 static const UChar
    832 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 UChar
    849 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 UChar
    869 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_REDUCTION
    886 static const UChar
    887 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 #else
    903 static const UChar
    904 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 #endif
    923 
    924 static const UChar
    925 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 UChar
    945 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_RED
    962 static const UChar
    963 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_NUMBER
    980 static const UChar
    981 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 #else
    994 static const UChar
    995 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 #endif
    1011 #else
    1012 static const UChar
    1013 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_NUMBER
    1030 static const UChar
    1031 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 #else
    1044 static const UChar
    1045 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 #endif
    1061 #endif
    1062 // initial probability for motion vector predictor index
    1063 static const UChar
    1064 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 flag
    1081 static const UChar
    1082 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 UChar
    1100 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 UChar
    1118 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 flag
    1135 static const UChar
    1136 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 UChar
    1154 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 UChar
    1172 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_INTERLEAVING
    1189 static const UChar
    1190 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 UChar
    1204 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 UChar
    1217 INIT_SAO_TYPE_IDX[3][NUM_SAO_TYPE_IDX_CTX] =
    1218 {
    1219   {
    1220     64, 104
    1221   },
    1222   {
    1223   168, 120
    1224   },
    1225   {
    1226     184, 120
    1227   },
    1228 };
    1229 static const Short
    1230 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 #endif
    1243 
    1244 static const UChar
    1245 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 #endif
    1261 
    1262 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    1263 static const Short
    1264 INIT_DMM_FLAG[3][NUM_DMM_FLAG_CTX] =
    1265 {
    1266   {
    1267     CNU
    1268   },
    1269   {
    1270     CNU
    1271   },
    1272   {
    1273     CNU
    1274   }
    1275 };
    1276 
    1277 static const Short
    1278 INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] =
    1279 {
    1280   {
    1281     CNU
    1282   },
    1283   {
    1284     CNU
    1285   },
    1286   {
    1287     CNU
    1288   }
    1289 };
    1290 
    1291 static const Short
    1292 INIT_DMM_DATA[3][NUM_DMM_DATA_CTX] =
    1293 {
    1294490  {
    1295491    CNU, CNU, CNU
     
    1301497    CNU, CNU, CNU
    1302498  }
     499#endif
    1303500};
    1304501
  • trunk/source/Lib/TLibCommon/NAL.h

    r210 r296  
    4646{
    4747  NalUnitType m_nalUnitType; ///< nal_unit_type
    48 #if NAL_REF_FLAG
    4948  Bool        m_nalRefFlag;  ///< nal_ref_flag
    50 #else
    51   NalRefIdc   m_nalRefIDC;   ///< nal_ref_idc
    52 #endif
    5349#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    5450  unsigned    m_layerId;
     
    5854  Bool        m_isDepth;     ///< is_depth
    5955  unsigned    m_temporalId;  ///< temporal_id
    60 #if !H0388
    61   bool        m_OutputFlag;  ///< output_flag
    62 #endif
    6356#endif
    6457
    6558  /** construct an NALunit structure with given header values. */
    66 #if H0388
    67 #if NAL_REF_FLAG
    6859  NALUnit(
    6960    NalUnitType nalUnitType,
     
    8677    ,m_temporalId  (temporalId)
    8778  {}
    88 #else
    89   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_INTEGRATION
    99     m_viewId      = viewId;
    100     m_isDepth     = isDepth;
    101 #else
    102     m_layerId = layerId;
    103 #endif
    104     m_temporalId  = temporalID;
    105   }
    106 #endif
    107 #else
    108   NALUnit(
    109     NalUnitType  nalUnitType,
    110     NalRefIdc    nalRefIDC,
    111 #if !VIDYO_VPS_INTEGRATION   
    112     Int          viewId,
    113     Bool         isDepth,
    114 #else
    115     unsigned         layerId,
    116 #endif
    117     unsigned     temporalID = 0,
    118     bool         outputFlag = true)
    119   {
    120     m_nalUnitType = nalUnitType;
    121     m_nalRefIDC   = nalRefIDC;
    122 #if !VIDYO_VPS_INTEGRATION
    123     m_viewId      = viewId;
    124     m_isDepth     = isDepth;
    125 #else
    126     m_layerId = layerId;
    127 #endif
    128     m_temporalId  = temporalID;
    129     m_OutputFlag  = outputFlag;
    130   }
    131 #endif
    13279
    13380  /** default constructor - no initialization; must be perfomed by user */
     
    13885  {
    13986    return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
    140 #if H0566_TLA
    14187#if !QC_REM_IDV_B0046   
    14288        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV
     
    14490        || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA
    14591        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA
    146 #else
    147         || m_nalUnitType == NAL_UNIT_CODED_SLICE_CDR
    148 #endif
    14992        || m_nalUnitType == NAL_UNIT_CODED_SLICE;
    15093  }
  • trunk/source/Lib/TLibCommon/TComAdaptiveLoopFilter.cpp

    r56 r296  
    4646
    4747
    48 #if !LCU_SYNTAX_ALF
    49 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 #endif
    7748
    7849// ====================================================================================================================
     
    8051// ====================================================================================================================
    8152
    82 #if ALF_SINGLE_FILTER_SHAPE
    8353Int TComAdaptiveLoopFilter::weightsShape1Sym[ALF_MAX_NUM_COEF+1] =
    8454{
     
    10979  depthIntShape1Sym
    11080};
    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
    16982Int kTableShape1[ALF_MAX_NUM_COEF+1] =
    17083{     
     
    17992  kTableShape1
    18093};
    181 #endif
    18294
    18395// ====================================================================================================================
     
    194106}
    195107
    196 #if LCU_SYNTAX_ALF
    197108/// AlfCUCtrlInfo
    198109Void AlfCUCtrlInfo::reset()
     
    530441}
    531442
    532 #endif
    533443
    534444
     
    543453  m_pvpAlfLCU    = NULL;
    544454  m_pvpSliceTileAlfLCU = NULL;
    545 #if LCU_SYNTAX_ALF
    546455  for(Int c=0; c< NUM_ALF_COMPONENT; c++)
    547456  {
     
    550459  m_varImg = NULL;
    551460  m_filterCoeffSym = NULL;
    552 #endif
    553461
    554462}
     
    755663Void TComAdaptiveLoopFilter::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
    756664{
    757 #if LCU_SYNTAX_ALF
    758665  destroy();
    759 #endif
    760666  if ( !m_pcTempPicYuv )
    761667  {
     
    765671  m_img_height = iPicHeight;
    766672  m_img_width = iPicWidth;
    767 #if LCU_SYNTAX_ALF
    768673  initMatrix_Pel(&(m_varImg), m_img_height, m_img_width);
    769 #else
    770   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 #endif
    775674  initMatrix_int(&m_filterCoeffSym, NO_VAR_BINS, ALF_MAX_NUM_COEF);
    776675  UInt uiNumLCUsInWidth   = m_img_width  / uiMaxCUWidth;
     
    782681  m_uiNumCUsInFrame = uiNumLCUsInWidth* uiNumLCUsInHeight;
    783682
    784 #if LCU_SYNTAX_ALF
    785683  m_numLCUInPicWidth = uiNumLCUsInWidth;
    786684  m_numLCUInPicHeight= uiNumLCUsInHeight;
    787685  m_lcuHeight = uiMaxCUHeight;
    788 #if ALF_SINGLE_FILTER_SHAPE
    789686  m_lineIdxPadBot = m_lcuHeight - 4 - 3; // DFRegion, Vertical Taps
    790 #else
    791   m_lineIdxPadBot = m_lcuHeight - 4 - 4; // DFRegion, Vertical Taps
    792 #endif
    793687  m_lineIdxPadTop = m_lcuHeight - 4; // DFRegion
    794688
    795689  m_lcuHeightChroma = m_lcuHeight>>1;
    796 #if ALF_SINGLE_FILTER_SHAPE
    797690  m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps
    798 #else
    799   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps
    800 #endif
    801691  m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ; // DFRegion
    802692
    803693  createLCUAlfInfo();
    804 #else
    805   createRegionIndexMap(m_varImgMethods[ALF_RA], m_img_width, m_img_height);
    806 #endif
    807694}
    808695
     
    813700    m_pcTempPicYuv->destroy();
    814701    delete m_pcTempPicYuv;
    815 #if LCU_SYNTAX_ALF
    816702    m_pcTempPicYuv = NULL;
    817 #endif
    818   }
    819 #if LCU_SYNTAX_ALF
     703  }
    820704  if(m_varImg != NULL)
    821705  {
     
    828712    m_filterCoeffSym = NULL;
    829713  }
    830 #else
    831   for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    832   {
    833     destroyMatrix_Pel(m_varImgMethods[i]);
    834   }
    835   destroyMatrix_int(m_filterCoeffSym);
    836 #endif
    837 #if LCU_SYNTAX_ALF
    838714  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
    951718
    952719// --------------------------------------------------------------------------------------------------------------------
     
    954721// --------------------------------------------------------------------------------------------------------------------
    955722
    956 #if LCU_SYNTAX_ALF
    957723/** ALF reconstruction process for one picture
    958724 * \param [in, out] pcPic the decoded/filtered picture (input: decoded picture; output filtered picture)
     
    1113879}
    1114880
    1115 #else
    1116 
    1117 /**
    1118  \param [in, out] pcPic         picture (TComPic) class (input/output)
    1119  \param [in] pcAlfParam    ALF parameter
    1120  \param [in,out] vAlfCUCtrlParam ALF CU control parameters
    1121  \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_SHAPE
    1133   m_lineIdxPadBot = m_lcuHeight - 4 - 3;             // DFRegion, Vertical Taps
    1134 #else
    1135   m_lineIdxPadBot = m_lcuHeight - 4 - 4;             // DFRegion, Vertical Taps
    1136 #endif
    1137   m_lineIdxPadTop = m_lcuHeight - 4;                 // DFRegion
    1138 
    1139   m_lcuHeightChroma     = m_lcuHeight>>1;
    1140 #if ALF_SINGLE_FILTER_SHAPE
    1141   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps
    1142 #else
    1143   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps
    1144 #endif
    1145   m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ;    // DFRegion
    1146 
    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   else
    1167   {
    1168     transferCtrlFlagsFromAlfParam(vAlfCUCtrlParam);
    1169   }
    1170   xALFLuma(pcPic, pcAlfParam, vAlfCUCtrlParam, pcPicYuvExtRec, pcPicYuvRec);
    1171   if(pcAlfParam->chroma_idc)
    1172   {
    1173 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    1174     reconstructALFCoeffChroma(pcAlfParam);
    1175 #else
    1176     predictALFCoeffChroma(pcAlfParam);
    1177 #endif
    1178     checkFilterCoeffValue(pcAlfParam->coeff_chroma, pcAlfParam->num_coeff_chroma, true );
    1179 
    1180     xALFChroma( pcAlfParam, pcPicYuvExtRec, pcPicYuvRec);
    1181   }
    1182 }
    1183 #endif
    1184881// ====================================================================================================================
    1185882// Protected member functions
     
    1216913}
    1217914
    1218 #if !LCU_SYNTAX_ALF
    1219 
    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     else
    1252     {
    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   else
    1257   {
    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         else
    1278         {
    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 table
    1289   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       else
    1299       {
    1300         varIndTab[i] = varIndTab[i-1];
    1301       }
    1302     }
    1303   }
    1304   predictALFCoeffLuma( pcAlfParam);
    1305   // reconstruct filter sets
    1306   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_SHAPE
    1331   Int varInd = 0;
    1332 #endif
    1333   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_SHAPE
    1341   if(filtNo == ALF_CROSS9x7_SQUARE3x3)
    1342 #else
    1343   if(filtNo == ALF_CROSS9x9)
    1344 #endif
    1345   {
    1346     for (i=0; i<NO_VAR_BINS; i++)
    1347     {
    1348       coef = filterSet[i];
    1349       //VB line 1
    1350       newCenterCoeff[0][i] = coef[8] + ((coef[0] + coef[1] + coef[2] + coef[3])<<1);
    1351       //VB line 2
    1352       newCenterCoeff[1][i] = coef[8] + ((coef[0] + coef[1] + coef[2])<<1);
    1353       //VB line 3
    1354       newCenterCoeff[2][i] = coef[8] + ((coef[0] + coef[1])<<1);
    1355       //VB line 4
    1356       newCenterCoeff[3][i] = coef[8] + ((coef[0])<<1);
    1357     }
    1358   }
    1359 
    1360 
    1361   switch(filtNo)
    1362   {
    1363 #if !ALF_SINGLE_FILTER_SHAPE
    1364   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         else
    1387         {
    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         else
    1432         {
    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 #else
    1470   case ALF_CROSS9x7_SQUARE3x3:
    1471     {
    1472       Pel *pImgPad5, *pImgPad6;
    1473 #endif
    1474       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_SHAPE
    1487           pImgPad7 = pImgPad + 4*stride;
    1488           pImgPad8 = pImgPad - 4*stride;
    1489 #endif
    1490         }
    1491         else if (yLineInLCU<m_lineIdxPadTop)
    1492         {
    1493           paddingLine = - yLineInLCU + m_lineIdxPadTop - 1;
    1494 #if ALF_SINGLE_FILTER_SHAPE
    1495           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 #else
    1502           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 #endif
    1511         }
    1512         else
    1513         {
    1514           paddingLine = yLineInLCU - m_lineIdxPadTop ;
    1515 #if ALF_SINGLE_FILTER_SHAPE
    1516           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 #else
    1523           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 #endif
    1532         }
    1533 
    1534         pVar = ppVarImg[i>>shiftHeight] + (xpos>>shiftWidth);
    1535 
    1536 #if ALF_SINGLE_FILTER_SHAPE
    1537         {
    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 #else
    1563         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         else
    1664         {
    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 #endif
    1693         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 process
    1712   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 boundary
    1734   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       else
    1781       {
    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     else
    1792     {
    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 filterCoeffTmp
    1804   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 prediction
    1812   for(ind = 1; ind < pcAlfParam->filters_per_group; ++ind)
    1813   {
    1814     if(pcAlfParam->predMethod)
    1815     {
    1816       // Prediction
    1817       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 #endif
    1832915
    1833916static Pel Clip_post(int high, int val)
     
    1836919}
    1837920
    1838 #if !LCU_SYNTAX_ALF
    1839 
    1840 /** Calculate ALF grouping indices for block-based (BA) mode
    1841  * \param [out] imgYvar grouping indices buffer
    1842  * \param [in] imgYpad picture buffer
    1843  * \param [in] stride picture stride size
    1844  * \param [in] adaptationMode  ALF_BA or ALF_RA mode
    1845  */
    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_GROUPS
    1856   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 #else
    1861   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 #endif 
    1864   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 2
    1877       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; //vertical
    1893       }
    1894       if (horizontal > 2*vertical)
    1895       {
    1896         direction = 2; //horizontal
    1897       }
    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_GROUPS
    1903       avgvar = avgVarTab[direction][avgvar];
    1904 #else     
    1905       avgvar = Clip_post(step1, (Int) avgvar ) + (step1+1)*direction;
    1906 #endif
    1907       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 chroma
    1965 // --------------------------------------------------------------------------------------------------------------------
    1966 
    1967 /**
    1968  \param pcPicDec    picture before ALF
    1969  \param pcPicRest   picture after  ALF
    1970  \param qh          filter coefficient
    1971  \param iTap        filter tap
    1972  \param iColor      0 for Cb and 1 for Cr
    1973  */
    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_SHAPE
    1994   if(filtNo == ALF_CROSS9x7_SQUARE3x3)
    1995 #else
    1996   if (filtNo == ALF_CROSS9x9)
    1997 #endif
    1998   {
    1999     //VB line 1
    2000     newCenterCoeff[0] = coef[8] + ((coef[0] + coef[1] + coef[2] + coef[3])<<1);
    2001     //VB line 2
    2002     newCenterCoeff[1] = coef[8] + ((coef[0] + coef[1] + coef[2])<<1);
    2003     //VB line 3
    2004     newCenterCoeff[2] = coef[8] + ((coef[0] + coef[1])<<1);
    2005     //VB line 4
    2006     newCenterCoeff[3] = coef[8] + ((coef[0])<<1);
    2007   }
    2008 
    2009   switch(filtNo)
    2010   {
    2011 #if !ALF_SINGLE_FILTER_SHAPE
    2012   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         else
    2034         {
    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         else
    2073         {
    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 #else
    2106   case ALF_CROSS9x7_SQUARE3x3:
    2107     {
    2108       Pel *pImgPad5, *pImgPad6;
    2109 #endif
    2110       for(i= ypos; i<= yposEnd; i++)
    2111       {
    2112         yLineInLCU = i % m_lcuHeightChroma;
    2113 #if ALF_SINGLE_FILTER_SHAPE
    2114         if (yLineInLCU<2 && i> 2)
    2115 #else
    2116         if (yLineInLCU<2)
    2117 #endif
    2118         {
    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_SHAPE
    2125           pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*stride;
    2126           pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*stride;
    2127 #else
    2128           pImgPad5 = pImgPad + 3*stride;
    2129           pImgPad6 = pImgPad - min(paddingline, 3)*stride;
    2130           pImgPad7 = pImgPad + 4*stride;
    2131           pImgPad8 = pImgPad - min(paddingline, 4)*stride;
    2132 #endif
    2133         }
    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_SHAPE
    2143           pImgPad7 = pImgPad + 4*stride;
    2144           pImgPad8 = pImgPad - 4*stride;
    2145 #endif
    2146         }
    2147         else if (yLineInLCU < m_lineIdxPadTopChroma)
    2148         {
    2149           paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;
    2150 #if ALF_SINGLE_FILTER_SHAPE
    2151           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 #else
    2158           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 #endif
    2167         }
    2168         else
    2169         {
    2170           paddingline = yLineInLCU - m_lineIdxPadTopChroma ;
    2171 #if ALF_SINGLE_FILTER_SHAPE
    2172           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 #else
    2179           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 #endif
    2188         }
    2189 
    2190 #if ALF_SINGLE_FILTER_SHAPE
    2191           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 #else
    2211         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         else
    2292         {         
    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 #endif
    2317         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 picture
    2335  * \param componentID slice parameters
    2336  * \param pcPicDecYuv original picture
    2337  * \param pcPicRestYuv picture before filtering
    2338  * \param coeff filter coefficients
    2339  * \param filtNo  filter shape
    2340  * \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 picture
    2369  * \param componentID slice parameters
    2370  * \param pcPicDecYuv original picture
    2371  * \param pcPicRestYuv picture before filtering
    2372  * \param shape  filter shape
    2373  * \param pCoeff filter coefficients
    2374  */
    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   else
    2386   {
    2387     xFilterChromaSlices(componentID, pDecYuv, pRestYuv, pCoeff, shape, chromaFormatShift);
    2388   }
    2389 }
    2390 
    2391 /** Chroma filtering for  multi-slice picture
    2392  * \param pcAlfParam ALF parameters
    2393  * \param pcPicDec to-be-filtered picture buffer
    2394  * \param pcPicRest filtered picture buffer
    2395  */
    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 #endif
    2410921
    2411922Void TComAdaptiveLoopFilter::setAlfCtrlFlags(AlfCUCtrlInfo* pAlfParam, TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt &idx)
     
    24981009 * \param numSlicesInPic number of slices in picture
    24991010 */
    2500 #if LCU_SYNTAX_ALF
    25011011Void TComAdaptiveLoopFilter::createPicAlfInfo(TComPic* pcPic, Int numSlicesInPic, Int alfQP)
    2502 #else
    2503 Void TComAdaptiveLoopFilter::createPicAlfInfo(TComPic* pcPic, Int numSlicesInPic)
    2504 #endif
    25051012{
    25061013  m_uiNumSlicesInPic = numSlicesInPic;
     
    25101017  m_pcPic = pcPic;
    25111018
    2512 #if LCU_SYNTAX_ALF
    25131019  m_isNonCrossSlice = pcPic->getIndependentSliceBoundaryForNDBFilter();
    25141020  m_suWidth = pcPic->getMinCUWidth();
    25151021  m_suHeight= pcPic->getMinCUHeight();
    25161022  m_alfQP = alfQP;
    2517 #endif
    2518 #if !LCU_SYNTAX_ALF 
    2519   if(m_uiNumSlicesInPic > 1 || m_bUseNonCrossALF)
    2520   {
    2521 #endif
    25221023    m_ppSliceAlfLCUs = new AlfLCUInfo*[m_uiNumSlicesInPic];
    25231024    m_pvpAlfLCU = new std::vector< AlfLCUInfo* >[m_uiNumSlicesInPic];
     
    25841085      m_pcSliceYuvTmp = pcPic->getYuvPicBufferForIndependentBoundaryProcessing();
    25851086    }
    2586 #if !LCU_SYNTAX_ALF
    2587   }
    2588 #endif
    25891087
    25901088}
     
    25941092Void TComAdaptiveLoopFilter::destroyPicAlfInfo()
    25951093{
    2596 #if !LCU_SYNTAX_ALF
    2597   if(m_bUseNonCrossALF)
    2598   {
    2599 #endif
    26001094    for(Int s=0; s< m_uiNumSlicesInPic; s++)
    26011095    {
     
    26141108    delete[] m_pvpSliceTileAlfLCU;
    26151109    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
    27271112
    27281113/** Copy ALF CU control flags from ALF parameters for slices
     
    28461231    {
    28471232      NDBFBlockInfo& rSGU = rAlfLCU[n];
    2848 #if LCU_SYNTAX_ALF
    28491233      if(rSGU.allBordersAvailable)
    28501234      {
    28511235        continue;
    28521236      }
    2853 #endif
    28541237      posX     = rSGU.posX >> formatShift;
    28551238      posY     = rSGU.posY >> formatShift;
     
    31271510}
    31281511
    3129 #if LCU_SYNTAX_ALF
    31301512/** reconstruct ALF luma coefficient
    31311513 * \param [in] alfLCUParam ALF parameters
     
    32321614  coeffPred = (1<<ALF_NUM_BIT_SHIFT) - sum;
    32331615#endif
    3234 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    32351616  filterCoeff[0][alfLCUParam->num_coeff-1] = coeffPred + alfLCUParam->coeffmulti[0][alfLCUParam->num_coeff-1];
    3236 #else
    3237   filterCoeff[0][alfLCUParam->num_coeff-1] = coeffPred - alfLCUParam->coeffmulti[0][alfLCUParam->num_coeff-1];
    3238 #endif
    32391617}
    32401618
     
    34441822  Int pred = (1<<ALF_NUM_BIT_SHIFT) - (sum);
    34451823#endif
    3446 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    34471824  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
    34541827/** filtering pixels
    34551828 * \param [out] imgRes filtered picture
     
    35761949  } 
    35771950}
    3578 #endif
    35791951
    35801952#if LCUALF_QP_DEPENDENT_BITS
     
    36231995  static Int shiftW = (Int)(log((double)VAR_SIZE_W)/log(2.0));
    36241996  static Int varMax = (Int)NO_VAR_BINS-1; 
    3625 #if ALF_16_BA_GROUPS
    36261997  static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};
    36271998  static Int avgVarTab[3][6] = { {0,  1,  2,  3,  4,  5,},
    36281999  {0,  6,  7,  8,  9, 10,},
    36292000  {0, 11, 12, 13, 14, 15}   };
    3630 #else
    3631   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 #endif
    36342001
    36352002  Int i, j, avgVar, vertical, horizontal, direction, yOffset;
     
    36832050      avgVar = (Pel) Clip_post( varMax, avgVar>>(g_uiBitIncrement+1) );
    36842051      avgVar = th[avgVar];
    3685 #if ALF_16_BA_GROUPS
    36862052      avgVar = avgVarTab[direction][avgVar];
    3687 #else     
    3688       avgVar = Clip_post(step, (Int)avgVar) + (step+1)*direction;
    3689 #endif
    36902053      imgYvar[i>>shiftH][j>>shiftW] = avgVar;
    36912054    }
     
    37672130  return pBuf;
    37682131}
    3769 #endif
    37702132
    37712133
  • trunk/source/Lib/TLibCommon/TComAdaptiveLoopFilter.h

    r56 r296  
    4949// ====================================================================================================================
    5050
    51 #if LCU_SYNTAX_ALF
    5251  #define LCUALF_QP_DEPENDENT_BITS    1 
    53 #endif
    54 
    55 #if ALF_SINGLE_FILTER_SHAPE
     52
    5653#define ALF_FILTER_LEN       10
    5754#define ALF_MAX_NUM_COEF     ALF_FILTER_LEN    //!< maximum number of filter coefficients
    58 #else
    59 #define ALF_MAX_NUM_COEF      9                                       //!< maximum number of filter coefficients
    60 #endif
    6155#define MAX_SQR_FILT_LENGTH   41                                      //!< ((max_horizontal_tap * max_vertical_tap) / 2 + 1) = ((11 * 5) / 2 + 1)
    6256
    63 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     57#if LCUALF_QP_DEPENDENT_BITS
    6458#define ALF_QP1               28
    6559#define ALF_QP2               34
     
    7872
    7973
    80 #if LCU_SYNTAX_ALF
    8174/// Luma/Chroma component ID
    8275enum ALFComponentID
     
    9689  NUM_ALF_MERGE_TYPE
    9790};
    98 #else
    99 ///
    100 /// Chroma component ID
    101 ///
    102 enum AlfChromaID
    103 {
    104   ALF_Cb = 0,
    105   ALF_Cr = 1
    106 };
    107 
    108 
    109 ///
    110 /// Adaptation mode ID
    111 ///
    112 enum ALFClassficationMethod
    113 {
    114   ALF_BA =0,
    115   ALF_RA,
    116   NUM_ALF_CLASS_METHOD
    117 };
    118 #endif
    11991///
    12092/// Filter shape
     
    12294enum ALFFilterShape
    12395{
    124 #if ALF_SINGLE_FILTER_SHAPE
    12596  ALF_CROSS9x7_SQUARE3x3 = 0,
    126 #else
    127   ALF_STAR5x5 = 0,
    128   ALF_CROSS9x9,
    129 #endif
    13097  NUM_ALF_FILTER_SHAPE
    13198};
    13299
    133 #if LCU_SYNTAX_ALF
    134100extern Int* kTableTabShapes[NUM_ALF_FILTER_SHAPE];
    135 #endif
    136 #if ALF_SINGLE_FILTER_SHAPE
    137101extern Int depthIntShape1Sym[ALF_MAX_NUM_COEF+1];
    138 #else
    139 extern Int depthIntShape0Sym[10];
    140 extern Int depthIntShape1Sym[10];
    141 #endif
    142102extern Int *pDepthIntTabShapes[NUM_ALF_FILTER_SHAPE];
    143103
     
    156116  const AlfCUCtrlInfo& operator= (const AlfCUCtrlInfo& src);  //!< "=" operator
    157117  AlfCUCtrlInfo():cu_control_flag(0), num_alf_cu_flag(0), alf_max_depth(0) {} //!< constructor
    158 #if LCU_SYNTAX_ALF
    159118  Void reset();
    160 #endif
    161119};
    162120
     
    190148
    191149  // filter shape information
    192 #if ALF_SINGLE_FILTER_SHAPE
    193150  static Int weightsShape1Sym[ALF_MAX_NUM_COEF+1];
    194 #else
    195   static Int weightsShape0Sym[10];
    196   static Int weightsShape1Sym[10];
    197 #endif
    198151  static Int *weightsTabShapes[NUM_ALF_FILTER_SHAPE];
    199152  static Int m_sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE];
     
    209162  //classification
    210163  Int      m_varIndTab[NO_VAR_BINS];
    211 #if !LCU_SYNTAX_ALF
    212   UInt     m_uiVarGenMethod;
    213   Pel** m_varImgMethods[NUM_ALF_CLASS_METHOD];
    214 #endif
    215164  Pel** m_varImg;
    216165
     
    237186  std::vector< std::vector< AlfLCUInfo* > > *m_pvpSliceTileAlfLCU;
    238187
    239 #if LCU_SYNTAX_ALF
    240188  Int m_suWidth;
    241189  Int m_suHeight;
     
    245193  Bool m_isNonCrossSlice;
    246194  Int m_alfQP;
    247 #endif
    248195
    249196private: //private member variables
     
    252199protected: //protected methods
    253200
    254 #if LCU_SYNTAX_ALF
    255201  Void createLCUAlfInfo();
    256202  Void destroyLCUAlfInfo();
     
    266212  Bool isEnabledComponent(ALFParam** alfLCUParam);
    267213  Int  getAlfPrecisionBit(Int qp);
    268 #if ALF_SINGLE_FILTER_SHAPE
    269214  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 #endif
    271215  Void calcOneRegionVar(Pel **imgYvar, Pel *imgYpad, Int stride, Bool isOnlyOneGroup, Int yPos, Int yPosEnd, Int xPos, Int xPosEnd);
    272 #endif
    273216
    274217
    275218  Void InitAlfLCUInfo(AlfLCUInfo& rAlfLCU, Int sliceID, Int tileID, TComDataCU* pcCU, UInt maxNumSUInLCU);
    276 #if !LCU_SYNTAX_ALF
    277   Void createRegionIndexMap(Pel **imgY_var, Int img_width, Int img_height); //!< create RA index for regions
    278   Void calcVar(Pel **imgYvar, Pel *imgYpad, Int stride, Int adaptationMode); //!< Calculate ALF grouping indices for block-based (BA) mode
    279   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 region
    280   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 region
    282   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 coefficients
    286 #endif
    287219  Void checkFilterCoeffValue( Int *filter, Int filterLength, Bool isChroma );
    288 #if !LCU_SYNTAX_ALF
    289   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 #endif
    295220  Void setAlfCtrlFlags(AlfCUCtrlInfo* pAlfParam, TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt &idx);
    296221  Void transferCtrlFlagsFromAlfParam(std::vector<AlfCUCtrlInfo>& vAlfParamSlices); //!< Copy ALF CU control flags from ALF parameters for slices 
     
    299224  Void copyRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* pPicDst, Pel* pPicSrc, Int stride, Int formatShift = 0);
    300225  Void extendRegionBorder(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* pPelSrc, Int stride, Int formatShift = 0);
    301 #if !LCU_SYNTAX_ALF 
    302   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 #endif
    305226  Int  getCtrlFlagsFromAlfParam(AlfLCUInfo* pcAlfLCU, Int iAlfDepth, UInt* puiFlags);
    306227
     
    317238  Void destroy ();
    318239
    319 #if LCU_SYNTAX_ALF
    320240  Void ALFProcess          (TComPic* pcPic, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam, Bool isAlfCoefInSlice);
    321241  Void resetLCUAlfInfo     ();
     
    324244
    325245  ALFParam*** getAlfLCUParam() {return m_alfFiltInfo;}
    326 #else
    327   Void predictALFCoeffChroma  ( ALFParam* pAlfParam );                  //!< prediction of chroma ALF coefficients
    328 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    329   Void reconstructALFCoeffChroma( ALFParam* pAlfParam );
    330 #endif
    331   Void ALFProcess             ( TComPic* pcPic, ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam ); ///< interface function for ALF process
    332 
    333   Void allocALFParam  ( ALFParam* pAlfParam ); //!< allocate ALF parameters
    334   Void freeALFParam   ( ALFParam* pAlfParam ); //!< free ALF parameters
    335   Void copyALFParam   ( ALFParam* pDesAlfParam, ALFParam* pSrcAlfParam ); //!< copy ALF parameters
    336 #endif
    337246  Int  getNumCUsInPic()  {return m_uiNumCUsInFrame;} //!< get number of LCU in picture for ALF process
    338 #if LCU_SYNTAX_ALF
    339247  Void createPicAlfInfo (TComPic* pcPic, Int uiNumSlicesInPic = 1, Int alfQP = 26);
    340 #else
    341   Void createPicAlfInfo (TComPic* pcPic, Int numSlicesInPic = 1);
    342 #endif
    343248  Void destroyPicAlfInfo();
    344249
  • trunk/source/Lib/TLibCommon/TComBitStream.cpp

    r56 r296  
    7373  m_puiTileMarkerLocation     = new UInt[MAX_MARKER_PER_NALU];
    7474  m_uiTileMarkerLocationCount = 0;
    75 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    7675  m_numBitsRead = 0;
    77 #endif
    7876}
    7977
     
    212210  assert( uiNumberOfBits <= 32 );
    213211 
    214 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    215212  m_numBitsRead += uiNumberOfBits;
    216 #endif
    217213
    218214  /* NB, bits are extracted from the MSB of each byte. */
     
    334330    buf->push_back(uiByte);
    335331  }
    336 #if OL_FLUSH && !OL_FLUSH_ALIGN
     332#if !OL_FLUSH_ALIGN
    337333  buf->push_back(0); // The final chunk might not start byte aligned.
    338334#endif
  • trunk/source/Lib/TLibCommon/TComBitStream.h

    r56 r296  
    176176  UInt m_uiTileMarkerLocationCount;
    177177  UInt *m_puiTileMarkerLocation;
    178 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    179178  UInt  m_numBitsRead;
    180 #endif
    181179
    182180public:
     
    192190  Void        pseudoRead      ( UInt uiNumberOfBits, UInt& ruiBits );
    193191  Void        read            ( UInt uiNumberOfBits, UInt& ruiBits );
    194 #if OL_FLUSH && !OL_FLUSH_ALIGN
     192#if !OL_FLUSH_ALIGN
    195193  Void        readByte        ( UInt &ruiBits )
    196194  {
     
    228226  Void                backupByte() { m_fifo_idx--; }
    229227#endif
    230 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    231228  UInt  getNumBitsRead() { return m_numBitsRead; }
     229};
     230
     231//! \}
     232
    232233#endif
    233 };
    234 
    235 //! \}
    236 
    237 #endif
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r210 r296  
    5151#endif
    5252
     53#if MERL_VSP_C0152
     54
     55#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )
     56
     57inline 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
     80inline 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
    53120// ====================================================================================================================
    54121// Constructor / destructor / create / destroy
     
    79146#endif
    80147  m_puhMergeIndex      = NULL;
     148#if MERL_VSP_C0152
     149  m_piVSPIndex         = NULL;
     150#endif
    81151  m_puhLumaIntraDir    = NULL;
    82152  m_puhChromaIntraDir  = NULL;
     
    135205#if HHI_DMM_PRED_TEX
    136206  m_puiWedgePredTexTabIdx    = NULL;
     207#if LGE_DMM3_SIMP_C0044
     208  m_puiWedgePredTexIntraTabIdx = NULL;
     209#endif
    137210  m_piWedgePredTexDeltaDC1   = NULL;
    138211  m_piWedgePredTexDeltaDC2   = NULL;
     
    141214  m_piContourPredTexDeltaDC2 = NULL;
    142215#endif
    143 #if HHI_INTER_VIEW_RESIDUAL_PRED
     216#if H3D_IVRP
    144217  m_pbResPredAvailable = NULL;
    145218  m_pbResPredFlag      = NULL;
     
    182255  if ( !bDecSubCu )
    183256  {
    184 #if H0736_AVC_STYLE_QP_RANGE
    185257    m_phQP               = (Char*     )xMalloc(Char,     uiNumPartition);
    186 #else
    187     m_phQP               = (UChar*    )xMalloc(UChar,    uiNumPartition);
    188 #endif
    189258    m_puhDepth           = (UChar*    )xMalloc(UChar,    uiNumPartition);
    190259#if HHI_MPI
     
    213282#endif
    214283    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
    216288    m_pbResPredAvailable = (Bool*  )xMalloc(Bool,   uiNumPartition);
    217289    m_pbResPredFlag      = (Bool*  )xMalloc(Bool,   uiNumPartition);
     
    283355#if HHI_DMM_PRED_TEX
    284356    m_puiWedgePredTexTabIdx    = (UInt*)xMalloc(UInt, uiNumPartition);
     357#if LGE_DMM3_SIMP_C0044
     358    m_puiWedgePredTexIntraTabIdx    = (UInt*)xMalloc(UInt, uiNumPartition);
     359#endif
    285360    m_piWedgePredTexDeltaDC1   = (Int* )xMalloc(Int,  uiNumPartition);
    286361    m_piWedgePredTexDeltaDC2   = (Int* )xMalloc(Int,  uiNumPartition);
     
    364439    if ( m_pbICFlag           ) { xFree(m_pbICFlag);            m_pbICFlag          = NULL; }
    365440#endif
     441#if MERL_VSP_C0152
     442    if ( m_piVSPIndex         ) { xFree(m_piVSPIndex);          m_piVSPIndex        = NULL; }
     443#endif
    366444    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
    367 #if HHI_INTER_VIEW_RESIDUAL_PRED
     445#if H3D_IVRP
    368446    if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable);  m_pbResPredAvailable= NULL; }
    369447    if ( m_pbResPredFlag      ) { xFree(m_pbResPredFlag);       m_pbResPredFlag     = NULL; }
     
    408486#if HHI_DMM_PRED_TEX
    409487    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
    410491    if ( m_piWedgePredTexDeltaDC1   ) { xFree(m_piWedgePredTexDeltaDC1  ); m_piWedgePredTexDeltaDC1   = NULL; }
    411492    if ( m_piWedgePredTexDeltaDC2   ) { xFree(m_piWedgePredTexDeltaDC2  ); m_piWedgePredTexDeltaDC2   = NULL; }
     
    463544  this->height = src.height;
    464545  ::memcpy(this->isBorderAvailable, src.isBorderAvailable, sizeof(Bool)*((Int)NUM_SGU_BORDER));
    465 #if LCU_SYNTAX_ALF
    466546  this->allBordersAvailable = src.allBordersAvailable;
    467 #endif
    468547
    469548  return *this;
     
    500579  m_uiTotalBins        = 0;
    501580  m_uiNumPartition     = pcPic->getNumPartInCU();
    502 #if BURST_IPCM
    503581  m_numSucIPCM       = 0;
    504582  m_lastCUSucIPCMFlag   = false;
    505 #endif
    506583
    507584  for(int i=0; i<pcPic->getNumPartInCU(); i++)
     
    558635#endif
    559636    m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui];
     637#if MERL_VSP_C0152
     638    m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui];
     639#endif
    560640    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
    561641    m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui];
     
    598678#endif
    599679    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
    600683    memset( m_puhLumaIntraDir   + firstElement, 2,                        numElements * sizeof( *m_puhLumaIntraDir ) );
    601684    memset( m_puhChromaIntraDir + firstElement, 0,                        numElements * sizeof( *m_puhChromaIntraDir ) );
     
    618701#if HHI_DMM_PRED_TEX
    619702    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
    620706    memset( m_piWedgePredTexDeltaDC1   + firstElement, 0, sizeof( Int  ) * numElements );
    621707    memset( m_piWedgePredTexDeltaDC2   + firstElement, 0, sizeof( Int  ) * numElements );
     
    627713    memset (m_pbRenderable             + firstElement, false, sizeof( Bool ) * numElements) ;
    628714#endif
    629 #if HHI_INTER_VIEW_RESIDUAL_PRED
     715#if H3D_IVRP
    630716    memset( m_pbResPredAvailable       + firstElement, 0    , sizeof( Bool ) * numElements );
    631717    memset( m_pbResPredFlag            + firstElement, 0    , sizeof( Bool ) * numElements );
     
    720806}
    721807
    722 #if H0736_AVC_STYLE_QP_RANGE
    723808/** initialize prediction data with enabling sub-LCU-level delta QP
    724809*\param  uiDepth  depth of the current CU
     
    729814*/
    730815Void TComDataCU::initEstData( UInt uiDepth, Int qp )
    731 #else
    732 /** initialize prediction data with enabling sub-LCU-level delta QP
    733 *\param  uiDepth  depth of the current CU
    734 *\param  uiQP     QP for the current CU
    735 *- set CU width and CU height according to depth
    736 *- set QP value according to input QP
    737 *- set last-coded QP value according to input last-coded QP
    738 */
    739 Void TComDataCU::initEstData( UInt uiDepth, UInt uiQP )
    740 #endif
    741816{
    742817  m_dTotalCost         = MAX_DOUBLE;
     
    770845      m_pePredMode[ui] = MODE_NONE;
    771846      m_pbIPCMFlag[ui] = 0;
    772 #if H0736_AVC_STYLE_QP_RANGE
    773847      m_phQP[ui] = qp;
    774 #else
    775       m_phQP[ui] = uiQP;
    776 #endif
    777848      m_puiAlfCtrlFlag[ui]= false;
    778849      m_pbMergeFlag[ui] = 0;
     
    781852#endif
    782853      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
    784858      m_pbResPredAvailable[ui] = 0;
    785859      m_pbResPredFlag[ui]      = 0;
     
    803877#if HHI_DMM_PRED_TEX
    804878    m_puiWedgePredTexTabIdx   [ui] = 0;
     879#if LGE_DMM3_SIMP_C0044
     880    m_puiWedgePredTexIntraTabIdx [ui] = 0;
     881#endif
    805882    m_piWedgePredTexDeltaDC1  [ui] = 0;
    806883    m_piWedgePredTexDeltaDC2  [ui] = 0;
     
    845922
    846923// initialize Sub partition
    847 #if H0736_AVC_STYLE_QP_RANGE
    848924Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp )
    849 #else
    850 Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP )
    851 #endif
    852925{
    853926  assert( uiPartUnitIdx<4 );
     
    869942  m_uiNumPartition     = pcCU->getTotalNumPart() >> 2;
    870943
    871 #if BURST_IPCM
    872944  m_numSucIPCM       = 0;
    873945  m_lastCUSucIPCMFlag   = false;
    874 #endif
    875946
    876947  Int iSizeInUchar = sizeof( UChar  ) * m_uiNumPartition;
    877948  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
    880953  Int sizeInChar = sizeof( Char  ) * m_uiNumPartition;
    881954  memset( m_phQP,              qp,  sizeInChar );
    882 #else
    883   memset( m_phQP,              uiQP, iSizeInUchar );
    884 #endif
    885955
    886956  memset( m_puiAlfCtrlFlag,     0, iSizeInBool );
     
    893963#endif
    894964  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
    896969  memset( m_pbResPredAvailable, 0, iSizeInBool  );
    897970  memset( m_pbResPredFlag,      0, iSizeInBool  );
     
    921994#if HHI_DMM_PRED_TEX
    922995  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
    923999  memset( m_piWedgePredTexDeltaDC1,   0, sizeof( Int  ) * m_uiNumPartition );
    9241000  memset( m_piWedgePredTexDeltaDC2,   0, sizeof( Int  ) * m_uiNumPartition );
     
    9731049#endif
    9741050      m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui];
     1051#if MERL_VSP_C0152
     1052      m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui];
     1053#endif
    9751054      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    9761055      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    9921071#if HHI_DMM_PRED_TEX
    9931072      m_puiWedgePredTexTabIdx   [ui]=pcCU->getWedgePredTexTabIdx    (uiPartOffset+ui);
     1073#if LGE_DMM3_SIMP_C0044
     1074      m_puiWedgePredTexIntraTabIdx [ui]=pcCU->getWedgePredTexIntraTabIdx (uiPartOffset+ui);
     1075#endif
    9941076      m_piWedgePredTexDeltaDC1  [ui]=pcCU->getWedgePredTexDeltaDC1  (uiPartOffset+ui);
    9951077      m_piWedgePredTexDeltaDC2  [ui]=pcCU->getWedgePredTexDeltaDC2  (uiPartOffset+ui);
     
    9981080      m_piContourPredTexDeltaDC2[ui]=pcCU->getContourPredTexDeltaDC2(uiPartOffset+ui);
    9991081#endif   
    1000 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1082#if H3D_IVRP
    10011083      m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ];
    10021084      m_pbResPredFlag     [ui] = pcCU->m_pbResPredFlag     [ uiPartOffset + ui ];
     
    11171199#endif
    11181200  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
    11201205  m_pbResPredAvailable  = pcCU->getResPredAvail()     + uiPart;
    11211206  m_pbResPredFlag       = pcCU->getResPredFlag ()     + uiPart;
     
    11931278#if HHI_DMM_PRED_TEX
    11941279  m_puiWedgePredTexTabIdx    = pcCU->getWedgePredTexTabIdx()     + uiPart;   
     1280#if LGE_DMM3_SIMP_C0044
     1281  m_puiWedgePredTexIntraTabIdx = pcCU->getWedgePredTexIntraTabIdx() + uiPart;   
     1282#endif
    11951283  m_piWedgePredTexDeltaDC1   = pcCU->getWedgePredTexDeltaDC1()   + uiPart;   
    11961284  m_piWedgePredTexDeltaDC2   = pcCU->getWedgePredTexDeltaDC2()   + uiPart;   
     
    12271315  m_uiCUAddr           = pcCU->getAddr();
    12281316  m_uiAbsIdxInLCU      = uiAbsPartIdx;
    1229  
     1317
    12301318  Int iRastPartIdx     = g_auiZscanToRaster[uiAbsPartIdx];
    12311319  m_uiCUPelX           = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() );
     
    12571345#endif
    12581346  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
    12601351  m_pbResPredAvailable = pcCU->getResPredAvail()          + uiAbsPartIdx;
    12611352  m_pbResPredFlag      = pcCU->getResPredFlag ()          + uiAbsPartIdx;
     
    12881379  Int iSizeInUchar  = sizeof( UChar ) * uiNumPartition;
    12891380  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 
    12921385  Int sizeInChar  = sizeof( Char ) * uiNumPartition;
    12931386  memcpy( m_phQP       + uiOffset, pcCU->getQP(),             sizeInChar                        );
    1294 #else
    1295   memcpy( m_phQP       + uiOffset, pcCU->getQP(),             iSizeInUchar                        );
    1296 #endif
    12971387  memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(),  sizeof( *m_pePartSize ) * uiNumPartition );
    12981388  memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition );
     
    13061396#endif
    13071397  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
    13091402  memcpy( m_pbResPredAvailable  + uiOffset, pcCU->getResPredAvail(),      iSizeInBool  );
    13101403  memcpy( m_pbResPredFlag       + uiOffset, pcCU->getResPredFlag(),       iSizeInBool  );
     
    13751468#if HHI_DMM_PRED_TEX
    13761469  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
    13771473  memcpy( m_piWedgePredTexDeltaDC1   + uiOffset, pcCU->getWedgePredTexDeltaDC1(),   sizeof( Int  ) * uiNumPartition );
    13781474  memcpy( m_piWedgePredTexDeltaDC2   + uiOffset, pcCU->getWedgePredTexDeltaDC2(),   sizeof( Int  ) * uiNumPartition );
     
    14191515  Int iSizeInUchar  = sizeof( UChar ) * m_uiNumPartition;
    14201516  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 
    14231521  Int sizeInChar  = sizeof( Char ) * m_uiNumPartition;
    14241522  memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar  );
    1425 #else
    1426   memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, iSizeInUchar );
    1427 #endif
    14281523
    14291524  memcpy( rpcCU->getPartitionSize()  + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition );
     
    14401535#endif
    14411536  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
    14431541  memcpy( rpcCU->getResPredAvail()      + m_uiAbsIdxInLCU, m_pbResPredAvailable,  iSizeInBool  );
    14441542  memcpy( rpcCU->getResPredFlag()       + m_uiAbsIdxInLCU, m_pbResPredFlag,       iSizeInBool  );
     
    15011599#if HHI_DMM_PRED_TEX
    15021600  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
    15031604  memcpy( rpcCU->getWedgePredTexDeltaDC1()   + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC1,   sizeof( Int  ) * m_uiNumPartition );
    15041605  memcpy( rpcCU->getWedgePredTexDeltaDC2()   + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC2,   sizeof( Int  ) * m_uiNumPartition );
     
    15471648  Int iSizeInUchar  = sizeof( UChar  ) * uiQNumPart;
    15481649  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 
    15511654  Int sizeInChar  = sizeof( Char ) * uiQNumPart;
    15521655  memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar );
    1553 #else
    1554   memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, iSizeInUchar );
    1555 #endif 
    15561656  memcpy( rpcCU->getPartitionSize()  + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart );
    15571657#if HHI_INTERVIEW_SKIP
     
    15661666#endif
    15671667  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
    15691672  memcpy( rpcCU->getResPredAvail()      + uiPartOffset, m_pbResPredAvailable,  iSizeInBool  );
    15701673  memcpy( rpcCU->getResPredFlag()       + uiPartOffset, m_pbResPredFlag,       iSizeInBool  );
     
    16281731#if HHI_DMM_PRED_TEX
    16291732  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
    16301736  memcpy( rpcCU->getWedgePredTexDeltaDC1()   + uiPartOffset, m_piWedgePredTexDeltaDC1,   sizeof( Int  ) * uiQNumPart );
    16311737  memcpy( rpcCU->getWedgePredTexDeltaDC2()   + uiPartOffset, m_piWedgePredTexDeltaDC2,   sizeof( Int  ) * uiQNumPart );
     
    17041810       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    17051811      ||
    1706 #if !REMOVE_TILE_DEPENDENCE
    1707        (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 #else
    17091812       (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))  )  )
    1710 #endif
    17111813      )
    17121814  {
     
    17661868       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    17671869      ||
    1768 #if !REMOVE_TILE_DEPENDENCE
    1769        (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 #else
    17711870       (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
    1772 #endif
    17731871      )
    17741872  {
     
    18171915  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    18181916       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1819 #if !REMOVE_TILE_DEPENDENCE
    1820        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1821 #else
    18221917       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1823 #endif
    18241918       ))||
    18251919       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    18261920       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1827 #if !REMOVE_TILE_DEPENDENCE
    1828        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1829 #else
    18301921       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1831 #endif
    18321922       ))
    18331923     )
     
    18431933  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    18441934       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1845 #if !REMOVE_TILE_DEPENDENCE
    1846        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1847 #else
    18481935       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1849 #endif
    18501936       ))||
    18511937       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    18521938       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1853 #if !REMOVE_TILE_DEPENDENCE
    1854        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1855 #else
    18561939       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1857 #endif
    18581940       ))
    18591941     )
     
    18711953  if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    18721954       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1873 #if !REMOVE_TILE_DEPENDENCE
    1874        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1875 #else
    18761955       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1877 #endif
    18781956       ))||
    18791957       (bEnforceEntropySliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    18801958       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1881 #if !REMOVE_TILE_DEPENDENCE
    1882        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1883 #else
    18841959       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1885 #endif
    18861960       ))
    18871961     )
     
    19432017  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19442018       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1945 #if !REMOVE_TILE_DEPENDENCE
    1946        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1947 #else
    19482019       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1949 #endif
    19502020       ))||
    19512021       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19522022       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1953 #if !REMOVE_TILE_DEPENDENCE
    1954        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1955 #else
    19562023       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1957 #endif
    19582024       ))
    19592025     )
     
    19782044       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    19792045       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1980 #if !REMOVE_TILE_DEPENDENCE
    1981        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1982 #else
    19832046       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1984 #endif
    19852047       ))||
    19862048       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    19872049       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    19882050       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1989 #if !REMOVE_TILE_DEPENDENCE
    1990        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1991 #else
    19922051       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1993 #endif
    19942052       ))
    19952053     )
     
    20462104  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    20472105       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2048 #if !REMOVE_TILE_DEPENDENCE
    2049        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2050 #else
    20512106       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2052 #endif
    20532107       ))||
    20542108       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    20552109       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2056 #if !REMOVE_TILE_DEPENDENCE
    2057        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2058 #else
    20592110       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2060 #endif
    20612111       ))
    20622112     )
     
    21172167  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    21182168       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2119 #if !REMOVE_TILE_DEPENDENCE
    2120        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2121 #else
    21222169       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2123 #endif
    21242170       ))||
    21252171       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    21262172       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2127 #if !REMOVE_TILE_DEPENDENCE
    2128        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2129 #else
    21302173       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2131 #endif
    21322174       ))
    21332175     )
     
    21892231  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    21902232       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2191 #if !REMOVE_TILE_DEPENDENCE
    2192        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2193 #else
    21942233       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2195 #endif
    21962234       ))||
    21972235       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    21982236       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2199 #if !REMOVE_TILE_DEPENDENCE
    2200        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2201 #else
    22022237       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2203 #endif
    22042238       ))
    22052239     )
     
    22202254       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    22212255       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2222 #if !REMOVE_TILE_DEPENDENCE
    2223        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2224 #else
    22252256       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2226 #endif
    22272257       ))||
    22282258       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    22292259       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    22302260       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2231 #if !REMOVE_TILE_DEPENDENCE
    2232        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2233 #else
    22342261       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2235 #endif
    22362262       ))
    22372263     )
     
    22802306  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22812307       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiAbsZorderQpMinCUIdx)||
    2282 #if !REMOVE_TILE_DEPENDENCE
    2283        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2284 #else
    22852308       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2286 #endif
    22872309       ))||
    22882310       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22892311       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)||
    2290 #if !REMOVE_TILE_DEPENDENCE
    2291        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2292 #else
    22932312       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2294 #endif
    22952313       ))
    22962314     )
     
    22992317  }
    23002318
    2301 #if H0204_QP_PREDICTION
    23022319  if ( m_pcCULeft && m_pcCULeft->getAddr() != getAddr() )
    23032320  {
    23042321    return NULL;
    23052322  }
    2306 #endif
    23072323
    23082324  return m_pcCULeft;
    23092325}
    23102326
    2311 #if H0204_QP_PREDICTION
    23122327/** Get Above QpMinCu
    23132328*\param   aPartUnitIdx
     
    23472362  if ( (enforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23482363       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(absZorderQpMinCUIdx)||
    2349 #if !REMOVE_TILE_DEPENDENCE
    2350        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2351 #else
    23522364       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2353 #endif
    23542365       ))||
    23552366       (enforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23562367       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)||
    2357 #if !REMOVE_TILE_DEPENDENCE
    2358        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2359 #else
    23602368       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2361 #endif
    23622369       ))
    23632370     )
     
    23732380  return m_pcCUAbove;
    23742381}
    2375 #endif
    2376 
    2377 #if H0736_AVC_STYLE_QP_RANGE
     2382
    23782383/** Get reference QP from left QpMinCu or latest coded QP
    23792384*\param   uiCurrAbsIdxInLCU
     
    23812386*/
    23822387Char 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{
    23922389  UInt        lPartIdx, aPartIdx;
    23932390  lPartIdx = 0;
     
    23962393  TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    23972394  return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1);
    2398 #else
    2399   // Left CU
    2400   TComDataCU* pcCULeft;
    2401   UInt        uiLPartIdx;
    2402   pcCULeft = getQpMinCuLeft( uiLPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    2403   if ( pcCULeft )
    2404   {
    2405     return pcCULeft->getQP(uiLPartIdx);
    2406   }
    2407   // Last QP
    2408   return getLastCodedQP( uiCurrAbsIdxInLCU );
    2409 #endif
    24102395}
    24112396
     
    24222407}
    24232408
    2424 #if H0736_AVC_STYLE_QP_RANGE
    2425<