Changeset 724 in 3DVCSoftware for trunk


Ignore:
Timestamp:
30 Nov 2013, 12:29:49 (11 years ago)
Author:
tech
Message:

Merged HTM-8.2-dev0@723.

Location:
trunk
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • trunk/cfg/3D-HEVC/NonCTC/allintra/baseCfg_2view+depth_AllIntra.cfg

    r655 r724  
    145145VSO                       : 1                                      # use of view synthesis optimization for depth coding
    146146DMM                                : 1
    147 RBC                                : 1
    148147SDC                                : 1
    149148DLT                                : 1
  • trunk/cfg/3D-HEVC/NonCTC/allintra/baseCfg_3view+depth_AllIntra.cfg

    r655 r724  
    152152VSO                       : 1                                      # use of view synthesis optimization for depth coding
    153153DMM                                : 1
    154 RBC                                : 1
    155154SDC                                : 1
    156155DLT                                : 1
  • trunk/cfg/3D-HEVC/NonCTC/fco/baseCfg_3view+depth.cfg

    r655 r724  
    227227IvMvPred                            : 1                # Inter-view motion prediction
    228228AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
    229 IlluCompEnable                      : 1 1              # Enable Illumination compensation ( 0: off, 1: on )  (v/d)
     229IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on )  (v/d)
    230230ViewSynthesisPred                   : 1                # View synthesis prediction
    231231DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
     
    237237VSO                       : 1                                      # use of view synthesis optimization for depth coding
    238238DMM                                : 1
    239 RBC                                : 1
    240239SDC                                : 1
    241240DLT                                : 1
     
    243242PC                                 : 0
    244243InterSDC                           : 1                             # use of inter sdc
     244MPI                                : 1
    245245
    246246#========== view synthesis optimization (VSO) ==========
  • trunk/cfg/3D-HEVC/NonCTC/rc/baseCfg_3view+depth_rate_control.cfg

    r655 r724  
    239239IvMvPred                            : 1                # Inter-view motion prediction
    240240AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
    241 IlluCompEnable                      : 1 1              # Enable Illumination compensation ( 0: off, 1: on )  (v/d)
     241IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on )  (v/d)
    242242ViewSynthesisPred                   : 1                # View synthesis prediction
    243243DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
     
    249249VSO                       : 1                                      # use of view synthesis optimization for depth coding
    250250DMM                                : 1
    251 RBC                                : 1
    252251SDC                                : 1
    253252DLT                                : 1
     
    255254PC                                 : 1
    256255InterSDC                           : 1                             # use of inter sdc
     256MPI                                : 1
    257257
    258258#========== view synthesis optimization (VSO) ==========
  • trunk/cfg/3D-HEVC/baseCfg_2view+depth.cfg

    r622 r724  
    195195
    196196#========== multiview coding tools ==========
    197 IvMvPred                            : 1                # Inter-view motion prediction
     197IvMvPred                            : 1 1              # Inter-view motion prediction
    198198AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
    199 IlluCompEnable                      : 1 1              # Enable Illumination compensation ( 0: off, 1: on )   (v/d)
     199IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on )   (v/d)
    200200ViewSynthesisPred                   : 1                # View synthesis prediction
    201201DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
     
    205205VSO                       : 1                                      # use of view synthesis optimization for depth coding
    206206DMM                                : 1
    207 RBC                                : 1
    208207SDC                                : 1
    209208DLT                                : 1
     
    211210PC                                 : 1
    212211InterSDC                           : 1                             # use of inter sdc
     212MPI                                : 1
    213213
    214214#========== view synthesis optimization (VSO) ==========
  • trunk/cfg/3D-HEVC/baseCfg_2view.cfg

    r622 r724  
    170170IvMvPred                            : 1                # Inter-view motion prediction
    171171AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
    172 IlluCompEnable                      : 1 1              # Enable Illumination compensation ( 0: off, 1: on ) (v/d)
     172IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on ) (v/d)
    173173ViewSynthesisPred                   : 1                # View synthesis prediction
    174174DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
  • trunk/cfg/3D-HEVC/baseCfg_3view+depth.cfg

    r622 r724  
    225225
    226226#========== multiview coding tools ==========
    227 IvMvPred                            : 1                # Inter-view motion prediction
     227IvMvPred                            : 1 1              # Inter-view motion prediction
    228228AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
    229 IlluCompEnable                      : 1 1              # Enable Illumination compensation ( 0: off, 1: on )  (v/d)
     229IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on )  (v/d)
    230230ViewSynthesisPred                   : 1                # View synthesis prediction
    231231DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
    232232IvMvScaling                         : 1                # Interview motion vector scaling
    233 
     233SubPULog2Size                       : 3                            # Log2 of sub-PU size for IvMvPred (2...6)
    234234
    235235
     
    237237VSO                       : 1                                      # use of view synthesis optimization for depth coding
    238238DMM                                : 1
    239 RBC                                : 1
    240239SDC                                : 1
    241240DLT                                : 1
     
    243242PC                                 : 1
    244243InterSDC                           : 1                             # use of inter sdc
     244MPI                                : 1
    245245
    246246#========== view synthesis optimization (VSO) ==========
  • trunk/cfg/3D-HEVC/fullCfg.cfg

    r655 r724  
    4848LayerIdsInAddOutputLayerSet_0 : 2 3          # LayerIds of additional output layers
    4949LayerIdsInAddOutputLayerSet_1 : 4 5          # LayerIds of additional output layers
    50 ProfileLevelTierIdx           : 0 0 0 0 0 0 # Indices to profile level tier (TBD)
     50ProfileLevelTierIdx           : 0 0 0 0 0 0 0 0 # Indices to profile level tier (TBD)
    5151
    5252#======== VPS / Dependencies ================
     
    254254IvMvPred                            : 1                # Inter-view motion prediction
    255255AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
    256 IlluCompEnable                      : 1 1              # Enable Illumination compensation ( 0: off, 1: on ) (v/d)
     256IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on ) (v/d)
    257257ViewSynthesisPred                   : 1                # View synthesis prediction
    258258DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
    259259IvMvScaling                         : 1                # Interview motion vector scaling
     260SubPULog2Size                       : 3                            # Log2 of sub-PU size for IvMvPred (2...6)
    260261
    261262#========== depth coding tools ==========
    262263VSO                       : 1                          # use of view synthesis optimization for depth coding
    263264DMM                                : 1
    264 RBC                                : 1
    265265SDC                                : 1
    266266DLT                                : 1
     
    268268PC                                 : 1
    269269InterSDC                           : 1                             # use of inter sdc
     270MPI                                : 1
    270271
    271272#========== view synthesis optimization (VSO) ==========
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r655 r724  
    378378#if H_3D_DIM
    379379  ("DMM",                   m_useDMM,           true,  "Depth intra model modes")
     380#if !SEC_DMM3_RBC_F0147
    380381  ("RBC",                   m_useRBC,           true,  "Region boundary chain mode")
     382#endif
    381383  ("SDC",                   m_useSDC,           true,  "Simplified depth coding")
    382384  ("DLT",                   m_useDLT,           true,  "Depth lookup table")
     
    508510  ("AdvMultiviewResPred",      m_uiUseAdvResPred,           (UInt)1, "Usage of Advanced Residual Prediction" )
    509511#endif
     512#if MTK_SPIVMP_F0110
     513  ("SubPULog2Size", m_iSubPULog2Size, (Int)3, "Sub-PU size index: 2^n")
     514#endif
     515
    510516#if H_3D_IC
     517#if SEC_ONLY_TEXTURE_IC_F0151
     518  ("IlluCompEnable",           m_abUseIC, true, "Enable illumination compensation")
     519#else
    511520  ("IlluCompEnable",           m_abUseIC, std::vector<Bool>(2, true), "Enable illumination compensation")
     521#endif
    512522#endif
    513523#if H_3D_INTER_SDC
    514524  ("InterSDC",                 m_bDepthInterSDCFlag,        true, "Enable depth inter SDC")
     525#endif
     526#if SEC_MPI_ENABLING_MERGE_F0150
     527  ("MPI",                      m_bMPIFlag,        true, "Enable MPI")
    515528#endif
    516529  // Coding tools
     
    750763#endif
    751764#if H_3D_IV_MERGE
     765#if QC_DEPTH_IV_MRG_F0125 
     766  ("IvMvPred",                        m_ivMvPredFlag            , std::vector<Bool>(2, true)            , "inter view motion prediction " )
     767#else
    752768  ("IvMvPred",                        m_ivMvPredFlag,           true            , "inter view motion prediction " ) 
     769#endif
    753770#endif
    754771#if H_3D_NBDV_REF
     
    14731490#if H_3D_ARP
    14741491  xConfirmPara( ( 0 != m_uiUseAdvResPred ) &&  ( 1 != m_uiUseAdvResPred ), "UseAdvResPred must be 0 or 1." );
     1492#endif
     1493#if MTK_SPIVMP_F0110
     1494  xConfirmPara( m_iSubPULog2Size < 2,                                        "SubPULog2Size must be 2 or greater.");
     1495  xConfirmPara( m_iSubPULog2Size > 6,                                        "SubPULog2Size must be 6 or smaller.");
     1496  xConfirmPara( (1<<m_iSubPULog2Size) > m_uiMaxCUWidth,                      "SubPULog2Size must be log2(maxCUSize) or smaller.");
    14751497#endif
    14761498#if ADAPTIVE_QP_SELECTION
     
    24142436#endif
    24152437#if H_3D_IV_MERGE
     2438#if QC_DEPTH_IV_MRG_F0125
     2439  printf("IvMvPred:%d %d", m_ivMvPredFlag[0] ? 1 : 0, m_ivMvPredFlag[1] ? 1 : 0);
     2440#else
    24162441  printf("IvMvPred:%d ", m_ivMvPredFlag );
     2442#endif
     2443#if MTK_SPIVMP_F0110
     2444  printf(" SubPULog2Size:%d  " , m_iSubPULog2Size  );
     2445#endif
    24172446#endif
    24182447#if H_3D_ARP
     
    24202449#endif
    24212450#if H_3D_IC
     2451#if SEC_ONLY_TEXTURE_IC_F0151
     2452  printf( "IlluCompEnable: %d ", m_abUseIC);
     2453#else
    24222454  printf( "IlluCompEnable: %d %d ", m_abUseIC[0] ? 1 : 0, m_abUseIC[1] ? 1 : 0 );
     2455#endif
    24232456#endif
    24242457#if H_3D_NBDV_REF
     
    24332466#if H_3D_DIM
    24342467  printf("DMM:%d ", m_useDMM );
     2468#if !SEC_DMM3_RBC_F0147
    24352469  printf("RBC:%d ", m_useRBC );
     2470#endif
    24362471  printf("SDC:%d ", m_useSDC );
    24372472  printf("DLT:%d ", m_useDLT );
     
    24392474#if H_3D_INTER_SDC
    24402475  printf( "interSDC: %d ", m_bDepthInterSDCFlag ? 1 : 0 );
     2476#endif
     2477#if SEC_MPI_ENABLING_MERGE_F0150
     2478  printf( "MPI: %d ", m_bMPIFlag ? 1 : 0 );
    24412479#endif
    24422480  printf("\n\n"); 
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r655 r724  
    115115
    116116#if H_3D_IV_MERGE
     117#if QC_DEPTH_IV_MRG_F0125
     118  vector<Bool>           m_ivMvPredFlag;                      ///< Interview motion vector prediction
     119#else
    117120  Bool                   m_ivMvPredFlag;                      ///< Interview motion vector prediction
     121#endif
     122#if MTK_SPIVMP_F0110
     123  Int                    m_iSubPULog2Size;                   
     124#endif
    118125#endif
    119126#if H_3D_ARP                                                  /// < flag and number of weighting factors in ARP
     
    122129#endif
    123130#if H_3D_IC
     131#if SEC_ONLY_TEXTURE_IC_F0151
     132  Bool   m_abUseIC;
     133#else
    124134  vector<Bool> m_abUseIC;                                    ///< flag for using illumination compensation for inter-view prediction
     135#endif
    125136#endif
    126137#if H_3D_NBDV_REF
     
    461472#if H_3D_DIM
    462473  Bool      m_useDMM;                                        ///< flag for using DMM
     474#if !SEC_DMM3_RBC_F0147
    463475  Bool      m_useRBC;                                        ///< flag for using RBC
     476#endif
    464477  Bool      m_useSDC;                                        ///< flag for using SDC
    465478  Bool      m_useDLT;                                        ///< flag for using DLT
     
    471484#if H_3D_INTER_SDC
    472485  Bool m_bDepthInterSDCFlag;                                ///< flag for inter SDC of depth map coding
     486#endif
     487#if SEC_MPI_ENABLING_MERGE_F0150
     488  Bool m_bMPIFlag;                                           ///< flag for MPI of depth map coding
    473489#endif
    474490#endif
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r655 r724  
    149149    //====== Camera Parameters =========
    150150    m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
     151#if QC_DEPTH_IV_MRG_F0125
     152    m_cTEncTop.setCamParPrecision              ( m_cCameraData.getCamParsCodedPrecision  () );
     153    m_cTEncTop.setCamParInSliceHeader          ( m_cCameraData.getVaryingCameraParameters() );
     154    m_cTEncTop.setCodedScale                   ( m_cCameraData.getCodedScale             () );
     155    m_cTEncTop.setCodedOffset                  ( m_cCameraData.getCodedOffset            () );
     156#else
    151157    m_cTEncTop.setCamParPrecision              ( isDepth ? false : m_cCameraData.getCamParsCodedPrecision  () );
    152158    m_cTEncTop.setCamParInSliceHeader          ( isDepth ? 0     : m_cCameraData.getVaryingCameraParameters() );
    153159    m_cTEncTop.setCodedScale                   ( isDepth ? 0     : m_cCameraData.getCodedScale             () );
    154160    m_cTEncTop.setCodedOffset                  ( isDepth ? 0     : m_cCameraData.getCodedOffset            () );
     161#endif
    155162#if H_3D_VSO
    156163    //====== VSO =========
     
    176183    m_cTEncTop.setARPStepNum                   ( ( isDepth || 0==layerIdInVps ) ? 1 : H_3D_ARP_WFNR     );
    177184#endif
     185#if MTK_SPIVMP_F0110
     186    m_cTEncTop.setSubPULog2Size                 (( isDepth || 0==layerIdInVps ) ? 0 : m_iSubPULog2Size   );
     187#endif
    178188#if H_3D_IC
     189#if SEC_ONLY_TEXTURE_IC_F0151
     190    m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
     191#else
    179192    m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 ? false : m_abUseIC[isDepth ? 1 : 0] );
     193#endif
    180194#endif
    181195  //========== Depth intra modes ==========
    182196#if H_3D_DIM
    183197    m_cTEncTop.setUseDMM                       ( isDepth ? m_useDMM               : false );
     198#if !SEC_DMM3_RBC_F0147
    184199    m_cTEncTop.setUseRBC                       ( isDepth ? m_useRBC               : false );
     200#endif
    185201    m_cTEncTop.setUseSDC                       ( isDepth ? m_useSDC               : false );
    186202    m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT               : false );
     
    193209#if H_3D_INTER_SDC
    194210    m_cTEncTop.setInterSDCEnable               ( isDepth ? m_bDepthInterSDCFlag    : false );
     211#endif
     212#if SEC_MPI_ENABLING_MERGE_F0150
     213    m_cTEncTop.setUseMPI               ( isDepth ? m_bMPIFlag    : false );
    195214#endif
    196215#endif // H_3D
     
    16391658    vps.setARPStepNum      ( layer, ( isDepth || isLayerZero ) ? 1 : H_3D_ARP_WFNR     );
    16401659#endif 
     1660#if MTK_SPIVMP_F0110
     1661    if( isDepth )
     1662    {
     1663      vps.setSubPULog2Size         ( layer, (layer != 1) ? m_iSubPULog2Size: 0 );
     1664    }
     1665    else
     1666    {
     1667      vps.setSubPULog2Size         ( layer, (!isLayerZero) ? m_iSubPULog2Size: 0 );
     1668    }
     1669#endif
    16411670
    16421671#if H_3D_DIM
     1672#if SEC_DMM3_RBC_F0147
     1673    vps.setVpsDepthModesFlag( layer, isDepth && !isLayerZero && (m_useDMM || m_useSDC || m_useDLT ) );
     1674#else
    16431675    vps.setVpsDepthModesFlag( layer, isDepth && !isLayerZero && (m_useDMM || m_useRBC || m_useSDC || m_useDLT ) );
     1676#endif
    16441677#if H_3D_DIM_DLT
    16451678    vps.setUseDLTFlag( layer , isDepth && m_useDLT );
     
    16521685
    16531686#if H_3D_IV_MERGE
     1687#if QC_DEPTH_IV_MRG_F0125
     1688    if( isDepth )
     1689    {
     1690      vps.setIvMvPredFlag         ( layer, (layer != 1) && m_ivMvPredFlag[1] );
     1691    }
     1692    else
     1693    {
     1694      vps.setIvMvPredFlag         ( layer, !isLayerZero && m_ivMvPredFlag[0] );
     1695    }
     1696#else
    16541697    vps.setIvMvPredFlag         ( layer, !isLayerZero && !isDepth && m_ivMvPredFlag );
     1698#endif
    16551699#endif
    16561700#if H_3D_NBDV_REF
     
    16631707    vps.setInterSDCFlag( layer, !isLayerZero && isDepth && m_bDepthInterSDCFlag );
    16641708#endif
     1709#if SEC_MPI_ENABLING_MERGE_F0150
     1710    vps.setMPIFlag( layer, !isLayerZero && isDepth && m_bMPIFlag );
     1711#endif
    16651712  } 
    16661713#if H_3D
  • trunk/source/Lib/TLibCommon/ContextTables.h

    r655 r724  
    109109#define NUM_DEPTH_INTRA_MODE_CTX      8       ///< number of context models for depth intra modes
    110110#define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (DMM or RBC)
     111#if QC_DIM_DELTADC_UNIFY_F0132
     112#define NUM_DDC_DATA_CTX              1       ///< number of context models for deltaDC data (DMM or RBC)
     113#else
    111114#define NUM_DDC_DATA_CTX              2       ///< number of context models for deltaDC data (DMM or RBC)
     115#endif
    112116#if H_3D_DIM_DMM
    113117#define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
     118#if !SEC_DMM3_RBC_F0147
    114119#define NUM_DMM3_DATA_CTX             1       ///< number of context models for DMM3 data
     120#endif
    115121#endif
    116122#if H_3D_DIM_RBC
     
    371377INIT_ARPW[3][NUM_ARPW_CTX] =
    372378{
     379#if LGE_ARP_CTX_F0161
     380    { 162, 153, 154, 162 },
     381    { 162, 153, 154, 162 },
     382    { 162, 153, 154, 162 },
     383#else
    373384  { 154, 154, 154, 154 },
    374385  { 154, 154, 154, 154 },
    375386  { 154, 154, 154, 154 },
     387#endif
    376388};
    377389#endif
     
    381393INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 
    382394{
     395#if LGE_IC_CTX_F0160
     396    { 154,  154,  154, },
     397    { 154,  154,  154, },
     398    { 154,  154,  154, },
     399#else
    383400  { CNU,  CNU,  CNU, },
    384401  { 197,  185,  201, },
    385402  { 197,  185,  201, },
     403#endif
    386404};
    387405#endif
     
    405423INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] =
    406424{
     425#if QC_DIM_DELTADC_UNIFY_F0132
     426  { 154 },
     427  { 154 },
     428  { 154 },
     429#else
    407430  { CNU, CNU },
    408431  { CNU, CNU },
    409432  { CNU, CNU },
     433#endif
    410434};
    411435#if H_3D_DIM_DMM
     
    417441  { CNU },
    418442};
     443#if !SEC_DMM3_RBC_F0147
    419444static const UChar
    420445INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] =
     
    424449  { CNU },
    425450};
     451#endif
    426452#endif
    427453#if H_3D_DIM_RBC
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r655 r724  
    120120    m_dmmWedgeTabIdx[i] = NULL;
    121121  }
     122#if !SEC_DMM3_RBC_F0147
    122123  m_dmm3IntraTabIdx = NULL;
     124#endif
    123125#endif
    124126#if H_3D_DIM_RBC
     
    143145#if H_3D_VSP
    144146  m_piVSPFlag            = NULL;
     147#endif
     148#if MTK_SPIVMP_F0110
     149  m_pbSPIVMPFlag         = NULL;
    145150#endif
    146151#if H_3D_ARP
     
    194199#if H_3D_VSP
    195200    m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
     201#endif
     202#if MTK_SPIVMP_F0110
     203    m_pbSPIVMPFlag       = (Bool*  )xMalloc(Bool,   uiNumPartition);
    196204#endif
    197205    m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
     
    271279      m_dmmWedgeTabIdx[i]    = (UInt*)xMalloc(UInt, uiNumPartition);
    272280    }
     281#if !SEC_DMM3_RBC_F0147
    273282    m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition);
     283#endif
    274284#endif
    275285#if H_3D_DIM_RBC
     
    352362    if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
    353363#endif
     364#if MTK_SPIVMP_F0110
     365    if ( m_pbSPIVMPFlag       ) { xFree(m_pbSPIVMPFlag);           m_pbSPIVMPFlag         = NULL; }
     366#endif
    354367    if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
    355368    if ( m_puhChromaIntraDir  ) { xFree(m_puhChromaIntraDir);   m_puhChromaIntraDir = NULL; }
     
    404417      if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }
    405418    }
     419#if !SEC_DMM3_RBC_F0147
    406420    if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; }
     421#endif
    407422#endif
    408423#if H_3D_DIM_RBC
     
    555570#if H_3D_VSP
    556571    m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
     572#endif
     573#if MTK_SPIVMP_F0110
     574    m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui];
    557575#endif
    558576    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
     
    598616    memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
    599617#endif
     618#if MTK_SPIVMP_F0110
     619    memset( m_pbSPIVMPFlag      + firstElement, 0,                        numElements * sizeof( *m_pbSPIVMPFlag ) );
     620#endif
    600621    memset( m_puhLumaIntraDir   + firstElement, DC_IDX,                   numElements * sizeof( *m_puhLumaIntraDir ) );
    601622    memset( m_puhChromaIntraDir + firstElement, 0,                        numElements * sizeof( *m_puhChromaIntraDir ) );
     
    622643      memset( m_dmmWedgeTabIdx[i] + firstElement, 0,                      numElements * sizeof( *m_dmmWedgeTabIdx[i] ) );
    623644    }
     645#if !SEC_DMM3_RBC_F0147
    624646    memset( m_dmm3IntraTabIdx   + firstElement, 0,                        numElements * sizeof( *m_dmm3IntraTabIdx ) );
     647#endif
    625648#endif
    626649#if H_3D_DIM_RBC
     
    776799      m_piVSPFlag[ui] = 0;
    777800#endif
     801#if MTK_SPIVMP_F0110
     802      m_pbSPIVMPFlag[ui] = 0;
     803#endif
    778804      m_puhLumaIntraDir[ui] = DC_IDX;
    779805      m_puhChromaIntraDir[ui] = 0;
     
    799825        m_dmmWedgeTabIdx[i] [ui] = 0;
    800826      }
     827#if !SEC_DMM3_RBC_F0147
    801828      m_dmm3IntraTabIdx [ui] = 0;
     829#endif
    802830#endif
    803831#if H_3D_DIM_SDC
     
    873901#if H_3D_VSP
    874902  memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
     903#endif
     904#if MTK_SPIVMP_F0110
     905  memset( m_pbSPIVMPFlag,       0, sizeof( Bool  ) * m_uiNumPartition );
    875906#endif
    876907  memset( m_puhLumaIntraDir,    DC_IDX, iSizeInUchar );
     
    910941    memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );
    911942  }
     943#if !SEC_DMM3_RBC_F0147
    912944  memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition );
     945#endif
    913946#endif
    914947#if H_3D_DIM_RBC
     
    9681001      m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
    9691002#endif
     1003#if MTK_SPIVMP_F0110
     1004      m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];
     1005#endif
    9701006      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    9711007      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    9921028        m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui];
    9931029      }
     1030#if !SEC_DMM3_RBC_F0147
    9941031      m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui];
     1032#endif
    9951033#endif
    9961034#if H_3D_DIM_SDC
     
    11161154  m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
    11171155#endif
     1156#if MTK_SPIVMP_F0110
     1157  m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
     1158#endif
    11181159
    11191160#if H_3D_ARP
     
    11461187    m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;
    11471188  }
     1189#if !SEC_DMM3_RBC_F0147
    11481190  m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart;
     1191#endif
    11491192#endif
    11501193#if H_3D_DIM_RBC
     
    12691312  m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
    12701313  m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
     1314#endif
     1315#if MTK_SPIVMP_F0110
     1316  m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()               + uiAbsPartIdx;
    12711317#endif
    12721318
     
    13191365
    13201366#endif
     1367#if MTK_SPIVMP_F0110
     1368  memcpy( m_pbSPIVMPFlag        + uiOffset, pcCU->getSPIVMPFlag(),        sizeof( Bool ) * uiNumPartition );
     1369#endif
    13211370  memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
    13221371  memcpy( m_puhChromaIntraDir   + uiOffset, pcCU->getChromaIntraDir(),    iSizeInUchar );
     
    13421391    memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition );
    13431392  }
     1393#if !SEC_DMM3_RBC_F0147
    13441394  memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition );
     1395#endif
    13451396#endif
    13461397#if H_3D_DIM_RBC
     
    14461497  memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
    14471498#endif
     1499#if MTK_SPIVMP_F0110
     1500  memcpy( rpcCU->getSPIVMPFlag()        + m_uiAbsIdxInLCU, m_pbSPIVMPFlag,        sizeof( Bool ) * m_uiNumPartition );
     1501#endif
    14481502  memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
    14491503  memcpy( rpcCU->getChromaIntraDir()    + m_uiAbsIdxInLCU, m_puhChromaIntraDir,   iSizeInUchar );
     
    14691523    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );
    14701524  }
     1525#if !SEC_DMM3_RBC_F0147
    14711526  memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition );
     1527#endif
    14721528#endif
    14731529#if H_3D_DIM_RBC
     
    15591615#if H_3D_VSP
    15601616  memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
     1617#endif
     1618#if MTK_SPIVMP_F0110
     1619  memcpy( rpcCU->getSPIVMPFlag()        + uiPartOffset, m_pbSPIVMPFlag,        sizeof(Bool) * uiQNumPart );
    15611620#endif
    15621621  memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
     
    15821641    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart );
    15831642  }
     1643#if !SEC_DMM3_RBC_F0147
    15841644  memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart );
     1645#endif
    15851646#endif
    15861647#if H_3D_DIM_RBC
     
    23132374{
    23142375  UInt        uiCtx = 0;
     2376
     2377#if LGE_IC_CTX_F0160
     2378  TComDataCU* pcTempCU = NULL;
     2379  UInt        uiTempPartIdx = 0;
     2380
     2381  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     2382  uiCtx    = ( pcTempCU ) ? pcTempCU->isIC( uiTempPartIdx ) : 0;
     2383
     2384  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     2385  uiCtx    += ( pcTempCU ) ? pcTempCU->isIC( uiTempPartIdx ) : 0;
     2386#endif
    23152387
    23162388  return uiCtx;
     
    26722744  setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
    26732745}
     2746
     2747#if MTK_SPIVMP_F0110
     2748Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2749{
     2750  setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
     2751}
     2752#endif
    26742753
    26752754#if H_3D_VSP
     
    32663345 *   false: otherwise
    32673346 */
     3347#if ETRIKHU_MERGE_REUSE_F0093
     3348inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
     3349  Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
     3350#else
    32683351inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
    32693352                                     Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag )
     3353#endif
    32703354{
    32713355  if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() )
     
    32823366    return false;
    32833367  }
     3368
     3369#if ETRIKHU_MERGE_REUSE_F0093
     3370  rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
     3371#endif
    32843372 
    32853373  Bool  refViewAvailFlag = false;
     
    33663454
    33673455#if H_3D_IV_MERGE
     3456#if ETRIKHU_MERGE_REUSE_F0093
     3457inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv,
     3458  Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
     3459#else
    33683460inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv,
    33693461                                       Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag )
     3462#endif
    33703463{
    33713464  for(Int iLoop = 0; iLoop < 2; iLoop ++ )
     
    33853478        }
    33863479        clipMv( cMv );
     3480
     3481#if ETRIKHU_MERGE_REUSE_F0093
     3482        rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
     3483#endif
     3484
    33873485        abCandIsInter        [ iCount ] = true;
    33883486        puhInterDirNeighbours[ iCount ] = puhInterDirNeighbours[iFirDispCand];
     
    34043502    if(ivCandDir[iLoop + 2])
    34053503    {
     3504#if ETRIKHU_MERGE_REUSE_F0093
     3505      TComMvField tmpMV[2];
     3506      UChar tmpDir = ivCandDir[iLoop + 2];
     3507#else
    34063508      abCandIsInter        [ iCount ] = true;
    34073509      puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2];
     3510#endif
    34083511      if( ( ivCandDir[iLoop + 2] & 1 ) == 1 )
    34093512      {
     3513#if ETRIKHU_MERGE_REUSE_F0093
     3514        tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] );
     3515#else
    34103516        pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] );
     3517#endif
    34113518      }
    34123519      if( ( ivCandDir[iLoop + 2] & 2 ) == 2 )
    34133520      {
     3521#if ETRIKHU_MERGE_REUSE_F0093
     3522        tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
     3523#else
    34143524        pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
     3525#endif
    34153526      }
    34163527     
     
    34193530      if( !iLoop && ivCandDir[0] > 0)
    34203531      {
     3532#if ETRIKHU_MERGE_REUSE_F0093
     3533        if(tmpDir == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==tmpMV[0] && pcMvFieldNeighbours[1]==tmpMV[1])
     3534#else
    34213535        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0 ]== pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[1]==pcMvFieldNeighbours[(iCount<<1)+1])
     3536#endif
    34223537        {
    34233538            bRemove                         = true;
     3539#if !ETRIKHU_MERGE_REUSE_F0093
    34243540            abCandIsInter        [ iCount ] = false; 
    34253541            puhInterDirNeighbours[ iCount ] = 0;
     
    34273543            pcMvFieldNeighbours  [ iCount<<1   ].setMvField( cZeroMv, NOT_VALID );
    34283544            pcMvFieldNeighbours  [(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     3545#endif
    34293546        }
    34303547      }
    34313548      if(!bRemove)
    34323549      {
     3550
     3551#if ETRIKHU_MERGE_REUSE_F0093
     3552        rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
     3553
     3554        abCandIsInter[ iCount ] = true;
     3555        puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2];
     3556        if( ( ivCandDir[iLoop + 2] & 1 ) == 1 )
     3557        {
     3558          pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] );
     3559        }
     3560        if( ( ivCandDir[iLoop + 2] & 2 ) == 2 )
     3561        {
     3562          pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
     3563        }
     3564#endif
     3565
    34333566#if H_3D_NBDV
    34343567        if(iLoop) // For IvMcShift candidate
     
    34693602                                     
    34703603#endif
     3604
     3605
     3606
     3607
     3608
     3609
     3610
     3611
     3612
     3613#if ETRIKHU_MERGE_REUSE_F0093
     3614Void TComDataCU::rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV)
     3615{
     3616  iCount3DV++;
     3617  for (int i=num; i>0; i--)
     3618  {
     3619    pcMvFieldNeighbours[(start+i)<<1].setMvField(pcMvFieldNeighbours[(start+i-1)<<1].getMv(), pcMvFieldNeighbours[(start+i-1)<<1].getRefIdx());
     3620    pcMvFieldNeighbours[((start+i)<<1)+1].setMvField(pcMvFieldNeighbours[((start+i-1)<<1)+1].getMv(), pcMvFieldNeighbours[((start+i-1)<<1)+1].getRefIdx());
     3621    puhInterDirNeighbours[start+i] = puhInterDirNeighbours[start+i-1];
     3622    iVSPIndexTrue[start+i] = iVSPIndexTrue[start+i-1];
     3623    inheritedVSPDisInfo[start+i].m_acDvInfo   = inheritedVSPDisInfo[start+i-1].m_acDvInfo;
     3624  }
     3625  TComMv  cZeroMv;
     3626  pcMvFieldNeighbours[start<<1].setMvField( cZeroMv, NOT_VALID );
     3627  pcMvFieldNeighbours[(start<<1)+1].setMvField( cZeroMv, NOT_VALID );
     3628  puhInterDirNeighbours[start] = 0;
     3629  iVSPIndexTrue[start] = 0;
     3630  inheritedVSPDisInfo[start].m_acDvInfo = m_cDefaultDisInfo;
     3631
     3632  return;
     3633}
     3634
     3635/** Constructs a list of merging candidates
     3636 * \param uiAbsPartIdx
     3637 * \param uiPUIdx
     3638 * \param uiDepth
     3639 * \param pcMvFieldNeighbours
     3640 * \param puhInterDirNeighbours
     3641 * \param numValidMergeCand
     3642 */
     3643// HM 12.0 based merge candidate list construction
     3644
     3645Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     3646{
     3647
     3648  UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
     3649  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
     3650  TComMv cZeroMv;
     3651  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
     3652  {
     3653    abCandIsInter[ui] = false;
     3654    pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
     3655    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
     3656  }
     3657  numValidMergeCand = getSlice()->getMaxNumMergeCand();
     3658  // compute the location of the current PU
     3659  Int xP, yP, nPSW, nPSH;
     3660  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
     3661
     3662  Int iCount = 0;
     3663
     3664  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
     3665  PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
     3666  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
     3667  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     3668
     3669  //left
     3670  UInt uiLeftPartIdx = 0;
     3671  TComDataCU* pcCULeft = 0;
     3672  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
     3673  Bool isAvailableA1 = pcCULeft &&
     3674    pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
     3675    !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
     3676    !pcCULeft->isIntra( uiLeftPartIdx ) ;
     3677  if ( isAvailableA1 )
     3678  {
     3679    m_bAvailableFlagA1 = 1;
     3680    abCandIsInter[iCount] = true;
     3681    // get Inter Dir
     3682    puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
     3683    // get Mv from Left
     3684    pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3685    if ( getSlice()->isInterB() )
     3686    {
     3687      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3688    }
     3689
     3690    iCount ++;
     3691  }
     3692 
     3693  // early termination
     3694  if (iCount == getSlice()->getMaxNumMergeCand())
     3695  {
     3696    return;
     3697  }
     3698  // above
     3699  UInt uiAbovePartIdx = 0;
     3700  TComDataCU* pcCUAbove = 0;
     3701  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
     3702  Bool isAvailableB1 = pcCUAbove &&
     3703  pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
     3704  !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
     3705  !pcCUAbove->isIntra( uiAbovePartIdx );
     3706  if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
     3707  {
     3708    m_bAvailableFlagB1 = 1;
     3709    abCandIsInter[iCount] = true;
     3710    // get Inter Dir
     3711    puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
     3712    // get Mv from Left
     3713    pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3714    if ( getSlice()->isInterB() )
     3715    {
     3716      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3717    }
     3718    if ( mrgCandIdx == iCount )
     3719    {
     3720      return;
     3721    }
     3722    iCount ++;
     3723  }
     3724  // early termination
     3725  if (iCount == getSlice()->getMaxNumMergeCand())
     3726  {
     3727    return;
     3728  }
     3729
     3730  // above right
     3731  UInt uiAboveRightPartIdx = 0;
     3732  TComDataCU* pcCUAboveRight = 0;
     3733  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
     3734  Bool isAvailableB0 = pcCUAboveRight &&
     3735  pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
     3736  !pcCUAboveRight->isIntra( uiAboveRightPartIdx );
     3737  if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
     3738  {
     3739    m_bAvailableFlagB0 = 1;
     3740    abCandIsInter[iCount] = true;
     3741    // get Inter Dir
     3742    puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx );
     3743    // get Mv from Left
     3744    pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3745    if ( getSlice()->isInterB() )
     3746    {
     3747      pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3748    }
     3749    if ( mrgCandIdx == iCount )
     3750    {
     3751      return;
     3752    }
     3753    iCount ++;
     3754  }
     3755  // early termination
     3756  if (iCount == getSlice()->getMaxNumMergeCand())
     3757  {
     3758    return;
     3759  }
     3760
     3761  //left bottom
     3762  UInt uiLeftBottomPartIdx = 0;
     3763  TComDataCU* pcCULeftBottom = 0;
     3764  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
     3765  Bool isAvailableA0 = pcCULeftBottom &&
     3766  pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
     3767  !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ;
     3768  if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
     3769  {
     3770    m_bAvailableFlagA0 = 1;
     3771    abCandIsInter[iCount] = true;
     3772    // get Inter Dir
     3773    puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx );
     3774    // get Mv from Left
     3775    pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3776    if ( getSlice()->isInterB() )
     3777    {
     3778      pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3779    }
     3780    if ( mrgCandIdx == iCount )
     3781    {
     3782      return;
     3783    }
     3784    iCount ++;
     3785  }
     3786  // early termination
     3787  if (iCount == getSlice()->getMaxNumMergeCand())
     3788  {
     3789    return;
     3790  }
     3791  // above left
     3792  if( iCount < 4 )
     3793  {
     3794    UInt uiAboveLeftPartIdx = 0;
     3795    TComDataCU* pcCUAboveLeft = 0;
     3796    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
     3797    Bool isAvailableB2 = pcCUAboveLeft &&
     3798    pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
     3799    !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx );
     3800    if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
     3801        && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
     3802    {
     3803      m_bAvailableFlagB2 = 1;
     3804      abCandIsInter[iCount] = true;
     3805      // get Inter Dir
     3806      puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx );
     3807      // get Mv from Left
     3808      pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3809      if ( getSlice()->isInterB() )
     3810      {
     3811        pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3812      }
     3813      if ( mrgCandIdx == iCount )
     3814      {
     3815        return;
     3816      }
     3817      iCount ++;
     3818    }
     3819  }
     3820  // early termination
     3821  if (iCount == getSlice()->getMaxNumMergeCand())
     3822  {
     3823    return;
     3824  }
     3825  if ( getSlice()->getEnableTMVPFlag())
     3826  {
     3827    //>> MTK colocated-RightBottom
     3828    UInt uiPartIdxRB;
     3829
     3830    deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 
     3831
     3832    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     3833    UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     3834
     3835    TComMv cColMv;
     3836    Int iRefIdx;
     3837    Int uiLCUIdx = -1;
     3838
     3839    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
     3840    {
     3841    }
     3842    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     3843    {
     3844    }
     3845    else
     3846    {
     3847      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     3848        ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     3849      {
     3850        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     3851        uiLCUIdx = getAddr();
     3852      }
     3853      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     3854      {
     3855        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     3856      }
     3857      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     3858      {
     3859        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     3860        uiLCUIdx = getAddr() + 1;
     3861      }
     3862      else //is the right bottom corner of LCU                       
     3863      {
     3864        uiAbsPartAddr = 0;
     3865      }
     3866    }
     3867
     3868    iRefIdx = 0;
     3869    Bool bExistMV = false;
     3870    UInt uiPartIdxCenter;
     3871    UInt uiCurLCUIdx = getAddr();
     3872    Int dir = 0;
     3873    UInt uiArrayAddr = iCount;
     3874    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
     3875    bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
     3876    if( bExistMV == false )
     3877    {
     3878      bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     3879    }
     3880    if( bExistMV )
     3881    {
     3882      dir |= 1;
     3883      pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx );
     3884    }
     3885
     3886    if ( getSlice()->isInterB() )
     3887    {
     3888#if H_3D_TMVP
     3889      iRefIdx = 0;
     3890#endif
     3891      bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
     3892      if( bExistMV == false )
     3893      {
     3894        bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     3895      }
     3896      if( bExistMV )
     3897      {
     3898        dir |= 2;
     3899        pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx );
     3900      }
     3901    }
     3902
     3903    if (dir != 0)
     3904    {
     3905      puhInterDirNeighbours[uiArrayAddr] = dir;
     3906      abCandIsInter[uiArrayAddr] = true;
     3907#if H_3D_NBDV
     3908      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     3909      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     3910#endif
     3911      if ( mrgCandIdx == iCount )
     3912      {
     3913        return;
     3914      }
     3915      iCount++;
     3916    }
     3917  }
     3918  // early termination
     3919  if (iCount == getSlice()->getMaxNumMergeCand())
     3920  {
     3921    return;
     3922  }
     3923  UInt uiArrayAddr = iCount;
     3924  UInt uiCutoff = uiArrayAddr;
     3925 
     3926  if ( getSlice()->isInterB() && iCount<5)  // JCT3V-F0129 by Qualcomm
     3927  {
     3928    UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
     3929    UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
     3930
     3931    for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
     3932    {
     3933      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
     3934      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
     3935      {
     3936        abCandIsInter[uiArrayAddr] = true;
     3937        puhInterDirNeighbours[uiArrayAddr] = 3;
     3938
     3939        // get Mv from cand[i] and cand[j]
     3940        pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
     3941        pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx());
     3942
     3943        Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() );
     3944        Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() );
     3945        if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv())
     3946        {
     3947          abCandIsInter[uiArrayAddr] = false;
     3948        }
     3949        else
     3950        {
     3951          uiArrayAddr++;
     3952        }
     3953      }
     3954    }
     3955  }
     3956  // early termination
     3957  if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
     3958  {
     3959    return;
     3960  }
     3961 
     3962  Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
     3963  Int r = 0;
     3964  Int refcnt = 0;
     3965  while (uiArrayAddr < getSlice()->getMaxNumMergeCand())
     3966  {
     3967    abCandIsInter[uiArrayAddr] = true;
     3968    puhInterDirNeighbours[uiArrayAddr] = 1;
     3969    pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r);
     3970
     3971    if ( getSlice()->isInterB() )
     3972    {
     3973      puhInterDirNeighbours[uiArrayAddr] = 3;
     3974      pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r);
     3975    }
     3976    uiArrayAddr++;
     3977    if ( refcnt == iNumRefIdx - 1 )
     3978    {
     3979      r = 0;
     3980    }
     3981    else
     3982    {
     3983      ++r;
     3984      ++refcnt;
     3985    }
     3986  }
     3987 
     3988  numValidMergeCand = uiArrayAddr;
     3989}
     3990
     3991
     3992
     3993/** Constructs a list of merging candidates
     3994 * \param uiAbsPartIdx
     3995 * \param uiPUIdx
     3996 * \param uiDepth
     3997 * \param pcMvFieldNeighbours
     3998 * \param puhInterDirNeighbours
     3999 * \param numValidMergeCand
     4000 */
     4001#if ETRIKHU_MERGE_REUSE_F0093
     4002Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
     4003#else
     4004Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
     4005#endif
     4006#if H_3D_VSP
     4007      , Int* vspFlag
     4008      , InheritedVSPDisInfo*  inheritedVSPDisInfo
     4009#endif
     4010#if MTK_SPIVMP_F0110
     4011      , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     4012#endif
     4013      , Int& numValidMergeCand, Int mrgCandIdx
     4014)
     4015{
     4016  UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
     4017#if H_3D_IV_MERGE
     4018  ////////////////////////////
     4019  //////// INIT LISTS ////////
     4020  ////////////////////////////
     4021  TComMv cZeroMv;
     4022  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
     4023#else
     4024  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
     4025#endif
     4026#if ETRIKHU_MERGE_REUSE_F0093
     4027  TComMvField tmpMV[2];
     4028  UChar tmpDir;
     4029
     4030  //////////////////////////////////
     4031  //////// GET DISPARITIES  ////////
     4032  //////////////////////////////////
     4033  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
     4034  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
     4035  {
     4036    inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;   // To prevent run-time error, this code must be executed always for merging process.
     4037  }
     4038  m_cDefaultDisInfo = cDisInfo;
     4039
     4040  if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))  // current slice is not both dependent view or depth
     4041  {
     4042    return;
     4043  }
     4044#else
     4045  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
     4046  {
     4047    abCandIsInter[ui] = false;
     4048#if H_3D_IV_MERGE
     4049    pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
     4050    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
     4051#else
     4052    pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
     4053    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
     4054#endif
     4055  }
     4056#endif
     4057
     4058  numValidMergeCand = getSlice()->getMaxNumMergeCand();
     4059#if H_3D
     4060  //////////////////////////////////
     4061  //////// DERIVE LOCATIONS ////////
     4062  //////////////////////////////////
     4063#endif
     4064  // compute the location of the current PU
     4065  Int xP, yP, nPSW, nPSH;
     4066  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
     4067
     4068  Int iCount = 0;
     4069
     4070  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
     4071#if !ETRIKHU_MERGE_REUSE_F0093
     4072  PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
     4073#endif
     4074  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
     4075  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     4076#if SEC_MPI_ENABLING_MERGE_F0150
     4077  Bool bMPIFlag   = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() );
     4078#endif
     4079#if QC_DEPTH_IV_MRG_F0125
     4080  Bool bIsDepth = getSlice()->getIsDepth();
     4081#if !BUGFIX_F0093
     4082  Bool bDepthIPMCAvai = false;
     4083#endif
     4084#endif
     4085
     4086#if LGE_SHARP_VSP_INHERIT_F0104
     4087#if H_3D_IC
     4088  Bool bICFlag = getICFlag(uiAbsPartIdx);
     4089#endif
     4090#if H_3D_ARP
     4091  Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
     4092#endif
     4093#endif
     4094
     4095#if ETRIKHU_MERGE_REUSE_F0093
     4096  Int  iPosLeftAbove[2] = {-1, -1};
     4097
     4098  Int iCountHEVC = 0;
     4099  Int iCount3DV = 0;
     4100  Int numA1B1B0 = 0;
     4101  Int numA0B2 = 0;
     4102
     4103#if H_3D_NBDV
     4104  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 
     4105  {
     4106    pcMvFieldNeighbours[i<<1    ].getMv().setIDVFlag (false);
     4107    pcMvFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false);
     4108  }
     4109#endif
     4110
     4111  //left
     4112  UInt uiLeftPartIdx = 0;
     4113  TComDataCU* pcCULeft = 0;
     4114  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 
     4115  if (getAvailableFlagA1())
     4116  {
     4117    iPosLeftAbove[0] = numA1B1B0;
     4118#if H_3D_VSP
     4119    if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
     4120#if LGE_SHARP_VSP_INHERIT_F0104
     4121#if H_3D_IC
     4122      && !bICFlag
     4123#endif
     4124#if H_3D_ARP
     4125      && !bARPFlag
     4126#endif
     4127#endif
     4128      )
     4129    {
     4130      vspFlag[numA1B1B0] = 1;
     4131#if !MTK_VSP_SIMPLIFICATION_F0111
     4132      xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
     4133#endif
     4134    }
     4135#endif
     4136    numA1B1B0++;
     4137  }
     4138
     4139  // above
     4140  UInt uiAbovePartIdx = 0;
     4141  TComDataCU* pcCUAbove = 0;
     4142  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
     4143  if ( getAvailableFlagB1())
     4144  {
     4145    iPosLeftAbove[1] = numA1B1B0;
     4146#if H_3D_VSP
     4147#if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
     4148    if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
     4149#else
     4150    if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
     4151#endif
     4152#if LGE_SHARP_VSP_INHERIT_F0104
     4153#if H_3D_IC
     4154      && !bICFlag
     4155#endif
     4156#if H_3D_ARP
     4157      && !bARPFlag
     4158#endif
     4159#endif
     4160      )
     4161    {
     4162      vspFlag[numA1B1B0] = 1;
     4163#if !MTK_VSP_SIMPLIFICATION_F0111
     4164      xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
     4165#endif
     4166    }
     4167#endif
     4168
     4169    numA1B1B0++;
     4170  }
     4171
     4172  // above right
     4173  UInt uiAboveRightPartIdx = 0;
     4174  TComDataCU* pcCUAboveRight = 0;
     4175  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
     4176  if ( getAvailableFlagB0())
     4177  {
     4178#if H_3D_VSP
     4179#if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
     4180    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
     4181#else
     4182    if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
     4183#endif
     4184#if LGE_SHARP_VSP_INHERIT_F0104
     4185#if H_3D_IC
     4186      && !bICFlag
     4187#endif
     4188#if H_3D_ARP
     4189      && !bARPFlag
     4190#endif
     4191#endif
     4192      )
     4193    {
     4194      vspFlag[numA1B1B0] = 1;
     4195#if !MTK_VSP_SIMPLIFICATION_F0111
     4196      xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
     4197#endif
     4198    }
     4199#endif
     4200    numA1B1B0++;
     4201  }
     4202 
     4203  // left bottom
     4204  UInt uiLeftBottomPartIdx = 0;
     4205  TComDataCU* pcCULeftBottom = getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
     4206  if ( getAvailableFlagA0())
     4207  {
     4208#if H_3D_VSP
     4209    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
     4210#if LGE_SHARP_VSP_INHERIT_F0104
     4211#if H_3D_IC
     4212      && !bICFlag
     4213#endif
     4214#if H_3D_ARP
     4215      && !bARPFlag
     4216#endif
     4217#endif
     4218      )
     4219    {
     4220      vspFlag[numA1B1B0] = 1;
     4221#if !MTK_VSP_SIMPLIFICATION_F0111
     4222      xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
     4223#endif
     4224    }
     4225#endif
     4226    iCountHEVC++;
     4227    numA0B2++;
     4228  }
     4229 
     4230  // above left
     4231  UInt uiAboveLeftPartIdx = 0;
     4232  TComDataCU* pcCUAboveLeft = 0;
     4233  pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
     4234  if (getAvailableFlagB2())
     4235  {
     4236#if H_3D_VSP
     4237#if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
     4238    if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
     4239#else
     4240    if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
     4241#endif
     4242#if LGE_SHARP_VSP_INHERIT_F0104
     4243#if H_3D_IC
     4244      && !bICFlag
     4245#endif
     4246#if H_3D_ARP
     4247      && !bARPFlag
     4248#endif
     4249#endif
     4250      )
     4251    {
     4252      vspFlag[numA1B1B0+iCountHEVC] = 1;
     4253#if !MTK_VSP_SIMPLIFICATION_F0111
     4254      xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
     4255#endif
     4256    }
     4257#endif
     4258    iCountHEVC++;
     4259    numA0B2++;
     4260  }
     4261
     4262  iCountHEVC = numValidMergeCand;
     4263#endif
     4264
     4265
     4266#if H_3D_IV_MERGE
     4267 
     4268  /////////////////////////////////////////////
     4269  //////// TEXTURE MERGE CANDIDATE (T) ////////
     4270  /////////////////////////////////////////////
     4271 
     4272#if SEC_MPI_ENABLING_MERGE_F0150
     4273  if( bMPIFlag)
     4274#else
     4275  if( m_pcSlice->getIsDepth())
     4276#endif
     4277  {
     4278    UInt uiPartIdxCenter;
     4279    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );   
     4280
     4281#if ETRIKHU_MERGE_REUSE_F0093
     4282    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     4283    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     4284    Int tRef[2]={-1, -1};
     4285#endif
     4286
     4287#if H_3D_FCO
     4288    TComPic * pcTexturePic = m_pcSlice->getTexturePic();
     4289    TComDataCU *pcTextureCU = 0;
     4290    if ( pcTexturePic )
     4291        pcTextureCU = pcTexturePic->getCU( getAddr() );
     4292#else
     4293    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     4294#endif
     4295 
     4296#if H_3D_FCO
     4297    if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     4298#else
     4299    if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     4300#endif
     4301    {
     4302#if ETRIKHU_MERGE_REUSE_F0093
     4303      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, tmpMV[0] );
     4304      tRef[0] = getPic()->isTextRefValid( REF_PIC_LIST_0, tmpMV[0].getRefIdx() );
     4305      if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) )
     4306      {
     4307        TComMv cMvPred = tmpMV[0].getMv();
     4308        const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     4309        cMvPred+=cAdd;
     4310        cMvPred>>=2;
     4311        clipMv(cMvPred);
     4312        tmpMV[0].setMvField(cMvPred,tRef[0]);
     4313      }
     4314      if ( getSlice()->isInterB() )
     4315      {
     4316        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, tmpMV[1] );
     4317        tRef[1] = getPic()->isTextRefValid( REF_PIC_LIST_1, tmpMV[1].getRefIdx() );
     4318        if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) )
     4319        {
     4320          TComMv cMvPred = tmpMV[1].getMv();
     4321          const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     4322          cMvPred+=cAdd;
     4323          cMvPred>>=2;
     4324          clipMv(cMvPred);
     4325          tmpMV[1].setMvField(cMvPred,tRef[1]);
     4326        }
     4327      }
     4328
     4329      tmpDir = 0;
     4330      if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) )
     4331      {
     4332        tmpDir += ((tmpMV[0].getRefIdx()>=0)?1:0);
     4333      }
     4334      if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) )
     4335      {
     4336        tmpDir += ((tmpMV[1].getRefIdx()>=0)?2:0);
     4337      }
     4338
     4339      if( tmpDir != 0 )
     4340      {
     4341        Int iCnloop = 0;
     4342        Bool bRemoveSpa = false; //pruning
     4343
     4344        for(Int i = 0; i < 2; i ++)
     4345        {
     4346          iCnloop = iPosLeftAbove[i];
     4347          if ( iCnloop == -1 )
     4348          {
     4349            continue;
     4350          }
     4351          if(tmpDir == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1])
     4352          {
     4353            bRemoveSpa                      = true;
     4354            break;
     4355          }     
     4356        }
     4357
     4358        if (!bRemoveSpa)
     4359        {
     4360          rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV);
     4361        }
     4362        else
     4363        {
     4364          rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV);
     4365          if (iCnloop<numA1B1B0)
     4366          {
     4367            numA1B1B0--;
     4368          }
     4369          iCountHEVC--;
     4370
     4371          if (iPosLeftAbove[0] != -1)
     4372          {
     4373            if (iCnloop == iPosLeftAbove[0])
     4374            {
     4375              iPosLeftAbove[0] = -1;
     4376            }
     4377            else
     4378            {
     4379              iPosLeftAbove[0]++;
     4380            }
     4381          }
     4382          if (iPosLeftAbove[1] != -1)
     4383          {
     4384            if (iCnloop == iPosLeftAbove[1])
     4385            {
     4386              iPosLeftAbove[1] = -1;
     4387            }
     4388            else
     4389            {
     4390              if (iCnloop > iPosLeftAbove[1])
     4391              {
     4392                iPosLeftAbove[1]++;
     4393              }
     4394            }
     4395          }
     4396        }
     4397
     4398        if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) )
     4399        {
     4400          pcMvFieldNeighbours[iCount<<1].setMvField(tmpMV[0].getMv(), tRef[0]);
     4401        }
     4402        if ( getSlice()->isInterB())
     4403        {
     4404          if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) )
     4405          {
     4406            pcMvFieldNeighbours[(iCount<<1)+1].setMvField(tmpMV[1].getMv(), tRef[1]);
     4407          }
     4408        }
     4409        puhInterDirNeighbours[iCount] = tmpDir;
     4410
     4411        if ( mrgCandIdx == iCount )
     4412        {
     4413          return;
     4414        }
     4415        iCount ++;
     4416
     4417#else
     4418      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     4419      Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() );
     4420      if( (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0) && ( iValidDepRef >= 0 ) )
     4421      {
     4422        TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
     4423        const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     4424        cMvPred+=cAdd;
     4425        cMvPred>>=2;
     4426        clipMv(cMvPred);
     4427        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,iValidDepRef);
     4428      }
     4429      if ( getSlice()->isInterB() )
     4430      {
     4431        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     4432        iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx() );
     4433        if( (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0) && ( iValidDepRef >= 0) )
     4434        {
     4435          TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
     4436          const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     4437          cMvPred+=cAdd;
     4438          cMvPred>>=2;
     4439          clipMv(cMvPred);
     4440          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,iValidDepRef);
     4441        }
     4442      }
     4443      puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0;
     4444      puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0;
     4445      if( puhInterDirNeighbours[iCount] != 0 )
     4446      {
     4447        abCandIsInter[iCount] = true;
     4448        if ( mrgCandIdx == iCount )
     4449        {
     4450          return;
     4451        }
     4452        iCount ++;
     4453      }
     4454#endif
     4455      }
     4456    }
     4457  }
     4458
     4459
     4460#if !ETRIKHU_MERGE_REUSE_F0093
     4461  //////////////////////////////////
     4462  //////// GET DISPARITIES  ////////
     4463  //////////////////////////////////
     4464
     4465  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
     4466  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
     4467  {
     4468    inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;
     4469  }
     4470#endif
     4471
     4472  /////////////////////////////////////////////////////////////////
     4473  //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
     4474  /////////////////////////////////////////////////////////////////
     4475
     4476  Int  posIvDC          = -1;
     4477#if !ETRIKHU_MERGE_REUSE_F0093
     4478  Bool bLeftAvai        = false;
     4479  Int  iPosLeftAbove[2] = {-1, -1};
     4480#endif
     4481
     4482  // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; 
     4483  // An enumerator would be appropriate here!
     4484  TComMv ivCandMv    [8];
     4485  Int    ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
     4486
     4487  // { IvMC, IvDC, IvMCShift, IvDCShift }; 
     4488  Int    ivCandDir   [4] = {0, 0, 0, 0};
     4489
     4490  Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
     4491 
     4492  if ( ivMvPredFlag )
     4493  {
     4494    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir
     4495#if QC_DEPTH_IV_MRG_F0125
     4496    , bIsDepth
     4497#endif
     4498#if MTK_SPIVMP_F0110
     4499    , pcMvFieldSP, puhInterDirSP
     4500#endif
     4501    );
     4502  } 
     4503 
     4504  ///////////////////////////////////////////////
     4505  //////// INTER VIEW MOTION COMP(IvMC) /////////
     4506  ///////////////////////////////////////////////
     4507
     4508  if( ivCandDir[0] )
     4509  {
     4510#if ETRIKHU_MERGE_REUSE_F0093
     4511    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     4512    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     4513
     4514    if( ( ivCandDir[0] & 1 ) == 1 )
     4515    {
     4516      tmpMV[0].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
     4517    }
     4518    if( ( ivCandDir[0] & 2 ) == 2 )
     4519    {
     4520      tmpMV[1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
     4521    }
     4522
     4523    Bool bRemoveSpa = false; //pruning
     4524    Bool bIvMC = false;
     4525    Int iCnloop=0;
     4526
     4527#if BUGFIX_F0093
     4528    if (!bIsDepth)
     4529    {
     4530#endif
     4531      for(Int i = 0; i < 2; i ++)
     4532      {
     4533        iCnloop = iPosLeftAbove[i];
     4534        if ( iCnloop == -1 )
     4535        {
     4536          continue;
     4537        }
     4538        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1])
     4539        {
     4540          bRemoveSpa                      = true;
     4541          break;
     4542        }     
     4543      }
     4544#if BUGFIX_F0093
     4545    }
     4546#endif
     4547#if QC_DEPTH_IV_MRG_F0125
     4548#if BUGFIX_F0093
     4549    if (bIsDepth)
     4550#else
     4551    if ( bIsDepth && !bRemoveSpa)
     4552#endif
     4553    {
     4554      iCnloop = iCount-1;
     4555      for(; iCnloop >= 0; iCnloop --)
     4556      {
     4557#if BUGFIX_F0093
     4558        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1])  // F0125 compatible with F0093
     4559#else
     4560        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     4561#endif
     4562        {
     4563          bRemoveSpa                      = true;
     4564          break;
     4565        }
     4566      }
     4567#if !BUGFIX_F0093
     4568      if(!bRemoveSpa)
     4569      {
     4570        bDepthIPMCAvai = true;
     4571      }
     4572#endif
     4573    }
     4574#endif
     4575
     4576    if (!bRemoveSpa)
     4577    {
     4578      bIvMC = true;
     4579      rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
     4580
     4581      if (iPosLeftAbove[0] != -1)
     4582      {
     4583        iPosLeftAbove[0]++;
     4584      }
     4585      if (iPosLeftAbove[1] != -1)
     4586      {
     4587        iPosLeftAbove[1]++;
     4588      }
     4589    }
     4590    else if (bRemoveSpa && !bIsDepth)
     4591    {
     4592      bIvMC = true;
     4593      rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV);
     4594
     4595      if (iCnloop<numA1B1B0)
     4596      {
     4597        numA1B1B0--;
     4598      }
     4599      iCountHEVC--;
     4600
     4601      if (iPosLeftAbove[0] != -1)
     4602      {
     4603        if (iCnloop == iPosLeftAbove[0])
     4604        {
     4605          iPosLeftAbove[0] = -1;
     4606        }
     4607        else
     4608        {
     4609          iPosLeftAbove[0]++;
     4610        }
     4611      }
     4612      if (iPosLeftAbove[1] != -1)
     4613      {
     4614        if (iCnloop == iPosLeftAbove[1])
     4615        {
     4616          iPosLeftAbove[1] = -1;
     4617        }
     4618        else
     4619        {
     4620          if (iCnloop > iPosLeftAbove[1])
     4621          {
     4622            iPosLeftAbove[1]++;
     4623          }
     4624        }
     4625      }
     4626    }
     4627
     4628    if (bIvMC)
     4629    {
     4630#if MTK_SPIVMP_F0110
     4631      pbSPIVMPFlag[iCount] = true;
     4632#endif
     4633      if( ( ivCandDir[0] & 1 ) == 1 )
     4634      {
     4635        pcMvFieldNeighbours[iCount<<1].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
     4636      }
     4637      if( ( ivCandDir[0] & 2 ) == 2 )
     4638      {
     4639        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
     4640      }
     4641
     4642      puhInterDirNeighbours[ iCount ] = ivCandDir[0];
     4643
     4644#if !BUGFIX_F0093
     4645#if QC_DEPTH_IV_MRG_F0125
     4646      if ( bDepthIPMCAvai || !bIsDepth )
     4647      {
     4648#endif
     4649#endif
     4650        if ( mrgCandIdx == iCount )
     4651        {
     4652          return;
     4653        }
     4654        iCount ++;
     4655#if !BUGFIX_F0093
     4656#if QC_DEPTH_IV_MRG_F0125
     4657      }
     4658#endif
     4659#endif
     4660    }
     4661#else
     4662    abCandIsInter        [ iCount ] = true;
     4663    puhInterDirNeighbours[ iCount ] = ivCandDir[0];   
     4664
     4665    if( ( ivCandDir[0] & 1 ) == 1 )
     4666    {
     4667      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
     4668    }
     4669    if( ( ivCandDir[0] & 2 ) == 2 )
     4670    {
     4671      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
     4672    }
     4673#if QC_DEPTH_IV_MRG_F0125
     4674    if ( bIsDepth )
     4675    {
     4676      Bool bRemoveSpa = false;
     4677      Int iCnloop = iCount-1;
     4678      for(; iCnloop >= 0; iCnloop --)
     4679      {
     4680        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     4681        {
     4682          bRemoveSpa                      = true;
     4683          abCandIsInter        [ iCount ] = false;
     4684
     4685          puhInterDirNeighbours[iCount]   = 0;
     4686          pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     4687          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     4688          break;
     4689        }
     4690      }
     4691      if(!bRemoveSpa)
     4692      {
     4693        bDepthIPMCAvai = true;
     4694      }
     4695    }
     4696    if ( bDepthIPMCAvai || !bIsDepth )
     4697    {
     4698#endif
     4699      if ( mrgCandIdx == iCount )
     4700      {
     4701        return;
     4702      }
     4703      iCount ++;
     4704#if QC_DEPTH_IV_MRG_F0125
     4705    }
     4706#endif
     4707
     4708#endif
     4709
     4710  }
     4711
     4712  // early termination
     4713  if (iCount == getSlice()->getMaxNumMergeCand())
     4714  {
     4715    return;
     4716  }
     4717#endif
     4718
     4719
     4720
     4721
     4722
     4723#if ETRIKHU_MERGE_REUSE_F0093
     4724  iCount += numA1B1B0;
     4725#else
     4726#if H_3D
     4727  ////////////////////////////
     4728  //////// LEFT (A1) /////////
     4729  ////////////////////////////
     4730#endif
     4731  //left
     4732  UInt uiLeftPartIdx = 0;
     4733  TComDataCU* pcCULeft = 0;
     4734  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
     4735  Bool isAvailableA1 = pcCULeft &&
     4736    pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
     4737    !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
     4738    !pcCULeft->isIntra( uiLeftPartIdx ) ;
     4739  if ( isAvailableA1 )
     4740  {
     4741    abCandIsInter[iCount] = true;
     4742    // get Inter Dir
     4743    puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
     4744    // get Mv from Left
     4745    pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     4746    if ( getSlice()->isInterB() )
     4747    {
     4748      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     4749    }
     4750#if H_3D_IV_MERGE
     4751    Bool bRemoveSpa = false; //pruning to inter-view candidates
     4752#if QC_DEPTH_IV_MRG_F0125
     4753    Int  iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1);
     4754#else
     4755    Int  iCnloop    = iCount - 1;
     4756#endif
     4757    for(; iCnloop >= 0; iCnloop --)
     4758    {
     4759      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     4760      {
     4761        bRemoveSpa                      = true;
     4762        abCandIsInter        [ iCount ] = false;
     4763
     4764        //reset to the default value for MC
     4765        puhInterDirNeighbours[iCount]   = 0;
     4766        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     4767        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     4768        break;
     4769      }
     4770    }
     4771    if(!bRemoveSpa)
     4772    {
     4773      bLeftAvai = true;
     4774      iPosLeftAbove[0] = iCount;
     4775#if H_3D_NBDV
     4776      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     4777      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     4778#endif
     4779#if H_3D_VSP
     4780      if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
     4781#if LGE_SHARP_VSP_INHERIT_F0104
     4782#if H_3D_IC
     4783        && !bICFlag
     4784#endif
     4785#if H_3D_ARP
     4786        && !bARPFlag
     4787#endif
     4788#endif
     4789        )
     4790      {
     4791        vspFlag[iCount] = 1;
     4792#if !MTK_VSP_SIMPLIFICATION_F0111
     4793        xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
     4794#endif
     4795      }
     4796#endif
     4797      if ( mrgCandIdx == iCount )
     4798      {
     4799        return;
     4800      }
     4801      iCount ++;
     4802    }
     4803#else // H_3D_IV_MERGE
     4804    if ( mrgCandIdx == iCount )
     4805    {
     4806      return;
     4807    }
     4808    iCount ++;
     4809#endif // H_3D_IV_MERGE
     4810  }
     4811
     4812  // early termination
     4813  if (iCount == getSlice()->getMaxNumMergeCand())
     4814  {
     4815    return;
     4816  }
     4817#if H_3D
     4818  ////////////////////////////
     4819  //////// ABOVE (B1) ////////
     4820  ////////////////////////////
     4821#endif
     4822  // above
     4823  UInt uiAbovePartIdx = 0;
     4824  TComDataCU* pcCUAbove = 0;
     4825  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
     4826  Bool isAvailableB1 = pcCUAbove &&
     4827    pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
     4828    !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
     4829    !pcCUAbove->isIntra( uiAbovePartIdx );
     4830  if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
     4831  {
     4832    abCandIsInter[iCount] = true;
     4833    // get Inter Dir
     4834    puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
     4835    // get Mv from Left
     4836    pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     4837    if ( getSlice()->isInterB() )
     4838    {
     4839      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     4840    }
     4841#if H_3D_IV_MERGE
     4842    Bool bRemoveSpa = false; //pruning to inter-view candidates
     4843#if QC_DEPTH_IV_MRG_F0125
     4844    Int iCnloop;
     4845    if( bIsDepth )
     4846      iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai)  ? (iCount-2): (iCount-1));
     4847    else
     4848      iCnloop = bLeftAvai? (iCount-2): (iCount-1);
     4849#else
     4850    Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
     4851#endif
     4852    for(; iCnloop >= 0; iCnloop --)
     4853    {
     4854      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     4855      {
     4856        bRemoveSpa                      = true;
     4857        abCandIsInter        [ iCount ] = false;
     4858
     4859        //reset to the default value for MC
     4860        puhInterDirNeighbours[iCount]   = 0;
     4861
     4862        pcMvFieldNeighbours[iCount<<1]    .setMvField( cZeroMv, NOT_VALID );
     4863        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     4864        break;
     4865      }
     4866    }
     4867
     4868    if(!bRemoveSpa)
     4869    {
     4870      iPosLeftAbove[1] = iCount;
     4871#if H_3D_NBDV
     4872      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     4873      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     4874#endif
     4875#if H_3D_VSP
     4876#if MTK_VSP_SIMPLIFICATION_F0111
     4877      if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
     4878#if LGE_SHARP_VSP_INHERIT_F0104
     4879#if H_3D_IC
     4880        && !bICFlag
     4881#endif
     4882#if H_3D_ARP
     4883        && !bARPFlag
     4884#endif
     4885#endif
     4886        )
     4887#else
     4888      if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
     4889#if LGE_SHARP_VSP_INHERIT_F0104
     4890#if H_3D_IC
     4891        && !bICFlag
     4892#endif
     4893#if H_3D_ARP
     4894        && !bARPFlag
     4895#endif
     4896#endif
     4897        )
     4898#endif
     4899      {
     4900
     4901        vspFlag[iCount] = 1;
     4902#if !MTK_VSP_SIMPLIFICATION_F0111
     4903        xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
     4904#endif
     4905      }
     4906#endif
     4907      if ( mrgCandIdx == iCount )
     4908      {
     4909        return;
     4910      }
     4911      iCount ++;
     4912    }
     4913#else // H_3D_IV_MERGE
     4914    if ( mrgCandIdx == iCount )
     4915    {
     4916      return;
     4917    }
     4918    iCount ++;
     4919#endif // H_3D_IV_MERGE
     4920  }
     4921  // early termination
     4922  if (iCount == getSlice()->getMaxNumMergeCand())
     4923  {
     4924    return;
     4925  }
     4926
     4927#if H_3D
     4928  //////////////////////////////////
     4929  //////// ABOVE RIGHT (B0) ////////
     4930  //////////////////////////////////
     4931#endif
     4932
     4933  // above right
     4934  UInt uiAboveRightPartIdx = 0;
     4935  TComDataCU* pcCUAboveRight = 0;
     4936  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
     4937  Bool isAvailableB0 = pcCUAboveRight &&
     4938    pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
     4939    !pcCUAboveRight->isIntra( uiAboveRightPartIdx );
     4940  if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
     4941  {
     4942    abCandIsInter[iCount] = true;
     4943    // get Inter Dir
     4944    puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx );
     4945    // get Mv from Left
     4946    pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     4947    if ( getSlice()->isInterB() )
     4948    {
     4949      pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     4950    }
     4951#if H_3D_NBDV
     4952    pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     4953    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     4954#endif
     4955#if H_3D_VSP
     4956#if MTK_VSP_SIMPLIFICATION_F0111
     4957    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
     4958#if LGE_SHARP_VSP_INHERIT_F0104
     4959#if H_3D_IC
     4960      && !bICFlag
     4961#endif
     4962#if H_3D_ARP
     4963      && !bARPFlag
     4964#endif
     4965#endif
     4966      )
     4967#else
     4968    if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
     4969#if LGE_SHARP_VSP_INHERIT_F0104
     4970#if H_3D_IC
     4971      && !bICFlag
     4972#endif
     4973#if H_3D_ARP
     4974      && !bARPFlag
     4975#endif
     4976#endif
     4977      )
     4978#endif
     4979    {
     4980      vspFlag[iCount] = 1;
     4981#if !MTK_VSP_SIMPLIFICATION_F0111
     4982      xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
     4983#endif
     4984    }
     4985#endif
     4986    if ( mrgCandIdx == iCount )
     4987    {
     4988      return;
     4989    }
     4990    iCount ++;
     4991  }
     4992  // early termination
     4993  if (iCount == getSlice()->getMaxNumMergeCand())
     4994  {
     4995    return;
     4996  }
     4997#endif
     4998
     4999
     5000#if H_3D_IV_MERGE
     5001  /////////////////////////////////////////////
     5002  //////// INTER VIEW DISP COMP (IvDC) ////////
     5003  /////////////////////////////////////////////
     5004
     5005#if ETRIKHU_MERGE_REUSE_F0093
     5006  if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand())
     5007#else
     5008  if( ivCandDir[1] )
     5009#endif
     5010  {
     5011    assert(iCount < getSlice()->getMaxNumMergeCand());
     5012
     5013#if ETRIKHU_MERGE_REUSE_F0093
     5014    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     5015    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     5016    if( ( ivCandDir[1] & 1 ) == 1 )
     5017    {
     5018      tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
     5019    }
     5020    if( ( ivCandDir[1] & 2 ) == 2 )
     5021    {
     5022      tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
     5023    }
     5024#else
     5025    abCandIsInter        [ iCount ] = true;
     5026    puhInterDirNeighbours[ iCount ] = ivCandDir[1];
     5027    if( ( ivCandDir[1] & 1 ) == 1 )
     5028    {
     5029      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
     5030    }
     5031    if( ( ivCandDir[1] & 2 ) == 2 )
     5032    {
     5033      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
     5034    }
     5035#endif
     5036
     5037    Bool bRemoveSpa = false; //pruning to A1, B1
     5038    for(Int i = 0; i < 2; i ++)
     5039    {
     5040      Int iCnloop = iPosLeftAbove[i];
     5041      if ( iCnloop == -1 )
     5042      {
     5043        continue;
     5044      }
     5045      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     5046      {
     5047        bRemoveSpa                      = true;
     5048#if !ETRIKHU_MERGE_REUSE_F0093
     5049        abCandIsInter        [ iCount ] = false;
     5050        //reset to the default value for MC
     5051        puhInterDirNeighbours[iCount]   = 0;
     5052        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     5053        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     5054#endif
     5055        break;
     5056      }     
     5057    }
     5058    if(!bRemoveSpa)
     5059    {
     5060#if ETRIKHU_MERGE_REUSE_F0093
     5061      rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
     5062      puhInterDirNeighbours[ iCount ] = ivCandDir[1];
     5063      if( ( ivCandDir[1] & 1 ) == 1 )
     5064      {
     5065        pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
     5066      }
     5067      if( ( ivCandDir[1] & 2 ) == 2 )
     5068      {
     5069        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
     5070      }
     5071#endif
     5072#if H_3D_NBDV
     5073      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     5074      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     5075#endif
     5076      posIvDC  = iCount;
     5077      if ( mrgCandIdx == iCount )
     5078        return;
     5079      iCount ++;
     5080
     5081      // early termination
     5082      if (iCount == getSlice()->getMaxNumMergeCand())
     5083      {
     5084        return;
     5085      }
     5086    }
     5087  }
     5088#endif // H_3D_IV_MERGE
     5089
     5090#if H_3D_VSP
     5091  /////////////////////////////////////////////////
     5092  //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
     5093  /////////////////////////////////////////////////
     5094#if ETRIKHU_MERGE_REUSE_F0093
     5095  if (iCount<getSlice()->getMaxNumMergeCand())
     5096  {
     5097#endif
     5098
     5099  if (
     5100#if LGE_SHARP_VSP_INHERIT_F0104
     5101#if H_3D_IC
     5102      !bICFlag &&
     5103#endif
     5104#if H_3D_ARP
     5105      !bARPFlag &&
     5106#endif
     5107#endif
     5108#if ETRIKHU_MERGE_REUSE_F0093
     5109      xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
     5110#else
     5111      xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
     5112#endif
     5113  {
     5114    return;
     5115  }
     5116
     5117  // early termination
     5118  if (iCount == getSlice()->getMaxNumMergeCand())
     5119  {
     5120    return;
     5121  }
     5122#endif
     5123#if ETRIKHU_MERGE_REUSE_F0093
     5124  }
     5125#endif
     5126
     5127#if ETRIKHU_MERGE_REUSE_F0093
     5128  iCount += numA0B2;
     5129#else
     5130#if H_3D
     5131  ///////////////////////////////////
     5132  //////// LEFT BOTTOM (A0) ////////
     5133  ///////////////////////////////////
     5134#endif
     5135
     5136  //left bottom
     5137  UInt uiLeftBottomPartIdx = 0;
     5138  TComDataCU* pcCULeftBottom = 0;
     5139  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
     5140  Bool isAvailableA0 = pcCULeftBottom &&
     5141  pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
     5142  !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ;
     5143  if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
     5144  {
     5145    abCandIsInter[iCount] = true;
     5146    // get Inter Dir
     5147    puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx );
     5148    // get Mv from Left
     5149    pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     5150    if ( getSlice()->isInterB() )
     5151    {
     5152      pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     5153    }
     5154#if H_3D_NBDV
     5155    pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     5156    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     5157#endif
     5158#if H_3D_VSP
     5159    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
     5160#if LGE_SHARP_VSP_INHERIT_F0104
     5161#if H_3D_IC
     5162        && !bICFlag
     5163#endif
     5164#if H_3D_ARP
     5165        && !bARPFlag
     5166#endif
     5167#endif
     5168        )
     5169    {
     5170      vspFlag[iCount] = 1;
     5171#if !MTK_VSP_SIMPLIFICATION_F0111
     5172      xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
     5173#endif
     5174    }
     5175#endif
     5176    if ( mrgCandIdx == iCount )
     5177    {
     5178      return;
     5179    }
     5180    iCount ++;
     5181  }
     5182  // early termination
     5183  if (iCount == getSlice()->getMaxNumMergeCand())
     5184  {
     5185    return;
     5186  }
     5187#if H_3D
     5188  ///////////////////////////////////
     5189  //////// LEFT ABOVE (B2) ////////
     5190  ///////////////////////////////////
     5191#endif
     5192
     5193  // above left
     5194  if( iCount < 4 )
     5195  {
     5196    UInt uiAboveLeftPartIdx = 0;
     5197    TComDataCU* pcCUAboveLeft = 0;
     5198    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
     5199    Bool isAvailableB2 = pcCUAboveLeft &&
     5200    pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
     5201    !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx );
     5202    if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
     5203        && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
     5204    {
     5205      abCandIsInter[iCount] = true;
     5206      // get Inter Dir
     5207      puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx );
     5208      // get Mv from Left
     5209      pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     5210      if ( getSlice()->isInterB() )
     5211      {
     5212        pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     5213      }
     5214#if H_3D_NBDV
     5215      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     5216      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     5217#endif
     5218#if H_3D_VSP
     5219#if MTK_VSP_SIMPLIFICATION_F0111
     5220      if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
     5221#if LGE_SHARP_VSP_INHERIT_F0104
     5222#if H_3D_IC
     5223          && !bICFlag
     5224#endif
     5225#if H_3D_ARP
     5226          && !bARPFlag
     5227#endif
     5228#endif
     5229          )
     5230#else
     5231      if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
     5232#if LGE_SHARP_VSP_INHERIT_F0104
     5233#if H_3D_IC
     5234          && !bICFlag
     5235#endif
     5236#if H_3D_ARP
     5237          && !bARPFlag
     5238#endif
     5239#endif
     5240          )
     5241#endif
     5242      {
     5243        vspFlag[iCount] = 1;
     5244#if !MTK_VSP_SIMPLIFICATION_F0111
     5245        xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
     5246#endif
     5247      }
     5248#endif
     5249      if ( mrgCandIdx == iCount )
     5250      {
     5251        return;
     5252      }
     5253      iCount ++;
     5254    }
     5255  }
     5256  // early termination
     5257  if (iCount == getSlice()->getMaxNumMergeCand())
     5258  {
     5259    return;
     5260  }
     5261#endif
     5262
     5263
     5264#if H_3D_IV_MERGE
     5265  ////////////////////////////////////////////////////
     5266  //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
     5267  ////////////////////////////////////////////////////
     5268#if ETRIKHU_MERGE_REUSE_F0093
     5269  if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() )
     5270  {
     5271    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
     5272#else
     5273  if(  ivMvPredFlag  )
     5274  {
     5275    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag))
     5276#endif
     5277    {
     5278      return;
     5279    }
     5280    //early termination
     5281    if (iCount == getSlice()->getMaxNumMergeCand())
     5282    {
     5283      return;
     5284    }
     5285  }
     5286#endif
     5287
     5288#if ETRIKHU_MERGE_REUSE_F0093
     5289  if (iCountHEVC + iCount3DV > getSlice()->getMaxNumMergeCand())
     5290  {
     5291    iCount = getSlice()->getMaxNumMergeCand();
     5292  }
     5293  else
     5294  {
     5295    iCount = iCountHEVC + iCount3DV;
     5296  }
     5297  numValidMergeCand = iCount;
     5298#else
     5299#if H_3D
     5300  /////////////////////////////////
     5301  //////// Collocate (COL) ////////
     5302  /////////////////////////////////
     5303#endif
     5304  if ( getSlice()->getEnableTMVPFlag())
     5305  {
     5306    //>> MTK colocated-RightBottom
     5307    UInt uiPartIdxRB;
     5308
     5309    deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 
     5310
     5311    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     5312    UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     5313
     5314    TComMv cColMv;
     5315    Int iRefIdx;
     5316    Int uiLCUIdx = -1;
     5317
     5318    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
     5319    {
     5320    }
     5321    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5322    {
     5323    }
     5324    else
     5325    {
     5326      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     5327        ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     5328      {
     5329        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     5330        uiLCUIdx = getAddr();
     5331      }
     5332      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     5333      {
     5334        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     5335      }
     5336      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     5337      {
     5338        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     5339        uiLCUIdx = getAddr() + 1;
     5340      }
     5341      else //is the right bottom corner of LCU                       
     5342      {
     5343        uiAbsPartAddr = 0;
     5344      }
     5345    }
     5346   
     5347   
     5348    iRefIdx = 0;
     5349    Bool bExistMV = false;
     5350    UInt uiPartIdxCenter;
     5351    UInt uiCurLCUIdx = getAddr();
     5352    Int dir = 0;
     5353    UInt uiArrayAddr = iCount;
     5354    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
     5355    bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
     5356    if( bExistMV == false )
     5357    {
     5358      bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     5359    }
     5360    if( bExistMV )
     5361    {
     5362      dir |= 1;
     5363      pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx );
     5364    }
     5365
     5366    if ( getSlice()->isInterB() )
     5367    {
     5368#if H_3D_TMVP
     5369      iRefIdx = 0;
     5370#endif
     5371      bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
     5372      if( bExistMV == false )
     5373      {
     5374        bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     5375      }
     5376      if( bExistMV )
     5377      {
     5378        dir |= 2;
     5379        pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx );
     5380      }
     5381    }
     5382   
     5383    if (dir != 0)
     5384    {
     5385      puhInterDirNeighbours[uiArrayAddr] = dir;
     5386      abCandIsInter[uiArrayAddr] = true;
     5387#if H_3D_NBDV
     5388      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     5389      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     5390#endif
     5391      if ( mrgCandIdx == iCount )
     5392      {
     5393        return;
     5394      }
     5395      iCount++;
     5396    }
     5397  }
     5398  // early termination
     5399  if (iCount == getSlice()->getMaxNumMergeCand())
     5400  {
     5401    return;
     5402  }
     5403  UInt uiArrayAddr = iCount;
     5404  UInt uiCutoff = uiArrayAddr;
     5405   
     5406  if ( getSlice()->isInterB())
     5407  {
     5408#if H_3D_IV_MERGE
     5409    UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3,    0, 4, 1, 4, 2, 4, 3, 4 };
     5410    UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2,    4, 0, 4, 1, 4, 2, 4, 3 };
     5411#else
     5412    UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
     5413    UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
     5414#endif
     5415
     5416    for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
     5417    {
     5418      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
     5419#if H_3D_VSP
     5420      Bool bValid = true;
     5421      if ( vspFlag[i] == 1 || vspFlag[j] == 1 )
     5422      {
     5423        bValid = false;
     5424      }
     5425      if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) )
     5426      {
     5427        assert(bValid == true);
     5428      }
     5429#endif
     5430#if H_3D_VSP
     5431      if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid)
     5432#else
     5433      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
     5434#endif
     5435      {
     5436        abCandIsInter[uiArrayAddr] = true;
     5437        puhInterDirNeighbours[uiArrayAddr] = 3;
     5438
     5439        // get Mv from cand[i] and cand[j]
     5440        pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
     5441        pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx());
     5442
     5443        Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() );
     5444        Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() );
     5445        if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv())
     5446        {
     5447          abCandIsInter[uiArrayAddr] = false;
     5448        }
     5449        else
     5450        {
     5451          uiArrayAddr++;
     5452        }
     5453      }
     5454    }
     5455  }
     5456  // early termination
     5457  if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
     5458  {
     5459    return;
     5460  }
     5461  Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
     5462  Int r = 0;
     5463  Int refcnt = 0;
     5464  while (uiArrayAddr < getSlice()->getMaxNumMergeCand())
     5465  {
     5466    abCandIsInter[uiArrayAddr] = true;
     5467    puhInterDirNeighbours[uiArrayAddr] = 1;
     5468    pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r);
     5469
     5470    if ( getSlice()->isInterB() )
     5471    {
     5472      puhInterDirNeighbours[uiArrayAddr] = 3;
     5473      pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r);
     5474    }
     5475    uiArrayAddr++;
     5476    if ( refcnt == iNumRefIdx - 1 )
     5477    {
     5478      r = 0;
     5479    }
     5480    else
     5481    {
     5482      ++r;
     5483      ++refcnt;
     5484    }
     5485  }
     5486
     5487  numValidMergeCand = uiArrayAddr;
     5488#endif
     5489}
     5490
     5491
     5492
     5493
     5494#else
     5495
    34715496/** Constructs a list of merging candidates
    34725497 * \param uiAbsPartIdx
     
    35225547  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    35235548  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     5549#if SEC_MPI_ENABLING_MERGE_F0150
     5550  Bool bMPIFlag   = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() );
     5551#endif
     5552#if QC_DEPTH_IV_MRG_F0125
     5553  Bool bIsDepth = getSlice()->getIsDepth();
     5554  Bool bDepthIPMCAvai = false;
     5555#endif
     5556
     5557#if LGE_SHARP_VSP_INHERIT_F0104
     5558#if H_3D_IC
     5559  Bool bICFlag = getICFlag(uiAbsPartIdx);
     5560#endif
     5561#if H_3D_ARP
     5562  Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
     5563#endif
     5564#endif
     5565
    35245566#if H_3D_IV_MERGE
    35255567 
     
    35285570  /////////////////////////////////////////////
    35295571
     5572#if SEC_MPI_ENABLING_MERGE_F0150
     5573  if( bMPIFlag)
     5574#else
    35305575  if( m_pcSlice->getIsDepth())
     5576#endif
    35315577  {
    35325578    UInt uiPartIdxCenter;
     
    36215667  if ( ivMvPredFlag )
    36225668  {
    3623     getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir );
     5669    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir
     5670#if QC_DEPTH_IV_MRG_F0125
     5671    , bIsDepth
     5672#endif
     5673    );
    36245674  } 
    36255675 
     
    36425692    }
    36435693
     5694#if QC_DEPTH_IV_MRG_F0125
     5695    if ( bIsDepth )
     5696    {
     5697      Bool bRemoveSpa = false;
     5698      Int iCnloop = iCount-1;
     5699      for(; iCnloop >= 0; iCnloop --)
     5700      {
     5701        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     5702        {
     5703          bRemoveSpa                      = true;
     5704          abCandIsInter        [ iCount ] = false;
     5705
     5706          puhInterDirNeighbours[iCount]   = 0;
     5707          pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     5708          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     5709          break;
     5710        }
     5711      }
     5712      if(!bRemoveSpa)
     5713      {
     5714        bDepthIPMCAvai = true;
     5715      }
     5716    }
     5717    if ( bDepthIPMCAvai || !bIsDepth )
     5718    {
     5719#endif
    36445720    if ( mrgCandIdx == iCount )
    36455721    {
     
    36475723    }
    36485724    iCount ++;
     5725#if QC_DEPTH_IV_MRG_F0125
     5726    }
     5727#endif
    36495728  }
    36505729
     
    36825761#if H_3D_IV_MERGE
    36835762    Bool bRemoveSpa = false; //pruning to inter-view candidates
     5763#if QC_DEPTH_IV_MRG_F0125
     5764    Int  iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1);
     5765#else
    36845766    Int  iCnloop    = iCount - 1;
     5767#endif
    36855768    for(; iCnloop >= 0; iCnloop --)
    36865769    {
     
    37065789#endif
    37075790#if H_3D_VSP
    3708       if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1)
     5791      if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
     5792#if LGE_SHARP_VSP_INHERIT_F0104
     5793#if H_3D_IC
     5794          && !bICFlag
     5795#endif
     5796#if H_3D_ARP
     5797          && !bARPFlag
     5798#endif
     5799#endif
     5800          )
    37095801      {
    37105802        vspFlag[iCount] = 1;
     5803#if !MTK_VSP_SIMPLIFICATION_F0111
    37115804        xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
     5805#endif
    37125806      }
    37135807#endif
     
    37585852#if H_3D_IV_MERGE
    37595853    Bool bRemoveSpa = false; //pruning to inter-view candidates
     5854#if QC_DEPTH_IV_MRG_F0125
     5855    Int iCnloop;
     5856    if( bIsDepth )
     5857      iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai)  ? (iCount-2): (iCount-1));
     5858    else
     5859      iCnloop = bLeftAvai? (iCount-2): (iCount-1);
     5860#else
    37605861    Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
     5862#endif
    37615863    for(; iCnloop >= 0; iCnloop --)
    37625864    {
     
    37835885#endif
    37845886#if H_3D_VSP
    3785       if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
     5887#if MTK_VSP_SIMPLIFICATION_F0111
     5888      if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
     5889#if LGE_SHARP_VSP_INHERIT_F0104
     5890#if H_3D_IC
     5891          && !bICFlag
     5892#endif
     5893#if H_3D_ARP
     5894          && !bARPFlag
     5895#endif
     5896#endif
     5897          )
     5898#else
     5899      if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
     5900#if LGE_SHARP_VSP_INHERIT_F0104
     5901#if H_3D_IC
     5902          && !bICFlag
     5903#endif
     5904#if H_3D_ARP
     5905          && !bARPFlag
     5906#endif
     5907#endif
     5908          )
     5909#endif
    37865910      {
    37875911
    37885912        vspFlag[iCount] = 1;
     5913#if !MTK_VSP_SIMPLIFICATION_F0111
    37895914        xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
     5915#endif
    37905916      }
    37915917#endif
     
    38395965#endif
    38405966#if H_3D_VSP
    3841     if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
     5967#if MTK_VSP_SIMPLIFICATION_F0111
     5968    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
     5969#if LGE_SHARP_VSP_INHERIT_F0104
     5970#if H_3D_IC
     5971        && !bICFlag
     5972#endif
     5973#if H_3D_ARP
     5974        && !bARPFlag
     5975#endif
     5976#endif
     5977        )
     5978#else
     5979    if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
     5980#if LGE_SHARP_VSP_INHERIT_F0104
     5981#if H_3D_IC
     5982        && !bICFlag
     5983#endif
     5984#if H_3D_ARP
     5985        && !bARPFlag
     5986#endif
     5987#endif
     5988        )
     5989#endif
    38425990    {
    38435991      vspFlag[iCount] = 1;
     5992#if !MTK_VSP_SIMPLIFICATION_F0111
    38445993      xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
     5994#endif
    38455995    }
    38465996#endif
     
    39206070  /////////////////////////////////////////////////
    39216071
    3922   if ( xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
     6072  if (
     6073#if LGE_SHARP_VSP_INHERIT_F0104
     6074#if H_3D_IC
     6075      !bICFlag &&
     6076#endif
     6077#if H_3D_ARP
     6078      !bARPFlag &&
     6079#endif
     6080#endif
     6081      xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
    39236082  {
    39246083    return;
     
    39606119#endif
    39616120#if H_3D_VSP
    3962     if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1)
     6121    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
     6122#if LGE_SHARP_VSP_INHERIT_F0104
     6123#if H_3D_IC
     6124        && !bICFlag
     6125#endif
     6126#if H_3D_ARP
     6127        && !bARPFlag
     6128#endif
     6129#endif
     6130        )
    39636131    {
    39646132      vspFlag[iCount] = 1;
     6133#if !MTK_VSP_SIMPLIFICATION_F0111
    39656134      xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
     6135#endif
    39666136    }
    39676137#endif
     
    40096179#endif
    40106180#if H_3D_VSP
    4011       if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
     6181#if MTK_VSP_SIMPLIFICATION_F0111
     6182      if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
     6183#if LGE_SHARP_VSP_INHERIT_F0104
     6184#if H_3D_IC
     6185          && !bICFlag
     6186#endif
     6187#if H_3D_ARP
     6188          && !bARPFlag
     6189#endif
     6190#endif
     6191          )
     6192#else
     6193      if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
     6194#if LGE_SHARP_VSP_INHERIT_F0104
     6195#if H_3D_IC
     6196          && !bICFlag
     6197#endif
     6198#if H_3D_ARP
     6199          && !bARPFlag
     6200#endif
     6201#endif
     6202          )
     6203#endif
    40126204      {
    40136205        vspFlag[iCount] = 1;
     6206#if !MTK_VSP_SIMPLIFICATION_F0111
    40146207        xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
     6208#endif
    40156209      }
    40166210#endif
     
    42356429  numValidMergeCand = uiArrayAddr;
    42366430}
     6431
     6432
     6433#endif
     6434
     6435
    42376436#if H_3D_VSP
    42386437inline Void TComDataCU::xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo*  inheritedVSPDisInfo)
     
    45716770}
    45726771
     6772#if LGE_IC_CTX_F0160
     6773Bool TComDataCU::isIC( UInt uiPartIdx )
     6774{
     6775    if ( m_pcSlice->isIntra () )
     6776    {
     6777        return false;
     6778    }
     6779    return ( ( getSkipFlag(uiPartIdx) || getPredictionMode(uiPartIdx) == MODE_INTER) && getICFlag( uiPartIdx ) && isICFlagRequired( uiPartIdx ) );
     6780}
     6781#endif
     6782
    45736783// ====================================================================================================================
    45746784// Protected member functions
     
    54117621  riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX();
    54127622  riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 
     7623}
     7624#endif
     7625#if QC_DEPTH_IV_MRG_F0125
     7626Bool TComDataCU::getDispNeighBlocks (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
     7627{
     7628  Pel pDepPos[3] = {0, 0, 0};
     7629  assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N);
     7630  Bool bDepAvail = false;
     7631  Pel *pDepth  = this->getPic()->getPicYuvRec()->getLumaAddr();
     7632  Int iDepStride =  this->getPic()->getPicYuvRec()->getStride();
     7633  TComMv cMv;
     7634
     7635  Int xP, yP, nPSW, nPSH;
     7636  this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
     7637
     7638  if(xP != 0 && yP != 0)
     7639  {
     7640    pDepPos[0] = pDepth[ (yP-1) * iDepStride + (xP-1) ];
     7641    bDepAvail = true;
     7642  }
     7643
     7644  if(xP != 0)
     7645  {
     7646    pDepPos[1] = pDepth[ (yP+nPSH-1) * iDepStride + (xP-1) ];
     7647    bDepAvail = true;
     7648  }
     7649
     7650  if(yP != 0)
     7651  {
     7652    pDepPos[2] = pDepth[ (yP-1) * iDepStride + (xP+nPSW-1) ];
     7653    bDepAvail = true;
     7654  }
     7655
     7656  if (bDepAvail)
     7657  {
     7658    Pel pAvgDepth = (xP != 0 && yP != 0) ? ((5*pDepPos[0] + 5*pDepPos[1] + 6*pDepPos[2] + 8)>>4) : (xP == 0) ? pDepPos[2] : pDepPos[1];
     7659    Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ pAvgDepth ];
     7660    cMv.setHor(iDisp);
     7661    cMv.setVer(0);
     7662    pDisp->m_acNBDV = cMv;
     7663    pDisp->m_aVIdxCan = 0;
     7664    return true;
     7665  }
     7666  else
     7667  { 
     7668    cMv.setZero();
     7669    pDisp->m_acNBDV = cMv;
     7670    pDisp->m_aVIdxCan = 0;
     7671    return false;
     7672  }
    54137673}
    54147674#endif
     
    59428202}
    59438203#endif
     8204
     8205#if MTK_SPIVMP_F0110
     8206Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight)
     8207{
     8208  Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId());
     8209  iNumSPInOneLine = iPUWidth/iSubPUSize;
     8210  iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine;
     8211  Int iNumSPInOneColumn = iPUHeight/iSubPUSize;
     8212  iNumSPInOneColumn = iNumSPInOneColumn < 1 ? 1: iNumSPInOneColumn;
     8213  iNumSP = iNumSPInOneLine * iNumSPInOneColumn;
     8214
     8215  iSPWidth = iNumSPInOneLine == 1 ? iPUWidth: iSubPUSize;
     8216  iSPHeight = iNumSPInOneColumn == 1 ? iPUHeight: iSubPUSize;
     8217}
     8218
     8219Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr )
     8220{
     8221  uiBaseAbsPartIdx += m_uiAbsIdxInLCU;
     8222  Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]];
     8223  Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]];
     8224  Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth;
     8225  Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight;
     8226  Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + iCurrPelX/getPic()->getMinCUWidth();
     8227  ruiPartAddr = g_auiRasterToZscan[iCurrRaster];
     8228  ruiPartAddr -= m_uiAbsIdxInLCU; 
     8229}
     8230
     8231Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight )
     8232{
     8233  uiAbsPartIdx += getZorderIdxInCU();
     8234  Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];
     8235  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
     8236  Int iEndPelX = iStartPelX + iWidth;
     8237  Int iEndPelY = iStartPelY + iHeight;
     8238
     8239  Int iCurrRaster, uiPartAddr;
     8240
     8241  for (Int i=iStartPelY; i<iEndPelY; i+=getPic()->getMinCUHeight())
     8242  {
     8243    for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth())
     8244    {
     8245      iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + j/getPic()->getMinCUWidth();
     8246      uiPartAddr = g_auiRasterToZscan[iCurrRaster];
     8247      uiPartAddr -= getZorderIdxInCU(); 
     8248
     8249      m_puhInterDir[uiPartAddr] = uiDir;
     8250    }
     8251  }
     8252}
     8253#endif
     8254
    59448255#if H_3D_IV_MERGE
    59458256Bool
    5946 TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc )
     8257TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc
     8258#if QC_DEPTH_IV_MRG_F0125
     8259, Bool bIsDepth           
     8260#endif
     8261#if MTK_SPIVMP_F0110
     8262, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     8263#endif
     8264)
    59478265{
    59488266  TComSlice*    pcSlice = getSlice (); 
     
    59508268 
    59518269  //--- get base CU/PU and check prediction mode ---
     8270#if QC_DEPTH_IV_MRG_F0125
     8271  TComPic*    pcBasePic   = pcSlice->getIvPic( bIsDepth, iViewIndex );
     8272#else
    59528273  TComPic*    pcBasePic   = pcSlice->getIvPic( false, iViewIndex );
     8274#endif
    59538275  TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
    59548276
     
    59618283  pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
    59628284
     8285#if !MTK_SPIVMP_F0110
     8286#if QC_DEPTH_IV_MRG_F0125
     8287  iCurrPosX  += ( iWidth  >> 1 );
     8288  iCurrPosY  += ( iHeight >> 1 );
     8289#else
    59638290  iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
    59648291  iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
     8292#endif
     8293#endif
    59658294
    59668295  Bool depthRefineFlag = false;
     
    59798308#endif
    59808309
     8310#if MTK_SPIVMP_F0110
     8311  ////////////////////////////////
     8312  //////////sub-PU IvMC///////////
     8313  ////////////////////////////////
     8314 
     8315  Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     8316  getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     8317
     8318  for (Int i=0; i<iNumSP; i++)
     8319  {
     8320    puhInterDirSP[i] = 0;
     8321    pcMvFieldSP[2*i].getMv().set(0, 0);
     8322    pcMvFieldSP[2*i+1].getMv().set(0,0);
     8323    pcMvFieldSP[2*i].setRefIdx(-1);
     8324    pcMvFieldSP[2*i+1].setRefIdx(-1);
     8325  }
     8326
     8327  Int         iBaseCUAddr;
     8328  Int         iBaseAbsPartIdx;
     8329  TComDataCU* pcBaseCU;
     8330  Int iPartition = 0;
     8331  Int iInterDirLast = 0;
     8332  TComMvField cMvFieldLast[2];
     8333
     8334  Int iDelX = iSPWidth/2;
     8335  Int iDelY = iSPHeight/2;
     8336
     8337  Int         iBasePosX, iBasePosY;
     8338  for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight)
     8339  {
     8340    for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth)
     8341    {
     8342      iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 ));
     8343      iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 ));
     8344
     8345      pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx );
     8346      pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     8347      if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
     8348      {
     8349        for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )
     8350        {
     8351          RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
     8352          Bool bLoop_stop = false;
     8353          for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop)
     8354          {
     8355            RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
     8356            TComMvField cBaseMvField;
     8357            pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
     8358            Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
     8359            if (iBaseRefIdx >= 0)
     8360            {
     8361              Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx);
     8362              if (iBaseRefPOC != pcSlice->getPOC())   
     8363              {
     8364                for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++)
     8365                {
     8366                  if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx))
     8367                  {
     8368                    abPdmAvailable[ uiCurrRefListId ] = true;
     8369                    TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
     8370
     8371                    if( !bIsDepth )
     8372                    {
     8373                      cMv.setIDVFlag   (true);
     8374                      cMv.setIDVHor    (cDv.getHor());                 
     8375                      cMv.setIDVVer    (cDv.getVer()); 
     8376                      cMv.setIDVVId    (iViewIndex);
     8377                    }
     8378
     8379                    clipMv( cMv );
     8380                    bLoop_stop = true;
     8381
     8382                    pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx);
     8383                    break;
     8384                  }
     8385                }
     8386              }
     8387            }
     8388          }
     8389        }
     8390      }
     8391
     8392      puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0);
     8393      if (puhInterDirSP[iPartition] == 0)
     8394      {
     8395        if (iInterDirLast != 0)
     8396        {
     8397          puhInterDirSP[iPartition] = iInterDirLast;
     8398          pcMvFieldSP[2*iPartition] = cMvFieldLast[0];
     8399          pcMvFieldSP[2*iPartition + 1] = cMvFieldLast[1];
     8400        }
     8401      }
     8402      else
     8403      {
     8404        if (iInterDirLast ==0)
     8405        {
     8406          availableMcDc[0] = puhInterDirSP[iPartition];
     8407          paiPdmRefIdx  [ 0 ] = pcMvFieldSP[2*iPartition].getRefIdx();
     8408          pacPdmMv      [ 0 ] = pcMvFieldSP[2*iPartition].getMv();
     8409          paiPdmRefIdx  [ 1 ] = pcMvFieldSP[2*iPartition+1].getRefIdx();
     8410          pacPdmMv      [ 1 ] = pcMvFieldSP[2*iPartition+1].getMv();
     8411
     8412          if (iPartition != 0)
     8413          {
     8414            for (Int iPart = iPartition-1; iPart >= 0; iPart--)
     8415            {
     8416              puhInterDirSP[iPart] = puhInterDirSP[iPartition];
     8417              pcMvFieldSP[2*iPart] = pcMvFieldSP[2*iPartition];
     8418              pcMvFieldSP[2*iPart + 1] = pcMvFieldSP[2*iPartition + 1];
     8419            }
     8420          }
     8421        }
     8422        iInterDirLast = puhInterDirSP[iPartition];
     8423        cMvFieldLast[0] = pcMvFieldSP[2*iPartition];
     8424        cMvFieldLast[1] = pcMvFieldSP[2*iPartition + 1];
     8425      }
     8426
     8427      iPartition ++;
     8428
     8429    }
     8430  } 
     8431
     8432  iCurrPosX  += ( iWidth  >> 1 );
     8433  iCurrPosY  += ( iHeight >> 1 );
     8434#endif
     8435
    59818436  ////////////////////////////////
    59828437  /////// IvMC + IvMCShift ///////
    59838438  ////////////////////////////////
    59848439
    5985   for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 
     8440#if MTK_SPIVMP_F0110
     8441  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
     8442#else
     8443  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
     8444#endif
    59868445  {
    59878446    // iLoopCan == 0 --> IvMC
    59888447    // iLoopCan == 1 --> IvMCShift
    59898448
     8449#if !MTK_SPIVMP_F0110
    59908450    Int         iBaseCUAddr;
    59918451    Int         iBaseAbsPartIdx;
     8452#endif
    59928453
    59938454    Int offsetW = (iLoopCan == 0) ? 0 : ( ((iWidth /2)*4) + 4 );
    59948455    Int offsetH = (iLoopCan == 0) ? 0 : ( ((iHeight/2)*4) + 4 );
    59958456
     8457#if MTK_SPIVMP_F0110
     8458    iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
     8459    iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) );
     8460#else
    59968461    Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
    59978462    Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) );
     8463#endif
    59988464    pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
    59998465
     8466#if MTK_SPIVMP_F0110
     8467    pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     8468#else
    60008469    TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     8470#endif
    60018471    if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
    60028472    {
     
    60268496                  TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
    60278497#if H_3D_NBDV
    6028                   cMv.setIDVFlag   (true);
    6029                   cMv.setIDVHor    (cDv.getHor());                 
    6030                   cMv.setIDVVer    (cDv.getVer()); 
    6031                   cMv.setIDVVId    (iViewIndex);
     8498#if QC_DEPTH_IV_MRG_F0125
     8499                  if( !bIsDepth )
     8500                  {
     8501#endif
     8502                    cMv.setIDVFlag   (true);
     8503                    cMv.setIDVHor    (cDv.getHor());                 
     8504                    cMv.setIDVVer    (cDv.getVer()); 
     8505                    cMv.setIDVVId    (iViewIndex);
     8506#if QC_DEPTH_IV_MRG_F0125
     8507                  }
     8508#endif
    60328509#endif
    60338510                  clipMv( cMv );
     
    60448521    }
    60458522  }
     8523#if MTK_SPIVMP_F0110
     8524  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
     8525#else
    60468526  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
     8527#endif
    60478528  {
    60488529    availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0);
     
    60718552#endif
    60728553          cMv.setHor( cMv.getHor() + ioffsetDV );
     8554#if QC_DEPTH_IV_MRG_F0125
     8555          if( bIsDepth )
     8556            cMv.setHor((cMv.getHor()+2)>>2);
     8557#endif
    60738558          cMv.setVer( 0 );
    60748559          clipMv( cMv );
     
    61548639  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
    61558640}
     8641#if !SEC_DMM3_RBC_F0147
    61568642Void  TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
    61578643{
     
    61598645  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm3IntraTabIdx[uiAbsPartIdx+ui] = uiTIdx; }
    61608646}
     8647#endif
    61618648#endif
    61628649#if H_3D_DIM_RBC
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r655 r724  
    198198                                      ///< 0: non-VSP; 1: VSP
    199199#endif
     200#if MTK_SPIVMP_F0110
     201  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP
     202                                      ///< 0: non-SPIVMP; 1: SPIVMP
     203#endif
    200204#if H_3D_ARP
    201205  UChar*        m_puhARPW;
     
    208212#if H_3D_DIM_DMM
    209213  UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE];
     214#if !SEC_DMM3_RBC_F0147
    210215  UInt*         m_dmm3IntraTabIdx;
     216#endif
    211217#endif
    212218#if H_3D_DIM_RBC
     
    227233  UChar*        m_pucInterSDCMask;
    228234#endif
    229 
     235#if ETRIKHU_MERGE_REUSE_F0093
     236  Bool          m_bAvailableFlagA1;    ///< A1 available flag
     237  Bool          m_bAvailableFlagB1;    ///< B1 available flag
     238  Bool          m_bAvailableFlagB0;    ///< B0 available flag
     239  Bool          m_bAvailableFlagA0;    ///< A0 available flag
     240  Bool          m_bAvailableFlagB2;    ///< B2 available flag
     241#endif
    230242  // -------------------------------------------------------------------------------------------------------------------
    231243  // misc. variables
     
    244256  UInt*         m_sliceSegmentStartCU; ///< Start CU address of current slice
    245257  Char          m_codedQP;
     258#if ETRIKHU_MERGE_REUSE_F0093
     259  DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
     260#endif
     261
    246262protected:
    247263 
     
    250266  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    251267#if H_3D_VSP
     268#if ETRIKHU_MERGE_REUSE_F0093
     269  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
     270                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo);
     271#else
    252272  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
    253273                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag );
    254274#endif
     275#endif
    255276#if H_3D_IV_MERGE
     277#if ETRIKHU_MERGE_REUSE_F0093
     278  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv,
     279                               Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo   );
     280#else
    256281  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv,
    257282                               Int* ivCandRefIdx, Int posIvDC, Int* vspFlag );
     283#endif
    258284  Bool          xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int*  ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand );
    259285#endif
     
    493519   );
    494520   
     521#if ETRIKHU_MERGE_REUSE_F0093
     522  Void          rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV);
     523#endif
     524#if QC_DEPTH_IV_MRG_F0125
     525  Bool          getDispNeighBlocks  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
     526  Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
     527#endif
     528
    495529#if H_3D_NBDV_REF
    496530  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
     
    501535  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
    502536#endif
     537#if MTK_SPIVMP_F0110
     538  Void          getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
     539  Void          getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
     540  Void          setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );
     541#endif
    503542#if H_3D_IV_MERGE
    504   Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc );   
     543  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc
     544#if QC_DEPTH_IV_MRG_F0125
     545    , Bool bIsDepth           
     546#endif
     547#if MTK_SPIVMP_F0110
     548    , TComMvField* pcMFieldSP, UChar* puhInterDirSP
     549#endif
     550    );   
    505551#endif
    506552#if H_3D_ARP
     
    538584  Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
    539585
     586#if !SEC_DMM3_RBC_F0147
    540587  UInt* getDmm3IntraTabIdx            ()                      { return m_dmm3IntraTabIdx;        }
    541588  UInt  getDmm3IntraTabIdx            ( UInt uiIdx )          { return m_dmm3IntraTabIdx[uiIdx]; }
    542589  Void  setDmm3IntraTabIdx            ( UInt uiIdx, UInt uh ) { m_dmm3IntraTabIdx[uiIdx] = uh;   }
    543590  Void  setDmm3IntraTabIdxSubParts    ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
     591#endif
    544592#endif
    545593#if H_3D_DIM_RBC
     
    655703 
    656704  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    657   Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     705
     706#if ETRIKHU_MERGE_REUSE_F0093
     707  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
     708  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
     709  Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;}
     710  Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;}
     711  Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;}
     712  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
     713  Void          getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
     714  Void          xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     715#else
     716  Void          getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     717#endif
    658718#if H_3D_VSP
    659719                                            , Int* vspFlag
    660720                                            , InheritedVSPDisInfo*  inheritedVSPDisInfo
    661721#endif
    662                                             , Int& numValidMergeCand, Int mrgCandIdx = -1 );
     722#if MTK_SPIVMP_F0110
     723                                            , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     724#endif
     725                                            , Int& numValidMergeCand, Int mrgCandIdx = -1
     726                                            );
    663727
    664728#if H_3D_VSP
    665729  inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
     730
     731#if MTK_SPIVMP_F0110
     732  Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
     733  Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
     734  Void          setSPIVMPFlag        ( UInt uiIdx, Bool n )     { m_pbSPIVMPFlag[uiIdx] = n;      }
     735  Void          setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     736#endif
    666737
    667738  Char*         getVSPFlag        ()                        { return m_piVSPFlag;          }
     
    681752  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
    682753  Bool          isBipredRestriction( UInt puIdx );
     754
     755#if LGE_IC_CTX_F0160
     756  Bool          isIC      ( UInt uiPartIdx );
     757#endif
    683758
    684759  // -------------------------------------------------------------------------------------------------------------------
  • trunk/source/Lib/TLibCommon/TComMotionInfo.cpp

    r608 r724  
    4040#include "assert.h"
    4141#include <stdlib.h>
     42#if MTK_SPIVMP_F0110
     43#include "TComDataCU.h"
     44#include "TComPic.h"
     45#endif
    4246
    4347//! \ingroup TLibCommon
     
    323327  setAllRefIdx( mvField.getRefIdx(), eCUMode, iPartAddr, uiDepth, iPartIdx );
    324328}
     329
     330#if MTK_SPIVMP_F0110
     331Void TComCUMvField::setMvFieldSP( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  )
     332{
     333  uiAbsPartIdx += pcCU->getZorderIdxInCU();
     334  Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];
     335  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
     336  Int iEndPelX = iStartPelX + iWidth;
     337  Int iEndPelY = iStartPelY + iHeight;
     338
     339  Int iCurrRaster, uiPartAddr;
     340
     341  for (Int i=iStartPelY; i<iEndPelY; i+=pcCU->getPic()->getMinCUHeight())
     342  {
     343    for (Int j=iStartPelX; j < iEndPelX; j += pcCU->getPic()->getMinCUWidth())
     344    {
     345      iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();
     346      uiPartAddr = g_auiRasterToZscan[iCurrRaster];
     347      uiPartAddr -= pcCU->getZorderIdxInCU(); 
     348
     349      m_pcMv[uiPartAddr] = cMvField.getMv();
     350      m_piRefIdx[uiPartAddr] = cMvField.getRefIdx();
     351    }
     352  }
     353}
     354#endif
    325355
    326356/**Subsampling of the stored prediction mode, reference index and motion vector
  • trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r622 r724  
    4343#include "CommonDef.h"
    4444#include "TComMv.h"
    45 
    4645//! \ingroup TLibCommon
    4746//! \{
     
    5150// ====================================================================================================================
    5251
     52#if MTK_SPIVMP_F0110
     53class TComDataCU;
     54#endif
    5355/// parameters for AMVP
    5456typedef struct _AMVPInfo
     
    171173  Void    setAllRefIdx ( Int iRefIdx,                 PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
    172174  Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
     175#if MTK_SPIVMP_F0110
     176  Void    setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  );
     177#endif
    173178
    174179  Void setNumPartition( Int iNumPart )
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r655 r724  
    425425  Bool dimDeltaDC = isDimDeltaDC( uiIntraMode );   
    426426  Bool isDmmMode  = (dimType <  DMM_NUM_TYPE);
     427#if !SEC_DMM3_RBC_F0147
    427428  Bool isRbcMode  = (dimType == RBC_IDX);
     429#endif
    428430
    429431  Bool* biSegPattern  = NULL;
     
    441443        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
    442444      } break;
     445#if !SEC_DMM3_RBC_F0147
    443446    case( DMM3_IDX ):
    444447      {
     
    452455        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);
    453456      } break;
     457#endif
    454458    case( DMM4_IDX ):
    455459      {
     
    475479  assert( biSegPattern );
    476480  Int* piMask = NULL;
     481#if QC_DIM_DELTADC_UNIFY_F0132 || HHI_DIM_PREDSAMP_FIX_F0171
     482  piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering
     483#else
    477484  if( isDmmMode ) piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering for DMM
    478485  else            piMask = pcCU->getPattern()->getPredictorPtr( 0, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt );
     486#endif
    479487  assert( piMask );
    480488  Int maskStride = 2*iWidth + 1; 
     
    491499    Pel deltaDC2 = pcCU->getDimDeltaDC( dimType, 1, uiAbsPartIdx );
    492500#if H_3D_DIM_DMM
     501#if QC_DIM_DELTADC_UNIFY_F0132 && !SEC_DMM3_RBC_F0147
     502    if( isDmmMode || isRbcMode)
     503#else
    493504    if( isDmmMode )
     505#endif
    494506    {
    495507#if H_3D_DIM_DLT
     
    502514    }
    503515#endif
    504 #if H_3D_DIM_RBC
     516#if H_3D_DIM_RBC && !QC_DIM_DELTADC_UNIFY_F0132
    505517    if( isRbcMode )
    506518    {
     
    549561}
    550562
     563#if MTK_SPIVMP_F0110
     564Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr )
     565{
     566  for (Int i = 0; i < iNumSP; i++)
     567  {
     568    uiMergedSPW[i] = iSPWidth;
     569    uiMergedSPH[i] = iSPHeight;
     570    pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]);
     571  }
     572  // horizontal sub-PU merge
     573  for (Int i=0; i<iNumSP; i++)
     574  {
     575    if (i % iNumSPInOneLine == iNumSPInOneLine - 1 || uiMergedSPW[i]==0 || uiMergedSPH[i]==0)
     576    {
     577      continue;
     578    }
     579    for (Int j=i+1; j<i+iNumSPInOneLine-i%iNumSPInOneLine; j++)
     580    {
     581      if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]))
     582      {
     583        uiMergedSPW[i] += iSPWidth;
     584        uiMergedSPW[j] = uiMergedSPH[j] = 0;
     585      }
     586      else
     587      {
     588        break;
     589      }
     590    }
     591  }
     592  //vertical sub-PU merge
     593  for (Int i=0; i<iNumSP-iNumSPInOneLine; i++)
     594  {
     595    if (uiMergedSPW[i]==0 || uiMergedSPH[i]==0)
     596    {
     597      continue;
     598    }
     599    for (Int j=i+iNumSPInOneLine; j<iNumSP; j+=iNumSPInOneLine)
     600    {
     601      if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]) && uiMergedSPW[i]==uiMergedSPW[j])
     602      {
     603        uiMergedSPH[i] += iSPHeight;
     604        uiMergedSPH[j] = uiMergedSPW[j] = 0;
     605      }
     606      else
     607      {
     608        break;
     609      }
     610    }
     611  }
     612}
     613
     614Bool TComPrediction::xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 )
     615{
     616  if( pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr1))
     617  {
     618    return false;
     619  }
     620  if( pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr1))
     621  {
     622    return false;
     623  }
     624
     625  if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) >= 0)
     626  {
     627    if (pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr1))
     628    {
     629      return false;
     630    }
     631  }
     632
     633  if (pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) >= 0)
     634  {
     635    if (pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr1))
     636    {
     637      return false;
     638    }
     639  }
     640  return true;
     641}
     642#endif
    551643
    552644Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
     
    580672      else
    581673      {
    582         if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    583         {
    584           xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     674#if MTK_SPIVMP_F0110
     675        if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
     676        {
     677          Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     678
     679          pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     680
     681          UInt uiW[256], uiH[256];
     682          UInt uiSPAddr[256];
     683
     684          xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);
     685
     686          //MC
     687          for (Int i = 0; i < iNumSP; i++)
     688          {
     689            if (uiW[i]==0 || uiH[i]==0)
     690            {
     691              continue;
     692            }
     693            if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))
     694            {
     695              xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );
     696            }
     697            else
     698            {
     699              xPredInterBi  (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);
     700            }
     701          }
    585702        }
    586703        else
    587704        {
    588           xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    589         }
     705#endif
     706          if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     707          {
     708            xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     709          }
     710          else
     711          {
     712            xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
     713          }
     714#if MTK_SPIVMP_F0110
     715        }
     716#endif
    590717      }
    591718#if H_3D_VSP
     
    631758      else
    632759      {
     760#if MTK_SPIVMP_F0110
     761       if (pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
     762      {
     763        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     764
     765        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     766
     767        UInt uiW[256], uiH[256];
     768        UInt uiSPAddr[256];
     769
     770        xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);
     771        //MC
     772        for (Int i = 0; i < iNumSP; i++)
     773        {
     774          if (uiW[i]==0 || uiH[i]==0)
     775          {
     776            continue;
     777          }
     778          if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))
     779          {
     780            xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );
     781          }
     782          else
     783          {
     784            xPredInterBi  (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);
     785          }
     786        }
     787      }
     788      else
     789      {
     790#endif
    633791        if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    634792        {
     
    639797          xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    640798        }
     799#if MTK_SPIVMP_F0110
     800       }
     801#endif
    641802      }
    642803#if H_3D_VSP
     
    664825  pcCU->clipMv(cMv);
    665826#if H_3D_ARP
     827#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     828  if(pcCU->getARPW( uiPartAddr ) > 0  && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())
     829  {
     830      xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
     831  }
     832  else
     833#endif
    666834  if(  pcCU->getARPW( uiPartAddr ) > 0
    667835    && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N
     
    744912  // fetch virtual depth map
    745913  pcBaseViewDepthPicYuv->extendPicBorder();
     914
     915#if MTK_F0109_LG_F0120_VSP_BLOCK
     916  Int vspSize=0;
     917  xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp,vspSize );
     918  // sub-PU based compensation
     919  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
     920  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
     921#else
    746922  xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp );
    747923  // sub-PU based compensation
    748924  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    749925  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
     926#endif
    750927}
    751928#endif
     
    777954  if( cDistparity.bDV )
    778955  {
     956#if SHARP_ARP_REF_CHECK_F0105
     957    Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList);
     958    if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() )
     959#else
    779960    if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC() )
     961#endif
    780962    {
    781963      bTobeScaled = true;
     
    783965
    784966    pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan );
     967
     968#if SHARP_ARP_REF_CHECK_F0105
     969    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan );
     970
     971    if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan))
     972#else
    785973    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan );
    786974   
    787975    if( ( !pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC() ) || ( !pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ) )
     976#endif
    788977    {
    789978      dW = 0;
     
    792981    else
    793982    {
     983#if SHARP_ARP_REF_CHECK_F0105
     984      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() );
     985#else
    794986      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() );
     987#endif
    795988    }
    796989
     
    8411034  }
    8421035}
     1036#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     1037Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
     1038{
     1039  Int         iRefIdx       = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
     1040  TComMv      cDMv          = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     1041  TComMv      cTempDMv      = cDMv;
     1042  UChar       dW            = pcCU->getARPW ( uiPartAddr );
     1043
     1044  TComPic* pcPicYuvBaseTRef = NULL;
     1045  TComPic* pcPicYuvCurrTRef = NULL;
     1046  TComPic* pcPicYuvBaseCol  = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx ); 
     1047  TComPicYuv* pcYuvBaseCol  = pcPicYuvBaseCol->getPicYuvRec();   
     1048  Bool bTMVAvai = false;     
     1049  TComMv cBaseTMV;
     1050  if( pNewMvFiled )
     1051  {
     1052    iRefIdx = pNewMvFiled->getRefIdx();
     1053    cDMv = pNewMvFiled->getMv();
     1054  }
     1055  pcCU->clipMv(cTempDMv);
     1056
     1057  assert(dW > 0);
     1058#if SHARP_ARP_REF_CHECK_F0105
     1059  if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex()))
     1060  {
     1061    dW = 0;
     1062  }
     1063#endif
     1064  Int uiLCUAddr,uiAbsPartAddr;
     1065  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
     1066  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
     1067
     1068  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
     1069  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 
     1070  pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
     1071  TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
     1072
     1073  if(!pColCU->isIntra(uiAbsPartAddr))
     1074  {
     1075    TComMvField puMVField;
     1076    for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1) && !bTMVAvai; iList ++)
     1077    {
     1078      RefPicList eRefPicListCurr = RefPicList(iList);
     1079      Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr);
     1080      if( iRef != -1)
     1081      {
     1082        pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 
     1083        Int  iCurrPOC    = pColCU->getSlice()->getPOC();
     1084        Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
     1085        Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr);
     1086        if( iCurrRef >= 0)
     1087        {
     1088          pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 
     1089          Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
     1090          {
     1091            pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic(iTargetPOC,  pcPicYuvBaseCol->getViewIndex() ); 
     1092            if(pcPicYuvBaseTRef)
     1093            {
     1094              cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr);
     1095              Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC);
     1096              if ( iScale != 4096 )
     1097                cBaseTMV = cBaseTMV.scaleMv( iScale );                 
     1098              bTMVAvai = true;
     1099              break;
     1100            }
     1101          }
     1102        }
     1103      }
     1104    }
     1105  }
     1106  if (bTMVAvai == false)
     1107  {
     1108    bTMVAvai = true;
     1109    cBaseTMV.set(0, 0);
     1110    pcPicYuvBaseTRef =  pColCU->getSlice()->getRefPic(eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 
     1111    pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic  (eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList));     
     1112  }
     1113
     1114  xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
     1115  xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
     1116
     1117  if( dW > 0 && bTMVAvai )
     1118  {
     1119    TComYuv*    pYuvCurrTRef    = &m_acYuvPredBase[0];
     1120    TComYuv*    pYuvBaseTRef    = &m_acYuvPredBase[1];
     1121    TComPicYuv* pcYuvCurrTref   = pcPicYuvCurrTRef->getPicYuvRec();       
     1122    TComPicYuv* pcYuvBaseTref   = pcPicYuvBaseTRef->getPicYuvRec(); 
     1123    TComMv      cTempMv         = cDMv + cBaseTMV;
     1124
     1125    pcCU->clipMv(cBaseTMV);
     1126    pcCU->clipMv(cTempMv);
     1127
     1128    xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
     1129    xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
     1130    xPredInterLumaBlk  ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true);
     1131    xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true);
     1132
     1133    pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); 
     1134    if(dW == 2)
     1135    {
     1136      pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW );
     1137    }
     1138    rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi );
     1139  }
     1140}
     1141#endif
     1142
    8431143#endif
    8441144
     
    14991799#if H_3D_VSP
    15001800// not fully support iRatioTxtPerDepth* != 1
     1801#if MTK_F0109_LG_F0120_VSP_BLOCK
     1802Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
     1803#else
    15011804Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
     1805#endif
    15021806{
    15031807  Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
     
    15271831  Pel *depth = yuvDepth->getLumaAddr();
    15281832
     1833#if !SHARP_VSP_BLOCK_IN_AMP_F0102
    15291834  if( width<8 || height<8 )
    15301835  { // no split
     
    15461851      depth += depStrideBlock;
    15471852    }
     1853#if MTK_F0109_LG_F0120_VSP_BLOCK
     1854  if(width==4)
     1855    vspSize=0;
     1856  else
     1857    vspSize=1;
     1858#endif
    15481859  }
    15491860  else
     
    15581869    Pel repDepth4x8[2] = {0, 0};
    15591870    Pel repDepth8x4[2] = {0, 0};
    1560 
     1871#endif
     1872
     1873#if !MTK_F0109_LG_F0120_VSP_BLOCK
     1874#if SHARP_VSP_BLOCK_IN_AMP_F0102
     1875    Int blocksize    = 8;
     1876    Int subblocksize = 4;
     1877    Int depStrideBlock = depStride * blocksize;
     1878    Pel *depthTmp = NULL;
     1879    Int depStrideTmp = depStride * nTxtPerDepthY;
     1880    Int offset[4] = { 0, subblocksize-1, subblocksize, blocksize-1 };
     1881    Pel *refDepthTmp[4] = { NULL, NULL, NULL, NULL };
     1882#endif
    15611883    Int refDepStrideBlock    = refDepStride * blocksize;
    15621884    Int refDepStrideSubBlock = refDepStride * subblocksize;
     
    15671889    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
    15681890
     1891#if SHARP_VSP_BLOCK_IN_AMP_F0102
     1892    Int subBlockW, subBlockH;
     1893    Int blockW, blockH;
     1894    subBlockW = subBlockH = 8;
     1895    if (height % 8)
     1896    {
     1897      subBlockW = 8;
     1898      subBlockH = 4;
     1899      blockW = width;  // no further split
     1900      blockH = height; // no further split
     1901    }
     1902    else if (width % 8)
     1903    {
     1904      subBlockW = 4;
     1905      subBlockH = 8;
     1906      blockW = width;  // no further split
     1907      blockH = height; // no further split
     1908    }
     1909    else
     1910    {
     1911      blockW = blockH = 8;
     1912    }
     1913    for( Int y=0; y<height; y+=blockH )
     1914    {
     1915      for( Int x=0; x<width; x+=blockW )
     1916      {
     1917        if (blockW == 8 && blockH == 8)
     1918        {
     1919          Bool ULvsBR = false, URvsBL = false;
     1920          ULvsBR = refDepthTmp[0][x+offset[0]] < refDepthTmp[3][x+offset[3]];
     1921          URvsBL = refDepthTmp[0][x+offset[3]] < refDepthTmp[3][x+offset[0]];
     1922          if( ULvsBR ^ URvsBL )
     1923          { // 4x8
     1924            subBlockW = 4;
     1925            subBlockH = 8;
     1926          }
     1927          else
     1928          {
     1929            subBlockW = 8;
     1930            subBlockH = 4;
     1931          }
     1932        }
     1933        for( Int yy=0; yy<blockH; yy+=subBlockH )
     1934        {
     1935          for( Int xx=0; xx<blockW; xx+=subBlockW )
     1936          {
     1937            Pel  maxDepthVal = 0;
     1938            Int xP0, xP1, yP0, yP1;
     1939            xP0 = x+xx;
     1940            xP1 = x+xx+subBlockW-1;
     1941            yP0 = yy;
     1942            yP1 = yy+subBlockH-1;
     1943            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP0*refDepStride]);
     1944            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP0*refDepStride]);
     1945            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP1*refDepStride]);
     1946            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP1*refDepStride]);
     1947            depthTmp = &depth[x+xx+yy*depStride];
     1948            for( Int sY=0; sY<subBlockH; sY+=nTxtPerDepthY )
     1949            {
     1950              for( Int sX=0; sX<subBlockW; sX+=nTxtPerDepthX )
     1951              {
     1952                depthTmp[sX] = maxDepthVal;
     1953              }
     1954              depthTmp += depStrideTmp;
     1955            }
     1956          }
     1957        }
     1958      }
     1959      refDepthTmp[0] += refDepStrideBlock;
     1960      depth       += depStrideBlock;
     1961    }
     1962#else // SHARP_VSP_BLOCK_IN_AMP_F0102
    15691963    for( Int y=0; y<height; y+=blocksize )
    15701964    {
     
    16622056      depth       += depStrideBlock;
    16632057    }
    1664   }
    1665 
    1666 
    1667 }
    1668 
     2058#endif // SHARP_VSP_BLOCK_IN_AMP_F0102
     2059#else
     2060#if SHARP_VSP_BLOCK_IN_AMP_F0102
     2061  if ((height % 8))
     2062  {
     2063    vspSize = 1; // 8x4
     2064  }
     2065  else if ((width % 8))
     2066  {
     2067    vspSize = 0; // 4x8
     2068  }
     2069  else
     2070  {
     2071    Bool ULvsBR, URvsBL;
     2072    ULvsBR = refDepth[0]       < refDepth[refDepStride * (height-1) + width-1];
     2073    URvsBL = refDepth[width-1] < refDepth[refDepStride * (height-1)];
     2074    vspSize = ( ULvsBR ^ URvsBL ) ? 0 : 1;
     2075  }
     2076  Int subBlockW, subBlockH;
     2077  Int depStrideTmp = depStride * nTxtPerDepthY;
     2078  if (vspSize)
     2079  {
     2080    subBlockW = 8;
     2081    subBlockH = 4;
     2082  }
     2083  else
     2084  {
     2085    subBlockW = 4;
     2086    subBlockH = 8;
     2087  }
     2088  for( Int y=0; y<height; y+=subBlockH )
     2089  {
     2090    Pel *refDepthTmp[4];
     2091    refDepthTmp[0] = refDepth + refDepStride * y;
     2092    refDepthTmp[1] = refDepthTmp[0] + subBlockW - 1;
     2093    refDepthTmp[2] = refDepthTmp[0] + refDepStride * (subBlockH - 1);
     2094    refDepthTmp[3] = refDepthTmp[2] + subBlockW - 1;
     2095    for( Int x=0; x<width; x+=subBlockW )
     2096    {
     2097      Pel  maxDepthVal;
     2098      maxDepthVal = refDepthTmp[0][x];
     2099      maxDepthVal = std::max( maxDepthVal, refDepthTmp[1][x]);
     2100      maxDepthVal = std::max( maxDepthVal, refDepthTmp[2][x]);
     2101      maxDepthVal = std::max( maxDepthVal, refDepthTmp[3][x]);
     2102      Pel *depthTmp = &depth[x+y*depStride];
     2103      for( Int sY=0; sY<subBlockH; sY+=nTxtPerDepthY )
     2104      {
     2105        for( Int sX=0; sX<subBlockW; sX+=nTxtPerDepthX )
     2106        {
     2107          depthTmp[sX] = maxDepthVal;
     2108        }
     2109        depthTmp += depStrideTmp;
     2110      }
     2111    }
     2112  }
     2113#else // SHARP_VSP_BLOCK_IN_AMP_F0102
     2114    Int refDepStrideBlock    = refDepStride * height;
     2115    Int refDepStrideSubBlock = refDepStride * height/2;
     2116    refDepthTmp[0] = refDepth;
     2117    refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock;
     2118    refDepthTmp[1] = refDepthTmp[2] - refDepStride;
     2119    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
     2120    offset[3] = width-1;
     2121    Bool ULvsBR = false, URvsBL = false;
     2122    ULvsBR = refDepthTmp[0][0+offset[0]] < refDepthTmp[3][0+offset[3]];
     2123    URvsBL = refDepthTmp[0][0+offset[3]] < refDepthTmp[3][0+offset[0]];
     2124    refDepStrideBlock    = refDepStride * blocksize;
     2125    refDepStrideSubBlock = refDepStride * subblocksize;
     2126    refDepthTmp[0] = refDepth;
     2127    refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock;
     2128    refDepthTmp[1] = refDepthTmp[2] - refDepStride;
     2129    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
     2130    offset[3] = blocksize-1;
     2131    if( ULvsBR ^ URvsBL )
     2132    {
     2133    vspSize = 0;//4x8
     2134    for( Int y=0; y<height; y+=blocksize )
     2135    {
     2136      for( Int x=0; x<width; x+=blocksize )
     2137      {
     2138        { // 4x8
     2139          repDepth4x8[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[1]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[1]];
     2140          if( repDepth4x8[0] < refDepthTmp[3][x+offset[0]] )
     2141          {
     2142            repDepth4x8[0] = refDepthTmp[3][x+offset[0]];
     2143          }
     2144          if( repDepth4x8[0] < refDepthTmp[3][x+offset[1]] )
     2145          {
     2146            repDepth4x8[0] = refDepthTmp[3][x+offset[1]];
     2147          }
     2148          repDepth4x8[1] = refDepthTmp[0][x+offset[2]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[2]] : refDepthTmp[0][x+offset[3]];
     2149          if( repDepth4x8[1] < refDepthTmp[3][x+offset[2]] )
     2150          {
     2151            repDepth4x8[1] = refDepthTmp[3][x+offset[2]];
     2152          }
     2153          if( repDepth4x8[1] < refDepthTmp[3][x+offset[3]] )
     2154          {
     2155            repDepth4x8[1] = refDepthTmp[3][x+offset[3]];
     2156  }
     2157
     2158          depthTmp = &depth[x];
     2159          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
     2160          {
     2161            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
     2162            {
     2163              depthTmp[sX] = repDepth4x8[0];
     2164            }
     2165            depthTmp += depStrideTmp;
     2166          }
     2167          depthTmp = &depth[x+subblocksize];
     2168          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
     2169          {
     2170            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
     2171            {
     2172              depthTmp[sX] = repDepth4x8[1];
     2173            }
     2174            depthTmp += depStrideTmp;
     2175          }
     2176        }
     2177      }
     2178      refDepthTmp[0] += refDepStrideBlock;
     2179      refDepthTmp[1] += refDepStrideBlock;
     2180      refDepthTmp[2] += refDepStrideBlock;
     2181      refDepthTmp[3] += refDepStrideBlock;
     2182      depth       += depStrideBlock;
     2183    }
     2184  }
     2185  else
     2186  { // 8x4
     2187    vspSize = 1;
     2188    for( Int y=0; y<height; y+=blocksize )
     2189    {
     2190      for( Int x=0; x<width; x+=blocksize )
     2191      {
     2192        repDepth8x4[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[3]];
     2193        if( repDepth8x4[0] < refDepthTmp[1][x+offset[0]] )
     2194        {
     2195          repDepth8x4[0] = refDepthTmp[1][x+offset[0]];
     2196        }
     2197        if( repDepth8x4[0] < refDepthTmp[1][x+offset[3]] )
     2198        {
     2199          repDepth8x4[0] = refDepthTmp[1][x+offset[3]];
     2200        }
     2201        repDepth8x4[1] = refDepthTmp[2][x+offset[0]] > refDepthTmp[2][x+offset[3]] ? refDepthTmp[2][x+offset[0]] : refDepthTmp[2][x+offset[3]];
     2202        if( repDepth8x4[1] < refDepthTmp[3][x+offset[0]] )
     2203        {
     2204          repDepth8x4[1] = refDepthTmp[3][x+offset[0]];
     2205        }
     2206        if( repDepth8x4[1] < refDepthTmp[3][x+offset[3]] )
     2207        {
     2208          repDepth8x4[1] = refDepthTmp[3][x+offset[3]];
     2209        }
     2210
     2211        depthTmp = &depth[x];
     2212        for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
     2213        {
     2214          for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
     2215          {
     2216            depthTmp[sX] = repDepth8x4[0];
     2217          }
     2218          depthTmp += depStrideTmp;
     2219        }
     2220        for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
     2221        {
     2222          for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
     2223          {
     2224            depthTmp[sX] = repDepth8x4[1];
     2225          }
     2226          depthTmp += depStrideTmp;
     2227}
     2228      }
     2229      refDepthTmp[0] += refDepStrideBlock;
     2230      refDepthTmp[1] += refDepStrideBlock;
     2231      refDepthTmp[2] += refDepStrideBlock;
     2232      refDepthTmp[3] += refDepStrideBlock;
     2233      depth       += depStrideBlock;
     2234    }
     2235  }
     2236#endif   
     2237#endif
     2238#if !SHARP_VSP_BLOCK_IN_AMP_F0102
     2239  }
     2240#endif
     2241
     2242
     2243}
     2244#if MTK_F0109_LG_F0120_VSP_BLOCK
     2245Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize)
     2246#else
    16692247Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
     2248#endif
    16702249{
    16712250  Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
    16722251  Int nTxtPerDepthY = H_3D_VSP_BLOCKSIZE;
    16732252 
     2253#if MTK_F0109_LG_F0120_VSP_BLOCK
     2254  nTxtPerDepthX = nTxtPerDepthX << vspSize;
     2255  nTxtPerDepthY = nTxtPerDepthY << (1-vspSize);
     2256#endif
    16742257  Int refStride = picRef->getStride();
    16752258  Int dstStride = yuvDst->getStride();
     
    17772360}
    17782361
     2362#if MTK_F0109_LG_F0120_VSP_BLOCK
     2363Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize)
     2364#else
    17792365Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
     2366#endif
    17802367{
    17812368#if (H_3D_VSP_BLOCKSIZE==1)
     
    17872374#endif
    17882375
     2376#if MTK_F0109_LG_F0120_VSP_BLOCK
     2377  nTxtPerDepthX = nTxtPerDepthX << vspSize;
     2378  nTxtPerDepthY = nTxtPerDepthY << (1-vspSize);
     2379#endif
    17892380  Int refStride = picRef->getCStride();
    17902381  Int dstStride = yuvDst->getCStride();
     
    19682559
    19692560#if H_3D_DIM_DMM
     2561#if !SEC_DMM3_RBC_F0147
    19702562UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx )
    19712563{
     
    19792571  return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx);
    19802572}
     2573#endif
    19812574
    19822575Void TComPrediction::xPredContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge )
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r655 r724  
    9393#if H_3D_ARP
    9494  Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
     95#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     96  Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );
     97#endif
    9598#endif
    9699  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
     
    120123
    121124#if H_3D_VSP
     125#if MTK_F0109_LG_F0120_VSP_BLOCK
     126  Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int txtPerDepthX=1, Int txtPerDepthY=1 );
     127  Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize);
     128  Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize);
     129#else
    122130  Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int txtPerDepthX=1, Int txtPerDepthY=1 );
    123131  Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
    124132  Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
    125133#endif
     134#endif
    126135
    127136  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
     
    133142  Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
    134143  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
    135 
     144#if MTK_SPIVMP_F0110
     145  Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );
     146  Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );
     147#endif
    136148#if H_3D_DIM
    137149  // depth intra functions
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r655 r724  
    604604std::vector< std::vector<TComWedgeRef>  > g_dmmWedgeRefLists;
    605605std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;
     606#if !SEC_DMM3_RBC_F0147
    606607std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
     608#endif
    607609
    608610Void initWedgeLists( Bool initNodeList )
     
    723725  }
    724726
     727#if !SEC_DMM3_RBC_F0147
    725728  UInt uiThrSz = DMM3_SIMPLIFY_TR;
    726729  std::vector< std::vector<UInt> > auiWdgListSz;
     
    739742  }
    740743  g_aauiWdgLstM3.push_back(auiWdgListSz);
     744#endif
    741745}
    742746
  • trunk/source/Lib/TLibCommon/TComRom.h

    r655 r724  
    172172extern       std::vector< std::vector<TComWedgeRef> >        g_dmmWedgeRefLists;
    173173extern       std::vector< std::vector<TComWedgeNode> >       g_dmmWedgeNodeLists;
     174#if !SEC_DMM3_RBC_F0147
    174175extern       std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
     176#endif
    175177
    176178Void initWedgeLists( Bool initNodeList = false );
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r655 r724  
    751751    if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0)
    752752        continue;
    753 
     753#if !SHARP_ARP_REF_CHECK_F0105
     754// move the following to setARPStepNum() to define ARP related thing in ARP function.
     755#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     756     for(Int i = 0; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
     757       {
     758       if ( this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() != getPOC() )
     759       {
     760         this->setFirstTRefIdx (RefPicList(uiRefListIdx), i);
     761         break;
     762       }
     763     }
     764#endif
     765#endif
    754766    Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm();
    755767    for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
     
    18261838#if H_3D_IV_MERGE
    18271839    m_ivMvPredFlag         [ i ] = false;
     1840#if MTK_SPIVMP_F0110
     1841    m_iSubPULog2Size       [ i ] = 0;
     1842#endif
    18281843#endif
    18291844#if H_3D_VSP
     
    18351850#if H_3D_INTER_SDC
    18361851    m_bInterSDCFlag        [ i ] = false;
     1852#endif
     1853#if SEC_MPI_ENABLING_MERGE_F0150
     1854    m_bMPIFlag             [ i ] = false;
    18371855#endif
    18381856  } 
     
    28312849
    28322850#if H_3D_ARP
     2851#if SHARP_ARP_REF_CHECK_F0105
     2852Void TComSlice::setARPStepNum( TComPicLists*ivPicLists )
     2853#else
    28332854Void TComSlice::setARPStepNum()                                 
    2834 {
     2855#endif
     2856{
     2857#if SHARP_ARP_REF_CHECK_F0105
     2858  Bool tempRefPicInListsFlag = false;
     2859#else
    28352860  Bool bAllIvRef = true;
    2836 
     2861#endif
     2862#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     2863  if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP())
     2864#else
    28372865  if(!getVPS()->getUseAdvRP(getLayerId()))
     2866#endif
    28382867  {
    28392868    m_nARPStepNum = 0;
     
    28412870  else
    28422871  {
     2872#if SHARP_ARP_REF_CHECK_F0105
     2873    setFirstTRefIdx (REF_PIC_LIST_0, -1);
     2874    setFirstTRefIdx (REF_PIC_LIST_1, -1);
     2875    for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ )
     2876    {
     2877      for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ )
     2878      {
     2879        if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() )
     2880        {
     2881          setFirstTRefIdx (RefPicList(refListIdx), i);
     2882          break;
     2883        }
     2884      }
     2885    }
     2886    tempRefPicInListsFlag = getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0;
     2887    m_nARPStepNum = tempRefPicInListsFlag ? getVPS()->getARPStepNum(getLayerId()) : 0;
     2888#else
    28432889    for( Int iRefListId = 0; iRefListId < 2; iRefListId++ )
    28442890    {
     
    28632909    }
    28642910    m_nARPStepNum = !bAllIvRef ? getVPS()->getARPStepNum(getLayerId()) : 0;
    2865   }
     2911#endif
     2912  }
     2913#if SHARP_ARP_REF_CHECK_F0105
     2914  if (tempRefPicInListsFlag)
     2915  {
     2916    for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ )
     2917    {
     2918      RefPicList eRefPicList = RefPicList( refListIdx );
     2919      Int prevPOC = getRefPic(eRefPicList, getFirstTRefIdx(eRefPicList) )->getPOC();
     2920      for( Int i = 0; i < getNumActiveRefLayerPics(); i++ )
     2921      {
     2922        Int layerIdInNuh = getRefPicLayerId( i );
     2923        Int viewIdx = getVPS()->getViewId( layerIdInNuh );
     2924        TComPic*pcPicPrev = ivPicLists->getPic(viewIdx, 0, prevPOC);
     2925        if (getFirstTRefIdx(eRefPicList) >= 0 && pcPicPrev && pcPicPrev->getSlice( 0 )->isReferenced())
     2926        {
     2927          m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true;
     2928        }
     2929        else
     2930        {
     2931          m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = false;
     2932        }
     2933      }
     2934  }
     2935}
     2936#endif
    28662937}
    28672938#endif
     
    29673038  setupLUT = setupLUT || getVPS()->getDepthRefinementFlag( layerIdInVPS );
    29683039#endif
     3040
     3041#if QC_DEPTH_IV_MRG_F0125
     3042  setupLUT = setupLUT || ( getVPS()->getIvMvPredFlag(layerIdInVPS ) && getIsDepth() );
     3043#endif
    29693044
    29703045  if( !setupLUT )
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r655 r724  
    597597#if H_3D_IV_MERGE
    598598  Bool        m_ivMvPredFlag             [ MAX_NUM_LAYERS ];
     599#if MTK_SPIVMP_F0110
     600  Int         m_iSubPULog2Size           [MAX_NUM_LAYERS   ];
     601#endif
    599602#endif
    600603#if H_3D_VSP
     
    618621#if H_3D_INTER_SDC
    619622  Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
     623#endif
     624#if SEC_MPI_ENABLING_MERGE_F0150
     625  Bool        m_bMPIFlag[MAX_NUM_LAYERS   ];
    620626#endif
    621627
     
    826832  Void    setIvMvPredFlag     ( Int layerIdInVps, Bool val )  { m_ivMvPredFlag[ layerIdInVps ] = val; }
    827833  Bool    getIvMvPredFlag     ( Int layerIdInVps )            { return m_ivMvPredFlag[ layerIdInVps ]; };
     834#if MTK_SPIVMP_F0110
     835  Int     getSubPULog2Size(Int layerIdInVps)           { return m_iSubPULog2Size[layerIdInVps]; }
     836  Void    setSubPULog2Size(Int layerIdInVps, Int u)    { m_iSubPULog2Size[layerIdInVps] = u;}
     837#endif
    828838#endif
    829839#if H_3D_VSP
     
    854864  Void    setInterSDCFlag      ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }
    855865#endif
    856 
     866#if SEC_MPI_ENABLING_MERGE_F0150
     867  Bool    getMPIFlag      ( Int layerIdInVps )           { return m_bMPIFlag[layerIdInVps]; }
     868  Void    setMPIFlag      ( Int layerIdInVps, Bool bval ){ m_bMPIFlag[layerIdInVps] = bval; }
     869#endif
    857870#endif 
    858871#endif
     
    13381351  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
    13391352  Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
     1353#if QC_DEPTH_IV_MRG_F0125
     1354  Void setHasCamParInSliceHeader( Bool b )  { m_bCamParInSliceHeader = b; }
     1355#endif
    13401356  Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
    13411357  Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
     
    17301746#endif
    17311747#if H_3D_ARP
     1748#if SHARP_ARP_REF_CHECK_F0105
     1749  Bool m_arpRefPicAvailable[2][MAX_NUM_LAYERS];
     1750#endif
    17321751  TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS];
    17331752  UInt                 m_nARPStepNum;
     1753#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     1754  Int         m_aiFirstTRefIdx    [2];
     1755#endif
    17341756#endif
    17351757#if H_3D_IC
     
    18181840#if H_3D_ARP
    18191841  Void      setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx )      { m_pBaseViewRefPicList[iViewIdx] = pListPic;                   }
     1842#if SHARP_ARP_REF_CHECK_F0105
     1843  Void      setARPStepNum( TComPicLists*ivPicLists );
     1844#else
    18201845  Void      setARPStepNum();                                 
     1846#endif
    18211847  TComPic*  getBaseViewRefPic    ( UInt uiPOC , Int iViewIdx )                       { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }
    18221848  UInt      getARPStepNum( )                                                         { return m_nARPStepNum;                                         } 
     
    20192045  Int       getAlterRefIdx          ( RefPicList e )        { return  m_aiAlterRefIdx[e];     }
    20202046#endif
     2047#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     2048  Int       getFirstTRefIdx        ( RefPicList e )                { return  m_aiFirstTRefIdx[e];     }
     2049  Void      setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;      }
     2050#endif
     2051#if SHARP_ARP_REF_CHECK_F0105
     2052  Bool      getArpRefPicAvailable( RefPicList e, Int viewIdx) {return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; }
     2053#endif
    20212054  Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
    20222055  Bool      getIsDepth            ()                 { return m_isDepth; }
  • trunk/source/Lib/TLibCommon/TComWedgelet.h

    r655 r724  
    5050enum DIM_IDX
    5151{
     52#if SEC_DMM3_RBC_F0147
     53  DMM1_IDX = 0,
     54  DMM4_IDX = 1,
     55#else
    5256  DMM1_IDX = 0,
    5357  DMM3_IDX = 1,
    5458  DMM4_IDX = 2,
    5559  RBC_IDX  = 3
     60#endif
    5661};
    5762
     63#if SEC_DMM3_RBC_F0147
     64#define DMM_NUM_TYPE   2
     65#define DIM_NUM_TYPE   (DMM_NUM_TYPE)
     66#else
    5867#define DMM_NUM_TYPE   3
    5968#define RBC_NUM_TYPE   1
    6069#define DIM_NUM_TYPE   (DMM_NUM_TYPE+RBC_NUM_TYPE)
     70#endif
    6171#define DIM_NO_IDX     MAX_UINT
    6272
     
    7585#define DMM_NO_WEDGEINDEX       MAX_UINT
    7686#define DMM_NUM_WEDGE_REFINES   8
     87#if !SEC_DMM3_RBC_F0147
    7788#define DMM3_SIMPLIFY_TR        1
     89#endif
    7890
    7991enum WedgeResolution
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r655 r724  
    6565#define H_3D          ( HEVC_EXT == 2)
    6666
     67
    6768/////////////////////////////////////////////////////////////////////////////////////////
    6869///////////////////////////////////   MAJOR DEFINES   /////////////////////////////////// 
     
    131132                                              // QC_AMVP_MRG_UNIFY_IVCAN_C0051     
    132133                                              // TEXTURE MERGING CANDIDATE     , JCT3V-C0137
    133                                               // QC_INRIA_MTK_MRG_E0126           
     134                                              // QC_INRIA_MTK_MRG_E0126
     135
     136
    134137#define H_3D_TMVP                         1   // QC_TMVP_C0047
    135138                                              // Sony_M23639
     
    162165
    163166
    164 
    165167// OTHERS
    166168                                              // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170
     
    173175#endif
    174176
    175 
    176177// Rate Control
    177178#define KWU_FIX_URQ                       1
     
    212213#if H_3D_DIM
    213214#define H_3D_DIM_DMM                      1   // Depth Modeling Modes
    214 #define H_3D_DIM_RBC                      1   // Region Boundary Chain mode
    215215#define H_3D_DIM_SDC                      1   // Simplified Depth Coding method
    216216#define H_3D_DIM_DLT                      1   // Depth Lookup Table
     
    227227#define H_3D_VSP_CONSTRAINED              0
    228228#endif
    229 
    230229#endif
    231230
     
    243242#define H_3D_FCO_VSP_DONBDV_E0163               0   // Adaptive depth reference for flexible coding order
    244243#endif
     244
     245
     246/////////////////////////////////////////////////////////////////////////////////////////
     247///////////////////////////////////   HTM-9.0 Integrations //////////////////////////////
     248/////////////////////////////////////////////////////////////////////////////////////////
     249
     250#if H_3D
     251
     252#define FIX_MISSING_MACRO_R690                  1 // Missing macro in integration to revision 690
     253
     254#define SEC_MPI_ENABLING_MERGE_F0150            1 // MPI flag in VPS and enabling in Merge mode
     255#define ETRIKHU_MERGE_REUSE_F0093               1 // Reuse HEVC merge candidate list construction for base candidates, JCT3V-F0093
     256
     257#if H_3D_ARP
     258#define QC_MTK_INTERVIEW_ARP_F0123_F0108        1 //JCT3V-F0123; JCT3V-F0108
     259#define SHARP_ARP_REF_CHECK_F0105               1 // ARP reference picture selection and DPB check
     260#define LGE_ARP_CTX_F0161                       1 //JCT3V-F0161
     261#endif
     262
     263#if H_3D_IV_MERGE
     264#define QC_DEPTH_IV_MRG_F0125                   1 // JCT3V-F0125: Depth oriented Inter-view MV candidate
     265#define MTK_SPIVMP_F0110                        1 // JCT3V-F0110: Sub-PU level inter-view motion prediction
     266#define BUGFIX_F0093                            1 // bug fix for F0093 for depth IvMC pruning
     267#define BUGFIX_2_F0093                          1 // bug fix for VSP inheritance
     268#endif
     269
     270#if H_3D_VSP
     271#define MTK_F0109_LG_F0120_VSP_BLOCK            1 // MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120 
     272#define SHARP_VSP_BLOCK_IN_AMP_F0102            1 // VSP partitioning for AMP
     273#define MTK_VSP_SIMPLIFICATION_F0111            1 // 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss
     274#define LGE_SHARP_VSP_INHERIT_F0104             1
     275#endif
     276
     277#define LGE_BUGFIX_F0158                        1 //JCT3V-F0158
     278#define LGE_IC_CTX_F0160                        1 //JCT3V-F0160
     279#define SEC_ONLY_TEXTURE_IC_F0151               1
     280
     281#if H_3D_DIM
     282#define SEC_DMM3_RBC_F0147                      1 // Removal of DMM3 and RBC from DMMs
     283#if !SEC_DMM3_RBC_F0147
     284#define H_3D_DIM_RBC                            1 // Region Boundary Chain mode
     285#endif
     286#define QC_DIM_DELTADC_UNIFY_F0132              1 // Unify delta DC coding in depth intra modes
     287#define HHI_DIM_PREDSAMP_FIX_F0171              1
     288#define LGE_PRED_RES_CODING_DLT_DOMAIN_F0159    1 //JCT3V-F0159
     289#endif
     290#endif
     291
    245292
    246293/////////////////////////////////////////////////////////////////////////////////////////
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r655 r724  
    12451245    pcVPS->setARPStepNum( i, 1 );
    12461246#endif 
     1247#if MTK_SPIVMP_F0110
     1248    pcVPS->setSubPULog2Size(i, 0);
     1249#endif
    12471250    if ( i != 0 )
    12481251    {
     
    12511254#if H_3D_IV_MERGE
    12521255        READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
     1256#if MTK_SPIVMP_F0110
     1257        READ_UVLC (uiCode, "log2_sub_PU_size_minus2");     pcVPS->setSubPULog2Size(i, uiCode+2);
     1258#endif
    12531259#endif
    12541260#if H_3D_ARP
     
    12651271      else
    12661272      {
    1267 
     1273#if QC_DEPTH_IV_MRG_F0125 && H_3D_IV_MERGE
     1274        if(i!=1)
     1275        {
     1276          READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
     1277        }
     1278#endif
     1279#if MTK_SPIVMP_F0110
     1280        if (i!=1)
     1281        {
     1282          READ_UVLC (uiCode, "log2_sub_PU_size_minus2");     pcVPS->setSubPULog2Size(i, uiCode+2);
     1283        }
     1284#endif
     1285#if SEC_MPI_ENABLING_MERGE_F0150
     1286        READ_FLAG( uiCode, "mpi_flag[i]" );             pcVPS->setMPIFlag( i, uiCode == 1 ? true : false );
     1287#endif
    12681288        READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
    12691289        //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false );
     
    17951815    }
    17961816#if H_3D_IC
     1817#if SEC_ONLY_TEXTURE_IC_F0151
     1818    else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth())
     1819#else
    17971820    else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) )
     1821#endif
    17981822    {
    17991823      UInt uiCodeTmp = 0;
     
    18131837      READ_UVLC( uiCode, "five_minus_max_num_merge_cand");
    18141838#if H_3D_IV_MERGE
     1839#if SEC_MPI_ENABLING_MERGE_F0150
     1840      if(rpcSlice->getIsDepth())
     1841      {
     1842        Bool bMPIFlag = rpcSlice->getVPS()->getMPIFlag( rpcSlice->getLayerIdInVps() ) ;
     1843        Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ;
     1844        rpcSlice->setMaxNumMergeCand(( ( bMPIFlag || ivMvPredFlag ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
     1845      }
     1846      else
     1847      {
     1848        Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ;
     1849        rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
     1850      }
     1851#else
    18151852      Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ;
    18161853      rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
     1854#endif
    18171855#else
    18181856      rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r655 r724  
    135135Void TDecCu::decompressCU( TComDataCU* pcCU )
    136136{
     137#if !QC_DEPTH_IV_MRG_F0125
    137138  xDecompressCU( pcCU, 0,  0 );
     139#endif
    138140}
    139141
     
    313315      m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
    314316      m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
     317#if QC_DEPTH_IV_MRG_F0125
     318      if( pcCU->getSlice()->getIsDepth())
     319      {
     320        DvInfo.bDV = m_ppcCU[uiDepth]->getDispNeighBlocks(0, 0, &DvInfo);
     321      }
     322      else
     323      {
     324#endif
    315325#if H_3D_NBDV_REF
    316326      if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() ))  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
     
    323333        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
    324334      }
    325 
     335#if QC_DEPTH_IV_MRG_F0125
     336      }
     337#endif
    326338#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
    327339      if ( g_decTraceDispDer )
     
    378390    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    379391
     392#if LGE_SHARP_VSP_INHERIT_F0104
     393#if H_3D_IC
     394    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     395#endif
     396#if H_3D_ARP
     397    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
     398#endif
     399#endif
     400
    380401#if H_3D_VSP
    381402    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    382403    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    383404    InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
     405#if MTK_SPIVMP_F0110
     406    Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
     407    memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     408    TComMvField*  pcMvFieldSP;
     409    UChar* puhInterDirSP;
     410    pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];
     411    puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
     412#endif
     413#if ETRIKHU_MERGE_REUSE_F0093
     414    m_ppcCU[uiDepth]->initAvailableFlags();
     415    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     416    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
     417#if MTK_SPIVMP_F0110
     418      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
     419#endif
     420      , numValidMergeCand, uiMergeIndex );
     421#else
    384422    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
     423#endif
    385424    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    386425#else
     426#if ETRIKHU_MERGE_REUSE_F0093
     427    m_ppcCU[uiDepth]->initAvailableFlags();
    387428    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     429    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     430#else
     431    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     432#endif
    388433#endif
    389434#if H_3D_VSP
     
    423468      }
    424469    }
     470#if MTK_SPIVMP_F0110
     471    pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
     472    if (bSPIVMPFlag[uiMergeIndex])
     473    {
     474      UInt uiSPAddr;
     475      Int iWidth = pcCU->getWidth(uiAbsPartIdx);
     476      Int iHeight = pcCU->getHeight(uiAbsPartIdx);
     477
     478      Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     479
     480      pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     481
     482      for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
     483      {
     484        pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
     485        pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
     486        pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
     487        pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
     488      }
     489    }
     490    delete pcMvFieldSP;
     491    delete puhInterDirSP;
     492#endif
     493#if !LGE_SHARP_VSP_INHERIT_F0104
    425494#if H_3D_IC
    426495    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    429498    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
    430499#endif
     500#endif
     501
    431502    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     503#if QC_DEPTH_IV_MRG_F0125
     504    xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
     505#endif
    432506    return;
    433507  }
     
    443517    {
    444518      xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     519#if QC_DEPTH_IV_MRG_F0125
     520      xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
     521#endif
    445522      return;
    446523    }
     
    452529  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
    453530  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
     531#if !LGE_SHARP_VSP_INHERIT_F0104
    454532#if H_3D_IC
    455533  m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    458536  m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth ); 
    459537#endif 
     538#endif
    460539#if H_3D_INTER_SDC
    461540  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    466545  setdQPFlag( bCodeDQP );
    467546  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     547#if QC_DEPTH_IV_MRG_F0125
     548  xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
     549#endif
    468550}
    469551
     
    481563{
    482564  TComPic* pcPic = pcCU->getPic();
    483  
     565#if !QC_DEPTH_IV_MRG_F0125 
    484566  Bool bBoundary = false;
    485567  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
     
    516598    return;
    517599  }
    518  
     600#endif 
    519601  // Residual reconstruction
    520602  m_ppcYuvResi[uiDepth]->clear();
     
    693775    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    694776    {
     777#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
     778        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     779        {
     780            pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
     781        }
     782        else
     783        {
    695784      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
     785        }
     786#else
     787      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
     788#endif
    696789      pRecIPred[ uiX ] = pReco[ uiX ];
    697790    }
  • trunk/source/Lib/TLibDecoder/TDecEntropy.cpp

    r655 r724  
    111111  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
    112112
     113#if SEC_ONLY_TEXTURE_IC_F0151
     114  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
     115#else
    113116  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) )
     117#endif
    114118  {
    115119    return;
     
    209213  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    210214#endif
    211 
     215#if MTK_SPIVMP_F0110
     216  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
     217  TComMvField*  pcMvFieldSP;
     218  UChar* puhInterDirSP;
     219  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];
     220  puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
     221#endif
    212222  for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ )
    213223  {
     
    235245      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
    236246      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     247#if LGE_SHARP_VSP_INHERIT_F0104
     248#if H_3D_IC
     249      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     250#endif
     251#if H_3D_ARP
     252      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
     253#endif
     254#endif
    237255      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
    238256      {
     
    244262          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    245263          InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
     264#if MTK_SPIVMP_F0110
     265          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     266#endif
     267#if ETRIKHU_MERGE_REUSE_F0093
     268          pcSubCU->initAvailableFlags();
     269          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     270          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
     271#if MTK_SPIVMP_F0110
     272            , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
     273#endif
     274            , numValidMergeCand );
     275#else
    246276          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
     277#endif
    247278          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    248279
     
    252283          }
    253284#else
     285#if ETRIKHU_MERGE_REUSE_F0093
     286          pcSubCU->initAvailableFlags();
     287          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     288          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     289
     290#else
    254291          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     292#endif
    255293#endif
    256294          isMerged = true;
     
    265303        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    266304        InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
     305#if MTK_SPIVMP_F0110
     306        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     307#endif
     308#if ETRIKHU_MERGE_REUSE_F0093
     309        pcSubCU->initAvailableFlags();
     310        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     311        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
     312#if MTK_SPIVMP_F0110
     313          , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
     314#endif
     315          ,numValidMergeCand, uiMergeIndex );
     316#else
    267317        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex );
     318#endif
    268319        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    269320        if(vspFlag[uiMergeIndex])
     
    272323        }
    273324#else
     325#if ETRIKHU_MERGE_REUSE_F0093
     326        pcSubCU->initAvailableFlags();
    274327        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     328        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     329#else
     330        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     331#endif
    275332#endif
    276333      }
     
    288345        }
    289346      }
     347#if MTK_SPIVMP_F0110
     348      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
     349      if (bSPIVMPFlag[uiMergeIndex] != 0)
     350      {
     351        Int iWidth, iHeight;
     352        UInt uiIdx;
     353        pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );
     354
     355        UInt uiSPAddr;
     356
     357        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     358
     359        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     360
     361        for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
     362        {
     363          pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
     364          pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
     365          pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
     366          pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
     367        }
     368      }
     369#endif
    290370    }
    291371    else
     
    301381        }
    302382      }
     383#if LGE_SHARP_VSP_INHERIT_F0104
     384#if H_3D_IC
     385      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     386#endif
     387#if H_3D_ARP
     388      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
     389#endif
     390#endif
    303391    }
    304392#if H_3D_VSP
     
    313401    }
    314402  }
     403#if MTK_SPIVMP_F0110
     404  delete pcMvFieldSP;
     405  delete puhInterDirSP;
     406#endif
    315407  return;
    316408}
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r655 r724  
    8989#if H_3D_DIM_DMM
    9090, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     91#if !SEC_DMM3_RBC_F0147
    9192, m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     93#endif
    9294#endif
    9395#if H_3D_DIM_RBC
     
    176178#if H_3D_DIM_DMM
    177179  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
     180#if !SEC_DMM3_RBC_F0147
    178181  m_cDmm3DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM3_DATA );
     182#endif
    179183#endif
    180184#if H_3D_DIM_RBC
     
    249253#if H_3D_DIM_DMM
    250254  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     255#if !SEC_DMM3_RBC_F0147
    251256  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
     257#endif
    252258#endif
    253259#if H_3D_DIM_RBC
     
    408414}
    409415
     416#if QC_DIM_DELTADC_UNIFY_F0132
     417Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt uiNumSeg )
     418{
     419  UInt absValDeltaDC = 0;
     420  xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, 0) );
     421  rValDeltaDC = (Pel)absValDeltaDC + ( uiNumSeg > 1 ? 0 : 1 );
     422
     423  if( rValDeltaDC != 0 )
     424  {
     425    UInt uiSign;
     426    m_pcTDecBinIf->decodeBinEP( uiSign );
     427    if ( uiSign )
     428    {
     429      rValDeltaDC = -rValDeltaDC;
     430    }
     431  }
     432}
     433#else
    410434Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt dimType )
    411435{
     
    424448  }
    425449}
     450#endif
     451
    426452#if H_3D_DIM_DMM
    427453Void TDecSbac::xParseDmm1WedgeIdx( UInt& ruiTabIdx, Int iNumBit )
     
    435461  ruiTabIdx = uiIdx;
    436462}
    437 
     463#if !SEC_DMM3_RBC_F0147
    438464Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit )
    439465{
     
    446472  ruiIntraIdx = uiIdx;
    447473}
     474#endif
    448475#endif
    449476#if H_3D_DIM_RBC
     
    11401167      pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
    11411168    } break;
     1169#if !SEC_DMM3_RBC_F0147
    11421170  case( DMM3_IDX ):
    11431171    {
     
    11461174      pcCU->setDmm3IntraTabIdxSubParts( uiIntraIdx, absPartIdx, depth );
    11471175    } break;
     1176#endif
    11481177  case( DMM4_IDX ): break;
    11491178#endif
     
    11571186  }
    11581187
    1159 #if H_3D_DIM_SDC
     1188#if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
    11601189  if( pcCU->getSDCFlag(absPartIdx) )
    11611190  {
     
    11731202  {
    11741203#endif
     1204#if QC_DIM_DELTADC_UNIFY_F0132
     1205    if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
     1206#else
    11751207    if( dimType < DIM_NUM_TYPE )
     1208#endif
    11761209    {
    11771210      UInt symbol;
     1211#if QC_DIM_DELTADC_UNIFY_F0132
     1212      UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1213
     1214      if( pcCU->getSDCFlag( absPartIdx ) )
     1215      {
     1216        assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
     1217        pcCU->setTrIdxSubParts(0, absPartIdx, depth);
     1218        pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
     1219      }
     1220
     1221      m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
     1222
     1223      if( symbol )
     1224      {
     1225        if( !pcCU->getSDCFlag( absPartIdx ) )
     1226        {
     1227          dir += symbol;
     1228        }
     1229      }
     1230      for( UInt segment = 0; segment < uiNumSegments; segment++ )
     1231      {
     1232        Pel valDeltaDC = 0;
     1233        if( symbol )
     1234        {
     1235          xParseDimDeltaDC( valDeltaDC, uiNumSegments );
     1236        }
     1237
     1238        if( pcCU->getSDCFlag( absPartIdx ) )
     1239        {
     1240          pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
     1241        }
     1242        else
     1243        {
     1244          pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
     1245        }
     1246      }
     1247#else
    11781248      m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
    11791249      if( symbol )
     
    11871257        }
    11881258      }
    1189     }
    1190 #if H_3D_DIM_SDC
     1259#endif
     1260    }
     1261#if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
    11911262  }
    11921263#endif
     
    12181289  else if( puIdx == 0 )
    12191290  {
     1291#if SEC_DMM3_RBC_F0147
     1292    while( binNum < 1 && symbol )
     1293#else
    12201294    while( binNum < 3 && symbol )
     1295#endif
    12211296    {
    12221297      ctxDepthMode = puIdx*3 + ((binNum >= 2) ? 2 : binNum);
     
    12251300      binNum++;
    12261301    }
     1302#if SEC_DMM3_RBC_F0147
     1303    if( modeCode == 0 ) { dir = 0;                       sdcFlag = 0;}
     1304    else if( modeCode == 1 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
     1305#else
    12271306         if( modeCode == 0 ) { dir = 0;                       sdcFlag = 0;}
    12281307    else if( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
    12291308    else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
    12301309    else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
     1310#endif
    12311311  }
    12321312  else
    12331313  {
     1314#if SEC_DMM3_RBC_F0147
     1315    while( binNum < 4 && symbol )
     1316    {
     1317      ctxDepthMode = puIdx*3 + ((binNum >= 2) ? 2 : binNum);
     1318      m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1319      modeCode = (modeCode<<1) + symbol;
     1320      binNum++;
     1321    }
     1322    if ( modeCode == 0 )        { dir =  PLANAR_IDX;             sdcFlag = 1;}
     1323    else if ( modeCode == 2 )   { dir = 5;                       sdcFlag = 0;}
     1324    else if ( modeCode == 6 )   { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
     1325    else if ( modeCode == 14 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
     1326    else if ( modeCode == 15 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
     1327#else
    12341328    UInt maxBinNum = 0;
    12351329    m_pcTDecBinIf->decodeBinEP(symbol);
     
    12631357      else if ( modeCode == 3 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
    12641358    }
     1359#endif
    12651360  }
    12661361  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r655 r724  
    9999#if H_3D_DIM
    100100  Void  xReadExGolombLevel   ( UInt& ruiSymbol, ContextModel& rcSCModel  );
     101#if QC_DIM_DELTADC_UNIFY_F0132
     102  Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt uiNumSeg );
     103#else
    101104  Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt dimType );
     105#endif
    102106#if H_3D_DIM_DMM
    103107  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
     108#if !SEC_DMM3_RBC_F0147
    104109  Void  xParseDmm3WedgeIdx   ( UInt& ruiIntraIdx, Int iNumBit );
     110#endif
    105111#endif
    106112#if H_3D_DIM_RBC
     
    213219#if H_3D_DIM_DMM
    214220  ContextModel3DBuffer m_cDmm1DataSCModel;
     221#if !SEC_DMM3_RBC_F0147
    215222  ContextModel3DBuffer m_cDmm3DataSCModel;
     223#endif
    216224#endif
    217225#if H_3D_DIM_RBC
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r655 r724  
    282282}
    283283
     284#if QC_DEPTH_IV_MRG_F0125
     285Void
     286CamParsCollector::copyCamParamForSlice( TComSlice* pcSlice )
     287{
     288  UInt uiViewIndex = pcSlice->getViewIndex();
     289
     290  pcSlice->getSPS()->initCamParaSPS( uiViewIndex, m_uiCamParsCodedPrecision, m_bCamParsVaryOverTime, m_aaiCodedScale, m_aaiCodedOffset );
     291
     292  if( m_bCamParsVaryOverTime )
     293  {
     294    pcSlice->setCamparaSlice( m_aaiCodedScale, m_aaiCodedOffset );
     295  }
     296}
     297#endif
     298
    284299Bool
    285300CamParsCollector::xIsComplete()
     
    951966    pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true );
    952967#if H_3D_ARP
     968#if SHARP_ARP_REF_CHECK_F0105
     969    pcSlice->setARPStepNum(m_ivPicLists);
     970#else
    953971    pcSlice->setARPStepNum();
     972#endif
    954973    if( pcSlice->getARPStepNum() > 1 )
    955974    {
     
    10531072  }
    10541073
     1074#if QC_DEPTH_IV_MRG_F0125
     1075  if( pcSlice->getIsDepth() && m_pcCamParsCollector )
     1076  {
     1077    m_pcCamParsCollector->copyCamParamForSlice( pcSlice );
     1078  }
     1079#endif
     1080
    10551081  //  Decode a picture
    10561082  m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic);
     
    10601086    m_pcCamParsCollector->setSlice( pcSlice );
    10611087  }
     1088#if QC_DEPTH_IV_MRG_F0125
     1089  if( pcSlice->getIsDepth() )
     1090  {
     1091    pcSlice->getSPS()->setHasCamParInSliceHeader( false );
     1092  }
     1093#endif
    10621094#endif
    10631095  m_bFirstSliceInPicture = false;
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r655 r724  
    7777  Bool  isInitialized() const     { return m_bInitialized; }
    7878  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
     79
     80#if QC_DEPTH_IV_MRG_F0125
     81  Void  copyCamParamForSlice( TComSlice* pcSlice );
     82#endif
    7983
    8084private:
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r655 r724  
    10061006#if H_3D_IV_MERGE
    10071007        WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
     1008#if MTK_SPIVMP_F0110
     1009        WRITE_UVLC( pcVPS->getSubPULog2Size(i)-2, "log2_sub_PU_size_minus2[i]");
     1010#endif
    10081011#endif
    10091012#if H_3D_ARP
     
    10191022      else
    10201023      {
     1024#if QC_DEPTH_IV_MRG_F0125
     1025        if(i!=1)
     1026        {
     1027          WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
     1028        }
     1029#endif
     1030#if MTK_SPIVMP_F0110
     1031        if (i!=1)
     1032        {
     1033          WRITE_UVLC( pcVPS->getSubPULog2Size(i)-2, "log2_sub_PU_size_minus2[i]");
     1034        }
     1035#endif
     1036#if SEC_MPI_ENABLING_MERGE_F0150
     1037        WRITE_FLAG( pcVPS->getMPIFlag( i ) ? 1 : 0 ,          "mpi_flag[i]" );
     1038#endif
    10211039        WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 ,          "vps_depth_modes_flag[i]" );
    10221040        //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     );
     
    13871405    }
    13881406#if H_3D_IC
     1407#if SEC_ONLY_TEXTURE_IC_F0151
     1408    else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth())
     1409#else
    13891410    else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) )
     1411#endif
    13901412    {
    13911413      WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );
     
    14051427    {
    14061428#if H_3D_IV_MERGE
     1429#if SEC_MPI_ENABLING_MERGE_F0150
     1430      if(pcSlice->getIsDepth())
     1431      {
     1432        Bool bMPIFlag = pcSlice->getVPS()->getMPIFlag( pcSlice->getLayerIdInVps() ) ;
     1433        Bool ivMvPredFlag = pcSlice->getVPS()->getIvMvPredFlag( pcSlice->getLayerIdInVps() ) ;
     1434        WRITE_UVLC( ( ( bMPIFlag || ivMvPredFlag ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
     1435      }
     1436      else
     1437      {
     1438        Bool ivMvPredFlag = pcSlice->getVPS()->getIvMvPredFlag( pcSlice->getLayerIdInVps() ) ;
     1439        WRITE_UVLC( ( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
     1440      }
     1441#else
    14071442      Bool ivMvPredFlag = pcSlice->getVPS()->getIvMvPredFlag( pcSlice->getLayerIdInVps() ) ;
    14081443      WRITE_UVLC( ( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
     1444#endif
    14091445#else
    14101446      WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
     
    14521488    WRITE_UVLC(0,"slice_header_extension_length"); //<- this element needs to be set to the correct value!!
    14531489
     1490#if QC_DEPTH_IV_MRG_F0125
     1491    if( pcSlice->getSPS()->hasCamParInSliceHeader() && !pcSlice->getIsDepth() )
     1492#else
    14541493    if( pcSlice->getSPS()->hasCamParInSliceHeader() )
     1494#endif
    14551495    {
    14561496      for( UInt uiId = 0; uiId < pcSlice->getViewIndex(); uiId++ )
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r655 r724  
    403403  UInt      m_uiARPStepNum;
    404404#endif
     405#if MTK_SPIVMP_F0110
     406  Int      m_iSubPULog2Size;
     407#endif
    405408#if H_3D_IC
    406409  Bool      m_bUseIC;
     
    412415#if H_3D_DIM
    413416  Bool      m_useDMM;
     417#if !SEC_DMM3_RBC_F0147
    414418  Bool      m_useRBC;
     419#endif
    415420  Bool      m_useSDC;
    416421  Bool      m_useDLT;
     422#endif
     423#if SEC_MPI_ENABLING_MERGE_F0150
     424  Bool      m_useMPI;
    417425#endif
    418426#if H_3D_QTLPC
     
    500508  UInt       getARPStepNum                  ()               { return m_uiARPStepNum;    }
    501509  Void       setARPStepNum                  ( UInt  u )      { m_uiARPStepNum = u;       }
     510#endif
     511#if MTK_SPIVMP_F0110
     512  Int        getSubPULog2Size                   ()                   { return m_iSubPULog2Size;}
     513  Void       setSubPULog2Size                   (Int u)              { m_iSubPULog2Size = u; }     
    502514#endif
    503515
     
    980992  Bool      getUseDMM                       ()        { return m_useDMM; }
    981993  Void      setUseDMM                       ( Bool b) { m_useDMM = b;    }
     994#if !SEC_DMM3_RBC_F0147
    982995  Bool      getUseRBC                       ()        { return m_useRBC; }
    983996  Void      setUseRBC                       ( Bool b) { m_useRBC = b;    }
     997#endif
    984998  Bool      getUseSDC                       ()        { return m_useSDC; }
    985999  Void      setUseSDC                       ( Bool b) { m_useSDC = b;    }
     
    9931007  Bool      getUsePC                        ()         { return m_bUsePC;  }
    9941008#endif
     1009#if SEC_MPI_ENABLING_MERGE_F0150
     1010  Void      setUseMPI                       ( Bool b ) { m_useMPI = b;    }
     1011  Bool      getUseMPI                       ()         { return m_useMPI; }
     1012#endif
    9951013#endif // H_3D
    9961014};
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r655 r724  
    497497#endif
    498498#if H_3D_IC
     499#if SEC_ONLY_TEXTURE_IC_F0151
     500  Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth();
     501#else
    499502  Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE );
     503#endif
    500504  bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC();
    501505#endif
     
    567571          PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
    568572          rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
     573#if QC_DEPTH_IV_MRG_F0125
     574          if (rpcTempCU->getSlice()->getIsDepth() )
     575          {
     576            DvInfo.bDV = rpcTempCU->getDispNeighBlocks(0, 0, &DvInfo);
     577