Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibCommon


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

Reintegrated branch 5.1-dev0 rev. 295.

Location:
trunk/source/Lib/TLibCommon
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/CommonDef.h

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

    r56 r296  
    5656Void ContextModel::init( Int qp, Int initValue )
    5757{
    58 #if H0736_AVC_STYLE_QP_RANGE
    5958  qp = Clip3(0, 51, qp);
    60 #endif
    6159
    62 #if CABAC_LINEAR_INIT
    6360  Int  slope      = (initValue>>4)*5 - 45;
    6461  Int  offset     = ((initValue&15)<<3)-16;
     
    6663  UInt mpState    = (initState >= 64 );
    6764  m_ucState       = ( (mpState? (initState - 64):(63 - initState)) <<1) + mpState;
    68 #else
    69   Int m = m_slopes[initValue>>4];
    70   Int n = initValue & 15;
    71  
    72   Int val = max( 0, min( 3839, (n<<8) + m * (qp-26) + 128 ) );
    73   val -= 1920;
    74   Int valMps = val >= 0;
    75   val = ( val ^ (val>>11) ) + 128;
    76   Int segmentIdx = val >> 8;
    77   Int pStateIdx = m_accumulatedSegOffset[segmentIdx] + ( (val&255) * m_segOffset[segmentIdx] >> 8);
    78  
    79   m_ucState = (pStateIdx<<1) + valMps;
    80 #endif
    8165}
    8266
     
    143127#endif
    144128};
    145 #if !CABAC_LINEAR_INIT
    146 const Int ContextModel::m_slopes[16] = { -239, -143, -85, -51, -31, -19, -11, 0, 11, 19, 31, 51, 85, 143, 239, 399 };
    147 const Int ContextModel::m_segOffset[8]            = {   6,  7,  5,  7, 10, 14, 16,  1 };
    148 const Int ContextModel::m_accumulatedSegOffset[8] = {  -3,  3, 10, 15, 22, 32, 46, 62 };
    149 #endif
    150129//! \}
  • trunk/source/Lib/TLibCommon/ContextModel.h

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

    r189 r296  
    5757
    5858#define NUM_MERGE_FLAG_EXT_CTX        1       ///< number of context models for merge flag of merge extended
    59 #if MRG_IDX_CTX_RED
    6059#define NUM_MERGE_IDX_EXT_CTX         1       ///< number of context models for merge index of merge extended
    61 #else
    62 #define NUM_MERGE_IDX_EXT_CTX         4       ///< number of context models for merge index of merge extended
    63 #endif
    64 
    65 #if HHI_INTER_VIEW_RESIDUAL_PRED
     60
     61#if H3D_IVRP
    6662#define NUM_RES_PRED_FLAG_CTX         4       ///< number of context for residual prediction flag
    6763#endif
     
    6965#define NUM_ALF_CTRL_FLAG_CTX         1       ///< number of context models for ALF control flag
    7066#define NUM_PART_SIZE_CTX             4       ///< number of context models for partition size
    71 #if AMP_CTX
    7267#define NUM_CU_AMP_CTX                1       ///< number of context models for partition size (AMP)
    73 #else
    74 #define NUM_CU_X_POS_CTX              2       ///< number of context models for partition size (AMP)
    75 #define NUM_CU_Y_POS_CTX              2       ///< number of context models for partition size (AMP)
    76 #endif
    7768#define NUM_PRED_MODE_CTX             1       ///< number of context models for prediction mode
    7869
     
    9586#define NUM_SIG_FLAG_CTX_LUMA         27      ///< number of context models for luma sig flag
    9687#define NUM_SIG_FLAG_CTX_CHROMA       21      ///< number of context models for chroma sig flag
    97 #if LAST_CTX_REDUCTION
    9888#define NUM_CTX_LAST_FLAG_XY          15      ///< number of context models for last coefficient position
    99 #else
    100 #define NUM_CTX_LAST_FLAG_XY          18      ///< number of context models for last coefficient position
    101 #endif
    102 
    103 #if LEVEL_CTX_LUMA_RED
     89
    10490#define NUM_ONE_FLAG_CTX              24      ///< number of context models for greater than 1 flag
    10591#define NUM_ONE_FLAG_CTX_LUMA         16      ///< number of context models for greater than 1 flag of luma
    10692#define NUM_ONE_FLAG_CTX_CHROMA        8      ///< number of context models for greater than 1 flag of chroma
    107 #if RESTRICT_GR1GR2FLAG_NUMBER
    10893#define NUM_ABS_FLAG_CTX               6      ///< number of context models for greater than 2 flag
    10994#define NUM_ABS_FLAG_CTX_LUMA          4      ///< number of context models for greater than 2 flag of luma
    11095#define NUM_ABS_FLAG_CTX_CHROMA        2      ///< number of context models for greater than 2 flag of chroma
    111 #else
    112 #define NUM_ABS_FLAG_CTX              18      ///< number of context models for greater than 2 flag
    113 #define NUM_ABS_FLAG_CTX_LUMA         12      ///< number of context models for greater than 2 flag of luma
    114 #define NUM_ABS_FLAG_CTX_CHROMA        6      ///< number of context models for greater than 2 flag of chroma
    115 #endif
    116 #else
    117 #define NUM_ONE_FLAG_CTX              32      ///< number of context models for greater than 1 flag
    118 #define NUM_ONE_FLAG_CTX_LUMA         24      ///< number of context models for greater than 1 flag of luma
    119 #define NUM_ONE_FLAG_CTX_CHROMA        8      ///< number of context models for greater than 1 flag of chroma
    120 #if RESTRICT_GR1GR2FLAG_NUMBER
    121 #define NUM_ABS_FLAG_CTX               8      ///< number of context models for greater than 2 flag
    122 #define NUM_ABS_FLAG_CTX_LUMA          6      ///< number of context models for greater than 2 flag of luma
    123 #define NUM_ABS_FLAG_CTX_CHROMA        2      ///< number of context models for greater than 2 flag of chroma
    124 #else
    125 #define NUM_ABS_FLAG_CTX              24      ///< number of context models for greater than 2 flag
    126 #define NUM_ABS_FLAG_CTX_LUMA         18      ///< number of context models for greater than 2 flag of luma
    127 #define NUM_ABS_FLAG_CTX_CHROMA        6      ///< number of context models for greater than 2 flag of chroma
    128 #endif
    129 #endif
    13096
    13197#define NUM_MVP_IDX_CTX               2       ///< number of context models for MVP index
     
    138104#define NUM_SAO_UVLC_CTX              2       ///< number of context models for SAO UVLC
    139105#define NUM_SAO_SVLC_CTX              3       ///< number of context models for SAO SVLC
    140 #if SAO_UNIT_INTERLEAVING
    141106#define NUM_SAO_RUN_CTX               3       ///< number of context models for AO SVLC (filter coeff.)
    142107#define NUM_SAO_MERGE_LEFT_FLAG_CTX   3       ///< number of context models for AO SVLC (filter coeff.)
    143108#define NUM_SAO_MERGE_UP_FLAG_CTX     1       ///< number of context models for AO SVLC (filter coeff.)
    144109#define NUM_SAO_TYPE_IDX_CTX          2       ///< number of context models for AO SVLC (filter coeff.)
    145 #endif
    146 #if CABAC_LINEAR_INIT
    147110#define CNU                          154      ///< dummy initialization value for unused context models 'Context model Not Used'
    148 #else
    149 #define CNU                          119      ///< dummy initialization value for unused context models 'Context model Not Used'
    150 #endif
    151111
    152112#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    153113#define NUM_DMM_FLAG_CTX              1       ///< number of context models for DMM flag
    154114#define NUM_DMM_MODE_CTX              1       ///< number of context models for DMM mode
     115#if LGE_DMM3_SIMP_C0044
     116#define NUM_DMM_DATA_CTX              4       ///< number of context models for DMM data
     117#else
    155118#define NUM_DMM_DATA_CTX              3       ///< number of context models for DMM data
     119#endif
    156120#endif
    157121
     
    177141
    178142// initial probability for split flag
    179 #if CABAC_LINEAR_INIT
    180143static const UChar
    181144INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] = 
     
    223186INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] = 
    224187{
    225 #if MRG_IDX_CTX_RED
    226188  { CNU, },
    227189  { 122, },
    228190  { 137, },
    229 #else
    230   { CNU,  CNU,  CNU,  CNU, },
    231   { 122,  138,  153,  182, },
    232   { 137,  139,  154,  139, },
    233 #endif
    234 };
    235 
    236 #if HHI_INTER_VIEW_RESIDUAL_PRED
     191};
     192
     193#if H3D_IVRP
    237194static const UChar
    238195INIT_RES_PRED_FLAG[3][NUM_RES_PRED_FLAG_CTX] =
     
    252209};
    253210
    254 #if AMP_CTX
    255211static const UChar
    256212INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] = 
     
    260216  { 154, },
    261217};
    262 #else
    263 static const UChar
    264 INIT_CU_X_POS[3][NUM_CU_X_POS_CTX] = 
    265 {
    266   { CNU,  CNU, },
    267   { 154,  139, },
    268   { 154,  139, },
    269 };
    270 
    271 static const UChar
    272 INIT_CU_Y_POS[3][NUM_CU_Y_POS_CTX] = 
    273 {
    274   { CNU,  CNU, },
    275   { 154,  154, },
    276   { 154,  139, },
    277 };
    278 #endif
    279218
    280219static const UChar
     
    354293};
    355294
    356 #if LAST_CTX_REDUCTION
    357295static const UChar
    358296INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] = 
     
    368306  },
    369307};
    370 #else
    371 static const UChar
    372 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] = 
    373 {
    374   { 110,  110,  124,  110,  140,  111,  124,  125,  111,  127,  111,  138,  111,  156,  127,  127,  111,   94,
    375     108,  123,   63,   63,  139,  124,   93,  108,  125,  111,  110,   63,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU,
    376   },
    377   { 125,  110,  124,  110,  125,  110,  153,  125,  111,  111,  110,  153,  139,  111,  111,  111,  125,  139,
    378     108,  123,  108,  152,  124,   94,  123,  137,  139,  110,  110,  154,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU,
    379   },
    380   { 125,  110,  124,  110,  125,  110,  153,  125,  111,  111,  110,  153,  139,  111,  111,  111,  125,  139, 
    381     108,  123,   93,  152,  124,   94,  123,  152,  139,  110,  110,  154,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU,
    382   },
    383 };
    384 #endif
    385308
    386309static const UChar
     
    406329};
    407330
    408 #if LEVEL_CTX_LUMA_RED
    409331static const UChar
    410332INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
     
    415337};
    416338
    417 #if RESTRICT_GR1GR2FLAG_NUMBER
    418339static const UChar
    419340INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
     
    423344  { 107,  167,   91,  107,  107,  167, },
    424345};
    425 #else
    426 static const UChar
    427 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
    428 {
    429   { 138,  139,  111,  153,  139,  111,  136,  167,  139,  167,  153,  139,  152,  139,  140,  152,  184,  141, },
    430   { 107,  153,  125,  167,  153,  140,   91,  137,  153,  122,  167,  139,  107,  153,  140,  167,  183,  140, },
    431   { 107,  153,  125,  167,  153,  140,   91,  137,  153,  107,  167,  139,  107,  153,  140,  167,  183,  140, },
    432 };
    433 #endif
    434 #else
    435 static const UChar
    436 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
    437 {
    438   { 140,   92,  137,  138,  140,  152,  138,  139,  126,  168,  139,  139,  153,   74,  149,   92,  139,  107,  122,  152,  110,   93,  152,  138,  140,  179,  166,  182,  140,  227,  122,  197, },
    439   { 154,  196,  196,  167,  154,  152,  167,  182,  155,  139,  139,  139,  182,  134,  149,  136,  153,  121,  136,  137,  139,  122,  152,  167,  169,  194,  166,  167,  154,  167,  137,  182, },
    440   { 154,  196,  167,  167,  154,  152,  167,  182,  155,  139,  139,  139,  182,  134,  149,  136,  153,  121,  136,  122,  139,  107,  152,  152,  169,  208,  166,  167,  154,  152,  167,  182, },
    441 };
    442 
    443 #if RESTRICT_GR1GR2FLAG_NUMBER
    444 static const UChar
    445 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
    446 {
    447   { 138,  153,  139,  136,  167,  153,  152,  152, },
    448   { 107,  167,  139,   91,  122,  152,  107,  167, },
    449   { 107,  167,  139,   91,  107,   93,  107,  167, },
    450 };
    451 #else
    452 static const UChar
    453 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
    454 {
    455   { 138,  139,  111,  153,  139,  111,  139,  125,  111,  136,  167,  139,  167,  153,  139,  153,  139,  110,  152,  139,  140,  152,  184,  141, },
    456   { 107,  153,  125,  167,  153,  140,  139,  154,  155,   91,  137,  153,  122,  167,  139,  152,  138,  139,  107,  153,  140,  167,  183,  140, },
    457   { 107,  153,  125,  167,  153,  140,  139,  154,  155,   91,  137,  153,  107,  167,  139,   93,  138,  139,  107,  153,  140,  167,  183,  140, },
    458 };
    459 #endif
    460 #endif
    461346
    462347static const UChar
     
    516401};
    517402
    518 #if SAO_UNIT_INTERLEAVING
    519403static const UChar
    520404INIT_SAO_MERGE_LEFT_FLAG[3][NUM_SAO_MERGE_LEFT_FLAG_CTX] =
     
    540424  { 200,  140, },
    541425};
    542 #endif
    543426
    544427static const UChar
     
    549432{ CNU,  153,  138,  138,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU, },
    550433};
     434
     435#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     436#if FIX_DMM_CTX_INIT_C0034
     437static const UChar
    551438#else
     439static const Short
     440#endif
     441INIT_DMM_FLAG[3][NUM_DMM_FLAG_CTX] =
     442{
     443  {
     444    CNU
     445  },
     446  {
     447    CNU
     448  },
     449  {
     450    CNU
     451  }
     452};
     453
     454#if FIX_DMM_CTX_INIT_C0034
    552455static const UChar
    553 INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] =
    554 {
    555   {
    556      87,  74, 107,
    557    
    558   },
    559   {
    560      84, 103, 105,
    561    
    562   },
    563   {
    564      84, 103, 105,
    565    
    566   },
    567 };
    568 
    569 // initial probability for skip flag
     456#else
     457static const Short
     458#endif
     459INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] =
     460{
     461  {
     462    CNU
     463  },
     464  {
     465    CNU
     466  },
     467  {
     468    CNU
     469  }
     470};
     471
     472#if FIX_DMM_CTX_INIT_C0034
    570473static const UChar
    571 INIT_SKIP_FLAG[3][NUM_SKIP_FLAG_CTX] =
    572 {
    573   {
    574     CNU, CNU, CNU,
    575    
    576   },
    577   {
    578     165, 168, 154,
    579    
    580   },
    581   {
    582     165, 168, 154,
    583    
    584   },
    585 };
    586 
    587 // initial probability for skip flag
    588 static const UChar
    589 INIT_ALF_CTRL_FLAG[3][NUM_ALF_CTRL_FLAG_CTX] =
    590 {
    591   {
    592     153,
    593    
    594   },
    595   {
    596      87,
    597    
    598   },
    599   {
    600     135,
    601    
    602   },
    603 };
    604 
    605 // initial probability for merge flag
    606 static const UChar
    607 INIT_MERGE_FLAG_EXT[3][NUM_MERGE_FLAG_EXT_CTX] =
    608 {
    609   {
    610     CNU,
    611    
    612   },
    613   {
    614     72,
    615    
    616   },
    617   {
    618     119,
    619    
    620   },
    621 };
    622 
    623 static const UChar
    624 INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] =
    625 {
    626 #if MRG_IDX_CTX_RED
    627   {
    628     CNU,
    629    
    630   },
    631   {
    632     100,
    633    
    634   },
    635   {
    636     116,
    637   },
    638474#else
    639   {
    640     CNU, CNU, CNU, CNU,
    641    
    642   },
    643   {
    644     100,  86, 102, 133,
    645    
    646   },
    647   {
    648     116,  87, 119, 103,
    649    
    650   },
    651 #endif
    652 };
    653 
    654 // initial probability for PU size
    655 static const UChar
    656 INIT_PART_SIZE[3][NUM_PART_SIZE_CTX] =
    657 {
    658   {
    659     167, CNU, CNU, CNU,
    660    
    661   },
    662   {
    663     119,  87, CNU, CNU,
    664    
    665   },
    666   {
    667     119,  87, CNU, CNU,
    668    
    669   },
    670 };
    671 #if AMP_CTX
    672 static const UChar
    673 INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] =
    674 {
    675   {
    676     CNU,
    677   },
    678   {
    679     119,
    680   },
    681   {
    682     119,
    683   },
    684 };
     475static const Short
     476#endif
     477INIT_DMM_DATA[3][NUM_DMM_DATA_CTX] =
     478{
     479#if LGE_DMM3_SIMP_C0044
     480  {
     481    CNU, CNU, CNU, CNU
     482  },
     483  {
     484    CNU, CNU, CNU, CNU
     485  },
     486  {
     487    CNU, CNU, CNU, CNU
     488  }
    685489#else
    686 // initial probability for AMP split position (X)
    687 static const UChar
    688 INIT_CU_X_POS[3][NUM_CU_X_POS_CTX] =
    689 {
    690   {
    691     CNU, CNU,
    692    
    693   },
    694   {
    695     119, 103,
    696    
    697   },
    698   {
    699     119, 103,
    700    
    701   },
    702 };
    703 
    704 // initial probability for AMP split position (Y)
    705 static const UChar
    706 INIT_CU_Y_POS[3][NUM_CU_Y_POS_CTX] =
    707 {
    708   {
    709     CNU, CNU,
    710    
    711   },
    712   {
    713     119, 119,
    714    
    715   },
    716   {
    717     119, 103,
    718    
    719   },
    720 };
    721 #endif
    722 // initial probability for prediction mode
    723 static const UChar
    724 INIT_PRED_MODE[3][NUM_PRED_MODE_CTX] =
    725 {
    726   {
    727     CNU,
    728    
    729   },
    730   {
    731     114,
    732    
    733   },
    734   {
    735     98,
    736    
    737   },
    738 };
    739 
    740 // initial probability for intra direction of luma
    741 static const UChar
    742 INIT_INTRA_PRED_MODE[3][NUM_ADI_CTX] =
    743 {
    744   {
    745     167,
    746    
    747   },
    748   {
    749     119,
    750    
    751   },
    752   {
    753     150,
    754    
    755   },
    756 };
    757 
    758 // initial probability for intra direction of chroma
    759 static const UChar
    760 INIT_CHROMA_PRED_MODE[3][NUM_CHROMA_PRED_CTX] =
    761 {
    762   {
    763     53, 103,
    764    
    765   },
    766   {
    767     85,  87,
    768    
    769   },
    770   {
    771     101,  87,
    772    
    773   },
    774 };
    775 
    776 // initial probability for temporal direction
    777 static const UChar
    778 INIT_INTER_DIR[3][NUM_INTER_DIR_CTX] =
    779 {
    780   {
    781     CNU, CNU, CNU, CNU,
    782    
    783   },
    784   {
    785     CNU, CNU, CNU, CNU,
    786    
    787   },
    788   {
    789     41,  39,  38,  36,
    790    
    791   },
    792 };
    793 
    794 // initial probability for motion vector difference
    795 static const UChar
    796 INIT_MVD[3][NUM_MV_RES_CTX] =
    797 {
    798   {
    799     CNU, CNU,
    800    
    801   },
    802   {
    803     120, 166,
    804    
    805   },
    806   {
    807     135, 166,
    808    
    809   },
    810 };
    811 
    812 // initial probability for reference frame index
    813 static const UChar
    814 INIT_REF_PIC[3][NUM_REF_NO_CTX] =
    815 {
    816   {
    817     CNU, CNU, CNU, CNU,
    818    
    819   },
    820   {
    821     102, 118, 103, CNU,
    822    
    823   },
    824   {
    825     118, 118, 134, CNU,
    826    
    827   },
    828 };
    829 
    830 // initial probability for dQP
    831 static const UChar
    832 INIT_DQP[3][NUM_DELTA_QP_CTX] =
    833 {
    834   {
    835     CNU, CNU, CNU,
    836    
    837   },
    838   {
    839     CNU, CNU, CNU,
    840    
    841   },
    842   {
    843     CNU, CNU, CNU,
    844    
    845   },
    846 };
    847 
    848 static const UChar
    849 INIT_QT_CBF[3][2*NUM_QT_CBF_CTX] =
    850 {
    851   {
    852      73,  74, CNU, CNU, CNU,
    853      55,  86, 133, CNU, CNU,
    854    
    855   },
    856   {
    857     102,  89, CNU, CNU, CNU,
    858     114,  84, 117, CNU, CNU,
    859    
    860   },
    861   {
    862     102,  89, CNU, CNU, CNU,
    863     114,  68, 117, CNU, CNU,
    864    
    865   },
    866 };
    867 
    868 static const UChar
    869 INIT_QT_ROOT_CBF[3][NUM_QT_ROOT_CBF_CTX] =
    870 {
    871   {
    872     CNU,
    873    
    874   },
    875   {
    876     39,
    877    
    878   },
    879   {
    880     39,
    881    
    882   },
    883 };
    884 
    885 #if LAST_CTX_REDUCTION
    886 static const UChar
    887 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] =
    888 {
    889   {
    890     72,  72,  71,  72, 104,  89,  88,  89,  59,  73,  89, 106,  60,  59,  43,   
    891     54,  70,  53,  CNU, CNU, CNU,  CNU, CNU, CNU,  CNU, CNU, CNU, CNU, CNU, CNU,
    892   },
    893   {
    894     57,  72,  55,  72,  57,  72,   88,  73,  73,  72,  103,  73,  89,  73,  57, 
    895     54,  70,  54,  CNU, CNU, CNU,  CNU, CNU, CNU,  CNU, CNU, CNU, CNU, CNU, CNU,
    896   },
    897   {
    898     88,  72,  71,  72,  57,  72,  88,  73,  73,  72,   103,  73,  89,  73,  57,   
    899     54,  70,  69,   CNU, CNU, CNU,  CNU, CNU, CNU,  CNU, CNU, CNU, CNU, CNU, CNU,
    900   },
    901 };
    902 #else
    903 static const UChar
    904 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] =
    905 {
    906   {
    907     72,  72,  71,  72, 104,  89,  71,  88,  89,  59,  73,  86,  89, 106,  60,  59,  43,  55,
    908     54,  70,  53,  53,  87,  71,  69,  54,  88,  73,  72,  53, CNU, CNU, CNU, CNU, CNU, CNU,
    909    
    910   },
    911   {
    912     57,  72,  71,  72,  57,  72, 102,  88,  73,  73,  72, 102, 103,  73,  89,  73,  57,  87,
    913     54,  70,  54, 101,  71,  55,  70, 116, 103,  72,  72, 119, CNU, CNU, CNU, CNU, CNU, CNU,
    914    
    915   },
    916   {
    917     88,  72,  71,  72,  57,  72, 102,  88,  73,  73,  72, 118, 103,  73,  89,  73,  57,  87,
    918     54,  70,  69,  85,  71,  55,  70,  85, 103,  72,  72, 119, CNU, CNU, CNU, CNU, CNU, CNU,
    919    
    920   },
    921 };
    922 #endif
    923 
    924 static const UChar
    925 INIT_SIG_CG_FLAG[3][2 * NUM_SIG_CG_FLAG_CTX] =
    926 {
    927   {
    928     83, 122,
    929     98, 121,
    930    
    931   },
    932   {
    933     99, 120,
    934     67, 119,
    935    
    936   },
    937   {
    938     99, 120,
    939     67, 119,
    940    
    941   },
    942 };
    943 
    944 static const UChar
    945 INIT_SIG_FLAG[3][NUM_SIG_FLAG_CTX] =
    946 {
    947   {
    948     74,  73,  88,  72,  72,  55,  71,  54,  71,  88, 103,  71,  53,  87, 134,  86,  84,  70,  68,  89,  90,  84,  88,  74, 130, 118,  88,
    949     120,  87, 149,  70,  52, 118, 133, 116, 114, 129, 132, 162, 115,  51, 115,  66, 120,  74, 115,  87,  89,
    950   },
    951   {
    952     152, 119, 103, 118,  87,  70,  70,  53, 118, 134, 118, 101,  68,  85, 101, 116, 100,  68,  67, 136, 168, 147, 150, 120, 115, 118, 119,
    953     136, 102,  70,  53,  67, 117, 102, 117, 115, 114,  84, 115,  99, 100,  83, 114, 152, 168, 131, 150, 120,
    954   },
    955   {
    956     152, 119, 103, 118,  87,  70,  70,  53,  71, 103, 118, 101,  68,  85, 101, 116, 116,  68,  67, 152, 168, 147, 150, 120, 115, 118, 119,
    957     136, 102,  86,  84,  67, 117, 102, 117, 115,  99, 100, 115,  99, 100,  83, 114, 152, 152, 131, 150, 120,
    958   },
    959 };
    960 
    961 #if LEVEL_CTX_LUMA_RED
    962 static const UChar
    963 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
    964 {
    965   {
    966     104,  68, 116,  86, 104, 132,  86,  87, 102,  66, 114,  68,  87,  84, 100, 101,
    967       104, 130, 147, 149, 104, 196, 100, 165,
    968   },
    969   {
    970     119, 179, 179, 164, 119,  85, 117, 149, 133,  98, 114, 115, 118,  99, 115, 116,
    971       135, 146, 147, 164, 119, 148, 116, 133,
    972   },
    973   {
    974     119, 179, 148, 164, 119,  85, 117, 149, 133,  98, 114, 115, 118,  99, 115, 100,
    975       135, 177, 147, 164, 119, 132, 148, 149,
    976   },
    977 };
    978 
    979 #if RESTRICT_GR1GR2FLAG_NUMBER
    980 static const UChar
    981 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    982 {
    983   {
    984     86, 102, 115, 117, 101, 101,
    985   },
    986   {
    987     84, 117, 83, 100, 84, 117,
    988   },
    989   {
    990     84, 117, 83,  84, 84, 117,
    991   },
    992 };
    993 #else
    994 static const UChar
    995 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    996 {
    997   {
    998     86, 103,  73, 102, 103,  73, 115, 117, 103, 117, 118, 103,
    999       101, 103, 104, 101, 167, 121,
    1000   },
    1001   {
    1002     84, 102,  88, 117, 118, 104, 83, 116, 118, 100, 117,  87,
    1003       84, 118, 120, 117, 150, 120,
    1004     },
    1005     {
    1006       84, 102,  88, 117, 118, 104, 83, 116, 118,  84, 117,  87,
    1007         84, 118, 120, 117, 150, 120,
    1008     },
    1009 };
    1010 #endif
    1011 #else
    1012 static const UChar
    1013 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
    1014 {
    1015   {
    1016     104,  68, 116,  86, 104, 132,  86,  87, 105, 134,  87, 103, 102,  66, 114,  68,  87,  84, 100, 101,  72,  69, 101,  86,
    1017     104, 130, 147, 149, 104, 196, 100, 165,
    1018   },
    1019   {
    1020     119, 179, 179, 164, 119,  85, 117, 149, 136, 103, 103, 103, 133,  98, 114, 115, 118,  99, 115, 116,  87, 100,  85, 117,
    1021     135, 146, 147, 164, 119, 148, 116, 133,
    1022   },
    1023   {
    1024     119, 179, 148, 164, 119,  85, 117, 149, 136,  87, 103, 103, 133,  98, 114, 115, 118,  99, 115, 100,  87,  84,  85,  85,
    1025     135, 177, 147, 164, 119, 132, 148, 149,
    1026   },
    1027 };
    1028 
    1029 #if RESTRICT_GR1GR2FLAG_NUMBER
    1030 static const UChar
    1031 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    1032 {
    1033   {
    1034     86, 102, 103, 115, 117, 102, 101, 101,
    1035   },
    1036   {
    1037     84, 117, 103, 83, 100, 85, 84, 117,
    1038   },
    1039   {
    1040     84, 117, 87, 83, 84, 69, 84, 117,
    1041   },
    1042 };
    1043 #else
    1044 static const UChar
    1045 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    1046 {
    1047   {
    1048     86, 103,  73, 102, 103,  73, 103,  88,  89, 115, 117, 103, 117, 118, 103, 102, 103,  72,
    1049     101, 103, 104, 101, 167, 121,
    1050   },
    1051   {
    1052     84, 102,  88, 117, 118, 104, 103, 119, 136,  83, 116, 118, 100, 117,  87,  85,  86, 103,
    1053     84, 118, 120, 117, 150, 120,
    1054   },
    1055   {
    1056     84, 102,  88, 117, 118, 104,  87, 119, 136,  83, 116, 118,  84, 117,  87,  69,  86,  87,
    1057     84, 118, 120, 117, 150, 120,
    1058   },
    1059 };
    1060 #endif
    1061 #endif
    1062 // initial probability for motion vector predictor index
    1063 static const UChar
    1064 INIT_MVP_IDX[3][NUM_MVP_IDX_CTX] =
    1065 {
    1066   {
    1067     CNU, CNU,
    1068    
    1069   },
    1070   {
    1071     134, CNU,
    1072    
    1073   },
    1074   {
    1075     134, CNU,
    1076    
    1077   },
    1078 };
    1079 
    1080 // initial probability for ALF flag
    1081 static const UChar
    1082 INIT_ALF_FLAG[3][NUM_ALF_FLAG_CTX] =
    1083 {
    1084   {
    1085     118,
    1086    
    1087   },
    1088   {
    1089     102,
    1090    
    1091   },
    1092   {
    1093     102,
    1094    
    1095   },
    1096 };
    1097 
    1098 // initial probability for ALF side information (unsigned)
    1099 static const UChar
    1100 INIT_ALF_UVLC[3][NUM_ALF_UVLC_CTX] =
    1101 {
    1102   {
    1103     120, 119,
    1104    
    1105   },
    1106   {
    1107     119, 119,
    1108    
    1109   },
    1110   {
    1111     119, 119,
    1112    
    1113   },
    1114 };
    1115 
    1116 // initial probability for ALF side information (signed)
    1117 static const UChar
    1118 INIT_ALF_SVLC[3][NUM_ALF_SVLC_CTX] =
    1119 {
    1120   {
    1121     139, 119, 124,
    1122    
    1123   },
    1124   {
    1125      90, 119, 140,
    1126    
    1127   },
    1128   {
    1129      90, 119, 124,
    1130    
    1131   },
    1132 };
    1133 
    1134 // initial probability for SAO flag
    1135 static const UChar
    1136 INIT_SAO_FLAG[3][NUM_SAO_FLAG_CTX] =
    1137 {
    1138   {
    1139     119,
    1140    
    1141   },
    1142   {
    1143     102,
    1144    
    1145   },
    1146   {
    1147     102,
    1148    
    1149   },
    1150 };
    1151 
    1152 // initial probability for SAO side information (unsigned)
    1153 static const UChar
    1154 INIT_SAO_UVLC[3][NUM_SAO_UVLC_CTX] =
    1155 {
    1156   {
    1157      61, 104,
    1158    
    1159   },
    1160   {
    1161     168, 120,
    1162    
    1163   },
    1164   {
    1165     184, 120,
    1166    
    1167   },
    1168 };
    1169 
    1170 // initial probability for SAO side information (signed)
    1171 static const UChar
    1172 INIT_SAO_SVLC[3][NUM_SAO_SVLC_CTX] =
    1173 {
    1174   {
    1175     171, 119, 199,
    1176    
    1177   },
    1178   {
    1179     169, 119, 151,
    1180    
    1181   },
    1182   {
    1183     169, 119, 151,
    1184    
    1185   },
    1186 };
    1187 
    1188 #if SAO_UNIT_INTERLEAVING
    1189 static const UChar
    1190 INIT_SAO_MERGE_LEFT_FLAG[3][NUM_SAO_MERGE_LEFT_FLAG_CTX] =
    1191 {
    1192   {
    1193     118, 118, 118,
    1194   },
    1195   {
    1196     102, 102, 102,
    1197     },
    1198     {
    1199       102, 102, 102,
    1200     },
    1201 };
    1202 
    1203 static const UChar
    1204 INIT_SAO_MERGE_UP_FLAG[3][NUM_SAO_MERGE_UP_FLAG_CTX] =
    1205 {
    1206   {
    1207     109,
    1208   },
    1209   {
    1210     102,
    1211   },
    1212   {
    1213     102,
    1214   },
    1215 };
    1216 static const UChar
    1217 INIT_SAO_TYPE_IDX[3][NUM_SAO_TYPE_IDX_CTX] =
    1218 {
    1219   {
    1220     64, 104
    1221   },
    1222   {
    1223   168, 120
    1224   },
    1225   {
    1226     184, 120
    1227   },
    1228 };
    1229 static const Short
    1230 INIT_SAO_RUN[3][NUM_SAO_RUN_CTX][2] =
    1231 {
    1232   {
    1233     {   11,   57 }, {   -1,   62 }, {    0,   64 }
    1234   },
    1235   {
    1236     {    6,   66 }, {   -1,   64 }, {    0,   64 }
    1237   },
    1238   {
    1239     {    1,   73 }, {    2,   61 }, {    0,   64 }
    1240   }
    1241 };
    1242 #endif
    1243 
    1244 static const UChar
    1245 INIT_TRANS_SUBDIV_FLAG[3][NUM_TRANS_SUBDIV_FLAG_CTX] =
    1246 {
    1247   {
    1248     CNU, 162, 148, 100, CNU, CNU, CNU, CNU, CNU, CNU,
    1249    
    1250   },
    1251   {
    1252     CNU,  71,  86,  55, CNU, CNU, CNU, CNU, CNU, CNU,
    1253    
    1254   },
    1255   {
    1256     CNU, 102,  86,  86, CNU, CNU, CNU, CNU, CNU, CNU,
    1257    
    1258   },
    1259 };
    1260 #endif
    1261 
    1262 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    1263 static const Short
    1264 INIT_DMM_FLAG[3][NUM_DMM_FLAG_CTX] =
    1265 {
    1266   {
    1267     CNU
    1268   },
    1269   {
    1270     CNU
    1271   },
    1272   {
    1273     CNU
    1274   }
    1275 };
    1276 
    1277 static const Short
    1278 INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] =
    1279 {
    1280   {
    1281     CNU
    1282   },
    1283   {
    1284     CNU
    1285   },
    1286   {
    1287     CNU
    1288   }
    1289 };
    1290 
    1291 static const Short
    1292 INIT_DMM_DATA[3][NUM_DMM_DATA_CTX] =
    1293 {
    1294490  {
    1295491    CNU, CNU, CNU
     
    1301497    CNU, CNU, CNU
    1302498  }
     499#endif
    1303500};
    1304501
  • trunk/source/Lib/TLibCommon/NAL.h

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

    r56 r296  
    4646
    4747
    48 #if !LCU_SYNTAX_ALF
    49 ALFParam::~ALFParam()
    50 {
    51   if (coeff_chroma != NULL)
    52   {
    53     delete[] coeff_chroma;
    54   }
    55   if (coeffmulti)
    56   {
    57     for (Int i=0; i<NO_VAR_BINS; i++)
    58     {
    59       if (coeffmulti[i] != NULL)
    60       {
    61         delete[] coeffmulti[i];
    62       }
    63     }
    64     delete[] coeffmulti;
    65   }
    66 
    67   if (nbSPred != NULL)
    68   {
    69     delete[] nbSPred;
    70   }
    71   if (filterPattern != NULL)
    72   {
    73     delete[] filterPattern;
    74   }
    75 }
    76 #endif
    7748
    7849// ====================================================================================================================
     
    8051// ====================================================================================================================
    8152
    82 #if ALF_SINGLE_FILTER_SHAPE
    8353Int TComAdaptiveLoopFilter::weightsShape1Sym[ALF_MAX_NUM_COEF+1] =
    8454{
     
    10979  depthIntShape1Sym
    11080};
    111 #else
    112 //Shape0: Star5x5
    113 Int TComAdaptiveLoopFilter::weightsShape0Sym[10] =
    114 {
    115   2,    2,    2,   
    116   2, 2, 2,       
    117   2, 2, 1, 1
    118 };
    119 
    120 
    121 //Shape1: Cross9x9
    122 Int TComAdaptiveLoopFilter::weightsShape1Sym[10] =
    123 {
    124               2,
    125               2,
    126               2,
    127               2,
    128   2, 2, 2, 2, 1,
    129               1
    130 };
    131 
    132 
    133 Int* TComAdaptiveLoopFilter::weightsTabShapes[NUM_ALF_FILTER_SHAPE] =
    134 {
    135   weightsShape0Sym, weightsShape1Sym
    136 };
    137 
    138 Int TComAdaptiveLoopFilter::m_sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE] =
    139 {
    140   9, 9
    141 };
    142 
    143 // Shape0
    144 Int depthIntShape0Sym[10] =
    145 {
    146   1,    3,    1,
    147   3, 4, 3,
    148   3, 4, 5, 5                 
    149 };
    150 // Shape1
    151 Int depthIntShape1Sym[10] =
    152 {
    153               5,
    154               6,
    155               7,
    156               8,
    157   5, 6, 7, 8, 9,
    158               9 
    159 };
    160 
    161 
    162 Int* pDepthIntTabShapes[NUM_ALF_FILTER_SHAPE] =
    163 {
    164   depthIntShape0Sym, depthIntShape1Sym
    165 };
    166 #endif
    167 
    168 #if LCU_SYNTAX_ALF
     81
    16982Int kTableShape1[ALF_MAX_NUM_COEF+1] =
    17083{     
     
    17992  kTableShape1
    18093};
    181 #endif
    18294
    18395// ====================================================================================================================
     
    194106}
    195107
    196 #if LCU_SYNTAX_ALF
    197108/// AlfCUCtrlInfo
    198109Void AlfCUCtrlInfo::reset()
     
    530441}
    531442
    532 #endif
    533443
    534444
     
    543453  m_pvpAlfLCU    = NULL;
    544454  m_pvpSliceTileAlfLCU = NULL;
    545 #if LCU_SYNTAX_ALF
    546455  for(Int c=0; c< NUM_ALF_COMPONENT; c++)
    547456  {
     
    550459  m_varImg = NULL;
    551460  m_filterCoeffSym = NULL;
    552 #endif
    553461
    554462}
     
    755663Void TComAdaptiveLoopFilter::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
    756664{
    757 #if LCU_SYNTAX_ALF
    758665  destroy();
    759 #endif
    760666  if ( !m_pcTempPicYuv )
    761667  {
     
    765671  m_img_height = iPicHeight;
    766672  m_img_width = iPicWidth;
    767 #if LCU_SYNTAX_ALF
    768673  initMatrix_Pel(&(m_varImg), m_img_height, m_img_width);
    769 #else
    770   for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    771   {
    772     initMatrix_Pel(&(m_varImgMethods[i]), m_img_height, m_img_width);
    773   }
    774 #endif
    775674  initMatrix_int(&m_filterCoeffSym, NO_VAR_BINS, ALF_MAX_NUM_COEF);
    776675  UInt uiNumLCUsInWidth   = m_img_width  / uiMaxCUWidth;
     
    782681  m_uiNumCUsInFrame = uiNumLCUsInWidth* uiNumLCUsInHeight;
    783682
    784 #if LCU_SYNTAX_ALF
    785683  m_numLCUInPicWidth = uiNumLCUsInWidth;
    786684  m_numLCUInPicHeight= uiNumLCUsInHeight;
    787685  m_lcuHeight = uiMaxCUHeight;
    788 #if ALF_SINGLE_FILTER_SHAPE
    789686  m_lineIdxPadBot = m_lcuHeight - 4 - 3; // DFRegion, Vertical Taps
    790 #else
    791   m_lineIdxPadBot = m_lcuHeight - 4 - 4; // DFRegion, Vertical Taps
    792 #endif
    793687  m_lineIdxPadTop = m_lcuHeight - 4; // DFRegion
    794688
    795689  m_lcuHeightChroma = m_lcuHeight>>1;
    796 #if ALF_SINGLE_FILTER_SHAPE
    797690  m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps
    798 #else
    799   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps
    800 #endif
    801691  m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ; // DFRegion
    802692
    803693  createLCUAlfInfo();
    804 #else
    805   createRegionIndexMap(m_varImgMethods[ALF_RA], m_img_width, m_img_height);
    806 #endif
    807694}
    808695
     
    813700    m_pcTempPicYuv->destroy();
    814701    delete m_pcTempPicYuv;
    815 #if LCU_SYNTAX_ALF
    816702    m_pcTempPicYuv = NULL;
    817 #endif
    818   }
    819 #if LCU_SYNTAX_ALF
     703  }
    820704  if(m_varImg != NULL)
    821705  {
     
    828712    m_filterCoeffSym = NULL;
    829713  }
    830 #else
    831   for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    832   {
    833     destroyMatrix_Pel(m_varImgMethods[i]);
    834   }
    835   destroyMatrix_int(m_filterCoeffSym);
    836 #endif
    837 #if LCU_SYNTAX_ALF
    838714  destroyLCUAlfInfo();
    839 #endif
    840 
    841 }
    842 
    843 #if !LCU_SYNTAX_ALF
    844 // --------------------------------------------------------------------------------------------------------------------
    845 // allocate / free / copy functions
    846 // --------------------------------------------------------------------------------------------------------------------
    847 Void TComAdaptiveLoopFilter::allocALFParam(ALFParam* pAlfParam)
    848 {
    849   pAlfParam->alf_flag = 0;
    850   pAlfParam->coeff_chroma = new Int[ALF_MAX_NUM_COEF];
    851   ::memset(pAlfParam->coeff_chroma, 0, sizeof(Int)*ALF_MAX_NUM_COEF );
    852   pAlfParam->coeffmulti = new Int*[NO_VAR_BINS];
    853   for (int i=0; i<NO_VAR_BINS; i++)
    854   {
    855     pAlfParam->coeffmulti[i] = new Int[ALF_MAX_NUM_COEF];
    856     ::memset(pAlfParam->coeffmulti[i],        0, sizeof(Int)*ALF_MAX_NUM_COEF );
    857   }
    858   pAlfParam->nbSPred = new Int[NO_VAR_BINS];
    859   ::memset(pAlfParam->nbSPred, 0, sizeof(Int)*NO_VAR_BINS);
    860   pAlfParam->filterPattern = new Int[NO_VAR_BINS];
    861   ::memset(pAlfParam->filterPattern, 0, sizeof(Int)*NO_VAR_BINS);
    862   pAlfParam->alf_pcr_region_flag = 0;
    863 }
    864 
    865 Void TComAdaptiveLoopFilter::freeALFParam(ALFParam* pAlfParam)
    866 {
    867   assert(pAlfParam != NULL);
    868   if (pAlfParam->coeff_chroma != NULL)
    869   {
    870     delete[] pAlfParam->coeff_chroma;
    871     pAlfParam->coeff_chroma = NULL;
    872   }
    873   for (int i=0; i<NO_VAR_BINS; i++)
    874   {
    875     delete[] pAlfParam->coeffmulti[i];
    876     pAlfParam->coeffmulti[i] = NULL;
    877   }
    878   delete[] pAlfParam->coeffmulti;
    879   pAlfParam->coeffmulti = NULL;
    880 
    881   delete[] pAlfParam->nbSPred;
    882   pAlfParam->nbSPred = NULL;
    883 
    884   delete[] pAlfParam->filterPattern;
    885   pAlfParam->filterPattern = NULL;
    886 }
    887 
    888 
    889 Void TComAdaptiveLoopFilter::copyALFParam(ALFParam* pDesAlfParam, ALFParam* pSrcAlfParam)
    890 {
    891   pDesAlfParam->alf_flag = pSrcAlfParam->alf_flag;
    892   pDesAlfParam->chroma_idc = pSrcAlfParam->chroma_idc;
    893   pDesAlfParam->num_coeff = pSrcAlfParam->num_coeff;
    894   pDesAlfParam->filter_shape_chroma = pSrcAlfParam->filter_shape_chroma;
    895   pDesAlfParam->num_coeff_chroma = pSrcAlfParam->num_coeff_chroma;
    896   pDesAlfParam->alf_pcr_region_flag = pSrcAlfParam->alf_pcr_region_flag;
    897   ::memcpy(pDesAlfParam->coeff_chroma, pSrcAlfParam->coeff_chroma, sizeof(Int)*ALF_MAX_NUM_COEF);
    898   pDesAlfParam->filter_shape = pSrcAlfParam->filter_shape;
    899   ::memcpy(pDesAlfParam->filterPattern, pSrcAlfParam->filterPattern, sizeof(Int)*NO_VAR_BINS);
    900   pDesAlfParam->startSecondFilter = pSrcAlfParam->startSecondFilter;
    901 
    902   //Coeff send related
    903   pDesAlfParam->filters_per_group = pSrcAlfParam->filters_per_group; //this can be updated using codedVarBins
    904   pDesAlfParam->predMethod = pSrcAlfParam->predMethod;
    905   ::memcpy(pDesAlfParam->nbSPred, pSrcAlfParam->nbSPred, sizeof(Int)*NO_VAR_BINS);
    906   for (int i=0; i<NO_VAR_BINS; i++)
    907   {
    908     ::memcpy(pDesAlfParam->coeffmulti[i], pSrcAlfParam->coeffmulti[i], sizeof(Int)*ALF_MAX_NUM_COEF);
    909   }
    910 }
    911 // --------------------------------------------------------------------------------------------------------------------
    912 // prediction of filter coefficients
    913 // --------------------------------------------------------------------------------------------------------------------
    914 
    915 Void TComAdaptiveLoopFilter::predictALFCoeffChroma( ALFParam* pAlfParam )
    916 {
    917   Int i, sum, pred, N;
    918   const Int* pFiltMag = NULL;
    919   pFiltMag = weightsTabShapes[pAlfParam->filter_shape_chroma];
    920   N = pAlfParam->num_coeff_chroma;
    921   sum=0;
    922   for(i=0; i<N;i++)
    923   {
    924     sum+=pFiltMag[i]*pAlfParam->coeff_chroma[i];
    925   }
    926   pred=(1<<ALF_NUM_BIT_SHIFT)-(sum-pAlfParam->coeff_chroma[N-1]);
    927 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    928   pAlfParam->coeff_chroma[N-1]=pAlfParam->coeff_chroma[N-1] - pred;
    929 #else
    930   pAlfParam->coeff_chroma[N-1]=pred-pAlfParam->coeff_chroma[N-1];
    931 #endif
    932 }
    933 
    934 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    935 Void TComAdaptiveLoopFilter::reconstructALFCoeffChroma( ALFParam* pAlfParam )
    936 {
    937   Int i, sum, pred, N;
    938   const Int* pFiltMag = NULL;
    939   pFiltMag = weightsTabShapes[pAlfParam->filter_shape_chroma];
    940   N = pAlfParam->num_coeff_chroma;
    941   sum=0;
    942   for(i=0; i<N;i++)
    943   {
    944     sum+=pFiltMag[i]*pAlfParam->coeff_chroma[i];
    945   }
    946   pred=(1<<ALF_NUM_BIT_SHIFT)-(sum-pAlfParam->coeff_chroma[N-1]);
    947   pAlfParam->coeff_chroma[N-1]=pred+ pAlfParam->coeff_chroma[N-1];
    948 }
    949 #endif
    950 #endif
     715
     716}
     717
    951718
    952719// --------------------------------------------------------------------------------------------------------------------
     
    954721// --------------------------------------------------------------------------------------------------------------------
    955722
    956 #if LCU_SYNTAX_ALF
    957723/** ALF reconstruction process for one picture
    958724 * \param [in, out] pcPic the decoded/filtered picture (input: decoded picture; output filtered picture)
     
    1113879}
    1114880
    1115 #else
    1116 
    1117 /**
    1118  \param [in, out] pcPic         picture (TComPic) class (input/output)
    1119  \param [in] pcAlfParam    ALF parameter
    1120  \param [in,out] vAlfCUCtrlParam ALF CU control parameters
    1121  \todo   for temporal buffer, it uses residual picture buffer, which may not be safe. Make it be safer.
    1122  */
    1123 Void TComAdaptiveLoopFilter::ALFProcess(TComPic* pcPic, ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)
    1124 {
    1125   assert(m_uiNumSlicesInPic == vAlfCUCtrlParam.size());
    1126   if(!pcAlfParam->alf_flag)
    1127   {
    1128     return;
    1129   }
    1130 
    1131   m_lcuHeight     = pcPic->getSlice(0)->getSPS()->getMaxCUHeight();
    1132 #if ALF_SINGLE_FILTER_SHAPE
    1133   m_lineIdxPadBot = m_lcuHeight - 4 - 3;             // DFRegion, Vertical Taps
    1134 #else
    1135   m_lineIdxPadBot = m_lcuHeight - 4 - 4;             // DFRegion, Vertical Taps
    1136 #endif
    1137   m_lineIdxPadTop = m_lcuHeight - 4;                 // DFRegion
    1138 
    1139   m_lcuHeightChroma     = m_lcuHeight>>1;
    1140 #if ALF_SINGLE_FILTER_SHAPE
    1141   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps
    1142 #else
    1143   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps
    1144 #endif
    1145   m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ;    // DFRegion
    1146 
    1147   TComPicYuv* pcPicYuvRec    = pcPic->getPicYuvRec();
    1148   TComPicYuv* pcPicYuvExtRec = m_pcTempPicYuv;
    1149     pcPicYuvRec   ->copyToPic          ( pcPicYuvExtRec );
    1150     pcPicYuvExtRec->setBorderExtension ( false );
    1151     pcPicYuvExtRec->extendPicBorder    ();
    1152 
    1153   if(m_uiNumSlicesInPic == 1)
    1154   {
    1155     AlfCUCtrlInfo* pcAlfCtrlParam = &(vAlfCUCtrlParam[0]);
    1156     if(pcAlfCtrlParam->cu_control_flag)
    1157     {
    1158       UInt idx = 0;
    1159       for(UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame(); uiCUAddr++)
    1160       {
    1161         TComDataCU *pcCU = pcPic->getCU(uiCUAddr);
    1162         setAlfCtrlFlags(pcAlfCtrlParam, pcCU, 0, 0, idx);
    1163       }
    1164     }
    1165   }
    1166   else
    1167   {
    1168     transferCtrlFlagsFromAlfParam(vAlfCUCtrlParam);
    1169   }
    1170   xALFLuma(pcPic, pcAlfParam, vAlfCUCtrlParam, pcPicYuvExtRec, pcPicYuvRec);
    1171   if(pcAlfParam->chroma_idc)
    1172   {
    1173 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    1174     reconstructALFCoeffChroma(pcAlfParam);
    1175 #else
    1176     predictALFCoeffChroma(pcAlfParam);
    1177 #endif
    1178     checkFilterCoeffValue(pcAlfParam->coeff_chroma, pcAlfParam->num_coeff_chroma, true );
    1179 
    1180     xALFChroma( pcAlfParam, pcPicYuvExtRec, pcPicYuvRec);
    1181   }
    1182 }
    1183 #endif
    1184881// ====================================================================================================================
    1185882// Protected member functions
     
    1216913}
    1217914
    1218 #if !LCU_SYNTAX_ALF
    1219 
    1220 Void TComAdaptiveLoopFilter::xALFLuma(TComPic* pcPic, ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam,TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)
    1221 {
    1222   Int    LumaStride = pcPicDec->getStride();
    1223   Pel* pDec = pcPicDec->getLumaAddr();
    1224   Pel* pRest = pcPicRest->getLumaAddr();
    1225 
    1226   decodeFilterSet(pcAlfParam, m_varIndTab, m_filterCoeffSym);
    1227 
    1228   m_uiVarGenMethod = pcAlfParam->alf_pcr_region_flag;
    1229   m_varImg         = m_varImgMethods[m_uiVarGenMethod];
    1230   calcVar(m_varImg, pRest, LumaStride, pcAlfParam->alf_pcr_region_flag);
    1231 
    1232   if(!m_bUseNonCrossALF)
    1233   {
    1234     Bool bCUCtrlEnabled = false;
    1235     for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    1236     {
    1237       if(!pcPic->getValidSlice(s))
    1238       {
    1239         continue;
    1240       }
    1241       if( vAlfCUCtrlParam[s].cu_control_flag == 1)
    1242       {
    1243         bCUCtrlEnabled = true;
    1244       }
    1245     }
    1246 
    1247     if(bCUCtrlEnabled) 
    1248     {
    1249       xCUAdaptive(pcPic, pcAlfParam->filter_shape, pRest, pDec, LumaStride);
    1250     } 
    1251     else
    1252     {
    1253       filterLuma(pRest, pDec, LumaStride, 0, m_img_height-1, 0, m_img_width-1,  pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);
    1254     }
    1255   }
    1256   else
    1257   {
    1258     Pel* pTemp = m_pcSliceYuvTmp->getLumaAddr();
    1259     for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    1260     {
    1261       if(!pcPic->getValidSlice(s))
    1262       {
    1263         continue;
    1264       }
    1265       std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];
    1266 
    1267       for(Int t=0; t< (Int)vpSliceTileAlfLCU.size(); t++)
    1268       {
    1269         std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];
    1270 
    1271         copyRegion(vpAlfLCU, pTemp, pDec, LumaStride);
    1272         extendRegionBorder(vpAlfLCU, pTemp, LumaStride);
    1273         if(vAlfCUCtrlParam[s].cu_control_flag == 1)
    1274         {
    1275           xCUAdaptiveRegion(vpAlfLCU, pTemp, pRest, LumaStride, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);
    1276         }
    1277         else
    1278         {
    1279           filterLumaRegion(vpAlfLCU, pTemp, pRest, LumaStride, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);
    1280         }
    1281       }
    1282     }
    1283   }
    1284 }
    1285 
    1286 Void TComAdaptiveLoopFilter::decodeFilterSet(ALFParam* pcAlfParam, Int* varIndTab, Int** filterCoeff)
    1287 {
    1288   // reconstruct merge table
    1289   memset(m_varIndTab, 0, NO_VAR_BINS * sizeof(Int));
    1290   if(pcAlfParam->filters_per_group > 1)
    1291   {
    1292     for(Int i = 1; i < NO_VAR_BINS; ++i)
    1293     {
    1294       if(pcAlfParam->filterPattern[i])
    1295       {
    1296         varIndTab[i] = varIndTab[i-1] + 1;
    1297       }
    1298       else
    1299       {
    1300         varIndTab[i] = varIndTab[i-1];
    1301       }
    1302     }
    1303   }
    1304   predictALFCoeffLuma( pcAlfParam);
    1305   // reconstruct filter sets
    1306   reconstructFilterCoeffs( pcAlfParam, filterCoeff);
    1307 
    1308 }
    1309 
    1310 
    1311 Void TComAdaptiveLoopFilter::filterLuma(Pel *pImgRes, Pel *pImgPad, Int stride,
    1312   Int ypos, Int yposEnd, Int xpos, Int xposEnd,
    1313   Int filtNo, Int** filterSet, Int* mergeTable, Pel** ppVarImg)
    1314 {
    1315   static Int numBitsMinus1= (Int)ALF_NUM_BIT_SHIFT;
    1316   static Int offset       = (1<<( (Int)ALF_NUM_BIT_SHIFT-1));
    1317   static Int shiftHeight  = (Int)(log((double)VAR_SIZE_H)/log(2.0));
    1318   static Int shiftWidth   = (Int)(log((double)VAR_SIZE_W)/log(2.0));
    1319 
    1320   Pel *pImgPad1,*pImgPad2,*pImgPad3,*pImgPad4;
    1321   Pel *pVar;
    1322   Int i, j, pixelInt;
    1323   Int *coef = NULL;
    1324 
    1325   pImgPad    += (ypos*stride);
    1326   pImgRes    += (ypos*stride);
    1327 
    1328   Int yLineInLCU;
    1329   Int paddingLine;
    1330 #if !ALF_SINGLE_FILTER_SHAPE
    1331   Int varInd = 0;
    1332 #endif
    1333   Int newCenterCoeff[4][NO_VAR_BINS];
    1334 
    1335   for(i=0; i< 4; i++)
    1336   {
    1337     ::memset(&(newCenterCoeff[i][0]), 0, sizeof(Int)*NO_VAR_BINS);
    1338   }
    1339 
    1340 #if ALF_SINGLE_FILTER_SHAPE
    1341   if(filtNo == ALF_CROSS9x7_SQUARE3x3)
    1342 #else
    1343   if(filtNo == ALF_CROSS9x9)
    1344 #endif
    1345   {
    1346     for (i=0; i<NO_VAR_BINS; i++)
    1347     {
    1348       coef = filterSet[i];
    1349       //VB line 1
    1350       newCenterCoeff[0][i] = coef[8] + ((coef[0] + coef[1] + coef[2] + coef[3])<<1);
    1351       //VB line 2
    1352       newCenterCoeff[1][i] = coef[8] + ((coef[0] + coef[1] + coef[2])<<1);
    1353       //VB line 3
    1354       newCenterCoeff[2][i] = coef[8] + ((coef[0] + coef[1])<<1);
    1355       //VB line 4
    1356       newCenterCoeff[3][i] = coef[8] + ((coef[0])<<1);
    1357     }
    1358   }
    1359 
    1360 
    1361   switch(filtNo)
    1362   {
    1363 #if !ALF_SINGLE_FILTER_SHAPE
    1364   case ALF_STAR5x5:
    1365     {
    1366       for(i= ypos; i<= yposEnd; i++)
    1367       {
    1368 
    1369         yLineInLCU = i % m_lcuHeight;   
    1370 
    1371         if (yLineInLCU<m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height)
    1372         {
    1373           pImgPad1 = pImgPad +   stride;
    1374           pImgPad2 = pImgPad -   stride;
    1375           pImgPad3 = pImgPad + 2*stride;
    1376           pImgPad4 = pImgPad - 2*stride;
    1377         }
    1378         else if (yLineInLCU<m_lineIdxPadTop)
    1379         {
    1380           paddingLine = - yLineInLCU + m_lineIdxPadTop - 1;
    1381           pImgPad1 = pImgPad + min(paddingLine, 1)*stride;
    1382           pImgPad2 = pImgPad -   stride;
    1383           pImgPad3 = pImgPad + min(paddingLine, 2)*stride;
    1384           pImgPad4 = pImgPad - 2*stride;
    1385         }
    1386         else
    1387         {
    1388           paddingLine = yLineInLCU - m_lineIdxPadTop ;
    1389           pImgPad1 = pImgPad + stride;
    1390           pImgPad2 = pImgPad - min(paddingLine, 1)*stride;
    1391           pImgPad3 = pImgPad + 2*stride;
    1392           pImgPad4 = pImgPad - min(paddingLine, 2)*stride;
    1393         }
    1394 
    1395         pVar = ppVarImg[i>>shiftHeight] + (xpos>>shiftWidth);
    1396 
    1397         if ( (yLineInLCU == m_lineIdxPadTop || yLineInLCU == m_lineIdxPadTop-1) && i-yLineInLCU+m_lcuHeight < m_img_height )
    1398         {
    1399           for(j= xpos; j<= xposEnd; j++)
    1400           {
    1401             pImgRes[j] = pImgPad[j];
    1402           }
    1403         }
    1404         else if ( (yLineInLCU == m_lineIdxPadTop+1 || yLineInLCU == m_lineIdxPadTop-2) && i-yLineInLCU+m_lcuHeight < m_img_height )
    1405         {
    1406           for(j= xpos; j<= xposEnd ; j++)
    1407           {
    1408             if (j % VAR_SIZE_W==0)
    1409             {
    1410               coef = filterSet[mergeTable[*(pVar++)]];
    1411             }
    1412 
    1413             pixelInt  = 0;
    1414 
    1415             pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);
    1416             pixelInt += coef[1]* (pImgPad3[j  ]+pImgPad4[j  ]);
    1417             pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);
    1418 
    1419             pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);
    1420             pixelInt += coef[4]* (pImgPad1[j  ]+pImgPad2[j  ]);
    1421             pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);
    1422 
    1423             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    1424             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    1425             pixelInt += coef[8]* (pImgPad[j  ]);
    1426 
    1427             pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);
    1428             pImgRes[j] = ( Clip( pixelInt ) + pImgPad[j] ) >> 1;
    1429           }
    1430         }
    1431         else
    1432         {
    1433 
    1434         for(j= xpos; j<= xposEnd ; j++)
    1435         {
    1436           if (j % VAR_SIZE_W==0)
    1437           {
    1438             coef = filterSet[mergeTable[*(pVar++)]];
    1439           }
    1440 
    1441           pixelInt  = 0;
    1442 
    1443           pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);
    1444           pixelInt += coef[1]* (pImgPad3[j  ]+pImgPad4[j  ]);
    1445           pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);
    1446 
    1447           pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);
    1448           pixelInt += coef[4]* (pImgPad1[j  ]+pImgPad2[j  ]);
    1449           pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);
    1450 
    1451           pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    1452           pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    1453           pixelInt += coef[8]* (pImgPad[j  ]);
    1454 
    1455           pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    1456           pImgRes[j] = Clip( pixelInt );
    1457         }
    1458 
    1459         }
    1460 
    1461         pImgPad += stride;
    1462         pImgRes += stride;
    1463       }
    1464     }
    1465     break;
    1466   case ALF_CROSS9x9:
    1467     {
    1468       Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8;
    1469 #else
    1470   case ALF_CROSS9x7_SQUARE3x3:
    1471     {
    1472       Pel *pImgPad5, *pImgPad6;
    1473 #endif
    1474       for(i= ypos; i<= yposEnd; i++)
    1475       {
    1476         yLineInLCU = i % m_lcuHeight;   
    1477 
    1478         if (yLineInLCU<m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height)
    1479         {
    1480           pImgPad1 = pImgPad +   stride;
    1481           pImgPad2 = pImgPad -   stride;
    1482           pImgPad3 = pImgPad + 2*stride;
    1483           pImgPad4 = pImgPad - 2*stride;
    1484           pImgPad5 = pImgPad + 3*stride;
    1485           pImgPad6 = pImgPad - 3*stride;
    1486 #if !ALF_SINGLE_FILTER_SHAPE
    1487           pImgPad7 = pImgPad + 4*stride;
    1488           pImgPad8 = pImgPad - 4*stride;
    1489 #endif
    1490         }
    1491         else if (yLineInLCU<m_lineIdxPadTop)
    1492         {
    1493           paddingLine = - yLineInLCU + m_lineIdxPadTop - 1;
    1494 #if ALF_SINGLE_FILTER_SHAPE
    1495           pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad + min(paddingLine, 1)*stride;
    1496           pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad -   stride;
    1497           pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + min(paddingLine, 2)*stride;
    1498           pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - 2*stride;
    1499           pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + min(paddingLine, 3)*stride;
    1500           pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - 3*stride;
    1501 #else
    1502           pImgPad1 = pImgPad + min(paddingLine, 1)*stride;
    1503           pImgPad2 = pImgPad -   stride;
    1504           pImgPad3 = pImgPad + min(paddingLine, 2)*stride;
    1505           pImgPad4 = pImgPad - 2*stride;
    1506           pImgPad5 = pImgPad + min(paddingLine, 3)*stride;
    1507           pImgPad6 = pImgPad - 3*stride;
    1508           pImgPad7 = pImgPad + min(paddingLine, 4)*stride;
    1509           pImgPad8 = pImgPad - 4*stride;
    1510 #endif
    1511         }
    1512         else
    1513         {
    1514           paddingLine = yLineInLCU - m_lineIdxPadTop ;
    1515 #if ALF_SINGLE_FILTER_SHAPE
    1516           pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad +   stride;
    1517           pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad - min(paddingLine, 1)*stride;
    1518           pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + 2*stride;
    1519           pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - min(paddingLine, 2)*stride;
    1520           pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + 3*stride;
    1521           pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - min(paddingLine, 3)*stride;
    1522 #else
    1523           pImgPad1 = pImgPad + stride;
    1524           pImgPad2 = pImgPad - min(paddingLine, 1)*stride;
    1525           pImgPad3 = pImgPad + 2*stride;
    1526           pImgPad4 = pImgPad - min(paddingLine, 2)*stride;
    1527           pImgPad5 = pImgPad + 3*stride;
    1528           pImgPad6 = pImgPad - min(paddingLine, 3)*stride;
    1529           pImgPad7 = pImgPad + 4*stride;
    1530           pImgPad8 = pImgPad - min(paddingLine, 4)*stride;
    1531 #endif
    1532         }
    1533 
    1534         pVar = ppVarImg[i>>shiftHeight] + (xpos>>shiftWidth);
    1535 
    1536 #if ALF_SINGLE_FILTER_SHAPE
    1537         {
    1538           for(j= xpos; j<= xposEnd ; j++)
    1539           {
    1540             if (j % VAR_SIZE_W==0)
    1541             {
    1542               coef = filterSet[mergeTable[*(pVar++)]];
    1543             }
    1544 
    1545             pixelInt  = 0;
    1546 
    1547             pixelInt += coef[0]* (pImgPad5[j]+pImgPad6[j]);
    1548             pixelInt += coef[1]* (pImgPad3[j]+pImgPad4[j]);
    1549             pixelInt += coef[2]* (pImgPad1[j-1]+pImgPad2[j+1]);
    1550             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    1551             pixelInt += coef[4]* (pImgPad1[j+1]+pImgPad2[j-1]);
    1552             pixelInt += coef[5]* (pImgPad[j+4]+pImgPad[j-4]);
    1553             pixelInt += coef[6]* (pImgPad[j+3]+pImgPad[j-3]);
    1554             pixelInt += coef[7]* (pImgPad[j+2]+pImgPad[j-2]);
    1555             pixelInt += coef[8]* (pImgPad[j+1]+pImgPad[j-1]);
    1556             pixelInt += coef[9]* (pImgPad[j  ]);
    1557 
    1558             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    1559             pImgRes[j] = Clip( pixelInt );
    1560           }
    1561         }
    1562 #else
    1563         if ( (yLineInLCU == m_lineIdxPadTop || yLineInLCU == m_lineIdxPadTop-1) && i-yLineInLCU+m_lcuHeight < m_img_height )
    1564         {
    1565           for(j= xpos; j<= xposEnd ; j++)
    1566           {
    1567             if (j % VAR_SIZE_W==0)
    1568             {
    1569               varInd = *(pVar++);
    1570               coef = filterSet[mergeTable[varInd]];
    1571             }
    1572 
    1573             pixelInt  = 0;
    1574 
    1575             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    1576             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    1577             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    1578             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    1579             pixelInt += newCenterCoeff[0][mergeTable[varInd]]* (pImgPad[j]);
    1580 
    1581             pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);
    1582             pImgRes[j] = Clip( pixelInt );
    1583           }
    1584         }
    1585         else if ( (yLineInLCU == m_lineIdxPadTop+1 || yLineInLCU == m_lineIdxPadTop-2) && i-yLineInLCU+m_lcuHeight < m_img_height )
    1586         {
    1587           for(j= xpos; j<= xposEnd ; j++)
    1588           {
    1589             if (j % VAR_SIZE_W==0)
    1590             {
    1591               varInd = *(pVar++);
    1592               coef = filterSet[mergeTable[varInd]];
    1593             }
    1594 
    1595             pixelInt  = 0;
    1596 
    1597             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    1598 
    1599             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    1600             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    1601             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    1602             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    1603             pixelInt += newCenterCoeff[1][mergeTable[varInd]]* (pImgPad[j]);
    1604 
    1605             pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);
    1606             pImgRes[j] = Clip( pixelInt );
    1607           }
    1608         }
    1609         else if ( (yLineInLCU == m_lineIdxPadTop+2 || yLineInLCU == m_lineIdxPadTop-3) && i-yLineInLCU+m_lcuHeight < m_img_height )
    1610         {
    1611           for(j= xpos; j<= xposEnd ; j++)
    1612           {
    1613             if (j % VAR_SIZE_W==0)
    1614             {
    1615               varInd = *(pVar++);
    1616               coef = filterSet[mergeTable[varInd]];
    1617             }
    1618 
    1619             pixelInt  = 0;
    1620 
    1621             pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);
    1622 
    1623             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    1624 
    1625             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    1626             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    1627             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    1628             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    1629             pixelInt += newCenterCoeff[2][mergeTable[varInd]]* (pImgPad[j  ]);
    1630 
    1631             pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);
    1632             pImgRes[j] = Clip( pixelInt );
    1633           }
    1634         }
    1635         else if ( (yLineInLCU == m_lineIdxPadTop+3 || yLineInLCU == m_lineIdxPadTop-4) && i-yLineInLCU+m_lcuHeight < m_img_height )
    1636         {
    1637           for(j= xpos; j<= xposEnd ; j++)
    1638           {
    1639             if (j % VAR_SIZE_W==0)
    1640             {
    1641               varInd = *(pVar++);
    1642               coef = filterSet[mergeTable[varInd]];
    1643             }
    1644 
    1645             pixelInt  = 0;
    1646 
    1647             pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);
    1648 
    1649             pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);
    1650 
    1651             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    1652 
    1653             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    1654             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    1655             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    1656             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    1657             pixelInt += newCenterCoeff[3][mergeTable[varInd]]* (pImgPad[j  ]);
    1658 
    1659             pixelInt=(int)((pixelInt+offset) >> numBitsMinus1);
    1660             pImgRes[j] = Clip( pixelInt );
    1661           }
    1662         }
    1663         else
    1664         {
    1665           for(j= xpos; j<= xposEnd ; j++)
    1666           {
    1667             if (j % VAR_SIZE_W==0)
    1668             {
    1669               coef = filterSet[mergeTable[*(pVar++)]];
    1670             }
    1671 
    1672             pixelInt  = 0;
    1673 
    1674             pixelInt += coef[0]* (pImgPad7[j]+pImgPad8[j]);
    1675 
    1676             pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);
    1677 
    1678             pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);
    1679 
    1680             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    1681 
    1682             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    1683             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    1684             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    1685             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    1686             pixelInt += coef[8]* (pImgPad[j  ]);
    1687 
    1688             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    1689             pImgRes[j] = Clip( pixelInt );
    1690           }
    1691         }
    1692 #endif
    1693         pImgPad += stride;
    1694         pImgRes += stride;
    1695       }
    1696     }
    1697     break;
    1698   default:
    1699     {
    1700       printf("Not a supported filter shape\n");
    1701       assert(0);
    1702       exit(1);
    1703     }
    1704   }
    1705 }
    1706 
    1707 
    1708 
    1709 Void TComAdaptiveLoopFilter::xCUAdaptive(TComPic* pcPic, Int filtNo, Pel *imgYFilt, Pel *imgYRec, Int Stride)
    1710 {
    1711   // for every CU, call CU-adaptive ALF process
    1712   for( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame() ; uiCUAddr++ )
    1713   {
    1714     TComDataCU* pcCU = pcPic->getCU( uiCUAddr );
    1715     xSubCUAdaptive(pcCU, filtNo, imgYFilt, imgYRec, 0, 0, Stride);
    1716   }
    1717 }
    1718 
    1719 Void TComAdaptiveLoopFilter::xSubCUAdaptive(TComDataCU* pcCU, Int filtNo, Pel *imgYFilt, Pel *imgYRec, UInt uiAbsPartIdx, UInt uiDepth, Int Stride)
    1720 {
    1721   TComPic* pcPic = pcCU->getPic();
    1722 
    1723   if(pcPic==NULL)
    1724   {
    1725     return;
    1726   }
    1727   Bool bBoundary = false;
    1728   UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
    1729   UInt uiRPelX   = uiLPelX + (g_uiMaxCUWidth>>uiDepth)  - 1;
    1730   UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    1731   UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
    1732 
    1733   // check picture boundary
    1734   if ( ( uiRPelX >= m_img_width ) || ( uiBPelY >= m_img_height ) )
    1735   {
    1736     bBoundary = true;
    1737   }
    1738 
    1739   if ( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < (g_uiMaxCUDepth-g_uiAddCUDepth) ) ) || bBoundary )
    1740   {
    1741     UInt uiQNumParts = ( pcPic->getNumPartInCU() >> (uiDepth<<1) )>>2;
    1742     for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++, uiAbsPartIdx+=uiQNumParts )
    1743     {
    1744       uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
    1745       uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    1746 
    1747       if( ( uiLPelX < m_img_width ) && ( uiTPelY < m_img_height ) )
    1748         xSubCUAdaptive(pcCU, filtNo, imgYFilt, imgYRec, uiAbsPartIdx, uiDepth+1, Stride);
    1749     }
    1750     return;
    1751   }
    1752 
    1753   if ( pcCU->getAlfCtrlFlag(uiAbsPartIdx) )
    1754   {
    1755     filterLuma(imgYFilt, imgYRec, Stride, uiTPelY, min(uiBPelY,(unsigned int)(m_img_height-1)), uiLPelX, min(uiRPelX,(unsigned int)(m_img_width-1))
    1756       ,filtNo, m_filterCoeffSym, m_varIndTab, m_varImg);
    1757   }
    1758 }
    1759 
    1760 /** Predict ALF luma filter coefficients. Centre coefficient is always predicted. Left neighbour is predicted according to flag.
    1761  */
    1762 Void TComAdaptiveLoopFilter::predictALFCoeffLuma(ALFParam* pcAlfParam)
    1763 {
    1764   Int sum, coeffPred, ind;
    1765   const Int* pFiltMag = NULL;
    1766   pFiltMag = weightsTabShapes[pcAlfParam->filter_shape];
    1767   for(ind = 0; ind < pcAlfParam->filters_per_group; ++ind)
    1768   {
    1769     sum = 0;
    1770     for(Int i = 0; i < pcAlfParam->num_coeff-2; i++)
    1771     {
    1772       sum +=  pFiltMag[i]*pcAlfParam->coeffmulti[ind][i];
    1773     }
    1774     if(pcAlfParam->nbSPred[ind]==0)
    1775     {
    1776       if((pcAlfParam->predMethod==0)|(ind==0))
    1777       {
    1778         coeffPred = ((1<<ALF_NUM_BIT_SHIFT)-sum) >> 2;
    1779       }
    1780       else
    1781       {
    1782         coeffPred = (0-sum) >> 2;
    1783       }
    1784       pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-2] = coeffPred + pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-2];
    1785     }
    1786     sum += pFiltMag[pcAlfParam->num_coeff-2]*pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-2];
    1787     if((pcAlfParam->predMethod==0)|(ind==0))
    1788     {
    1789       coeffPred = (1<<ALF_NUM_BIT_SHIFT)-sum;
    1790     }
    1791     else
    1792     {
    1793       coeffPred = -sum;
    1794     }
    1795     pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-1] = coeffPred + pcAlfParam->coeffmulti[ind][pcAlfParam->num_coeff-1];
    1796   }
    1797 }
    1798 
    1799 Void TComAdaptiveLoopFilter::reconstructFilterCoeffs(ALFParam* pcAlfParam,int **pfilterCoeffSym)
    1800 {
    1801   int i, ind;
    1802 
    1803   // Copy non zero filters in filterCoeffTmp
    1804   for(ind = 0; ind < pcAlfParam->filters_per_group; ++ind)
    1805   {
    1806     for(i = 0; i < pcAlfParam->num_coeff; i++)
    1807     {
    1808       pfilterCoeffSym[ind][i] = pcAlfParam->coeffmulti[ind][i];
    1809     }
    1810   }
    1811   // Undo prediction
    1812   for(ind = 1; ind < pcAlfParam->filters_per_group; ++ind)
    1813   {
    1814     if(pcAlfParam->predMethod)
    1815     {
    1816       // Prediction
    1817       for(i = 0; i < pcAlfParam->num_coeff; ++i)
    1818       {
    1819         pfilterCoeffSym[ind][i] = (int)(pfilterCoeffSym[ind][i] + pfilterCoeffSym[ind - 1][i]);
    1820       }
    1821     }
    1822   }
    1823 
    1824   for(ind = 0; ind < pcAlfParam->filters_per_group; ind++)
    1825   {
    1826     checkFilterCoeffValue(pfilterCoeffSym[ind], pcAlfParam->num_coeff, false );
    1827   }
    1828 }
    1829 
    1830 
    1831 #endif
    1832915
    1833916static Pel Clip_post(int high, int val)
     
    1836919}
    1837920
    1838 #if !LCU_SYNTAX_ALF
    1839 
    1840 /** Calculate ALF grouping indices for block-based (BA) mode
    1841  * \param [out] imgYvar grouping indices buffer
    1842  * \param [in] imgYpad picture buffer
    1843  * \param [in] stride picture stride size
    1844  * \param [in] adaptationMode  ALF_BA or ALF_RA mode
    1845  */
    1846 Void TComAdaptiveLoopFilter::calcVar(Pel **imgYvar, Pel *imgYpad, Int stride, Int adaptationMode)
    1847 {
    1848   if(adaptationMode == ALF_RA)
    1849   {
    1850     return;
    1851   }
    1852   static Int shiftH = (Int)(log((double)VAR_SIZE_H)/log(2.0));
    1853   static Int shiftW = (Int)(log((double)VAR_SIZE_W)/log(2.0));
    1854   static Int varmax = (Int)NO_VAR_BINS-1;
    1855 #if ALF_16_BA_GROUPS
    1856   static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};
    1857   static Int avgVarTab[3][6] = { {0,  1,  2,  3,  4,  5,},
    1858   {0,  6,  7,  8,  9, 10,},
    1859   {0, 11, 12, 13, 14, 15}   };
    1860 #else
    1861   static Int step1  = (Int)((Int)(NO_VAR_BINS)/3) - 1; 
    1862   static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4};
    1863 #endif 
    1864   Int i, j, avgvar, vertical, horizontal,direction, yoffset;
    1865   Pel *pimgYpad, *pimgYpadup, *pimgYpaddown;
    1866 
    1867   for(i = 0; i < m_img_height - 3; i=i+4)
    1868   {
    1869     yoffset      = ((i)*stride) + stride;
    1870     pimgYpad     = &imgYpad [yoffset];
    1871     pimgYpadup   = &imgYpad [yoffset + stride];
    1872     pimgYpaddown = &imgYpad [yoffset - stride];
    1873 
    1874     for(j = 0; j < m_img_width - 3 ; j=j+4)
    1875     {
    1876       // Compute at sub-sample by 2
    1877       vertical   =  abs((pimgYpad[j+1]<<1  ) - pimgYpaddown[j+1]   - pimgYpadup[j+1]);
    1878       horizontal =  abs((pimgYpad[j+1]<<1  ) - pimgYpad    [j+2]   - pimgYpad  [j  ]);
    1879 
    1880       vertical   += abs((pimgYpad[j+2]<<1  ) - pimgYpaddown[j+2]   - pimgYpadup[j+2]);
    1881       horizontal += abs((pimgYpad[j+2]<<1  ) - pimgYpad    [j+3]   - pimgYpad  [j+1]);
    1882 
    1883       vertical   += abs((pimgYpad[j+1+stride]<<1) - pimgYpaddown[j+1+stride] - pimgYpadup[j+1+stride]);
    1884       horizontal += abs((pimgYpad[j+1+stride]<<1) - pimgYpad    [j+2+stride] - pimgYpad  [j+stride  ]);
    1885 
    1886       vertical   += abs((pimgYpad[j+2+stride]<<1) - pimgYpaddown[j+2+stride] - pimgYpadup[j+2+stride]);
    1887       horizontal += abs((pimgYpad[j+2+stride]<<1) - pimgYpad    [j+3+stride] - pimgYpad  [j+1+stride]);
    1888 
    1889       direction = 0;
    1890       if (vertical > 2*horizontal)
    1891       {
    1892         direction = 1; //vertical
    1893       }
    1894       if (horizontal > 2*vertical)
    1895       {
    1896         direction = 2; //horizontal
    1897       }
    1898 
    1899       avgvar = (vertical + horizontal) >> 2;
    1900       avgvar = (Pel) Clip_post(varmax, avgvar >>(g_uiBitIncrement+1));
    1901       avgvar = th[avgvar];
    1902 #if ALF_16_BA_GROUPS
    1903       avgvar = avgVarTab[direction][avgvar];
    1904 #else     
    1905       avgvar = Clip_post(step1, (Int) avgvar ) + (step1+1)*direction;
    1906 #endif
    1907       imgYvar[(i )>>shiftH][(j)>>shiftW] = avgvar;
    1908     }
    1909   }
    1910 }
    1911 
    1912 Void TComAdaptiveLoopFilter::createRegionIndexMap(Pel **imgYVar, Int imgWidth, Int imgHeight)
    1913 {
    1914   int varStepSizeWidth = VAR_SIZE_W;
    1915   int varStepSizeHeight = VAR_SIZE_H;
    1916   int shiftHeight = (int)(log((double)varStepSizeHeight)/log(2.0));
    1917   int shiftWidth = (int)(log((double)varStepSizeWidth)/log(2.0));
    1918 
    1919   int i, j;
    1920   int regionTable[NO_VAR_BINS] = {0, 1, 4, 5, 15, 2, 3, 6, 14, 11, 10, 7, 13, 12,  9,  8};
    1921   int xInterval;
    1922   int yInterval;
    1923   int yIndex;
    1924   int yIndexOffset;
    1925   int yStartLine;
    1926   int yEndLine;
    1927 
    1928   xInterval = ((( (imgWidth+63)/64) + 1) / 4 * 64)>>shiftWidth; 
    1929   yInterval = ((((imgHeight+63)/64) + 1) / 4 * 64)>>shiftHeight;
    1930 
    1931   for (yIndex = 0; yIndex < 4 ; yIndex++)
    1932   {
    1933     yIndexOffset = yIndex * 4;
    1934     yStartLine = yIndex * yInterval;
    1935     yEndLine   = (yIndex == 3) ? imgHeight>>shiftHeight : (yStartLine+yInterval);
    1936 
    1937     for(i = yStartLine; i < yEndLine ; i++)
    1938     {
    1939       for(j = 0; j < xInterval ; j++)
    1940       {
    1941         imgYVar[i][j] = regionTable[yIndexOffset+0];     
    1942       }
    1943 
    1944       for(j = xInterval; j < xInterval*2 ; j++)
    1945       {
    1946         imgYVar[i][j] = regionTable[yIndexOffset+1];     
    1947       }
    1948 
    1949       for(j = xInterval*2; j < xInterval*3 ; j++)
    1950       {
    1951         imgYVar[i][j] = regionTable[yIndexOffset+2];     
    1952       }
    1953 
    1954       for(j = xInterval*3; j < imgWidth>>shiftWidth ; j++)
    1955       {
    1956         imgYVar[i][j] = regionTable[yIndexOffset+3];     
    1957       }
    1958     }
    1959   }
    1960 
    1961 }
    1962 
    1963 // --------------------------------------------------------------------------------------------------------------------
    1964 // ALF for chroma
    1965 // --------------------------------------------------------------------------------------------------------------------
    1966 
    1967 /**
    1968  \param pcPicDec    picture before ALF
    1969  \param pcPicRest   picture after  ALF
    1970  \param qh          filter coefficient
    1971  \param iTap        filter tap
    1972  \param iColor      0 for Cb and 1 for Cr
    1973  */
    1974 Void TComAdaptiveLoopFilter::filterChroma(Pel *pImgRes, Pel *pImgPad, Int stride,
    1975                                           Int ypos, Int yposEnd, Int xpos, Int xposEnd,
    1976                                           Int filtNo, Int* coef)
    1977 {
    1978   static Int numBitsMinus1= (Int)ALF_NUM_BIT_SHIFT;
    1979   static Int offset       = (1<<( (Int)ALF_NUM_BIT_SHIFT-1));
    1980 
    1981   Pel *pImgPad1,*pImgPad2,*pImgPad3,*pImgPad4;
    1982   Int i, j, pixelInt;
    1983 
    1984   pImgPad    += (ypos*stride);
    1985   pImgRes    += (ypos*stride);
    1986 
    1987   Int imgHeightChroma = m_img_height>>1;
    1988   Int yLineInLCU;
    1989   Int paddingline;
    1990   Int newCenterCoeff[4];
    1991 
    1992   ::memset(newCenterCoeff, 0, sizeof(Int)*4);
    1993 #if ALF_SINGLE_FILTER_SHAPE
    1994   if(filtNo == ALF_CROSS9x7_SQUARE3x3)
    1995 #else
    1996   if (filtNo == ALF_CROSS9x9)
    1997 #endif
    1998   {
    1999     //VB line 1
    2000     newCenterCoeff[0] = coef[8] + ((coef[0] + coef[1] + coef[2] + coef[3])<<1);
    2001     //VB line 2
    2002     newCenterCoeff[1] = coef[8] + ((coef[0] + coef[1] + coef[2])<<1);
    2003     //VB line 3
    2004     newCenterCoeff[2] = coef[8] + ((coef[0] + coef[1])<<1);
    2005     //VB line 4
    2006     newCenterCoeff[3] = coef[8] + ((coef[0])<<1);
    2007   }
    2008 
    2009   switch(filtNo)
    2010   {
    2011 #if !ALF_SINGLE_FILTER_SHAPE
    2012   case ALF_STAR5x5:
    2013     {
    2014       for(i= ypos; i<= yposEnd; i++)
    2015       {
    2016         yLineInLCU = i % m_lcuHeightChroma;
    2017 
    2018         if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )
    2019         {
    2020           pImgPad1 = pImgPad + stride;
    2021           pImgPad2 = pImgPad - stride;
    2022           pImgPad3 = pImgPad + 2*stride;
    2023           pImgPad4 = pImgPad - 2*stride;
    2024         }
    2025         else if (yLineInLCU < m_lineIdxPadTopChroma)
    2026         {
    2027           paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;
    2028           pImgPad1 = pImgPad + min(paddingline, 1)*stride;
    2029           pImgPad2 = pImgPad - stride;
    2030           pImgPad3 = pImgPad + min(paddingline, 2)*stride;
    2031           pImgPad4 = pImgPad - 2*stride;
    2032         }
    2033         else
    2034         {
    2035           paddingline = yLineInLCU - m_lineIdxPadTopChroma ;
    2036           pImgPad1 = pImgPad + stride;
    2037           pImgPad2 = pImgPad - min(paddingline, 1)*stride;
    2038           pImgPad3 = pImgPad + 2*stride;
    2039           pImgPad4 = pImgPad - min(paddingline, 2)*stride;
    2040         }
    2041 
    2042         if ( (yLineInLCU == m_lineIdxPadTopChroma || yLineInLCU == m_lineIdxPadTopChroma-1) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )
    2043         {
    2044           for(j= xpos; j<= xposEnd ; j++)
    2045           {
    2046             pImgRes[j] = pImgPad[j];
    2047           }
    2048         }
    2049         else if ( (yLineInLCU == m_lineIdxPadTopChroma+1 || yLineInLCU == m_lineIdxPadTopChroma-2) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )
    2050         {
    2051           for(j= xpos; j<= xposEnd ; j++)
    2052           {
    2053             pixelInt  = 0;
    2054 
    2055             pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);
    2056             pixelInt += coef[1]* (pImgPad3[j  ]+pImgPad4[j  ]);
    2057             pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);
    2058 
    2059             pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);
    2060             pixelInt += coef[4]* (pImgPad1[j  ]+pImgPad2[j  ]);
    2061             pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);
    2062 
    2063             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    2064             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    2065             pixelInt += coef[8]* (pImgPad[j  ]);
    2066 
    2067             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2068 
    2069             pImgRes[j] = (Clip( pixelInt ) + pImgPad[j]) >> 1;
    2070           }
    2071         }
    2072         else
    2073         {
    2074 
    2075         for(j= xpos; j<= xposEnd ; j++)
    2076         {
    2077           pixelInt  = 0;
    2078 
    2079           pixelInt += coef[0]* (pImgPad3[j+2]+pImgPad4[j-2]);
    2080           pixelInt += coef[1]* (pImgPad3[j  ]+pImgPad4[j  ]);
    2081           pixelInt += coef[2]* (pImgPad3[j-2]+pImgPad4[j+2]);
    2082 
    2083           pixelInt += coef[3]* (pImgPad1[j+1]+pImgPad2[j-1]);
    2084           pixelInt += coef[4]* (pImgPad1[j  ]+pImgPad2[j  ]);
    2085           pixelInt += coef[5]* (pImgPad1[j-1]+pImgPad2[j+1]);
    2086 
    2087           pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    2088           pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    2089           pixelInt += coef[8]* (pImgPad[j  ]);
    2090 
    2091           pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2092 
    2093           pImgRes[j] = Clip( pixelInt );
    2094         }
    2095 
    2096         }
    2097         pImgPad += stride;
    2098         pImgRes += stride;
    2099       }
    2100     }
    2101     break;
    2102   case ALF_CROSS9x9:
    2103     {
    2104       Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8;
    2105 #else
    2106   case ALF_CROSS9x7_SQUARE3x3:
    2107     {
    2108       Pel *pImgPad5, *pImgPad6;
    2109 #endif
    2110       for(i= ypos; i<= yposEnd; i++)
    2111       {
    2112         yLineInLCU = i % m_lcuHeightChroma;
    2113 #if ALF_SINGLE_FILTER_SHAPE
    2114         if (yLineInLCU<2 && i> 2)
    2115 #else
    2116         if (yLineInLCU<2)
    2117 #endif
    2118         {
    2119           paddingline = yLineInLCU + 2 ;
    2120           pImgPad1 = pImgPad + stride;
    2121           pImgPad2 = pImgPad - stride;
    2122           pImgPad3 = pImgPad + 2*stride;
    2123           pImgPad4 = pImgPad - 2*stride;
    2124 #if ALF_SINGLE_FILTER_SHAPE
    2125           pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*stride;
    2126           pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*stride;
    2127 #else
    2128           pImgPad5 = pImgPad + 3*stride;
    2129           pImgPad6 = pImgPad - min(paddingline, 3)*stride;
    2130           pImgPad7 = pImgPad + 4*stride;
    2131           pImgPad8 = pImgPad - min(paddingline, 4)*stride;
    2132 #endif
    2133         }
    2134         else if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )
    2135         {
    2136           pImgPad1 = pImgPad + stride;
    2137           pImgPad2 = pImgPad - stride;
    2138           pImgPad3 = pImgPad + 2*stride;
    2139           pImgPad4 = pImgPad - 2*stride;
    2140           pImgPad5 = pImgPad + 3*stride;
    2141           pImgPad6 = pImgPad - 3*stride;
    2142 #if !ALF_SINGLE_FILTER_SHAPE
    2143           pImgPad7 = pImgPad + 4*stride;
    2144           pImgPad8 = pImgPad - 4*stride;
    2145 #endif
    2146         }
    2147         else if (yLineInLCU < m_lineIdxPadTopChroma)
    2148         {
    2149           paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;
    2150 #if ALF_SINGLE_FILTER_SHAPE
    2151           pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad + min(paddingline, 1)*stride;
    2152           pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad -   stride;
    2153           pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + min(paddingline, 2)*stride;
    2154           pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - 2*stride;
    2155           pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + min(paddingline, 3)*stride;
    2156           pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - 3*stride;
    2157 #else
    2158           pImgPad1 = pImgPad + min(paddingline, 1)*stride;
    2159           pImgPad2 = pImgPad - stride;
    2160           pImgPad3 = pImgPad + min(paddingline, 2)*stride;
    2161           pImgPad4 = pImgPad - 2*stride;
    2162           pImgPad5 = pImgPad + min(paddingline, 3)*stride;
    2163           pImgPad6 = pImgPad - 3*stride;
    2164           pImgPad7 = pImgPad + min(paddingline, 4)*stride;
    2165           pImgPad8 = pImgPad - 4*stride;
    2166 #endif
    2167         }
    2168         else
    2169         {
    2170           paddingline = yLineInLCU - m_lineIdxPadTopChroma ;
    2171 #if ALF_SINGLE_FILTER_SHAPE
    2172           pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad +   stride;
    2173           pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad - min(paddingline, 1)*stride;
    2174           pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + 2*stride;
    2175           pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - min(paddingline, 2)*stride;
    2176           pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*stride;
    2177           pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*stride;
    2178 #else
    2179           pImgPad1 = pImgPad + stride;
    2180           pImgPad2 = pImgPad - min(paddingline, 1)*stride;
    2181           pImgPad3 = pImgPad + 2*stride;
    2182           pImgPad4 = pImgPad - min(paddingline, 2)*stride;
    2183           pImgPad5 = pImgPad + 3*stride;
    2184           pImgPad6 = pImgPad - min(paddingline, 3)*stride;
    2185           pImgPad7 = pImgPad + 4*stride;
    2186           pImgPad8 = pImgPad - min(paddingline, 4)*stride;
    2187 #endif
    2188         }
    2189 
    2190 #if ALF_SINGLE_FILTER_SHAPE
    2191           for(j= xpos; j<= xposEnd ; j++)
    2192           {
    2193             pixelInt  = 0;
    2194 
    2195             pixelInt += coef[0]* (pImgPad5[j]+pImgPad6[j]);
    2196             pixelInt += coef[1]* (pImgPad3[j]+pImgPad4[j]);
    2197             pixelInt += coef[2]* (pImgPad1[j-1]+pImgPad2[j+1]);
    2198             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    2199             pixelInt += coef[4]* (pImgPad1[j+1]+pImgPad2[j-1]);
    2200             pixelInt += coef[5]* (pImgPad[j+4]+pImgPad[j-4]);
    2201             pixelInt += coef[6]* (pImgPad[j+3]+pImgPad[j-3]);
    2202             pixelInt += coef[7]* (pImgPad[j+2]+pImgPad[j-2]);
    2203             pixelInt += coef[8]* (pImgPad[j+1]+pImgPad[j-1]);
    2204             pixelInt += coef[9]* (pImgPad[j  ]);
    2205 
    2206             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2207 
    2208             pImgRes[j] = Clip( pixelInt );
    2209           }
    2210 #else
    2211         if ( (yLineInLCU == m_lineIdxPadTopChroma || yLineInLCU == m_lineIdxPadTopChroma-1) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )
    2212         {
    2213           for(j= xpos; j<= xposEnd ; j++)
    2214           {
    2215             pixelInt  = 0;
    2216 
    2217             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    2218             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    2219             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    2220             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    2221             pixelInt += newCenterCoeff[0]* (pImgPad[j  ]);
    2222 
    2223             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2224 
    2225             pImgRes[j] = Clip( pixelInt );
    2226           }
    2227         }
    2228         else if ( (yLineInLCU == m_lineIdxPadTopChroma+1 || yLineInLCU == m_lineIdxPadTopChroma-2) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )
    2229         {
    2230           for(j= xpos; j<= xposEnd ; j++)
    2231           {
    2232             pixelInt  = 0;
    2233            
    2234             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    2235 
    2236             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    2237             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    2238             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    2239             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    2240             pixelInt += newCenterCoeff[1]* (pImgPad[j  ]);
    2241 
    2242             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2243 
    2244             pImgRes[j] = Clip( pixelInt );
    2245           }
    2246         }
    2247         else if ( (yLineInLCU == 0 && i>0) || (yLineInLCU == m_lineIdxPadTopChroma-3 && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma) )
    2248         {
    2249           for(j= xpos; j<= xposEnd ; j++)
    2250           {
    2251             pixelInt  = 0;
    2252 
    2253             pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);
    2254 
    2255             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    2256 
    2257             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    2258             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    2259             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    2260             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    2261             pixelInt += newCenterCoeff[2]* (pImgPad[j  ]);
    2262 
    2263             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2264 
    2265             pImgRes[j] = Clip( pixelInt );
    2266           }
    2267         }
    2268         else if ( (yLineInLCU == 1 && i>1) || (yLineInLCU == m_lineIdxPadTopChroma-4 && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma) )
    2269         {
    2270           for(j= xpos; j<= xposEnd ; j++)
    2271           {
    2272             pixelInt  = 0;
    2273 
    2274             pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);
    2275 
    2276             pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);
    2277 
    2278             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    2279 
    2280             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    2281             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    2282             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    2283             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    2284             pixelInt += newCenterCoeff[3]* (pImgPad[j  ]);
    2285 
    2286             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2287 
    2288             pImgRes[j] = Clip( pixelInt );
    2289           }
    2290         }
    2291         else
    2292         {         
    2293           for(j= xpos; j<= xposEnd ; j++)
    2294           {
    2295             pixelInt  = 0;
    2296 
    2297             pixelInt += coef[0]* (pImgPad7[j]+pImgPad8[j]);
    2298 
    2299             pixelInt += coef[1]* (pImgPad5[j]+pImgPad6[j]);
    2300 
    2301             pixelInt += coef[2]* (pImgPad3[j]+pImgPad4[j]);
    2302 
    2303             pixelInt += coef[3]* (pImgPad1[j]+pImgPad2[j]);
    2304 
    2305             pixelInt += coef[4]* (pImgPad[j+4]+pImgPad[j-4]);
    2306             pixelInt += coef[5]* (pImgPad[j+3]+pImgPad[j-3]);
    2307             pixelInt += coef[6]* (pImgPad[j+2]+pImgPad[j-2]);
    2308             pixelInt += coef[7]* (pImgPad[j+1]+pImgPad[j-1]);
    2309             pixelInt += coef[8]* (pImgPad[j  ]);
    2310 
    2311             pixelInt=(Int)((pixelInt+offset) >> numBitsMinus1);
    2312 
    2313             pImgRes[j] = Clip( pixelInt );
    2314           }
    2315         }
    2316 #endif
    2317         pImgPad += stride;
    2318         pImgRes += stride;
    2319 
    2320       }
    2321     }
    2322 
    2323     break;
    2324   default:
    2325     {
    2326       printf("Not a supported filter shape\n");
    2327       assert(0);
    2328       exit(1);
    2329     }
    2330   }
    2331 
    2332 }
    2333 
    2334 /** Chroma filtering for multi-slice picture
    2335  * \param componentID slice parameters
    2336  * \param pcPicDecYuv original picture
    2337  * \param pcPicRestYuv picture before filtering
    2338  * \param coeff filter coefficients
    2339  * \param filtNo  filter shape
    2340  * \param chromaFormatShift size adjustment for chroma (1 for 4:2:0 format)
    2341  */
    2342 Void TComAdaptiveLoopFilter::xFilterChromaSlices(Int componentID, TComPicYuv* pcPicDecYuv, TComPicYuv* pcPicRestYuv, Int *coeff, Int filtNo, Int chromaFormatShift)
    2343 {
    2344   Pel* pPicDec   = (componentID == ALF_Cb)?(    pcPicDecYuv->getCbAddr()):(    pcPicDecYuv->getCrAddr());
    2345   Pel* pPicSlice = (componentID == ALF_Cb)?(m_pcSliceYuvTmp->getCbAddr()):(m_pcSliceYuvTmp->getCrAddr());
    2346   Pel* pRest     = (componentID == ALF_Cb)?(   pcPicRestYuv->getCbAddr()):(   pcPicRestYuv->getCrAddr());
    2347   Int  stride    = pcPicDecYuv->getCStride();
    2348 
    2349   for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    2350   {
    2351     if(!m_pcPic->getValidSlice(s))
    2352     {
    2353       continue;
    2354     }
    2355     std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];
    2356 
    2357     for(Int t=0; t< (Int)vpSliceTileAlfLCU.size(); t++)
    2358     {
    2359       std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];
    2360 
    2361       copyRegion(vpAlfLCU, pPicSlice, pPicDec, stride, chromaFormatShift);
    2362       extendRegionBorder(vpAlfLCU, pPicSlice, stride, chromaFormatShift);
    2363       filterChromaRegion(vpAlfLCU, pPicSlice, pRest, stride, coeff, filtNo, chromaFormatShift);
    2364     }
    2365   }
    2366 }
    2367 
    2368 /** Chroma filtering for one component in multi-slice picture
    2369  * \param componentID slice parameters
    2370  * \param pcPicDecYuv original picture
    2371  * \param pcPicRestYuv picture before filtering
    2372  * \param shape  filter shape
    2373  * \param pCoeff filter coefficients
    2374  */
    2375 Void TComAdaptiveLoopFilter::xFilterChromaOneCmp(Int componentID, TComPicYuv *pDecYuv, TComPicYuv *pRestYuv, Int shape, Int *pCoeff)
    2376 {
    2377   Int chromaFormatShift = 1;
    2378   if(!m_bUseNonCrossALF)
    2379   {
    2380     Pel* pDec    = (componentID == ALF_Cb)?(pDecYuv->getCbAddr()): (pDecYuv->getCrAddr());
    2381     Pel* pRest   = (componentID == ALF_Cb)?(pRestYuv->getCbAddr()):(pRestYuv->getCrAddr());
    2382     Int  iStride = pDecYuv->getCStride();
    2383     filterChroma(pRest, pDec, iStride, 0, (Int)(m_img_height>>1) -1, 0, (Int)(m_img_width>>1)-1, shape, pCoeff);
    2384   }
    2385   else
    2386   {
    2387     xFilterChromaSlices(componentID, pDecYuv, pRestYuv, pCoeff, shape, chromaFormatShift);
    2388   }
    2389 }
    2390 
    2391 /** Chroma filtering for  multi-slice picture
    2392  * \param pcAlfParam ALF parameters
    2393  * \param pcPicDec to-be-filtered picture buffer
    2394  * \param pcPicRest filtered picture buffer
    2395  */
    2396 Void TComAdaptiveLoopFilter::xALFChroma(ALFParam* pcAlfParam, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)
    2397 {
    2398   if((pcAlfParam->chroma_idc>>1)&0x01)
    2399   {
    2400     xFilterChromaOneCmp(ALF_Cb, pcPicDec, pcPicRest, pcAlfParam->filter_shape_chroma, pcAlfParam->coeff_chroma);
    2401   }
    2402 
    2403   if(pcAlfParam->chroma_idc&0x01)
    2404   {
    2405     xFilterChromaOneCmp(ALF_Cr, pcPicDec, pcPicRest, pcAlfParam->filter_shape_chroma, pcAlfParam->coeff_chroma);
    2406   }
    2407 }
    2408 
    2409 #endif
    2410921
    2411922Void TComAdaptiveLoopFilter::setAlfCtrlFlags(AlfCUCtrlInfo* pAlfParam, TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt &idx)
     
    24981009 * \param numSlicesInPic number of slices in picture
    24991010 */
    2500 #if LCU_SYNTAX_ALF
    25011011Void TComAdaptiveLoopFilter::createPicAlfInfo(TComPic* pcPic, Int numSlicesInPic, Int alfQP)
    2502 #else
    2503 Void TComAdaptiveLoopFilter::createPicAlfInfo(TComPic* pcPic, Int numSlicesInPic)
    2504 #endif
    25051012{
    25061013  m_uiNumSlicesInPic = numSlicesInPic;
     
    25101017  m_pcPic = pcPic;
    25111018
    2512 #if LCU_SYNTAX_ALF
    25131019  m_isNonCrossSlice = pcPic->getIndependentSliceBoundaryForNDBFilter();
    25141020  m_suWidth = pcPic->getMinCUWidth();
    25151021  m_suHeight= pcPic->getMinCUHeight();
    25161022  m_alfQP = alfQP;
    2517 #endif
    2518 #if !LCU_SYNTAX_ALF 
    2519   if(m_uiNumSlicesInPic > 1 || m_bUseNonCrossALF)
    2520   {
    2521 #endif
    25221023    m_ppSliceAlfLCUs = new AlfLCUInfo*[m_uiNumSlicesInPic];
    25231024    m_pvpAlfLCU = new std::vector< AlfLCUInfo* >[m_uiNumSlicesInPic];
     
    25841085      m_pcSliceYuvTmp = pcPic->getYuvPicBufferForIndependentBoundaryProcessing();
    25851086    }
    2586 #if !LCU_SYNTAX_ALF
    2587   }
    2588 #endif
    25891087
    25901088}
     
    25941092Void TComAdaptiveLoopFilter::destroyPicAlfInfo()
    25951093{
    2596 #if !LCU_SYNTAX_ALF
    2597   if(m_bUseNonCrossALF)
    2598   {
    2599 #endif
    26001094    for(Int s=0; s< m_uiNumSlicesInPic; s++)
    26011095    {
     
    26141108    delete[] m_pvpSliceTileAlfLCU;
    26151109    m_pvpSliceTileAlfLCU = NULL;
    2616 #if !LCU_SYNTAX_ALF
    2617   }
    2618 #endif
    2619 }
    2620 
    2621 #if !LCU_SYNTAX_ALF
    2622 /** ALF for cu-on/off-controlled region
    2623  * \param vpAlfLCU ALF LCU information container
    2624  * \param imgDec to-be-filtered picture buffer
    2625  * \param imgRest filtered picture buffer
    2626  * \param stride picture buffer stride size
    2627  * \param filtNo filter shape
    2628  * \param filterCoeff filter coefficients
    2629  * \param mergeTable merge table for filter set
    2630  * \param varImg BA index
    2631  */
    2632 Void TComAdaptiveLoopFilter::xCUAdaptiveRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* imgDec, Pel* imgRest, Int stride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg)
    2633 {
    2634   UInt SUWidth   = m_pcPic->getMinCUWidth();
    2635   UInt SUHeight  = m_pcPic->getMinCUHeight();
    2636   UInt idx, startSU, endSU, currSU, LCUX, LCUY, LPelX, TPelY;
    2637   TComDataCU* pcCU;
    2638 
    2639   for(idx=0; idx< vpAlfLCU.size(); idx++)
    2640   {
    2641     AlfLCUInfo&    rAlfLCU = *(vpAlfLCU[idx]);
    2642     pcCU                   = rAlfLCU.pcCU;
    2643     startSU              = rAlfLCU.startSU;
    2644     endSU                = rAlfLCU.endSU;
    2645     LCUX                 = pcCU->getCUPelX();
    2646     LCUY                 = pcCU->getCUPelY();
    2647 
    2648     for(currSU= startSU; currSU<= endSU; currSU++)
    2649     {
    2650       LPelX   = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
    2651       TPelY   = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
    2652       if( !( LPelX < m_img_width )  || !( TPelY < m_img_height )  )
    2653       {
    2654         continue;
    2655       }
    2656       if(pcCU->getAlfCtrlFlag(currSU))
    2657       {
    2658         filterLuma(imgRest, imgDec, stride, TPelY, TPelY+ SUHeight-1, LPelX, LPelX+ SUWidth-1,  filtNo, m_filterCoeffSym, m_varIndTab, m_varImg);
    2659       }
    2660     }
    2661   }
    2662 
    2663 }
    2664 
    2665 /** ALF for "non" cu-on/off-controlled region
    2666  * \param vpAlfLCU ALF LCU information container
    2667  * \param imgDec to-be-filtered picture buffer
    2668  * \param imgRest filtered picture buffer
    2669  * \param stride picture buffer stride size
    2670  * \param filtNo filter shape
    2671  * \param filterCoeff filter coefficients
    2672  * \param mergeTable merge table for filter set
    2673  * \param varImg BA index
    2674  */
    2675 Void TComAdaptiveLoopFilter::filterLumaRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* imgDec, Pel* imgRest, Int stride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg)
    2676 {
    2677 
    2678   Int height, width;
    2679   Int ypos, xpos;
    2680 
    2681   for(Int i=0; i< vpAlfLCU.size(); i++)
    2682   {
    2683     AlfLCUInfo& rAlfLCU = *(vpAlfLCU[i]);
    2684     for(UInt j=0; j< rAlfLCU.numSGU; j++)
    2685     {
    2686       ypos   = (Int)(rAlfLCU[j].posY  );
    2687       xpos   = (Int)(rAlfLCU[j].posX  );
    2688       height = (Int)(rAlfLCU[j].height);
    2689       width  = (Int)(rAlfLCU[j].width );
    2690 
    2691       filterLuma(imgRest, imgDec, stride, ypos, ypos+ height-1, xpos, xpos+ width-1,  filtNo, filterCoeff, mergeTable, varImg);
    2692     }
    2693   }
    2694 }
    2695 
    2696 
    2697 /** Perform ALF for one chroma region
    2698  * \param vpAlfLCU ALF LCU data container
    2699  * \param pDec to-be-filtered picture buffer
    2700  * \param pRest filtered picture buffer
    2701  * \param stride picture buffer stride
    2702  * \param coeff  filter coefficients
    2703  * \param filtNo filter shape
    2704  * \param chromaFormatShift chroma component size adjustment (1 for 4:2:0)
    2705  */
    2706 Void TComAdaptiveLoopFilter::filterChromaRegion(std::vector<AlfLCUInfo*> &vpAlfLCU, Pel* pDec, Pel* pRest, Int stride, Int *coeff, Int filtNo, Int chromaFormatShift)
    2707 {
    2708   Int height, width;
    2709   Int ypos, xpos;
    2710 
    2711   for(Int i=0; i< vpAlfLCU.size(); i++)
    2712   {
    2713     AlfLCUInfo& cAlfLCU = *(vpAlfLCU[i]);
    2714     for(Int j=0; j< cAlfLCU.numSGU; j++)
    2715     {
    2716       ypos   = (Int)(cAlfLCU[j].posY   >> chromaFormatShift);
    2717       xpos   = (Int)(cAlfLCU[j].posX   >> chromaFormatShift);
    2718       height = (Int)(cAlfLCU[j].height >> chromaFormatShift);
    2719       width  = (Int)(cAlfLCU[j].width  >> chromaFormatShift);
    2720 
    2721       filterChroma(pRest, pDec, stride, ypos, ypos+ height -1, xpos, xpos+ width-1, filtNo, coeff);
    2722     }
    2723   }
    2724 }
    2725 
    2726 #endif
     1110}
     1111
    27271112
    27281113/** Copy ALF CU control flags from ALF parameters for slices
     
    28461231    {
    28471232      NDBFBlockInfo& rSGU = rAlfLCU[n];
    2848 #if LCU_SYNTAX_ALF
    28491233      if(rSGU.allBordersAvailable)
    28501234      {
    28511235        continue;
    28521236      }
    2853 #endif
    28541237      posX     = rSGU.posX >> formatShift;
    28551238      posY     = rSGU.posY >> formatShift;
     
    31271510}
    31281511
    3129 #if LCU_SYNTAX_ALF
    31301512/** reconstruct ALF luma coefficient
    31311513 * \param [in] alfLCUParam ALF parameters
     
    32321614  coeffPred = (1<<ALF_NUM_BIT_SHIFT) - sum;
    32331615#endif
    3234 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    32351616  filterCoeff[0][alfLCUParam->num_coeff-1] = coeffPred + alfLCUParam->coeffmulti[0][alfLCUParam->num_coeff-1];
    3236 #else
    3237   filterCoeff[0][alfLCUParam->num_coeff-1] = coeffPred - alfLCUParam->coeffmulti[0][alfLCUParam->num_coeff-1];
    3238 #endif
    32391617}
    32401618
     
    34441822  Int pred = (1<<ALF_NUM_BIT_SHIFT) - (sum);
    34451823#endif
    3446 #if ALF_CHROMA_COEF_PRED_HARMONIZATION
    34471824  coeff[numCoef-1] = coeff[numCoef-1] - pred;
    3448 #else
    3449   coeff[numCoef-1] = pred- coeff[numCoef-1];
    3450 #endif
    3451 }
    3452 
    3453 #if ALF_SINGLE_FILTER_SHAPE
     1825}
     1826
    34541827/** filtering pixels
    34551828 * \param [out] imgRes filtered picture
     
    35761949  } 
    35771950}
    3578 #endif
    35791951
    35801952#if LCUALF_QP_DEPENDENT_BITS
     
    36231995  static Int shiftW = (Int)(log((double)VAR_SIZE_W)/log(2.0));
    36241996  static Int varMax = (Int)NO_VAR_BINS-1; 
    3625 #if ALF_16_BA_GROUPS
    36261997  static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};
    36271998  static Int avgVarTab[3][6] = { {0,  1,  2,  3,  4,  5,},
    36281999  {0,  6,  7,  8,  9, 10,},
    36292000  {0, 11, 12, 13, 14, 15}   };
    3630 #else
    3631   static Int step   = (Int)((Int)(NO_VAR_BINS)/3) - 1; 
    3632   static Int th[NO_VAR_BINS] = {0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4};
    3633 #endif
    36342001
    36352002  Int i, j, avgVar, vertical, horizontal, direction, yOffset;
     
    36832050      avgVar = (Pel) Clip_post( varMax, avgVar>>(g_uiBitIncrement+1) );
    36842051      avgVar = th[avgVar];
    3685 #if ALF_16_BA_GROUPS
    36862052      avgVar = avgVarTab[direction][avgVar];
    3687 #else     
    3688       avgVar = Clip_post(step, (Int)avgVar) + (step+1)*direction;
    3689 #endif
    36902053      imgYvar[i>>shiftH][j>>shiftW] = avgVar;
    36912054    }
     
    37672130  return pBuf;
    37682131}
    3769 #endif
    37702132
    37712133
  • trunk/source/Lib/TLibCommon/TComAdaptiveLoopFilter.h

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

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

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

    r210 r296  
    5151#endif
    5252
     53#if MERL_VSP_C0152
     54
     55#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )
     56
     57inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo )
     58{
     59  Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx);
     60  if( vspIdx != 0 )
     61  {
     62    Int idx = vspIdx - 1;
     63    bVspMvZeroDone[idx] = true;
     64    iVSPIndexTrue [idx] = iCount;
     65
     66    // no need to reset Inter Dir
     67
     68    // set MV using checked disparity
     69    if (vspIdx < 4)
     70    {
     71      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     72      if ( pcCURef->getSlice()->isInterB() )
     73      {
     74         pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     75      }
     76    }
     77  }
     78}
     79
     80inline Bool TComDataCU::xAddVspMergeCand( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
     81                                          UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo )
     82{
     83  if( ucVspMergePos == VSP_MERGE_POS )
     84  {
     85    Int idx = vspIdx - 1;
     86    {
     87      if( getSlice()->getSPS()->getViewId() != 0 && bVspMvZeroDone[idx] == false )
     88      {
     89        {
     90          abCandIsInter [iCount] = true;
     91          bVspMvZeroDone[idx] = true;
     92
     93          // get Inter Dir
     94          Int iInterDir = ((getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 && getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 0) ? 3 :
     95            (getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2));
     96          puhInterDirNeighbours[iCount] = iInterDir; // The direction information does not matter
     97          // get Mv using checked disparity vector
     98          if (vspIdx < 4) // spatial
     99          {
     100            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID );
     101            if ( getSlice()->isInterB() )
     102            {
     103              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], NOT_VALID );
     104            }
     105          }
     106          iVSPIndexTrue[idx] = iCount;
     107          if ( mrgCandIdx == iCount )
     108          {
     109            return false;
     110          }
     111          iCount ++;
     112        }
     113      }
     114    }
     115  }
     116  return true;
     117}
     118#endif
     119
    53120// ====================================================================================================================
    54121// Constructor / destructor / create / destroy
     
    79146#endif
    80147  m_puhMergeIndex      = NULL;
     148#if MERL_VSP_C0152
     149  m_piVSPIndex         = NULL;
     150#endif
    81151  m_puhLumaIntraDir    = NULL;
    82152  m_puhChromaIntraDir  = NULL;
     
    135205#if HHI_DMM_PRED_TEX
    136206  m_puiWedgePredTexTabIdx    = NULL;
     207#if LGE_DMM3_SIMP_C0044
     208  m_puiWedgePredTexIntraTabIdx = NULL;
     209#endif
    137210  m_piWedgePredTexDeltaDC1   = NULL;
    138211  m_piWedgePredTexDeltaDC2   = NULL;
     
    141214  m_piContourPredTexDeltaDC2 = NULL;
    142215#endif
    143 #if HHI_INTER_VIEW_RESIDUAL_PRED
     216#if H3D_IVRP
    144217  m_pbResPredAvailable = NULL;
    145218  m_pbResPredFlag      = NULL;
     
    182255  if ( !bDecSubCu )
    183256  {
    184 #if H0736_AVC_STYLE_QP_RANGE
    185257    m_phQP               = (Char*     )xMalloc(Char,     uiNumPartition);
    186 #else
    187     m_phQP               = (UChar*    )xMalloc(UChar,    uiNumPartition);
    188 #endif
    189258    m_puhDepth           = (UChar*    )xMalloc(UChar,    uiNumPartition);
    190259#if HHI_MPI
     
    213282#endif
    214283    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
    215 #if HHI_INTER_VIEW_RESIDUAL_PRED
     284#if MERL_VSP_C0152
     285    m_piVSPIndex         = (Char*  )xMalloc(Char,   uiNumPartition);
     286#endif
     287#if H3D_IVRP
    216288    m_pbResPredAvailable = (Bool*  )xMalloc(Bool,   uiNumPartition);
    217289    m_pbResPredFlag      = (Bool*  )xMalloc(Bool,   uiNumPartition);
     
    283355#if HHI_DMM_PRED_TEX
    284356    m_puiWedgePredTexTabIdx    = (UInt*)xMalloc(UInt, uiNumPartition);
     357#if LGE_DMM3_SIMP_C0044
     358    m_puiWedgePredTexIntraTabIdx    = (UInt*)xMalloc(UInt, uiNumPartition);
     359#endif
    285360    m_piWedgePredTexDeltaDC1   = (Int* )xMalloc(Int,  uiNumPartition);
    286361    m_piWedgePredTexDeltaDC2   = (Int* )xMalloc(Int,  uiNumPartition);
     
    364439    if ( m_pbICFlag           ) { xFree(m_pbICFlag);            m_pbICFlag          = NULL; }
    365440#endif
     441#if MERL_VSP_C0152
     442    if ( m_piVSPIndex         ) { xFree(m_piVSPIndex);          m_piVSPIndex        = NULL; }
     443#endif
    366444    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
    367 #if HHI_INTER_VIEW_RESIDUAL_PRED
     445#if H3D_IVRP
    368446    if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable);  m_pbResPredAvailable= NULL; }
    369447    if ( m_pbResPredFlag      ) { xFree(m_pbResPredFlag);       m_pbResPredFlag     = NULL; }
     
    408486#if HHI_DMM_PRED_TEX
    409487    if ( m_puiWedgePredTexTabIdx    ) { xFree(m_puiWedgePredTexTabIdx   ); m_puiWedgePredTexTabIdx    = NULL; }
     488#if LGE_DMM3_SIMP_C0044
     489    if ( m_puiWedgePredTexIntraTabIdx ) { xFree(m_puiWedgePredTexIntraTabIdx); m_puiWedgePredTexIntraTabIdx    = NULL; }
     490#endif
    410491    if ( m_piWedgePredTexDeltaDC1   ) { xFree(m_piWedgePredTexDeltaDC1  ); m_piWedgePredTexDeltaDC1   = NULL; }
    411492    if ( m_piWedgePredTexDeltaDC2   ) { xFree(m_piWedgePredTexDeltaDC2  ); m_piWedgePredTexDeltaDC2   = NULL; }
     
    463544  this->height = src.height;
    464545  ::memcpy(this->isBorderAvailable, src.isBorderAvailable, sizeof(Bool)*((Int)NUM_SGU_BORDER));
    465 #if LCU_SYNTAX_ALF
    466546  this->allBordersAvailable = src.allBordersAvailable;
    467 #endif
    468547
    469548  return *this;
     
    500579  m_uiTotalBins        = 0;
    501580  m_uiNumPartition     = pcPic->getNumPartInCU();
    502 #if BURST_IPCM
    503581  m_numSucIPCM       = 0;
    504582  m_lastCUSucIPCMFlag   = false;
    505 #endif
    506583
    507584  for(int i=0; i<pcPic->getNumPartInCU(); i++)
     
    558635#endif
    559636    m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui];
     637#if MERL_VSP_C0152
     638    m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui];
     639#endif
    560640    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
    561641    m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui];
     
    598678#endif
    599679    memset( m_puhMergeIndex     + firstElement, 0,                        numElements * sizeof( *m_puhMergeIndex ) );
     680#if MERL_VSP_C0152
     681    memset( m_piVSPIndex        + firstElement, 0,                        numElements * sizeof( *m_piVSPIndex ) );
     682#endif
    600683    memset( m_puhLumaIntraDir   + firstElement, 2,                        numElements * sizeof( *m_puhLumaIntraDir ) );
    601684    memset( m_puhChromaIntraDir + firstElement, 0,                        numElements * sizeof( *m_puhChromaIntraDir ) );
     
    618701#if HHI_DMM_PRED_TEX
    619702    memset( m_puiWedgePredTexTabIdx    + firstElement, 0, sizeof( UInt ) * numElements );
     703#if LGE_DMM3_SIMP_C0044
     704    memset( m_puiWedgePredTexIntraTabIdx + firstElement, 0, sizeof( UInt ) * numElements );
     705#endif
    620706    memset( m_piWedgePredTexDeltaDC1   + firstElement, 0, sizeof( Int  ) * numElements );
    621707    memset( m_piWedgePredTexDeltaDC2   + firstElement, 0, sizeof( Int  ) * numElements );
     
    627713    memset (m_pbRenderable             + firstElement, false, sizeof( Bool ) * numElements) ;
    628714#endif
    629 #if HHI_INTER_VIEW_RESIDUAL_PRED
     715#if H3D_IVRP
    630716    memset( m_pbResPredAvailable       + firstElement, 0    , sizeof( Bool ) * numElements );
    631717    memset( m_pbResPredFlag            + firstElement, 0    , sizeof( Bool ) * numElements );
     
    720806}
    721807
    722 #if H0736_AVC_STYLE_QP_RANGE
    723808/** initialize prediction data with enabling sub-LCU-level delta QP
    724809*\param  uiDepth  depth of the current CU
     
    729814*/
    730815Void TComDataCU::initEstData( UInt uiDepth, Int qp )
    731 #else
    732 /** initialize prediction data with enabling sub-LCU-level delta QP
    733 *\param  uiDepth  depth of the current CU
    734 *\param  uiQP     QP for the current CU
    735 *- set CU width and CU height according to depth
    736 *- set QP value according to input QP
    737 *- set last-coded QP value according to input last-coded QP
    738 */
    739 Void TComDataCU::initEstData( UInt uiDepth, UInt uiQP )
    740 #endif
    741816{
    742817  m_dTotalCost         = MAX_DOUBLE;
     
    770845      m_pePredMode[ui] = MODE_NONE;
    771846      m_pbIPCMFlag[ui] = 0;
    772 #if H0736_AVC_STYLE_QP_RANGE
    773847      m_phQP[ui] = qp;
    774 #else
    775       m_phQP[ui] = uiQP;
    776 #endif
    777848      m_puiAlfCtrlFlag[ui]= false;
    778849      m_pbMergeFlag[ui] = 0;
     
    781852#endif
    782853      m_puhMergeIndex[ui] = 0;
    783 #if HHI_INTER_VIEW_RESIDUAL_PRED
     854#if MERL_VSP_C0152
     855      m_piVSPIndex[ui] = 0;
     856#endif
     857#if H3D_IVRP
    784858      m_pbResPredAvailable[ui] = 0;
    785859      m_pbResPredFlag[ui]      = 0;
     
    803877#if HHI_DMM_PRED_TEX
    804878    m_puiWedgePredTexTabIdx   [ui] = 0;
     879#if LGE_DMM3_SIMP_C0044
     880    m_puiWedgePredTexIntraTabIdx [ui] = 0;
     881#endif
    805882    m_piWedgePredTexDeltaDC1  [ui] = 0;
    806883    m_piWedgePredTexDeltaDC2  [ui] = 0;
     
    845922
    846923// initialize Sub partition
    847 #if H0736_AVC_STYLE_QP_RANGE
    848924Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp )
    849 #else
    850 Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP )
    851 #endif
    852925{
    853926  assert( uiPartUnitIdx<4 );
     
    869942  m_uiNumPartition     = pcCU->getTotalNumPart() >> 2;
    870943
    871 #if BURST_IPCM
    872944  m_numSucIPCM       = 0;
    873945  m_lastCUSucIPCMFlag   = false;
    874 #endif
    875946
    876947  Int iSizeInUchar = sizeof( UChar  ) * m_uiNumPartition;
    877948  Int iSizeInBool  = sizeof( Bool   ) * m_uiNumPartition;
    878 
    879 #if H0736_AVC_STYLE_QP_RANGE
     949#if MERL_VSP_C0152
     950  Int iSizeInChar  = sizeof( Char   ) * m_uiNumPartition;
     951#endif
     952
    880953  Int sizeInChar = sizeof( Char  ) * m_uiNumPartition;
    881954  memset( m_phQP,              qp,  sizeInChar );
    882 #else
    883   memset( m_phQP,              uiQP, iSizeInUchar );
    884 #endif
    885955
    886956  memset( m_puiAlfCtrlFlag,     0, iSizeInBool );
     
    893963#endif
    894964  memset( m_puhMergeIndex,      0, iSizeInUchar );
    895 #if HHI_INTER_VIEW_RESIDUAL_PRED
     965#if MERL_VSP_C0152
     966  memset( m_piVSPIndex,         0, iSizeInChar );
     967#endif
     968#if H3D_IVRP
    896969  memset( m_pbResPredAvailable, 0, iSizeInBool  );
    897970  memset( m_pbResPredFlag,      0, iSizeInBool  );
     
    921994#if HHI_DMM_PRED_TEX
    922995  memset( m_puiWedgePredTexTabIdx,    0, sizeof( UInt ) * m_uiNumPartition );
     996#if LGE_DMM3_SIMP_C0044
     997  memset( m_puiWedgePredTexIntraTabIdx, 0, sizeof( UInt ) * m_uiNumPartition );
     998#endif
    923999  memset( m_piWedgePredTexDeltaDC1,   0, sizeof( Int  ) * m_uiNumPartition );
    9241000  memset( m_piWedgePredTexDeltaDC2,   0, sizeof( Int  ) * m_uiNumPartition );
     
    9731049#endif
    9741050      m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui];
     1051#if MERL_VSP_C0152
     1052      m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui];
     1053#endif
    9751054      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    9761055      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    9921071#if HHI_DMM_PRED_TEX
    9931072      m_puiWedgePredTexTabIdx   [ui]=pcCU->getWedgePredTexTabIdx    (uiPartOffset+ui);
     1073#if LGE_DMM3_SIMP_C0044
     1074      m_puiWedgePredTexIntraTabIdx [ui]=pcCU->getWedgePredTexIntraTabIdx (uiPartOffset+ui);
     1075#endif
    9941076      m_piWedgePredTexDeltaDC1  [ui]=pcCU->getWedgePredTexDeltaDC1  (uiPartOffset+ui);
    9951077      m_piWedgePredTexDeltaDC2  [ui]=pcCU->getWedgePredTexDeltaDC2  (uiPartOffset+ui);
     
    9981080      m_piContourPredTexDeltaDC2[ui]=pcCU->getContourPredTexDeltaDC2(uiPartOffset+ui);
    9991081#endif   
    1000 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1082#if H3D_IVRP
    10011083      m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ];
    10021084      m_pbResPredFlag     [ui] = pcCU->m_pbResPredFlag     [ uiPartOffset + ui ];
     
    11171199#endif
    11181200  m_puhMergeIndex       = pcCU->getMergeIndex()       + uiPart;
    1119 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1201#if MERL_VSP_C0152
     1202  m_piVSPIndex          = pcCU->getVSPIndex()         + uiPart;
     1203#endif
     1204#if H3D_IVRP
    11201205  m_pbResPredAvailable  = pcCU->getResPredAvail()     + uiPart;
    11211206  m_pbResPredFlag       = pcCU->getResPredFlag ()     + uiPart;
     
    11931278#if HHI_DMM_PRED_TEX
    11941279  m_puiWedgePredTexTabIdx    = pcCU->getWedgePredTexTabIdx()     + uiPart;   
     1280#if LGE_DMM3_SIMP_C0044
     1281  m_puiWedgePredTexIntraTabIdx = pcCU->getWedgePredTexIntraTabIdx() + uiPart;   
     1282#endif
    11951283  m_piWedgePredTexDeltaDC1   = pcCU->getWedgePredTexDeltaDC1()   + uiPart;   
    11961284  m_piWedgePredTexDeltaDC2   = pcCU->getWedgePredTexDeltaDC2()   + uiPart;   
     
    12271315  m_uiCUAddr           = pcCU->getAddr();
    12281316  m_uiAbsIdxInLCU      = uiAbsPartIdx;
    1229  
     1317
    12301318  Int iRastPartIdx     = g_auiZscanToRaster[uiAbsPartIdx];
    12311319  m_uiCUPelX           = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() );
     
    12571345#endif
    12581346  m_puhMergeIndex      = pcCU->getMergeIndex()            + uiAbsPartIdx;
    1259 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1347#if MERL_VSP_C0152
     1348  m_piVSPIndex         = pcCU->getVSPIndex()              + uiAbsPartIdx;
     1349#endif
     1350#if H3D_IVRP
    12601351  m_pbResPredAvailable = pcCU->getResPredAvail()          + uiAbsPartIdx;
    12611352  m_pbResPredFlag      = pcCU->getResPredFlag ()          + uiAbsPartIdx;
     
    12881379  Int iSizeInUchar  = sizeof( UChar ) * uiNumPartition;
    12891380  Int iSizeInBool   = sizeof( Bool  ) * uiNumPartition;
    1290  
    1291 #if H0736_AVC_STYLE_QP_RANGE
     1381#if MERL_VSP_C0152
     1382  Int iSizeInChar   = sizeof( Char )  * uiNumPartition;
     1383#endif
     1384 
    12921385  Int sizeInChar  = sizeof( Char ) * uiNumPartition;
    12931386  memcpy( m_phQP       + uiOffset, pcCU->getQP(),             sizeInChar                        );
    1294 #else
    1295   memcpy( m_phQP       + uiOffset, pcCU->getQP(),             iSizeInUchar                        );
    1296 #endif
    12971387  memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(),  sizeof( *m_pePartSize ) * uiNumPartition );
    12981388  memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition );
     
    13061396#endif
    13071397  memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
    1308 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1398#if MERL_VSP_C0152
     1399  memcpy( m_piVSPIndex          + uiOffset, pcCU->getVSPIndex(),          iSizeInChar );
     1400#endif
     1401#if H3D_IVRP
    13091402  memcpy( m_pbResPredAvailable  + uiOffset, pcCU->getResPredAvail(),      iSizeInBool  );
    13101403  memcpy( m_pbResPredFlag       + uiOffset, pcCU->getResPredFlag(),       iSizeInBool  );
     
    13751468#if HHI_DMM_PRED_TEX
    13761469  memcpy( m_puiWedgePredTexTabIdx    + uiOffset, pcCU->getWedgePredTexTabIdx(),     sizeof( UInt ) * uiNumPartition );
     1470#if LGE_DMM3_SIMP_C0044
     1471  memcpy( m_puiWedgePredTexIntraTabIdx + uiOffset, pcCU->getWedgePredTexIntraTabIdx(), sizeof( UInt ) * uiNumPartition );
     1472#endif
    13771473  memcpy( m_piWedgePredTexDeltaDC1   + uiOffset, pcCU->getWedgePredTexDeltaDC1(),   sizeof( Int  ) * uiNumPartition );
    13781474  memcpy( m_piWedgePredTexDeltaDC2   + uiOffset, pcCU->getWedgePredTexDeltaDC2(),   sizeof( Int  ) * uiNumPartition );
     
    14191515  Int iSizeInUchar  = sizeof( UChar ) * m_uiNumPartition;
    14201516  Int iSizeInBool   = sizeof( Bool  ) * m_uiNumPartition;
    1421  
    1422 #if H0736_AVC_STYLE_QP_RANGE
     1517#if MERL_VSP_C0152
     1518  Int iSizeInChar   = sizeof( Char  ) * m_uiNumPartition;
     1519#endif
     1520 
    14231521  Int sizeInChar  = sizeof( Char ) * m_uiNumPartition;
    14241522  memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar  );
    1425 #else
    1426   memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, iSizeInUchar );
    1427 #endif
    14281523
    14291524  memcpy( rpcCU->getPartitionSize()  + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition );
     
    14401535#endif
    14411536  memcpy( rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar );
    1442 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1537#if MERL_VSP_C0152
     1538  memcpy( rpcCU->getVSPIndex()          + m_uiAbsIdxInLCU, m_piVSPIndex,         iSizeInChar );
     1539#endif
     1540#if H3D_IVRP
    14431541  memcpy( rpcCU->getResPredAvail()      + m_uiAbsIdxInLCU, m_pbResPredAvailable,  iSizeInBool  );
    14441542  memcpy( rpcCU->getResPredFlag()       + m_uiAbsIdxInLCU, m_pbResPredFlag,       iSizeInBool  );
     
    15011599#if HHI_DMM_PRED_TEX
    15021600  memcpy( rpcCU->getWedgePredTexTabIdx()     + m_uiAbsIdxInLCU, m_puiWedgePredTexTabIdx,    sizeof( UInt ) * m_uiNumPartition );
     1601#if LGE_DMM3_SIMP_C0044
     1602  memcpy( rpcCU->getWedgePredTexIntraTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredTexIntraTabIdx,    sizeof( UInt ) * m_uiNumPartition );
     1603#endif
    15031604  memcpy( rpcCU->getWedgePredTexDeltaDC1()   + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC1,   sizeof( Int  ) * m_uiNumPartition );
    15041605  memcpy( rpcCU->getWedgePredTexDeltaDC2()   + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC2,   sizeof( Int  ) * m_uiNumPartition );
     
    15471648  Int iSizeInUchar  = sizeof( UChar  ) * uiQNumPart;
    15481649  Int iSizeInBool   = sizeof( Bool   ) * uiQNumPart;
    1549  
    1550 #if H0736_AVC_STYLE_QP_RANGE
     1650#if MERL_VSP_C0152
     1651  Int iSizeInChar   = sizeof( Char   ) * uiQNumPart;
     1652#endif
     1653 
    15511654  Int sizeInChar  = sizeof( Char ) * uiQNumPart;
    15521655  memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar );
    1553 #else
    1554   memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, iSizeInUchar );
    1555 #endif 
    15561656  memcpy( rpcCU->getPartitionSize()  + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart );
    15571657#if HHI_INTERVIEW_SKIP
     
    15661666#endif
    15671667  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
    1568 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1668#if MERL_VSP_C0152
     1669  memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,         iSizeInChar );
     1670#endif
     1671#if H3D_IVRP
    15691672  memcpy( rpcCU->getResPredAvail()      + uiPartOffset, m_pbResPredAvailable,  iSizeInBool  );
    15701673  memcpy( rpcCU->getResPredFlag()       + uiPartOffset, m_pbResPredFlag,       iSizeInBool  );
     
    16281731#if HHI_DMM_PRED_TEX
    16291732  memcpy( rpcCU->getWedgePredTexTabIdx()     + uiPartOffset, m_puiWedgePredTexTabIdx,    sizeof( UInt ) * uiQNumPart );
     1733#if LGE_DMM3_SIMP_C0044
     1734  memcpy( rpcCU->getWedgePredTexIntraTabIdx() + uiPartOffset, m_puiWedgePredTexIntraTabIdx, sizeof( UInt ) * uiQNumPart );
     1735#endif
    16301736  memcpy( rpcCU->getWedgePredTexDeltaDC1()   + uiPartOffset, m_piWedgePredTexDeltaDC1,   sizeof( Int  ) * uiQNumPart );
    16311737  memcpy( rpcCU->getWedgePredTexDeltaDC2()   + uiPartOffset, m_piWedgePredTexDeltaDC2,   sizeof( Int  ) * uiQNumPart );
     
    17041810       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    17051811      ||
    1706 #if !REMOVE_TILE_DEPENDENCE
    1707        (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))  )  )
    1708 #else
    17091812       (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))  )  )
    1710 #endif
    17111813      )
    17121814  {
     
    17661868       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    17671869      ||
    1768 #if !REMOVE_TILE_DEPENDENCE
    1769        (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
    1770 #else
    17711870       (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
    1772 #endif
    17731871      )
    17741872  {
     
    18171915  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    18181916       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1819 #if !REMOVE_TILE_DEPENDENCE
    1820        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1821 #else
    18221917       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1823 #endif
    18241918       ))||
    18251919       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    18261920       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1827 #if !REMOVE_TILE_DEPENDENCE
    1828        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1829 #else
    18301921       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1831 #endif
    18321922       ))
    18331923     )
     
    18431933  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    18441934       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1845 #if !REMOVE_TILE_DEPENDENCE
    1846        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1847 #else
    18481935       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1849 #endif
    18501936       ))||
    18511937       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    18521938       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1853 #if !REMOVE_TILE_DEPENDENCE
    1854        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1855 #else
    18561939       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1857 #endif
    18581940       ))
    18591941     )
     
    18711953  if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    18721954       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1873 #if !REMOVE_TILE_DEPENDENCE
    1874        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1875 #else
    18761955       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1877 #endif
    18781956       ))||
    18791957       (bEnforceEntropySliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    18801958       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1881 #if !REMOVE_TILE_DEPENDENCE
    1882        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1883 #else
    18841959       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1885 #endif
    18861960       ))
    18871961     )
     
    19432017  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19442018       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1945 #if !REMOVE_TILE_DEPENDENCE
    1946        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1947 #else
    19482019       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1949 #endif
    19502020       ))||
    19512021       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19522022       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1953 #if !REMOVE_TILE_DEPENDENCE
    1954        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1955 #else
    19562023       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1957 #endif
    19582024       ))
    19592025     )
     
    19782044       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    19792045       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1980 #if !REMOVE_TILE_DEPENDENCE
    1981        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1982 #else
    19832046       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1984 #endif
    19852047       ))||
    19862048       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    19872049       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    19882050       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1989 #if !REMOVE_TILE_DEPENDENCE
    1990        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1991 #else
    19922051       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1993 #endif
    19942052       ))
    19952053     )
     
    20462104  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    20472105       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2048 #if !REMOVE_TILE_DEPENDENCE
    2049        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2050 #else
    20512106       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2052 #endif
    20532107       ))||
    20542108       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    20552109       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2056 #if !REMOVE_TILE_DEPENDENCE
    2057        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2058 #else
    20592110       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2060 #endif
    20612111       ))
    20622112     )
     
    21172167  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    21182168       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2119 #if !REMOVE_TILE_DEPENDENCE
    2120        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2121 #else
    21222169       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2123 #endif
    21242170       ))||
    21252171       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    21262172       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2127 #if !REMOVE_TILE_DEPENDENCE
    2128        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2129 #else
    21302173       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2131 #endif
    21322174       ))
    21332175     )
     
    21892231  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    21902232       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2191 #if !REMOVE_TILE_DEPENDENCE
    2192        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2193 #else
    21942233       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2195 #endif
    21962234       ))||
    21972235       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    21982236       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2199 #if !REMOVE_TILE_DEPENDENCE
    2200        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2201 #else
    22022237       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2203 #endif
    22042238       ))
    22052239     )
     
    22202254       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    22212255       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2222 #if !REMOVE_TILE_DEPENDENCE
    2223        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2224 #else
    22252256       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2226 #endif
    22272257       ))||
    22282258       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    22292259       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    22302260       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2231 #if !REMOVE_TILE_DEPENDENCE
    2232        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2233 #else
    22342261       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2235 #endif
    22362262       ))
    22372263     )
     
    22802306  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22812307       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiAbsZorderQpMinCUIdx)||
    2282 #if !REMOVE_TILE_DEPENDENCE
    2283        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2284 #else
    22852308       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2286 #endif
    22872309       ))||
    22882310       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22892311       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)||
    2290 #if !REMOVE_TILE_DEPENDENCE
    2291        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2292 #else
    22932312       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2294 #endif
    22952313       ))
    22962314     )
     
    22992317  }
    23002318
    2301 #if H0204_QP_PREDICTION
    23022319  if ( m_pcCULeft && m_pcCULeft->getAddr() != getAddr() )
    23032320  {
    23042321    return NULL;
    23052322  }
    2306 #endif
    23072323
    23082324  return m_pcCULeft;
    23092325}
    23102326
    2311 #if H0204_QP_PREDICTION
    23122327/** Get Above QpMinCu
    23132328*\param   aPartUnitIdx
     
    23472362  if ( (enforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23482363       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(absZorderQpMinCUIdx)||
    2349 #if !REMOVE_TILE_DEPENDENCE
    2350        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2351 #else
    23522364       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2353 #endif
    23542365       ))||
    23552366       (enforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23562367       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)||
    2357 #if !REMOVE_TILE_DEPENDENCE
    2358        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2359 #else
    23602368       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2361 #endif
    23622369       ))
    23632370     )
     
    23732380  return m_pcCUAbove;
    23742381}
    2375 #endif
    2376 
    2377 #if H0736_AVC_STYLE_QP_RANGE
     2382
    23782383/** Get reference QP from left QpMinCu or latest coded QP
    23792384*\param   uiCurrAbsIdxInLCU
     
    23812386*/
    23822387Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU )
    2383 #else
    2384 /** Get reference QP from left QpMinCu or latest coded QP
    2385 *\param   uiCurrAbsIdxInLCU
    2386 *\returns UChar   reference QP value
    2387 */
    2388 UChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU )
    2389 #endif
    2390 {
    2391 #if H0204_QP_PREDICTION
     2388{
    23922389  UInt        lPartIdx, aPartIdx;
    23932390  lPartIdx = 0;
     
    23962393  TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    23972394  return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1);
    2398 #else
    2399   // Left CU
    2400   TComDataCU* pcCULeft;
    2401   UInt        uiLPartIdx;
    2402   pcCULeft = getQpMinCuLeft( uiLPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    2403   if ( pcCULeft )
    2404   {
    2405     return pcCULeft->getQP(uiLPartIdx);
    2406   }
    2407   // Last QP
    2408   return getLastCodedQP( uiCurrAbsIdxInLCU );
    2409 #endif
    24102395}
    24112396
     
    24222407}
    24232408
    2424 #if H0736_AVC_STYLE_QP_RANGE
    24252409Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )
    2426 #else
    2427 UChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )
    2428 #endif
    24292410{
    24302411  UInt uiQUPartIdxMask = ~((1<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))-1);
     
    24632444Bool TComDataCU::isLosslessCoded(UInt absPartIdx)
    24642445{
    2465 #if H0736_AVC_STYLE_QP_RANGE
    24662446  return ( getSlice()->getSPS()->getUseLossless() && ((getQP(absPartIdx) + getSlice()->getSPS()->getQpBDOffsetY()) == 0) );
    2467 #else
    2468   return ( getSlice()->getSPS()->getUseLossless() && (getQP(absPartPIdx)  == 0) );
    2469 #endif
    24702447}
    24712448#endif
     
    24802457{
    24812458  uiModeList[0] = PLANAR_IDX;
    2482 #if LOGI_INTRA_NAME_3MPM
    24832459  uiModeList[1] = VER_IDX;
    24842460  uiModeList[2] = HOR_IDX;
    2485 #else
    2486   uiModeList[1] = 1;
    2487   uiModeList[2] = 2;
    2488 #endif
    24892461  uiModeList[3] = DC_IDX;
    24902462  uiModeList[4] = LM_CHROMA_IDX;
     
    25002472    if( uiLumaMode == uiModeList[i] )
    25012473    {
    2502 #if LOGI_INTRA_NAME_3MPM
    25032474      uiModeList[i] = 34; // VER+8 mode
    2504 #else
    2505       uiModeList[i] = 7; // VER+8 mode
    2506 #endif
    25072475      break;
    25082476    }
     
    25262494  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
    25272495 
    2528 #if DEFAULT_DC
    25292496  iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2530 #else
    2531   iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;
    2532 #endif
    25332497#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    25342498  mapDMMtoIntraMode( iLeftIntraDir );
     
    25412505  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true, false, true );
    25422506 
    2543 #if DEFAULT_DC
    25442507  iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2545 #else
    2546   iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;
    2547 #endif
    25482508#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    25492509  mapDMMtoIntraMode( iAboveIntraDir );
     
    25532513#endif
    25542514 
    2555 #if LOGI_INTRA_NAME_3MPM
    25562515  uiPredNum = 3;
    25572516  if(iLeftIntraDir == iAboveIntraDir)
     
    25932552    }
    25942553  }
    2595 #else
    2596   Int iIdx  = getIntraSizeIdx(uiAbsPartIdx);
    2597  
    2598  
    2599   if ( iLeftIntraDir >= g_aucIntraModeNumAng[iIdx] )
    2600   {
    2601     iLeftIntraDir = PLANAR_IDX;
    2602   }
    2603  
    2604  
    2605   if ( iAboveIntraDir >= g_aucIntraModeNumAng[iIdx] )
    2606   {
    2607     iAboveIntraDir = PLANAR_IDX;
    2608   }
    2609  
    2610   if(iLeftIntraDir == iAboveIntraDir)
    2611   {
    2612     uiPredNum = 2;
    2613    
    2614     if( piMode )
    2615     {
    2616       *piMode = iLeftIntraDir;
    2617     }
    2618    
    2619     iAboveIntraDir = iLeftIntraDir == PLANAR_IDX ? DC_IDX : PLANAR_IDX; // DC or Planar
    2620    
    2621     assert( iLeftIntraDir != iAboveIntraDir );
    2622    
    2623     uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);
    2624     uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);
    2625   }
    2626   else
    2627   {
    2628     uiPredNum = 2;
    2629     uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);
    2630     uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);
    2631   }
    2632 #endif
    26332554 
    26342555  return uiPredNum;
     
    26802601  UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter();
    26812602  Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0;
    2682 #if G519_TU_AMP_NSQT_HARMONIZATION
    26832603  Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) );
    2684 #else
    2685   Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize == SIZE_Nx2N || partSize == SIZE_2NxN) );
    2686 #endif
    26872604 
    26882605  UInt log2MinTUSizeInCU = 0;
     
    27062623
    27072624
    2708 #if HHI_INTER_VIEW_RESIDUAL_PRED
     2625#if H3D_IVRP
    27092626UInt
    27102627TComDataCU::getCtxResPredFlag( UInt uiAbsPartIdx )
     
    28532770}
    28542771
    2855 #if H0736_AVC_STYLE_QP_RANGE
    28562772Void TComDataCU::setQPSubParts( Int qp, UInt uiAbsPartIdx, UInt uiDepth )
    2857 #else
    2858 Void TComDataCU::setQPSubParts( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth )
    2859 #endif
    28602773{
    28612774  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     
    28662779    if( m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiSCUIdx+getZorderIdxInCU()) == pcSlice->getEntropySliceCurStartCUAddr() )
    28672780    {
    2868 #if H0736_AVC_STYLE_QP_RANGE
    28692781      m_phQP[uiSCUIdx] = qp;
    2870 #else
    2871       m_phQP[uiSCUIdx] = uiQP;
    2872 #endif
    28732782    }
    28742783  }
     
    30332942}
    30342943
    3035 #if HHI_INTER_VIEW_RESIDUAL_PRED
     2944#if MERL_VSP_C0152
     2945Void TComDataCU::setVSPIndexSubParts ( Char iVSPIdx, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2946{
     2947  setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
     2948}
     2949#endif
     2950
     2951#if H3D_IVRP
    30362952Void TComDataCU::setResPredAvailSubParts( Bool bResPredAvailable, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    30372953{
     
    30632979}
    30642980
     2981#if LGE_ILLUCOMP_DEPTH_C0046
     2982//This modification is not needed after integrating JCT3V-C0137
     2983Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx, UInt uiDepth)
     2984{
     2985  UInt uiPartAddr;
     2986  UInt iNumbPart;
     2987
     2988  if(!getSlice()->getIsDepth())
     2989  {
     2990    Int iWidth, iHeight;
     2991
     2992    iNumbPart = ( getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ? 1 : (getPartitionSize(uiAbsPartIdx) == SIZE_NxN ? 4 : 2) );
     2993
     2994    for(UInt i = 0; i < iNumbPart; i++)
     2995    {
     2996      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true);
     2997      uiPartAddr += uiAbsPartIdx;
     2998
     2999      for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
     3000      {
     3001        RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     3002        Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
     3003
     3004        if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx))
     3005        {
     3006          return true;
     3007        }
     3008      }
     3009    }
     3010  }
     3011  else
     3012  {
     3013    iNumbPart = getPic()->getNumPartInCU() >> (uiDepth << 1);
     3014
     3015    for(UInt i = 0; i < iNumbPart; i++)
     3016    {
     3017      uiPartAddr = uiAbsPartIdx + i;
     3018
     3019      for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
     3020      {
     3021        RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     3022        Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
     3023
     3024        if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx))
     3025        {
     3026          return true;
     3027        }
     3028      }
     3029    }
     3030  }
     3031
     3032  return false;
     3033}
     3034#else
    30653035Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx)
    30663036{
     
    30863056      {
    30873057        return true;
    3088       }
    3089     }
     3058    }
     3059  }
    30903060  }
    30913061  return false;
    30923062}
     3063#endif
    30933064#endif
    30943065
     
    32723243#endif
    32733244
    3274 #if LG_RESTRICTEDRESPRED_M24766
     3245#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    32753246Int TComDataCU::getResiPredMode(UInt uiPartAddr)
    32763247{
     
    36173588 * \param numValidMergeCand
    36183589 */
    3619 #if SIMP_MRG_PRUN
     3590#if MERL_VSP_C0152
     3591Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx )
     3592#else
    36203593Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     3594#endif
     3595{
     3596#if H3D_IVMP
     3597#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
     3598  const Int extraMergeCand = ( ( getSlice()->getIsDepth() || getSlice()->getSPS()->getMultiviewMvPredMode() )? 1 : 0 );
    36213599#else
    3622 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand )
    3623 #endif
    3624 {
    3625 #if HHI_INTER_VIEW_MOTION_PRED
    36263600  const Int extraMergeCand = ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
     3601#endif
    36273602#endif
    36283603
    36293604  UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
    36303605  UInt uiIdx = 1;
    3631 #if HHI_INTER_VIEW_MOTION_PRED
    3632   bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
     3606#if H3D_IVMP
     3607  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
    36333608  for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui )
    36343609#else
    3635   bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
     3610  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    36363611  for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui )
    36373612#endif
     
    36403615  }
    36413616  // compute the location of the current PU
    3642 #if PARALLEL_MERGE
    36433617  Int xP, yP, nPSW, nPSH;
    36443618  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    3645 #endif
    3646 
     3619
     3620#if MERL_VSP_C0152
     3621  Bool bVspMvZeroDone[3] = {false, false, false};
     3622#endif
     3623 
    36473624  Int iCount = 0;
    36483625
     
    36523629  deriveLeftBottomIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    36533630
    3654 #if HHI_INTER_VIEW_MOTION_PRED
     3631#if H3D_IVMP
    36553632  Bool bNoPdmMerge   = ( m_pcSlice->getSPS()->getViewId() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE );
    36563633
    36573634  //===== add merge with predicted depth maps =====
    3658 #if QC_MRG_CANS_B0048
    36593635  TComMv  acPdmMv       [4];
    36603636  Int     aiPdmRefIdx   [4] = {-1, -1, -1, -1};
    36613637  Bool    bLeftAvai         = false;
    3662 #if OL_DISMV_POS_B0069
    36633638  Int     iPosLeftAbove[2]  = {-1, -1};
    3664 #endif
    3665 #else
    3666   TComMv  acPdmMv       [2];
    3667   Int     aiPdmRefIdx   [2] = {-1, -1};
    3668 #endif
    3669 
    3670 #if LGE_DVMCP_A0126
    3671 #if QC_MRG_CANS_B0048
     3639
     3640#if H3D_NBDV
    36723641  acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = acPdmMv[2].m_bDvMcp = acPdmMv[3].m_bDvMcp = false;
    3673 #else
    3674   acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = false;
    3675 #endif
    3676 #endif
    3677 
    3678 #if QC_MULTI_DIS_CAN_A0097
     3642#endif //H3D_NBDV
     3643
     3644#if MTK_MDIVRP_C0138
     3645  Bool bDVAvail = true;
     3646#endif
     3647
     3648#if H3D_NBDV
    36793649  DisInfo cDisInfo;
    36803650  cDisInfo.iN = 0;
    36813651  if(!bNoPdmMerge)
    36823652  {
    3683 #if LGE_DVMCP_A0126
    3684 #if LGE_IVMP_PARALLEL_MERGE_B0136 && !QC_SIMPLE_NBDV_B0047
    3685     getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo, true, REF_PIC_LIST_X, -1, true );
    3686 #else
    3687     getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo
    3688 #if LGE_IVMP_PARALLEL_MERGE_B0136==QC_SIMPLE_NBDV_B0047
    3689 ,
    3690 true
     3653    getDisMvpCandNBDV(uiPUIdx, uiAbsPartIdx, &cDisInfo , true
     3654#if MERL_VSP_C0152
     3655            , true
    36913656#endif
    36923657);
    3693 #endif
    3694 #else
    3695     getDisMvpCand (uiPUIdx, uiAbsPartIdx, &cDisInfo );
    3696 #endif
    36973658  }
    36983659  if(cDisInfo.iN==0)
     
    37023663    cDisInfo.m_acMvCand[0].setVer(0);
    37033664    cDisInfo.m_aVIdxCan[0] = 0;
    3704   }
    3705 #if QC_MRG_CANS_B0048
     3665#if MTK_MDIVRP_C0138
     3666    bDVAvail = false;
     3667#endif
     3668  }
     3669
     3670#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
     3671  if( m_pcSlice->getIsDepth())
     3672  {
     3673    UInt uiPartIdxCenter;
     3674    xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter );   
     3675    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     3676    if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     3677    {
     3678      abCandIsInter[iCount] = true;     
     3679      puhInterDirNeighbours[iCount] = pcTextureCU->getInterDir( uiPartIdxCenter );
     3680      if( ( puhInterDirNeighbours[iCount] & 1 ) == 1 )
     3681      {
     3682        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3683        TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
     3684        const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     3685        cMvPred+=cAdd;
     3686        cMvPred>>=2;
     3687        clipMv(cMvPred);
     3688        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx());
     3689      }
     3690      if ( getSlice()->isInterB() )
     3691      {
     3692        if( ( puhInterDirNeighbours[iCount] & 2 ) == 2 )
     3693        {
     3694          pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3695          TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
     3696          const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     3697          cMvPred+=cAdd;
     3698          cMvPred>>=2;
     3699          clipMv(cMvPred);
     3700          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx());
     3701        }
     3702      }
     3703#if MERL_VSP_C0152
     3704      xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     3705#endif
     3706      if ( mrgCandIdx == iCount )
     3707      {
     3708        return;
     3709      }
     3710      iCount ++;
     3711    }
     3712  }
     3713#endif
     3714
    37063715  Int iPdmDir[2] = {0, 0};
    3707 #endif
    3708   Int     iPdmInterDir      = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo 
    3709 #if QC_MRG_CANS_B0048
    3710     , iPdmDir
    3711 #endif
    3712     );
     3716#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     3717  getUnifiedMvPredCan(uiPUIdx, REF_PIC_LIST_0, 0, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir, true);
     3718  Int iPdmInterDir;
    37133719#else
     3720  Int     iPdmInterDir      = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir );
     3721#endif
     3722#else // H3D_NBDV
     3723  Int iPdmDir[2] = {0, 0};
    37143724  Int     iPdmInterDir      = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv );
    3715 #endif
    3716 #if QC_MRG_CANS_B0048
     3725  iPdmDir[0] = iPdmInterDir;
     3726  iPdmDir[1] = iPdmInterDir;
     3727#endif // H3D_NBDV
     3728#if MTK_MDIVRP_C0138
     3729  if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail)
     3730  {
     3731    setResPredAvailSubParts(true, 0, 0, uiDepth);
     3732  }
     3733#endif
     3734
    37173735  if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 0 )
    3718 #else
    3719   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 )
    3720 #endif
    37213736  {
    37223737    abCandIsInter        [ iCount ] = true;
    3723 #if QC_MRG_CANS_B0048
    37243738    puhInterDirNeighbours[ iCount ] = iPdmDir[0];
    37253739    iPdmInterDir                    = iPdmDir[0];
    3726 #else
    3727     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    3728 #endif
     3740
    37293741    if( ( iPdmInterDir & 1 ) == 1 )
    37303742    {
     
    37473759    }
    37483760#endif
    3749 #if SIMP_MRG_PRUN
    37503761    if ( mrgCandIdx == iCount )
    37513762    {
    37523763      return;
    37533764    }
    3754 #endif
    37553765    iCount ++;
    37563766  }
    3757 #endif
    3758 
    3759 #if QC_MRG_CANS_B0048
     3767
    37603768  if(extraMergeCand)
    37613769  {
     
    37733781        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] );
    37743782      }
    3775 #if LGE_DVMCP_A0126
     3783#if H3D_NBDV
    37763784      pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    37773785      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    37783786#endif
    3779 #if SIMP_MRG_PRUN
    37803787      if ( mrgCandIdx == iCount )
    37813788          return;
    3782 #endif
    37833789      iCount ++;
    37843790    }   
    37853791  }
    3786 #endif
     3792#endif //  H3D_IVMP
     3793
     3794#if MERL_VSP_COMPENSATION_C0152
     3795  //===== vsp 0 =====
     3796  if( iCount < 4 + extraMergeCand )
     3797    if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     3798      return;
     3799#endif
     3800
    37873801  //left
    37883802  UInt uiLeftPartIdx = 0;
    37893803  TComDataCU* pcCULeft = 0;
    3790 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    37913804  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB, true, false );
    3792 #else
    3793   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    3794 #endif
    3795 #if PARALLEL_MERGE
    37963805  if (pcCULeft)
    37973806  {
     
    38013810    }
    38023811  }
    3803 #endif
    38043812  PartSize partSize = getPartitionSize( uiAbsPartIdx );
    38053813  if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N)))
    38063814  {
    3807   if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) )
     3815    if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx )
     3816#if MERL_VSP_C0152
     3817      CHECK_ADD_YET(pcCULeft, uiLeftPartIdx, 1)
     3818#endif
     3819      )
     3820    {
     3821      abCandIsInter[iCount] = true;
     3822      // get Inter Dir
     3823      puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
     3824      // get Mv from Left
     3825      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3826      if ( getSlice()->isInterB() )
     3827      {
     3828        pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3829      }
     3830#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     3831      else
     3832      {
     3833        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
     3834      }
     3835#endif
     3836
     3837#if H3D_IVMP
     3838      Bool bRemoveSpa = false; //pruning to inter-view candidates
     3839      Int  iCnloop    = iCount - 1;
     3840      for(; iCnloop >= 0; iCnloop --)
     3841      {
     3842        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     3843        {
     3844          bRemoveSpa                      = true;
     3845          abCandIsInter        [ iCount ] = false;
     3846
     3847          //reset to the default value for IC, MC
     3848          puhInterDirNeighbours[iCount]   = 0;
     3849          TComMv  cZeroMv;
     3850          pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     3851          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     3852          break;
     3853        }
     3854      }
     3855      if(!bRemoveSpa)
     3856      {
     3857        bLeftAvai = true;
     3858        iPosLeftAbove[0] = iCount;
     3859#endif  // H3D_IVMP
     3860#if H3D_NBDV
     3861        pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
     3862        pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
     3863#endif
     3864#if MERL_VSP_C0152
     3865        xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     3866#endif
     3867        if ( mrgCandIdx == iCount )
     3868        {
     3869          return;
     3870        }
     3871        iCount ++;
     3872#if H3D_IVMP
     3873      }
     3874#endif
     3875    }
     3876  }
     3877
     3878#if H3D_IVMP
     3879  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 1 )
     3880  {
     3881    abCandIsInter        [ iCount ] = true;
     3882    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
     3883    if( ( iPdmInterDir & 1 ) == 1 )
     3884    {
     3885      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
     3886    }
     3887#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     3888    else
     3889    {
     3890      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
     3891    }
     3892#endif
     3893    if( ( iPdmInterDir & 2 ) == 2 )
     3894    {
     3895      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
     3896    }
     3897#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     3898    else
     3899    {
     3900      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
     3901    }
     3902#endif
     3903    if ( mrgCandIdx == iCount )
     3904    {
     3905      return;
     3906    }
     3907    iCount ++;
     3908  }
     3909#endif //  H3D_IVMP
     3910
     3911#if MERL_VSP_COMPENSATION_C0152
     3912  //===== vsp 1 =====
     3913  if( iCount < 4 + extraMergeCand )
     3914    if ( !xAddVspMergeCand(1, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     3915      return;
     3916#endif
     3917
     3918  // above
     3919  UInt uiAbovePartIdx = 0;
     3920  TComDataCU* pcCUAbove = 0;
     3921  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true );
     3922    if (pcCUAbove)
     3923    {
     3924      if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
     3925      {
     3926        pcCUAbove = NULL;
     3927      }
     3928    }
     3929  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
     3930#if MERL_VSP_C0152
     3931    CHECK_ADD_YET(pcCUAbove, uiAbovePartIdx, 1)
     3932#endif
     3933    && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD))
     3934    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    38083935  {
    38093936    abCandIsInter[iCount] = true;
    38103937    // get Inter Dir
    3811     puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
     3938    puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    38123939    // get Mv from Left
    3813     pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3940    pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    38143941    if ( getSlice()->isInterB() )
    38153942    {
    3816       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3943      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    38173944    }
    38183945#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     
    38223949    }
    38233950#endif
    3824 #if QC_MRG_CANS_B0048
    3825     Bool bRemoveSpa = false; //prunign to inter-view candidates
    3826     Int  iCnloop    = iCount - 1;
     3951#if H3D_IVMP
     3952    Bool bRemoveSpa = false; //pruning to inter-view candidates
     3953    Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
    38273954    for(; iCnloop >= 0; iCnloop --)
    38283955    {
     
    38313958        bRemoveSpa                      = true;
    38323959        abCandIsInter        [ iCount ] = false;
    3833 #if FIX_MISUSE_REFINDEX
     3960
    38343961        //reset to the default value for IC, MC
    38353962        puhInterDirNeighbours[iCount]   = 0;
     
    38383965        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    38393966        break;
    3840 #endif
    38413967      }
    38423968    }
    38433969    if(!bRemoveSpa)
    38443970    {
    3845       bLeftAvai = true;
    3846 #if OL_DISMV_POS_B0069
    3847       iPosLeftAbove[0] = iCount;
    3848 #endif
    3849 #endif
    3850 #if LGE_DVMCP_A0126
     3971      iPosLeftAbove[1] = iCount;
     3972#endif //  H3D_IVMP
     3973#if H3D_NBDV
    38513974    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    38523975    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    38533976#endif
    3854 #if SIMP_MRG_PRUN
     3977#if MERL_VSP_C0152
     3978     xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     3979#endif
    38553980    if ( mrgCandIdx == iCount )
    38563981    {
    38573982      return;
    38583983    }
    3859 #endif
    38603984    iCount ++;
    3861 #if QC_MRG_CANS_B0048
    3862       }
    3863 #endif
    3864   }
    3865   }
    3866 
    3867 #if HHI_INTER_VIEW_MOTION_PRED
    3868 #if QC_MRG_CANS_B0048
    3869   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 1 )
    3870 #else
    3871   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 1 )
    3872 #endif
     3985#if H3D_IVMP
     3986    }
     3987#endif
     3988  }
     3989
     3990#if H3D_IVMP
     3991  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 2 )
    38733992  {
    38743993    abCandIsInter        [ iCount ] = true;
     
    38944013    }
    38954014#endif
    3896 #if SIMP_MRG_PRUN
    38974015    if ( mrgCandIdx == iCount )
    38984016    {
    38994017      return;
    39004018    }
    3901 #endif
    39024019    iCount ++;
    39034020  }
    3904 #endif
    3905 
    3906   // above
    3907 #if !SIMP_MRG_PRUN
    3908   partSize = getPartitionSize( uiAbsPartIdx );
    3909   if (!(uiPUIdx == 1 && (partSize == SIZE_2NxN || partSize == SIZE_2NxnU || partSize == SIZE_2NxnD)))
    3910   {
    3911 #endif
    3912   UInt uiAbovePartIdx = 0;
    3913   TComDataCU* pcCUAbove = 0;
    3914 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    3915   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true );
    3916 #else
    3917   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, true, true );
    3918 #endif
    3919 #if PARALLEL_MERGE
    3920     if (pcCUAbove)
    3921     {
    3922       if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
    3923       {
    3924         pcCUAbove = NULL;
    3925       }
    3926     }
    3927 #endif
    3928 #if SIMP_MRG_PRUN
    3929   if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
    3930     && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD))
    3931     && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    3932 #else
    3933   if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) )
    3934 #endif
    3935   {
    3936     abCandIsInter[iCount] = true;
    3937     // get Inter Dir
    3938     puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    3939     // get Mv from Left
    3940     pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3941     if ( getSlice()->isInterB() )
    3942     {
    3943       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3944     }
    3945 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    3946     else
    3947     {
    3948       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    3949     }
    3950 #endif
    3951 #if QC_MRG_CANS_B0048
    3952     Bool bRemoveSpa = false; //prunign to inter-view candidates
    3953     Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
    3954     for(; iCnloop >= 0; iCnloop --)
    3955     {
    3956       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    3957       {
    3958         bRemoveSpa                      = true;
    3959         abCandIsInter        [ iCount ] = false;
    3960 #if FIX_MISUSE_REFINDEX
    3961         //reset to the default value for IC, MC
    3962         puhInterDirNeighbours[iCount]   = 0;
    3963         TComMv  cZeroMv;
    3964         pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    3965         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    3966         break;
    3967 #endif
    3968       }
    3969     }
    3970     if(!bRemoveSpa)
    3971     {
    3972 #if OL_DISMV_POS_B0069
    3973       iPosLeftAbove[1] = iCount;
    3974 #endif
    3975 #endif
    3976 #if LGE_DVMCP_A0126
    3977     pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    3978     pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    3979 #endif
    3980 #if SIMP_MRG_PRUN
    3981     if ( mrgCandIdx == iCount )
    3982     {
     4021#endif //  H3D_IVMP
     4022
     4023#if MERL_VSP_COMPENSATION_C0152
     4024  //===== vsp 2 =====
     4025  if( iCount < 4 + extraMergeCand )
     4026    if ( !xAddVspMergeCand(2, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
    39834027      return;
    3984     }
    3985 #endif
    3986     iCount ++;
    3987 #if QC_MRG_CANS_B0048
    3988     }
    3989 #endif
    3990   }
    3991 #if !SIMP_MRG_PRUN
    3992   }
    3993 #endif
    3994 
    3995 #if HHI_INTER_VIEW_MOTION_PRED
    3996 #if QC_MRG_CANS_B0048
    3997   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 2 )
    3998 #else
    3999   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 2 )
    4000 #endif
    4001   {
    4002     abCandIsInter        [ iCount ] = true;
    4003     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    4004     if( ( iPdmInterDir & 1 ) == 1 )
    4005     {
    4006       pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
    4007     }
    4008 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4009     else
    4010     {
    4011       pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
    4012     }
    4013 #endif
    4014     if( ( iPdmInterDir & 2 ) == 2 )
    4015     {
    4016       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
    4017     }
    4018 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4019     else
    4020     {
    4021       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    4022     }
    4023 #endif
    4024 #if SIMP_MRG_PRUN
    4025     if ( mrgCandIdx == iCount )
    4026     {
    4027       return;
    4028     }
    4029 #endif
    4030     iCount ++;
    4031   }
    40324028#endif
    40334029
     
    40354031  UInt uiAboveRightPartIdx = 0;
    40364032  TComDataCU* pcCUAboveRight = 0;
    4037 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    40384033  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, false, true );
    4039 #else
    4040   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, true, true);
    4041 #endif
    4042 #if PARALLEL_MERGE
    40434034  if (pcCUAboveRight)
    40444035  {
     
    40484039    }
    40494040  }
    4050 #endif
    4051 #if SIMP_MRG_PRUN
    4052   if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    4053 #else
    4054   if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) )
    4055 #endif
     4041  if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx )
     4042#if MERL_VSP_C0152
     4043    CHECK_ADD_YET(pcCUAboveRight, uiAboveRightPartIdx, 1)
     4044#endif
     4045    && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    40564046  {
    40574047    abCandIsInter[iCount] = true;
     
    40704060    }
    40714061#endif
    4072 #if LGE_DVMCP_A0126
     4062#if H3D_NBDV
    40734063    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    40744064    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    40754065#endif
    4076 #if SIMP_MRG_PRUN
     4066#if MERL_VSP_C0152
     4067    xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4068#endif
    40774069    if ( mrgCandIdx == iCount )
    40784070    {
    40794071      return;
    40804072    }
    4081 #endif
    40824073    iCount ++;
    40834074  }
    40844075
    4085 #if HHI_INTER_VIEW_MOTION_PRED
    4086 #if QC_MRG_CANS_B0048
     4076#if H3D_IVMP
    40874077  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 3 )
    4088 #else
    4089   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 3 )
    4090 #endif
    40914078  {
    40924079    abCandIsInter        [ iCount ] = true;
     
    41124099    }
    41134100#endif
    4114 #if SIMP_MRG_PRUN
    41154101    if ( mrgCandIdx == iCount )
    41164102    {
    41174103      return;
    41184104    }
    4119 #endif
    41204105    iCount ++;
    41214106  }
    4122 #endif
    4123 
    4124 #if OL_DISMV_POS_B0069
     4107
    41254108  if(extraMergeCand)
    41264109  {
     
    41284111    {
    41294112      assert(iCount < MRG_MAX_NUM_CANDS_MEM);
    4130       Bool bRemoveSpa = false; //prunign to A1, B1
     4113      Bool bRemoveSpa = false; //pruning to A1, B1
    41314114      abCandIsInter        [ iCount ] = true;
    41324115      puhInterDirNeighbours[ iCount ] = iPdmDir[1];
     
    41484131          bRemoveSpa                      = true;
    41494132          abCandIsInter        [ iCount ] = false;
    4150 #if FIX_MISUSE_REFINDEX
    41514133          //reset to the default value for IC, MC
    41524134          puhInterDirNeighbours[iCount]   = 0;
     
    41554137          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    41564138          break;
    4157 #endif
    41584139        }
    41594140      }
    41604141      if(!bRemoveSpa)
    41614142      {
    4162 #if LGE_DVMCP_A0126
     4143#if H3D_NBDV
    41634144        pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    41644145        pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    41654146#endif
    4166 #if SIMP_MRG_PRUN
    41674147        if ( mrgCandIdx == iCount )
    41684148          return;
    4169 #endif
    41704149        iCount ++;
    41714150      }
    41724151    }   
    41734152  }
    4174 #endif
     4153#endif // H3D_IVMP
     4154
     4155#if MERL_VSP_COMPENSATION_C0152
     4156  //===== vsp 3 =====
     4157  if( iCount < 4 + extraMergeCand )
     4158    if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4159      return;
     4160#endif
     4161
     4162#if MERL_VSP_C0152
     4163#if VSP_MERGE_POS < 4
     4164#if H3D_IVMP
     4165  if( iCount < 4 + extraMergeCand )
     4166#else
     4167  if( iCount < 4 )
     4168#endif
     4169  {
     4170#endif
     4171#endif
     4172
    41754173  //left bottom
    41764174  UInt uiLeftBottomPartIdx = 0;
    41774175  TComDataCU* pcCULeftBottom = 0;
    4178 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    41794176  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB, true, false );
    4180 #else
    4181   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    4182 #endif
    4183 #if PARALLEL_MERGE
    41844177  if (pcCULeftBottom)
    41854178  {
     
    41894182    }
    41904183  }
    4191 #endif
    4192 #if SIMP_MRG_PRUN
    4193   if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    4194 #else
    4195   if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) )
    4196 #endif
     4184  if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx )
     4185#if MERL_VSP_C0152
     4186    CHECK_ADD_YET(pcCULeftBottom, uiLeftBottomPartIdx, 1)
     4187#endif
     4188    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    41974189  {
    41984190    abCandIsInter[iCount] = true;
     
    42114203    }
    42124204#endif
    4213 #if LGE_DVMCP_A0126
     4205#if H3D_NBDV
    42144206    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    42154207    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    42164208#endif
    4217 #if SIMP_MRG_PRUN
     4209#if MERL_VSP_C0152
     4210     xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4211#endif
    42184212    if ( mrgCandIdx == iCount )
    42194213    {
    42204214      return;
    42214215    }
    4222 #endif
    42234216    iCount ++;
    42244217  }
    4225 
    4226 #if HHI_INTER_VIEW_MOTION_PRED
    4227 #if QC_MRG_CANS_B0048
     4218#if MERL_VSP_C0152
     4219#if VSP_MERGE_POS < 4
     4220  }
     4221#endif
     4222#endif
     4223 
     4224#if H3D_IVMP
    42284225  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 4 )
    4229 #else
    4230   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 4 )
    4231 #endif
    42324226  {
    42334227    abCandIsInter        [ iCount ] = true;
     
    42534247    }
    42544248#endif
    4255 #if SIMP_MRG_PRUN
    42564249    if ( mrgCandIdx == iCount )
    42574250    {
    42584251      return;
    42594252    }
    4260 #endif
    42614253    iCount ++;
    42624254  }
    4263 #endif
    4264 
    4265   // above left
    4266 #if HHI_INTER_VIEW_MOTION_PRED
     4255#endif //  H3D_IVMP
     4256
     4257#if MERL_VSP_COMPENSATION_C0152
     4258  //===== vsp 4 =====
     4259  if( iCount < 4 + extraMergeCand )
     4260    if ( !xAddVspMergeCand(4, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4261      return;
     4262#endif
     4263 
     4264  // above left
     4265#if H3D_IVMP
    42674266  if( iCount < 4 + extraMergeCand )
    42684267#else
     
    42724271    UInt uiAboveLeftPartIdx = 0;
    42734272    TComDataCU* pcCUAboveLeft = 0;
    4274 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    42754273    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, false, true );
    4276 #else
    4277     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, true, true );
    4278 #endif
    4279 #if PARALLEL_MERGE
    42804274    if (pcCUAboveLeft)
    42814275    {
     
    42854279      }
    42864280    }
    4287 #endif
    4288 #if SIMP_MRG_PRUN
    42894281    if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx )
     4282#if MERL_VSP_C0152
     4283     CHECK_ADD_YET(pcCUAboveLeft, uiAboveLeftPartIdx, 1)
     4284#endif
    42904285     && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    42914286     && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    42924287     )
    4293 #else
    4294     if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) )
    4295 #endif
    42964288    {
    42974289      abCandIsInter[iCount] = true;
     
    43104302      }
    43114303#endif
    4312 #if LGE_DVMCP_A0126
     4304#if H3D_NBDV
    43134305      pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    43144306      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    43154307#endif
    4316 #if SIMP_MRG_PRUN
     4308#if MERL_VSP_C0152
     4309     xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4310#endif
    43174311      if ( mrgCandIdx == iCount )
    43184312      {
    43194313        return;
    43204314      }
    4321 #endif
    43224315      iCount ++;
    43234316    }
    43244317  }
    43254318
     4319#if MERL_VSP_COMPENSATION_C0152
     4320  //===== vsp 5 =====
     4321  if( iCount < 4 + extraMergeCand )
     4322    if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4323      return;
     4324#endif
     4325
    43264326  if ( getSlice()->getPPS()->getEnableTMVPFlag()
    4327 #if QC_MRG_CANS_B0048
     4327#if H3D_IVMP
    43284328       && iCount < (MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand)
    43294329#endif
     
    43364336    {
    43374337      RefPicList  eRefPicList = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    4338 #if SET_MERGE_TMVP_REFIDX
    43394338      Int iRefIdxTmp;
    43404339      if ( uiPUIdx != 0 )
     
    43464345        iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1;
    43474346      }
    4348 #else     
    4349       Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1;
    4350 #endif
    43514347      iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
    43524348    }
     
    43564352    Int uiLCUIdx = getAddr();
    43574353    PartSize eCUMode = getPartitionSize( 0 );
     4354
     4355#if MERL_VSP_C0152 // Potential bug, not related to BW_VSP
     4356    if (eCUMode==SIZE_NxN)
     4357    {
     4358      printf("Size NxN ???");
     4359      assert(0);
     4360    }
     4361#endif
    43584362
    43594363    deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); 
     
    44094413    UInt uiCurLCUIdx = getAddr();
    44104414    xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );
    4411     bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
     4415    bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx
     4416#if QC_TMVP_MRG_REFIDX_C0047
     4417    , 1
     4418#endif
     4419    );
    44124420    if( bExistMV == false )
    44134421    {
    4414       bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx );
     4422      bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx
     4423#if QC_TMVP_MRG_REFIDX_C0047
     4424    , 1
     4425#endif
     4426    );
    44154427    }
    44164428    if( bExistMV )
     
    44274439        iRefIdx = 0;
    44284440#endif
    4429         bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
     4441        bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx
     4442#if QC_TMVP_MRG_REFIDX_C0047
     4443        , 1
     4444#endif
     4445        );
    44304446        if( bExistMV == false )
    44314447        {
    4432           bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx );
     4448          bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx
     4449#if QC_TMVP_MRG_REFIDX_C0047
     4450        , 1
     4451#endif 
     4452        );
    44334453        }
    44344454        if( bExistMV )
     
    44524472#endif
    44534473      }
    4454 #if LGE_DVMCP_A0126
     4474#if H3D_NBDV
    44554475      pcMvFieldNeighbours[uiArrayAddr<<1    ].getMv().m_bDvMcp = false;
    44564476      pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv().m_bDvMcp = false;
    44574477#endif
    4458 #if SIMP_MRG_PRUN
    44594478      if ( mrgCandIdx == iCount )
    44604479      {
     
    44624481      }
    44634482      iCount++;
    4464 #endif
    44654483    }
    44664484    uiIdx++;
     
    44684486  }
    44694487
    4470 #if SIMP_MRG_PRUN
    44714488  UInt uiArrayAddr = iCount;
    4472 #else
    4473 #if HHI_INTER_VIEW_MOTION_PRED
    4474   for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS_MEM; uiOuter++ )
    4475 #else
    4476   for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ )
    4477 #endif
    4478   {
    4479     if( abCandIsInter[ uiOuter ] )
    4480     {
    4481 #if HHI_INTER_VIEW_MOTION_PRED
    4482       for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS_MEM; uiIter++ )
    4483 #else
    4484       for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ )
    4485 #endif
    4486       {
    4487         UInt uiMvFieldNeighIdxCurr = uiOuter << 1;
    4488         UInt uiMvFieldNeighIdxComp = uiIter << 1;
    4489         if( getSlice()->isInterB() )
    4490         {
    4491           if( puhInterDirNeighbours[ uiOuter ] == 3 )
    4492           {
    4493             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&
    4494               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&
    4495               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4496             {
    4497               abCandIsInter[ uiIter ] = false;
    4498             }
    4499           }
    4500           else if( puhInterDirNeighbours[ uiOuter ] == 2 )
    4501           {
    4502             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&
    4503               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&
    4504               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4505             {
    4506               abCandIsInter[ uiIter ] = false;
    4507             }
    4508           }
    4509           else
    4510           {
    4511             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&
    4512               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() &&
    4513               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4514             {
    4515               abCandIsInter[ uiIter ] = false;
    4516             }
    4517           }
    4518         }
    4519         else
    4520         {
    4521           if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&
    4522               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() )
    4523           {
    4524             assert( puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] );
    4525             abCandIsInter[ uiIter ] = false;
    4526           }
    4527         }
    4528       }
    4529     }
    4530   }
    4531 
    4532 #if HHI_INTER_VIEW_MOTION_PRED
    4533   bool abCandIsInterFlag[MRG_MAX_NUM_CANDS_MEM];
    4534   for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4535 #else
    4536   bool abCandIsInterFlag[MRG_MAX_NUM_CANDS];
    4537   for (int i=0; i<MRG_MAX_NUM_CANDS; i++)
    4538 #endif
    4539   {
    4540     abCandIsInterFlag[i] = abCandIsInter[ i ];
    4541     abCandIsInter[ i ] = false;
    4542   }
    4543 
    4544   UInt uiArrayAddr = 0;
    4545    
    4546 #if HHI_INTER_VIEW_MOTION_PRED
    4547   for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4548 #else
    4549   for (int i=0; i<MRG_MAX_NUM_CANDS; i++)
    4550 #endif
    4551   {
    4552     if (abCandIsInterFlag[i])
    4553     {
    4554       abCandIsInter[uiArrayAddr] = true;
    4555       puhInterDirNeighbours[uiArrayAddr] = puhInterDirNeighbours[i];
    4556       pcMvFieldNeighbours[uiArrayAddr<<1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
    4557       pcMvFieldNeighbours[(uiArrayAddr<<1)+1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    4558       ++uiArrayAddr;
    4559     }
    4560   }
    4561 
    4562 #if HHI_INTER_VIEW_MOTION_PRED
    4563   for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4564 #else
    4565   for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS; i++)
    4566 #endif
    4567   {
    4568     puhInterDirNeighbours[i] = (getSlice()->isInterB()) ? 3 : 1;
    4569     abCandIsInter[i] = false;
    4570     TComMv tmpMv;
    4571     tmpMv.set(0,0);
    4572     pcMvFieldNeighbours[i<<1].setMvField(tmpMv, 0);
    4573     if ( getSlice()->isInterB() )
    4574     {
    4575       pcMvFieldNeighbours[(i<<1)+1].setMvField(tmpMv, 0);
    4576     }
    4577   }
    4578 #endif
    45794489  UInt uiCutoff = uiArrayAddr;
    45804490   
    45814491  if ( getSlice()->isInterB() )
    45824492  {
    4583 #if HHI_INTER_VIEW_MOTION_PRED
     4493#if H3D_IVMP
    45844494    Int iCombinedCount = 0;
    45854495    Int iMaxCombCount  = ( extraMergeCand ?  6 :  5 );
     
    45984508    {
    45994509      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
    4600       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
     4510#if MERL_VSP_C0152
     4511      Bool bValid = true;
     4512      if (pcMvFieldNeighbours[i<<1].getRefIdx() < 0 || pcMvFieldNeighbours[(j<<1)+1].getRefIdx() < 0) // NOT_VALID
     4513        bValid = false;
     4514#endif
     4515      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)
     4516#if MERL_VSP_C0152
     4517       && bValid
     4518#endif
     4519         )
    46014520      {
    46024521        abCandIsInter[uiArrayAddr] = true;
     
    46224541      }
    46234542    }
    4624 #if !REMOVE_NON_SCALED 
    4625     Int iScaledCount = 0;
    4626 #if HHI_INTER_VIEW_MOTION_PRED
    4627     for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; i++)
    4628 #else
    4629     for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; i++)
    4630 #endif
    4631     {
    4632 #if HHI_INTER_VIEW_MOTION_PRED
    4633       for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; j++)
    4634 #else
    4635       for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; j++)
    4636 #endif
    4637       {
    4638         if (abCandIsInter[i] && pcMvFieldNeighbours[(i<<1)+j].getRefIdx()>=0 && pcMvFieldNeighbours[(i<<1)+j].getRefIdx() < m_pcSlice->getNumRefIdx((j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0))
    4639         {
    4640           Int iCurrPOC = m_pcSlice->getPOC();
    4641           Int iCurrRefPOC1 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );
    4642           Int iCurrRefPOC2 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_0:REF_PIC_LIST_1, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );
    4643 
    4644           if (iCurrRefPOC1 != iCurrRefPOC2 && abs(iCurrPOC-iCurrRefPOC1) == abs(iCurrPOC-iCurrRefPOC2))
    4645           {
    4646             abCandIsInter[uiArrayAddr] = true;
    4647             puhInterDirNeighbours[uiArrayAddr] = 3;
    4648            
    4649             TComMv cMvPred = pcMvFieldNeighbours[(i<<1)+j].getMv();
    4650             TComMv rcMv;
    4651 
    4652             rcMv.set(-1*cMvPred.getHor(), -1*cMvPred.getVer());
    4653 
    4654             if (j==0)
    4655             {
    4656               pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[(i<<1)].getMv(), pcMvFieldNeighbours[(i<<1)].getRefIdx());
    4657               pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)].getRefIdx());
    4658             }
    4659             else
    4660             {
    4661               pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    4662               pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    4663             }
    4664 
    4665             uiArrayAddr++;
    4666             iScaledCount++;
    4667           }
    4668         }
    4669       }
    4670     }
    4671 #endif
    46724543  }
    46734544
    46744545  Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
    4675 #if HHI_INTER_VIEW_MOTION_PRED
     4546#if H3D_IVMP
    46764547  for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM; r++)
    46774548#else
     
    46964567    uiArrayAddr++;
    46974568  }
    4698 #if HHI_INTER_VIEW_MOTION_PRED
     4569#if H3D_IVMP
    46994570  if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand )
    47004571  {
     
    47704641  if( uiIter == 0 )
    47714642  {
    4772     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     4643    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     4644#if MERL_VSP_C0152
     4645     && !pcCorner->getVSPIndex( uiCornerPUIdx )
     4646#endif
     4647    )
    47734648    {
    47744649      rbValidCand = true;
     
    48054680  else
    48064681  {
    4807     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     4682    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     4683#if MERL_VSP_C0152
     4684     && !pcCorner->getVSPIndex( uiCornerPUIdx )
     4685#endif
     4686    )
    48084687    {
    48094688      rbValidCand = true;
     
    48394718  }
    48404719}
    4841 #if PARALLEL_MERGE
    48424720/** Check whether the current PU and a spatial neighboring PU are in a same ME region.
    48434721 * \param xN, xN   location of the upper-left corner pixel of a neighboring PU
     
    49264804}
    49274805
    4928 #endif
    49294806AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx)
    49304807{
    49314808  return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]);
    49324809}
    4933 #if QC_MULTI_DIS_CAN_A0097
     4810#if H3D_NBDV
    49344811/** construct a list of disparity motion vectors from the neighbouring PUs **/
    49354812Void TComDataCU::getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo )
     
    49484825
    49494826  UInt uiIdx = 0;
    4950 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    49514827    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    4952 #else
    4953     pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    4954 #endif
    49554828  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4829#if MERL_VSP_C0152
     4830  if(! pcTmpCU->getVSPIndex(uiIdx))
     4831#endif
    49564832  {
    49574833    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    49734849    }
    49744850  }
    4975 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    49764851      pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    4977 #else
    4978     pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
    4979 #endif
    49804852
    49814853  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4854#if MERL_VSP_C0152
     4855  if(! pcTmpCU->getVSPIndex(uiIdx))
     4856#endif
    49824857  {
    49834858    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50004875  }
    50014876
    5002 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    50034877      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    5004 #else
    5005       pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
    5006 #endif
    50074878  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4879#if MERL_VSP_C0152
     4880  if(! pcTmpCU->getVSPIndex(uiIdx))
     4881#endif
    50084882  {
    50094883    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50254899    }
    50264900  }
    5027 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    50284901      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    5029 #else
    5030       pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
    5031 #endif
    50324902  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4903#if MERL_VSP_C0152
     4904  if(! pcTmpCU->getVSPIndex(uiIdx))
     4905#endif
    50334906  {
    50344907    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50524925
    50534926  // Above predictor search
    5054 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    50554927      pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    50564928    assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5057 #else
    5058       pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
    5059 #endif
    50604929  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4930#if MERL_VSP_C0152
     4931  if(! pcTmpCU->getVSPIndex(uiIdx))
     4932#endif
    50614933  {
    50624934    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    52575129}
    52585130
    5259 #if LGE_DVMCP_A0126
    5260 #if QC_SIMPLE_NBDV_B0047
    5261 Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo
    5262 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5263                                 , Bool bParMerge
    5264 #endif
     5131#if MERL_VSP_C0152
     5132#if LGE_SIMP_DVP_REFINE_C0112
     5133Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine)
    52655134#else
    5266 Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo, Bool bMerge, RefPicList eRefPicList0, Int iRefIdx0
    5267 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5268                                 , Bool bParMerge
    5269 #endif
     5135Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec)
     5136#endif
     5137{
     5138  Int depStride =  pcBaseViewDepthPicYuv->getStride();
     5139
     5140  Int width  = pcBaseViewDepthPicYuv->getWidth();
     5141  Int height = pcBaseViewDepthPicYuv->getHeight();
     5142
     5143  Int depthPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
     5144  Int depthPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
     5145
     5146  Pel *depth  = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
     5147  Pel  maxDepth = 0;
     5148#if LGE_SIMP_DVP_REFINE_C0112
     5149  if ( bSimpleDvpRefine )
     5150  {
     5151    Int depthStartPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
     5152    Int depthStartPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
     5153    Int depthEndPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + iWidth  + (mv->getHor()>>2));
     5154    Int depthEndPosY = Clip3(0,   height- iHeight - 1,  iBlkY + iHeight + (mv->getVer()>>2));
     5155    Int iCenterX = (depthStartPosX + depthEndPosX) >> 1;
     5156    Int iCenterY = (depthStartPosY + depthEndPosY) >> 1;
     5157
     5158    Pel *depthTL  = pcBaseViewDepthPicYuv->getLumaAddr();
     5159    Int aiDepth[5];
     5160    aiDepth[0] = depthTL[ (depthStartPosY) * depStride + depthStartPosX ];      // Left Top
     5161    aiDepth[1] = depthTL[ (depthEndPosY)   * depStride + depthStartPosX ];      // Left Bottom
     5162    aiDepth[2] = depthTL[ (depthStartPosY) * depStride + depthEndPosX   ];      // Right Top
     5163    aiDepth[3] = depthTL[ (depthEndPosY)   * depStride + depthEndPosX   ];      // Right Bottom
     5164    aiDepth[4] = depthTL[ (iCenterY)       * depStride + iCenterX       ];      // Center
     5165    for (Int i = 0; i < 5; i++)
     5166    {
     5167      if (maxDepth < aiDepth[i])
     5168        maxDepth = aiDepth[i];
     5169    }
     5170  }
     5171  else
     5172  {
     5173    for (Int j = 0; j < iHeight; j++)
     5174    {
     5175      for (Int i = 0; i < iWidth; i++)
     5176      {
     5177        if (maxDepth < depth[i])
     5178          maxDepth = depth[i];
     5179      }
     5180      depth += depStride;
     5181    }
     5182  }
     5183#else
     5184  for (Int j = 0; j < iHeight; j++)
     5185  {
     5186    for (Int i = 0; i < iWidth; i++)
     5187    {
     5188      if (maxDepth < depth[i])
     5189        maxDepth = depth[i];
     5190    }
     5191    depth += depStride;
     5192  }
     5193#endif
     5194  Int disparity = aiShiftLUT[ maxDepth ] << iShiftPrec;
     5195
     5196  return disparity;
     5197}
     5198#if LGE_SIMP_DVP_REFINE_C0112
     5199Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
     5200#else
     5201Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred)
     5202#endif
     5203{
     5204  if (picDepth)
     5205  {
     5206    UInt uiAbsPartAddrCurrCU = m_uiAbsIdxInLCU + uiPartAddr;
     5207    Int iWidth, iHeight;
     5208    getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); // The modified value of uiPartAddr won't be used any more
     5209   
     5210    TComPicYuv* pcBaseViewDepthPicYuv = picDepth->getPicYuvRec();
     5211    Int iBlkX = ( getAddr() % picDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5212    Int iBlkY = ( getAddr() / picDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5213    Int* aiShiftLUT;
     5214    Int  iShiftPrec;
     5215    getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
     5216#if LGE_SIMP_DVP_REFINE_C0112
     5217    Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
     5218#else
     5219    Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec);
     5220#endif
     5221    cMvPred->setHor(x);
     5222    clipMv(*cMvPred);
     5223  }
     5224}
     5225#endif
     5226
     5227#if H3D_NBDV
     5228Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo , Bool bParMerge
     5229#if MERL_VSP_C0152
     5230                                , Bool bDepthRefine
    52705231#endif
    52715232                                )
     
    52735234  PartSize eCUMode = getPartitionSize( uiPartAddr );
    52745235  TComDataCU* pcTmpCU = NULL;
    5275 #if !QC_SIMPLE_NBDV_B0047
    5276   TComDataCU* pcCULeft = NULL;
    5277 #endif
    52785236  pDInfo->iN = 0;
    52795237
     
    52835241  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    52845242
    5285 #if QC_SIMPLE_NBDV_B0047
    52865243  const Int iNumofDvMCP = 7;
     5244#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5245  Int   aiDvMcpDvCandX[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
     5246  Int   aiDvMcpDvCandY[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
     5247#else
    52875248  Int   aiDvMcpDvCand[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
     5249#endif
    52885250  Bool  abDvMcpFlag  [2][iNumofDvMCP] = {{false,},{false,}};
    5289 #else
    5290   Int   aiDvMcpDvCand[2][7] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
    5291   Bool  abDvMcpFlag  [2][7] = {{false,},{false,}};
    5292   //Int   aiRefPOC     [2][7] = {{-1,},{-1}}; // debug
    5293 #endif
    52945251  TComMv cTmpMvPred, cMv;
    52955252  Bool  bTmpIsSkipped = false;
    52965253  Bool  bDvMcpIsFound = false;
    5297 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5298   Int iLCUAddrDiff = 0;
    5299 #endif
    5300 
    5301 #if LGE_IVMP_PARALLEL_MERGE_B0136
     5254  Int   iLCUAddrDiff = 0;
     5255
    53025256  Int xP, yP, nPSW, nPSH;
    53035257  if( bParMerge)
    53045258    this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
    5305 #endif
    53065259
    53075260  deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
    53085261  deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
    53095262
    5310   UInt uiIdx = 0;
    5311 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5312   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    5313 #else
    5314   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    5315 #endif
    5316 #if DV_DERIVATION_PARALLEL_B0096
    5317   if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
    5318   {
    5319     pcTmpCU = NULL;
    5320   }
    5321 #endif
    5322 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5323   if (pcTmpCU && bParMerge)
    5324   {
    5325     if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
    5326     {
    5327       pcTmpCU = NULL;
    5328     }
    5329   }
    5330 #endif
    5331 
    5332 #if !QC_SIMPLE_NBDV_B0047
    5333   pcCULeft = pcTmpCU;
    5334   UInt uiLeftPartIdx = uiIdx;
    5335 #endif
    5336 
    5337   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5338   {
    5339     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5340     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5341     {
    5342       eRefPicList = RefPicList(iList);
    5343       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5344       if( refId >= 0)
    5345       {
    5346         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5347         if (refViewIdx!= m_pcSlice->getViewId()) // DCP
    5348         {
    5349           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5350           clipMv(cMvPred);
    5351           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5352           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5353           return;
    5354         }
    5355         else // MCP
    5356         {
    5357           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5358           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5359           {
    5360             aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
    5361             abDvMcpFlag  [iList][DVFROM_LEFT] = true;
    5362             bDvMcpIsFound = true;
    5363           }
    5364         }
    5365       }
    5366     }
    5367   }
    5368 
    5369 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5370   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    5371 #else
    5372   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
    5373 #endif
    5374 #if DV_DERIVATION_PARALLEL_B0096
    5375   if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
    5376   {
    5377     pcTmpCU = NULL;
    5378   }
    5379 #endif
    5380 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5381   if (pcTmpCU && bParMerge)
    5382   {
    5383     if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
    5384     {
    5385       pcTmpCU = NULL;
    5386     }
    5387   }
    5388 #endif
    5389 
    5390   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5391   {
    5392 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5393     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5394 #endif
    5395     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5396     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5397     {
    5398       eRefPicList = RefPicList(iList);
    5399       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5400       if( refId >= 0)
    5401       {
    5402         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5403         if (refViewIdx!= m_pcSlice->getViewId())
    5404         {
    5405           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5406           clipMv(cMvPred);
    5407           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5408           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5409           return;
    5410         }
    5411 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5412         else if(iLCUAddrDiff == 0) //MCP, within same LCU
    5413 #else
    5414         else // MCP
    5415 #endif
    5416         {
    5417           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5418           if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
    5419           {
    5420             aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
    5421             abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
    5422             bDvMcpIsFound = true;
    5423           }
    5424         }
    5425       }
    5426     }
    5427   }
    5428 
    5429 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5430   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    5431 #else
    5432   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
    5433 #endif
    5434 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5435   if (pcTmpCU && bParMerge)
    5436   {
    5437     if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
    5438     {
    5439       pcTmpCU = NULL;
    5440     }
    5441   }
    5442 #endif
    5443 
    5444   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5445   {
    5446 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5447     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5448 #endif
    5449     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5450     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5451     {
    5452       eRefPicList = RefPicList(iList);
    5453       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5454       if( refId >= 0)
    5455       {
    5456         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5457         if (refViewIdx!= m_pcSlice->getViewId())
    5458         {
    5459           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5460           clipMv(cMvPred);
    5461           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5462           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5463           return;
    5464         }
    5465 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5466         else if(iLCUAddrDiff == 0)
    5467 #else
    5468         else  // MCP
    5469 #endif
    5470         {
    5471           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5472           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5473           {
    5474             aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
    5475             abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
    5476             bDvMcpIsFound = true;
    5477           }
    5478         }
    5479       }
    5480     }
    5481   }
    5482 
    5483 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5484   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    5485 #else
    5486   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
    5487 #endif
    5488 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5489   if (pcTmpCU && bParMerge)
    5490   {
    5491     if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
    5492     {
    5493       pcTmpCU = NULL;
    5494     }
    5495   }
    5496 #endif
    5497   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5498   {
    5499     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5500     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5501     {
    5502       eRefPicList = RefPicList(iList);
    5503       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5504       if( refId >= 0)
    5505       {
    5506         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5507         if (refViewIdx!= m_pcSlice->getViewId())
    5508         {
    5509           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5510           clipMv(cMvPred);
    5511           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5512           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5513           return;
    5514         }
    5515         else // MCP
    5516         {
    5517           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5518           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5519           {
    5520             aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
    5521             abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
    5522             bDvMcpIsFound = true;
    5523           }
    5524         }
    5525       }
    5526     }
    5527   }
    5528 
    5529   // Above predictor search
    5530 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5531   pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    5532   assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5533 #else
    5534   pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
    5535 #endif
    5536 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5537   if (pcTmpCU && bParMerge)
    5538   {
    5539     if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
    5540     {
    5541       pcTmpCU = NULL;
    5542     }
    5543   }
    5544 #endif
    5545 
    5546   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5547   {
    5548 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5549     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5550 #endif
    5551     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5552     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5553     {
    5554       eRefPicList = RefPicList(iList);
    5555       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5556       if( refId >= 0)
    5557       {
    5558         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5559         if (refViewIdx!= m_pcSlice->getViewId())
    5560         {
    5561           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5562           clipMv(cMvPred);
    5563           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5564           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5565           return;
    5566         }
    5567 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5568         else if(iLCUAddrDiff <= 1)
    5569 #else
    5570         else // MCP
    5571 #endif
    5572         {
    5573           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5574           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5575           {
    5576             aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
    5577             abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
    5578             bDvMcpIsFound = true;
    5579           }
    5580         }
    5581       }
    5582     }
    5583   }
    5584 
     5263#if MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
    55855264  // copied from getInterMergeCand()
    55865265  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
    55875266  {
    5588 #if !QC_SIMPLE_NBDV_B0047
    5589     UInt uiPUIdx = uiPartIdx;
    5590     UInt uiAbsPartAddr = uiPartAddr;
    5591 
    5592     // col [2]
    5593     Int iRefIdxSkip[2] = {-1, -1};
    5594     if( !bMerge )
    5595     {
    5596       iRefIdxSkip[ eRefPicList0 ] = iRefIdx0;
    5597     }
    5598     else
    5599     {
    5600       for (Int i=0; i<2; i++)
    5601       {
    5602         RefPicList  eRefPicList1 = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    5603 #if SET_MERGE_TMVP_REFIDX
    5604         Int iRefIdxTmp;
    5605         if ( uiPUIdx != 0 )
    5606         {
    5607           iRefIdxTmp = 0;
    5608         }
    5609         else
    5610         {   
    5611           iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
    5612         }
    5613 #else     
    5614         Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
    5615 #endif
    5616         iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
    5617       }
    5618     }
    5619 
    5620     //>> MTK colocated-RightBottom
    5621     UInt uiPartIdxRB;
    5622     Int uiLCUIdx = getAddr();
    5623     eCUMode = getPartitionSize( 0 );
    5624 
    5625     deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); 
    5626 
    5627     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    5628     //UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    5629 
    5630     TComMv cColMv;
    5631     Int iRefIdx;
    5632 
    5633     if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    5634     {
    5635       uiLCUIdx = -1;
    5636     }
    5637     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    5638     {
    5639       uiLCUIdx = -1;
    5640     }
    5641     else
    5642     {
    5643       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    5644         ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    5645       {
    5646         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    5647         uiLCUIdx = getAddr();
    5648       }
    5649       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    5650       {
    5651         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    5652         uiLCUIdx = -1 ;
    5653       }
    5654       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
    5655       {
    5656         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    5657         uiLCUIdx = getAddr() + 1;
    5658       }
    5659       else //is the right bottom corner of LCU                       
    5660       {
    5661         uiAbsPartAddr = 0;
    5662         uiLCUIdx = -1 ;
    5663       }
    5664     }
    5665 
    5666     Bool bExistMV = false;
    5667     UInt uiPartIdxCenter;
    5668     UInt uiCurLCUIdx = getAddr();
    5669     xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );
    5670 
    5671     Int iTargetView, iStartView;
    5672     if( !bMerge ) // AMVP
    5673     {
    5674       bExistMV = uiLCUIdx >= 0 && xGetColDisMV( eRefPicList0, iRefIdx0, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
    5675       if( bExistMV == false )
    5676       {
    5677         bExistMV = xGetColDisMV( eRefPicList0, iRefIdx0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );
    5678       }
    5679       if( bExistMV ) // DV is found
    5680       {
    5681         if( cColMv.m_bDvMcp == false ) //=> DCP, if true => DV-MCP
    5682         {
    5683           clipMv(cColMv);
    5684           pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5685           pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
    5686           return;
    5687         }
    5688         else // DV-MCP
    5689         {
    5690           aiDvMcpDvCand[eRefPicList0][DVFROM_COL] = cColMv.getHor();
    5691           abDvMcpFlag  [eRefPicList0][DVFROM_COL] = true;
    5692           bDvMcpIsFound = true;
    5693         }
    5694       }
    5695     }
    5696     else // MERGE
    5697     {
    5698       iRefIdx = iRefIdxSkip[0];
    5699       bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
    5700       if( bExistMV == false )
    5701       {
    5702         bExistMV = xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
    5703       }
    5704       if( bExistMV )
    5705       {
    5706         if( cColMv.m_bDvMcp == false ) // DCP
    5707         {
    5708           clipMv(cColMv);
    5709           pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5710           pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
    5711           return;
    5712         }
    5713         else { // // DV-MCP
    5714           aiDvMcpDvCand[0][DVFROM_COL] = cColMv.getHor();
    5715           abDvMcpFlag  [0][DVFROM_COL] = true;
    5716           bDvMcpIsFound = true;
    5717         };
    5718 
    5719         if ( getSlice()->isInterB() )
    5720         {       
    5721           iRefIdx = iRefIdxSkip[1];
    5722           bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
    5723           if( bExistMV == false )
    5724           {
    5725             bExistMV = xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
    5726           }
    5727           if( bExistMV )
    5728           {
    5729             if( cColMv.m_bDvMcp == false ) // DCP
    5730             {
    5731               clipMv(cColMv);
    5732               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5733               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
    5734               return;
    5735             }
    5736             else // DV-MCP
    5737             {
    5738               aiDvMcpDvCand[1][DVFROM_COL] = cColMv.getHor();
    5739               abDvMcpFlag  [1][DVFROM_COL] = true;
    5740               bDvMcpIsFound = true;
    5741             };
    5742           }
    5743         }
    5744       }
    5745     }
    5746 #else
    57475267    TComMv cColMv;
    57485268    Int iTargetViewIdx = 0;
    57495269    Int iTStartViewIdx = 0;
    57505270    UInt uiPartIdxRB, uiBRIdx;
     5271#if !MTK_SIMPLIFY_DVTC_C0135
    57515272    Int uiViewIdxCurr= getSlice()->getViewId();
     5273#endif
    57525274    UInt uiPartIdxCenter;
    57535275    xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
     
    57595281    uiBRIdx = uiPartIdxLT;
    57605282    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     5283#if MTK_SIMPLIFY_DVTC_C0135
     5284    if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     5285    {
     5286      uiLCUnew = -1;
     5287    }
     5288    else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5289    {
     5290      uiLCUnew = -1;
     5291    }
     5292    else
     5293#else
    57615294    if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
     5295#endif
    57625296    {
    57635297      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     
    57695303      {
    57705304        uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     5305#if MTK_SIMPLIFY_DVTC_C0135
     5306        uiLCUnew = -1;
     5307#else
    57715308        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
     5309#endif
    57725310      }
    57735311      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     
    57795317      {
    57805318        uiBRIdx = 0;
     5319#if MTK_SIMPLIFY_DVTC_C0135
     5320        uiLCUnew = -1;
     5321#else
    57815322        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
     5323#endif
    57825324      }
    57835325    }
     
    58055347      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
    58065348      {
     5349#if !MTK_SIMPLIFY_DVTC_C0135
    58075350        if (uiViewIdxCurr > 1) 
    58085351        {
     5352#endif
    58095353          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
    58105354          {
    58115355            clipMv(cColMv);
    5812             pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5813             pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     5356#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5357            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5358            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5359#else
     5360            {
     5361              TComPic* picDepth = NULL;
     5362              picDepth = getSlice()->getRefPicBaseDepth();
     5363              if (picDepth && bDepthRefine)
     5364#if LGE_SIMP_DVP_REFINE_C0112
     5365                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5366#else
     5367                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5368#endif
     5369
     5370              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5371              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5372            }
     5373#endif
    58145374            return ;
    58155375          }
     5376#if !MTK_SIMPLIFY_DVTC_C0135
    58165377        }
    5817 
     5378#endif
    58185379        if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
    58195380        {
    58205381          clipMv(cColMv);
    5821           pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5822           pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     5382#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5383            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5384            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5385#else
     5386            {
     5387              TComPic* picDepth = NULL;
     5388              picDepth = getSlice()->getRefPicBaseDepth();
     5389              if (picDepth && bDepthRefine)
     5390#if LGE_SIMP_DVP_REFINE_C0112
     5391                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5392#else
     5393                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5394#endif
     5395              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5396              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5397            }
     5398#endif
    58235399          return ;
    58245400        }
     5401#if !MTK_SIMPLIFY_DVTC_C0135
    58255402        if(uiViewIdxCurr == 1) 
    58265403        {
     
    58285405          {
    58295406            clipMv(cColMv);
    5830             pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5831             pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     5407#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5408            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5409            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5410#else
     5411            {
     5412              TComPic* picDepth = NULL;
     5413              picDepth = getSlice()->getRefPicBaseDepth();
     5414              if (picDepth && bDepthRefine)
     5415#if LGE_SIMP_DVP_REFINE_C0112
     5416                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5417#else
     5418                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5419#endif
     5420              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5421              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5422            }
     5423#endif
    58325424            return ;
    58335425          }
    58345426        }
    5835       }
    5836     }
    5837 #endif
     5427#endif
     5428      }
     5429    }
    58385430  } // if TMVP Flag
     5431#endif
     5432  UInt uiIdx = 0;
     5433  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
     5434  if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
     5435  {
     5436    pcTmpCU = NULL;
     5437  }
     5438
     5439  if (pcTmpCU && bParMerge)
     5440  {
     5441    if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
     5442    {
     5443      pcTmpCU = NULL;
     5444    }
     5445  }
     5446
     5447  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5448  {
     5449    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5450    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5451    {
     5452      eRefPicList = RefPicList(iList);
     5453      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5454      if( refId >= 0)
     5455      {
     5456        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5457        if (refViewIdx != m_pcSlice->getViewId()) // DCP
     5458        {
     5459          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5460          clipMv(cMvPred);
     5461#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5462          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5463          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5464#else
     5465          {
     5466            TComPic* picDepth = NULL;
     5467            picDepth = getSlice()->getRefPicBaseDepth();
     5468            if (picDepth && bDepthRefine)
     5469#if LGE_SIMP_DVP_REFINE_C0112
     5470              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5471#else
     5472              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5473#endif
     5474            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5475            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5476          }
     5477#endif
     5478          return;
     5479        }
     5480        else // MCP
     5481        {
     5482          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5483          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5484          {
     5485#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5486            aiDvMcpDvCandX[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
     5487            aiDvMcpDvCandY[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispY;
     5488#else
     5489            aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
     5490#endif
     5491            abDvMcpFlag  [iList][DVFROM_LEFT] = true;
     5492            bDvMcpIsFound = true;
     5493          }
     5494        }
     5495      }
     5496#if MERL_VSP_C0152
     5497      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5498      {
     5499        TComPic* picDepth = NULL;
     5500        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5501        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5502        if (picDepth && bDepthRefine)
     5503          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5504        myMv.setVer(0);
     5505
     5506        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5507        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5508        return;
     5509      }
     5510#endif
     5511    }
     5512  }
     5513
     5514  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
     5515  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
     5516  {
     5517    pcTmpCU = NULL;
     5518  }
     5519
     5520  if (pcTmpCU && bParMerge)
     5521  {
     5522    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
     5523    {
     5524      pcTmpCU = NULL;
     5525    }
     5526  }
     5527
     5528  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5529  {
     5530    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     5531    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5532    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5533    {
     5534      eRefPicList = RefPicList(iList);
     5535      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5536      if( refId >= 0)
     5537      {
     5538        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5539        if (refViewIdx!= m_pcSlice->getViewId())
     5540        {
     5541          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5542          clipMv(cMvPred);
     5543#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5544          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5545          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5546#else
     5547          {
     5548            TComPic* picDepth = NULL;
     5549            picDepth = getSlice()->getRefPicBaseDepth();
     5550            if (picDepth && bDepthRefine)
     5551#if LGE_SIMP_DVP_REFINE_C0112
     5552              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5553#else
     5554              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5555#endif
     5556            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5557            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5558          }
     5559#endif
     5560          return;
     5561        }
     5562        else if(iLCUAddrDiff == 0) //MCP, within same LCU
     5563        {
     5564          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5565          if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
     5566          {
     5567#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5568            aiDvMcpDvCandX[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
     5569            aiDvMcpDvCandY[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispY;
     5570#else
     5571            aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
     5572#endif
     5573            abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
     5574            bDvMcpIsFound = true;
     5575          }
     5576        }
     5577      }
     5578#if MERL_VSP_C0152
     5579      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5580      {
     5581        TComPic* picDepth = NULL;
     5582        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5583        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5584        if (picDepth && bDepthRefine)
     5585          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5586        myMv.setVer(0);
     5587
     5588        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5589        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5590        return;
     5591      }
     5592#endif
     5593    }
     5594  }
     5595
     5596  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
     5597
     5598  if (pcTmpCU && bParMerge)
     5599  {
     5600    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
     5601    {
     5602      pcTmpCU = NULL;
     5603    }
     5604  }
     5605
     5606  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5607  {
     5608    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     5609    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5610    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5611    {
     5612      eRefPicList = RefPicList(iList);
     5613      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5614      if( refId >= 0)
     5615      {
     5616        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5617        if (refViewIdx!= m_pcSlice->getViewId())
     5618        {
     5619          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5620          clipMv(cMvPred);
     5621#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5622          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5623          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5624#else
     5625          {
     5626            TComPic* picDepth = NULL;
     5627            picDepth = getSlice()->getRefPicBaseDepth();
     5628            if (picDepth && bDepthRefine)
     5629#if LGE_SIMP_DVP_REFINE_C0112
     5630              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5631#else
     5632              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5633#endif
     5634            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5635            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5636          }
     5637#endif
     5638          return;
     5639        }
     5640        else if(iLCUAddrDiff == 0)
     5641        {
     5642          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5643          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5644          {
     5645#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5646            aiDvMcpDvCandX[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
     5647            aiDvMcpDvCandY[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispY;
     5648#else
     5649            aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
     5650#endif
     5651            abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
     5652            bDvMcpIsFound = true;
     5653          }
     5654        }
     5655      }
     5656#if MERL_VSP_C0152
     5657      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5658      {
     5659        TComPic* picDepth = NULL;
     5660        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5661        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5662        if (picDepth && bDepthRefine)
     5663          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5664        myMv.setVer(0);
     5665
     5666        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5667        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5668        return;
     5669      }
     5670#endif
     5671    }
     5672  }
     5673
     5674  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
     5675
     5676  if (pcTmpCU && bParMerge)
     5677  {
     5678    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
     5679    {
     5680      pcTmpCU = NULL;
     5681    }
     5682  }
     5683
     5684  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5685  {
     5686    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5687    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5688    {
     5689      eRefPicList = RefPicList(iList);
     5690      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5691      if( refId >= 0)
     5692      {
     5693        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5694        if (refViewIdx!= m_pcSlice->getViewId())
     5695        {
     5696          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5697          clipMv(cMvPred);
     5698#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5699          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5700          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5701#else
     5702          {
     5703            TComPic* picDepth = NULL;
     5704            picDepth = getSlice()->getRefPicBaseDepth();
     5705            if (picDepth && bDepthRefine)
     5706#if LGE_SIMP_DVP_REFINE_C0112
     5707              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5708#else
     5709              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5710#endif
     5711            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5712            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5713          }
     5714#endif
     5715          return;
     5716        }
     5717        else // MCP
     5718        {
     5719          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5720          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5721          {
     5722#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5723            aiDvMcpDvCandX[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
     5724            aiDvMcpDvCandY[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispY;
     5725#else
     5726            aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
     5727#endif
     5728            abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
     5729            bDvMcpIsFound = true;
     5730          }
     5731        }
     5732      }
     5733#if MERL_VSP_C0152
     5734      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5735      {
     5736        TComPic* picDepth = NULL;
     5737        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5738        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5739        if (picDepth && bDepthRefine)
     5740          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5741        myMv.setVer(0);
     5742
     5743        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5744        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5745        return;
     5746      }
     5747#endif
     5748    }
     5749  }
     5750
     5751  // Above predictor search
     5752  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
     5753  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
     5754
     5755  if (pcTmpCU && bParMerge)
     5756  {
     5757    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
     5758    {
     5759      pcTmpCU = NULL;
     5760    }
     5761  }
     5762
     5763  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5764  {
     5765    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     5766
     5767    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5768    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5769    {
     5770      eRefPicList = RefPicList(iList);
     5771      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5772      if( refId >= 0)
     5773      {
     5774        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5775        if (refViewIdx!= m_pcSlice->getViewId())
     5776        {
     5777          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5778          clipMv(cMvPred);
     5779#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5780          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5781          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5782#else
     5783          {
     5784            TComPic* picDepth = NULL;
     5785            picDepth = getSlice()->getRefPicBaseDepth();
     5786            if (picDepth && bDepthRefine)
     5787#if LGE_SIMP_DVP_REFINE_C0112
     5788              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5789#else
     5790              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5791#endif
     5792            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5793            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5794          }
     5795#endif
     5796          return;
     5797        }
     5798        else if(iLCUAddrDiff <= 1)
     5799        {
     5800          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5801          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5802          {
     5803#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5804            aiDvMcpDvCandX[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
     5805            aiDvMcpDvCandY[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispY;
     5806#else
     5807            aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
     5808#endif
     5809            abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
     5810            bDvMcpIsFound = true;
     5811          }
     5812        }
     5813      }
     5814#if MERL_VSP_C0152
     5815      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5816      {
     5817        TComPic* picDepth = NULL;
     5818        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5819        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5820        if (picDepth && bDepthRefine)
     5821          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5822        myMv.setVer(0);
     5823
     5824        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5825        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5826        return;
     5827      }
     5828#endif
     5829    }
     5830  }
     5831#if !MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
     5832  // copied from getInterMergeCand()
     5833  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     5834  {
     5835    TComMv cColMv;
     5836    Int iTargetViewIdx = 0;
     5837    Int iTStartViewIdx = 0;
     5838    UInt uiPartIdxRB, uiBRIdx;
     5839#if !MTK_SIMPLIFY_DVTC_C0135
     5840    Int uiViewIdxCurr= getSlice()->getViewId();
     5841#endif
     5842    UInt uiPartIdxCenter;
     5843    xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
     5844
     5845    Int uiLCUIdx = getAddr();
     5846    Int uiLCUnew = uiLCUIdx;
     5847    eCUMode = getPartitionSize( 0 );
     5848    deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 
     5849    uiBRIdx = uiPartIdxLT;
     5850    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     5851#if MTK_SIMPLIFY_DVTC_C0135
     5852    if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     5853    {
     5854      uiLCUnew = -1;
     5855    }
     5856    else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5857    {
     5858      uiLCUnew = -1;
     5859    }
     5860    else
     5861#else
     5862    if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
     5863#endif
     5864    {
     5865      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     5866      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     5867      {
     5868        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     5869      }
     5870      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     5871      {
     5872        uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     5873#if MTK_SIMPLIFY_DVTC_C0135
     5874        uiLCUnew = -1;
     5875#else
     5876        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
     5877#endif
     5878      }
     5879      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     5880      {
     5881        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     5882        uiLCUnew = uiLCUIdx + 1;
     5883      }
     5884      else //is the right bottom corner of LCU                       
     5885      {
     5886        uiBRIdx = 0;
     5887#if MTK_SIMPLIFY_DVTC_C0135
     5888        uiLCUnew = -1;
     5889#else
     5890        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
     5891#endif
     5892      }
     5893    }
     5894    const Int iNumofCandPic = 2;
     5895    for(Int i =0; i < iNumofCandPic; i++)
     5896    {
     5897      Int lpRef=0;
     5898      if(i == 0)
     5899      {   //check the col-located picture
     5900        eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
     5901#if COLLOCATED_REF_IDX
     5902        lpRef = getSlice()->getColRefIdx();
     5903#else
     5904        Int lpRef = 0;
     5905#endif
     5906      }
     5907      else
     5908      {
     5909        if(!(getPic()->getRapbCheck()))
     5910          break;
     5911        eRefPicList=getPic()->getRapRefList();
     5912        lpRef=getPic()->getRapRefIdx();
     5913      }
     5914
     5915      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
     5916      {
     5917#if !MTK_SIMPLIFY_DVTC_C0135
     5918        if (uiViewIdxCurr > 1) 
     5919        {
     5920#endif
     5921          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     5922          {
     5923            clipMv(cColMv);
     5924#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5925            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5926            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5927#else
     5928            {
     5929              TComPic* picDepth = NULL;
     5930              picDepth = getSlice()->getRefPicBaseDepth();
     5931              if (picDepth && bDepthRefine)
     5932#if LGE_SIMP_DVP_REFINE_C0112
     5933                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5934#else
     5935                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5936#endif
     5937
     5938              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5939              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5940            }
     5941#endif
     5942            return ;
     5943          }
     5944#if !MTK_SIMPLIFY_DVTC_C0135
     5945        }
     5946#endif
     5947        if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
     5948        {
     5949          clipMv(cColMv);
     5950#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5951            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5952            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5953#else
     5954            {
     5955              TComPic* picDepth = NULL;
     5956              picDepth = getSlice()->getRefPicBaseDepth();
     5957              if (picDepth && bDepthRefine)
     5958#if LGE_SIMP_DVP_REFINE_C0112
     5959                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5960#else
     5961                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5962#endif
     5963              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5964              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5965            }
     5966#endif
     5967          return ;
     5968        }
     5969#if !MTK_SIMPLIFY_DVTC_C0135
     5970        if(uiViewIdxCurr == 1) 
     5971        {
     5972          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     5973          {
     5974            clipMv(cColMv);
     5975#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5976            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5977            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5978#else
     5979            {
     5980              TComPic* picDepth = NULL;
     5981              picDepth = getSlice()->getRefPicBaseDepth();
     5982              if (picDepth && bDepthRefine)
     5983#if LGE_SIMP_DVP_REFINE_C0112
     5984                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5985#else
     5986                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5987#endif
     5988              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5989              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5990            }
     5991#endif
     5992            return ;
     5993          }
     5994        }
     5995#endif
     5996      }
     5997    }
     5998  } // if TMVP Flag
     5999#endif
    58396000
    58406001  if( bDvMcpIsFound ) // skip dvmcp
    58416002  {
    5842 #if QC_SIMPLE_NBDV_B0047
    58436003    for( Int i=1 ; i<iNumofDvMCP-1 ; i++ ) // 5 spatial
    5844 #else
    5845     for( Int i=1 ; i<7 ; i++ ) // 5 spatial + 1 temporal
    5846 #endif
    58476004    {
    58486005      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    58506007        if( abDvMcpFlag[iList][i]==true )
    58516008        {
     6009#if MTK_RELEASE_DV_CONSTRAINT_C0129
     6010          TComMv dv( aiDvMcpDvCandX[iList][ i ], aiDvMcpDvCandY[iList][ i ] );
     6011#else
    58526012          TComMv dv( aiDvMcpDvCand[iList][ i ], 0 );
     6013#endif
    58536014          clipMv( dv );
    5854           pDInfo->m_acMvCand[ pDInfo->iN  ] = dv;
    5855           pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6015#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6016          pDInfo->m_acMvCand[ pDInfo->iN] = dv;
     6017          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6018#else
     6019          {
     6020            TComPic* picDepth = NULL;
     6021            picDepth = getSlice()->getRefPicBaseDepth();
     6022            if (picDepth && bDepthRefine)
     6023#if LGE_SIMP_DVP_REFINE_C0112
     6024              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv, true);
     6025#else
     6026              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv);
     6027#endif
     6028            pDInfo->m_acMvCand[ pDInfo->iN] = dv;
     6029            pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6030          }
     6031#endif
    58566032          return;
    58576033        }
     
    58636039}
    58646040#endif
     6041
    58656042#endif
    58666043
     
    58726049 * \param pInfo
    58736050 */
    5874 #if SHARP_INTERVIEW_DECOUPLE_B0111
     6051#if H3D_IVMP
    58756052Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx)
    58766053{
     
    58986075    if (iMVPIdx<=0)
    58996076    {
    5900       // extention part
     6077#if H3D_NBDV
     6078      // Extension part
    59016079      DisInfo cDisInfo;
    59026080      cDisInfo.iN = 0;
    5903 #if LGE_DVMCP_A0126
    5904 #if QC_SIMPLE_NBDV_B0047
    5905 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    5906       getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false);
    5907 #else
    5908       getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo);
    5909 #endif
    5910 #else
    5911       getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false, eRefPicList, iRefIdx );
    5912 #endif
    5913 #else
    5914       getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo );
    5915 #endif
     6081      getDisMvpCandNBDV(uiPartIdx, uiPartAddr, &cDisInfo, false
     6082#if MERL_VSP_C0152
     6083            , true
     6084#endif
     6085              );
    59166086      if(cDisInfo.iN==0)
    59176087      {
     
    59216091        cDisInfo.m_aVIdxCan[0] = 0;
    59226092      }
     6093#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     6094      Int paiPdmRefIdx[4] = {-1, -1, -1, -1};
     6095      Int iPdmDir[4]      = {-1, -1, -1, -1};
     6096#if QC_C0051_FIXED_BY_MTK
     6097      TComMv cPdmMvPred[4];
     6098#else
     6099      TComMv cPdmMvPred[2];
     6100#endif
     6101      cPdmMvPred[0].m_bDvMcp = cPdmMvPred[1].m_bDvMcp = false;
     6102      if(getUnifiedMvPredCan(uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, cPdmMvPred, &cDisInfo, iPdmDir, false))
     6103#else // QC_AMVP_MRG_UNIFY_IVCAN_C0051
    59236104      TComMv  cPdmMvPred;
    5924 #if QC_MULTI_DIS_CAN_A0097
    59256105      if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
     6106#endif // QC_AMVP_MRG_UNIFY_IVCAN_C0051
     6107#else // H3D_NBDV
     6108      if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
     6109#endif
     6110
     6111#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     6112      {
     6113        clipMv( cPdmMvPred[0] );
     6114        pInfo->m_acMvCand[0] = cPdmMvPred[0];
     6115      }
     6116      else
     6117      {
     6118        pInfo->m_acMvCand[0].set(0,0);
     6119      }
    59266120#else
    5927       if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    5928 #endif
    59296121      {
    59306122        clipMv( cPdmMvPred );
     
    59356127        pInfo->m_acMvCand[0].set(0,0);
    59366128      }
     6129#endif
    59376130    }
    59386131  }
     
    59416134
    59426135Void TComDataCU::fillMvpCandBase( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo )
    5943 #else
     6136#else //  H3D_IVMP 
    59446137Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo )
    5945 #endif
     6138#endif //  H3D_IVMP
    59466139{
    59476140  PartSize eCUMode = getPartitionSize( 0 );
     
    59556148    return;
    59566149  }
    5957  
    5958 #if QC_MULTI_DIS_CAN_A0097 && !SHARP_INTERVIEW_DECOUPLE_B0111
    5959   DisInfo cDisInfo;
    5960   cDisInfo.iN = 0;
    5961   if(m_pcSlice->getSPS()->getViewId() && m_pcSlice->getSPS()->getMultiviewMvPredMode())
    5962   {
    5963 #if LGE_DVMCP_A0126
    5964 #if QC_SIMPLE_NBDV_B0047
    5965 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    5966     getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false);
    5967 #else
    5968     getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo);
    5969 #endif
    5970 #else
    5971     getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false, eRefPicList, iRefIdx );
    5972 #endif
    5973 #else
    5974     getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo );
    5975 #endif
    5976   }
    5977   if(cDisInfo.iN==0)
    5978   {
    5979     cDisInfo.iN = 1;
    5980     cDisInfo.m_acMvCand[0].setHor(0);
    5981     cDisInfo.m_acMvCand[0].setVer(0);
    5982     cDisInfo.m_aVIdxCan[0] = 0;
    5983   }
    5984 #endif
    5985 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    5986 #if ( PDM_AMVP_POS == 0 )
    5987   // get inter-view mv predictor (at position 0)
    5988   TComMv  cPdmMvPred;
    5989 #if QC_MULTI_DIS_CAN_A0097
    5990   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    5991 #else
    5992   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    5993 #endif
    5994   {
    5995     clipMv( cPdmMvPred );
    5996     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    5997   }
    5998 #endif
    5999 #endif
    60006150
    60016151  //-- Get Spatial MV
     
    60096159  TComDataCU* tmpCU = NULL;
    60106160  UInt idx;
    6011 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    60126161  tmpCU = getPUBelowLeft(idx, uiPartIdxLB, true, false);
    6013 #else
    6014   tmpCU = getPUBelowLeft(idx, uiPartIdxLB);
    6015 #endif
    60166162  bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
    60176163
    60186164  if (!bAddedSmvp)
    60196165  {
    6020 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    60216166    tmpCU = getPULeft(idx, uiPartIdxLB, true, false);
    6022 #else
    6023     tmpCU = getPULeft(idx, uiPartIdxLB);
    6024 #endif
    60256167    bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
    60266168  }
     
    60426184  }
    60436185
    6044 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6045 #if ( PDM_AMVP_POS == 1 )
    6046   // get inter-view mv predictor (at position 1)
    6047   TComMv  cPdmMvPred;
    6048 #if QC_MULTI_DIS_CAN_A0097
    6049   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    6050 #else
    6051   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    6052 #endif
    6053   {
    6054     clipMv( cPdmMvPred );
    6055     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    6056   }
    6057 #endif
    6058 #endif
    6059 
    60606186  // Above predictor search
    60616187  bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT);
     
    60946220  }
    60956221
    6096 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6097 #if ( PDM_AMVP_POS == 2 )
    6098   // get inter-view mv predictor (at position 2)
    6099   TComMv  cPdmMvPred;
    6100 #if QC_MULTI_DIS_CAN_A0097
    6101   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    6102 #else
    6103   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    6104 #endif
    6105   {
    6106     clipMv( cPdmMvPred );
    6107     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    6108   }
    6109 #endif
    6110 #endif
    6111 
    6112 #if AMVP_PRUNING_SIMPLIFICATION
     6222
    61136223  if ( pInfo->iN == 2 )
    61146224  {
     
    61166226    {
    61176227      pInfo->iN = 1;
    6118 #if FIX_MISUSE_REFINDEX
     6228#if QC_MRG_CANS_B0048
    61196229      pInfo->m_acMvCand[ 1 ].set(0, 0);
    61206230#endif
    61216231    }
    61226232  }
    6123 #if QC_MULTI_DIS_CAN_A0097 && !SHARP_INTERVIEW_DECOUPLE_B0111
    6124   if ( getSlice()->getViewId()!=0 && pInfo->iN == 3 )
    6125   {
    6126     if ( pInfo->m_acMvCand[ 1 ] == pInfo->m_acMvCand[ 2 ] )
    6127     {
    6128       pInfo->iN = 2;
    6129       if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
    6130         pInfo->iN = 1;
    6131     }
    6132     else
    6133     {
    6134       if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
    6135       {
    6136         pInfo->m_acMvCand[1 ] = pInfo->m_acMvCand[ 2 ];
    6137         pInfo->iN = 2;
    6138       }
    6139       else if (pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 2 ])
    6140       {
    6141          pInfo->iN = 2;
    6142       }
    6143     }
    6144   }
    6145 #endif
    6146 #endif
    61476233
    61486234  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     
    61956281    if ( uiLCUIdx >= 0 && xGetColMVP( eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col ) )
    61966282    {
    6197 #if FIX_LGE_DVMCP_B0133
     6283#if H3D_NBDV
    61986284      cColMv.m_bDvMcp = false;
    61996285#endif
     
    62076293      if (xGetColMVP( eRefPicList, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx_Col ))
    62086294      {
    6209 #if FIX_LGE_DVMCP_B0133
     6295#if H3D_NBDV
    62106296        cColMv.m_bDvMcp = false;
    62116297#endif
     
    62166302  }
    62176303
    6218 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6219 #if ( PDM_AMVP_POS == 3 )
    6220   // get inter-view mv predictor (at position 3)
    6221   TComMv  cPdmMvPred;
    6222 #if QC_MULTI_DIS_CAN_A0097
    6223   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    6224 #else
    6225   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    6226 #endif
    6227   {
    6228     clipMv( cPdmMvPred );
    6229     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    6230   }
    6231 #endif
    6232 #endif
    6233 
    6234 #if !AMVP_PRUNING_SIMPLIFICATION
    6235   // Check No MV Candidate
    6236   xUniqueMVPCand( pInfo );
    6237 #endif
    6238 
    6239 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6240   const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
    6241   if (pInfo->iN > iNumAMVPCands)
    6242   {
    6243     pInfo->iN = iNumAMVPCands;
    6244   }
    6245   else if (pInfo->iN < iNumAMVPCands)
    6246 #else
     6304
    62476305  if (pInfo->iN > AMVP_MAX_NUM_CANDS)
    62486306  {
     
    62506308  }
    62516309  else if (pInfo->iN < AMVP_MAX_NUM_CANDS)
    6252 #endif
    6253   {
    6254 #if !AMVP_ZERO_CHECKING_REMOVAL
    6255     int j;
    6256     for (j=0; j<pInfo->iN; j++)
    6257     {
    6258       if (pInfo->m_acMvCand[j].getHor() == 0 && pInfo->m_acMvCand[j].getVer() == 0)
    6259       {
    6260         break;
    6261       }
    6262     }
    6263     if (j == pInfo->iN)
    6264     {
    6265 #endif
     6310  {
    62666311      pInfo->m_acMvCand[pInfo->iN].set(0,0);
    62676312      pInfo->iN++;
    6268 #if !AMVP_ZERO_CHECKING_REMOVAL
    6269     }
    6270 #endif
    62716313  }
    62726314  return ;
     
    63586400    case MD_LEFT:
    63596401    {
    6360 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63616402      pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false);
    6362 #else
    6363       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
    6364 #endif
    63656403      break;
    63666404    }
    63676405    case MD_ABOVE:
    63686406    {
    6369 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63706407      pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true);
    6371 #else
    6372       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);
    6373 #endif
    63746408      break;
    63756409    }
    63766410    case MD_ABOVE_RIGHT:
    63776411    {
    6378 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63796412      pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true);
    6380 #else
    6381       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);
    6382 #endif
    63836413      break;
    63846414    }
    63856415    case MD_BELOW_LEFT:
    63866416    {
    6387 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63886417      pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false);
    6389 #else
    6390       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
    6391 #endif
    63926418      break;
    63936419    }
    63946420    case MD_ABOVE_LEFT:
    63956421    {
    6396 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63976422      pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true);
    6398 #else
    6399       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);
    6400 #endif
    64016423      break;
    64026424    }
     
    64076429  }
    64086430 
     6431#if MERL_VSP_C0152
     6432  if(pcTmpCU != NULL && pcTmpCU->getVSPIndex(uiIdx))
     6433  {
     6434    return false;
     6435  }
     6436#endif
     6437
    64096438  if ( pcTmpCU != NULL && m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) )
    64106439  {
    64116440    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    6412 #if LGE_DVMCP_A0126
     6441#if H3D_NBDV
    64136442    cMvPred.m_bDvMcp = false;
    64146443#endif
     
    64546483    {
    64556484      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    6456 #if LGE_DVMCP_A0126
     6485#if H3D_NBDV
    64576486      cMvPred.m_bDvMcp = false;
    64586487#endif
     
    64646493}
    64656494
    6466 #if !AMVP_PRUNING_SIMPLIFICATION
    6467 /**
    6468  * Reduce list of motion vector predictors to a set of unique predictors
    6469  * \param pInfo list of motion vector predictors
    6470  */
    6471 Void TComDataCU::xUniqueMVPCand(AMVPInfo* pInfo)
    6472 {
    6473   Int n = 1;
    6474   if ( pInfo->iN == 0 )
    6475   {
    6476 #if AMVP_ZERO_CHECKING_REMOVAL
    6477     return;
    6478 #else
    6479     // Add a zero candidate is none is available
    6480     pInfo->m_acMvCand[ 0 ].setZero();
    6481 #endif
    6482   }
    6483   else
    6484   {
    6485     for (Int i = 1; i < pInfo->iN; i++)
    6486     {
    6487       Int j;
    6488       for (j = n - 1; j >= 0; j--)
    6489       {
    6490         if ( pInfo->m_acMvCand[ i ] == pInfo->m_acMvCand[ j ] )
    6491         {
    6492           break;
    6493         }
    6494       }
    6495       if ( j < 0 )
    6496       {
    6497         pInfo->m_acMvCand[ n++ ] = pInfo->m_acMvCand[ i ];
    6498       }
    6499     }
    6500   }
    6501   pInfo->iN = n;
    6502 }
    6503 #endif
    65046495
    65056496/**
     
    65156506  TComDataCU* pcTmpCU = NULL;
    65166507  UInt uiIdx;
     6508
    65176509  switch( eDir )
    65186510  {
    65196511  case MD_LEFT:
    65206512    {
    6521 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65226513      pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false);
    6523 #else
    6524       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
    6525 #endif
    65266514      break;
    65276515    }
    65286516  case MD_ABOVE:
    65296517    {
    6530 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65316518      pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true);
    6532 #else
    6533       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);
    6534 #endif
    65356519      break;
    65366520    }
    65376521  case MD_ABOVE_RIGHT:
    65386522    {
    6539 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65406523      pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true);
    6541 #else
    6542       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);
    6543 #endif
    65446524      break;
    65456525    }
    65466526  case MD_BELOW_LEFT:
    65476527    {
    6548 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65496528      pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false);
    6550 #else
    6551       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
    6552 #endif
    65536529      break;
    65546530    }
    65556531  case MD_ABOVE_LEFT:
    65566532    {
    6557 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65586533      pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true);
    6559 #else
    6560       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);
    6561 #endif
    65626534      break;
    65636535    }
     
    65726544    return false;
    65736545  }
    6574  
     6546
     6547#if MERL_VSP_C0152
     6548  if(pcTmpCU->getVSPIndex(uiIdx))
     6549  {
     6550    return false;
     6551  }
     6552#endif
    65756553  RefPicList eRefPicList2nd = REF_PIC_LIST_0;
    65766554  if(       eRefPicList == REF_PIC_LIST_0 )
     
    65876565  Int iNeibPOC = iCurrPOC;
    65886566  Int iNeibRefPOC;
    6589 
     6567#if INTER_VIEW_VECTOR_SCALING_C0116
     6568  Int iCurrViewId = m_pcSlice->getViewOrderIdx(); // will be changed to view_id
     6569  Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getViewOrderIdx(); // will be changed to view_id
     6570  Int iNeibViewId = iCurrViewId;
     6571  Int iNeibRefViewId;
     6572#endif
    65906573#if QC_IV_AS_LT_B0046
    65916574  Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm();
     
    65956578  {
    65966579    iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) );
     6580#if INTER_VIEW_VECTOR_SCALING_C0116
     6581    iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id
     6582#endif
    65976583#if QC_IV_AS_LT_B0046
    65986584    bIsNeibRefLongTerm = m_pcSlice->getRefPic( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getIsLongTerm() ;
     6585#if INTER_VIEW_VECTOR_SCALING_C0116
     6586    if ( (bIsCurrRefLongTerm == bIsNeibRefLongTerm) && ((iNeibRefPOC == iCurrRefPOC) && (iNeibRefViewId == iCurrRefViewId)))
     6587#else
    65996588    if ( (bIsCurrRefLongTerm == bIsNeibRefLongTerm) && (iNeibRefPOC == iCurrRefPOC) )
     6589#endif
    66006590#else
    66016591    if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) )
     
    66056595    {
    66066596      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    6607 #if LGE_DVMCP_A0126
     6597#if H3D_NBDV
    66086598      cMvPred.m_bDvMcp = false;
    66096599#endif
     
    66186608  {
    66196609    iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) );
     6610#if INTER_VIEW_VECTOR_SCALING_C0116
     6611    iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id
     6612#endif
    66206613    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    66216614    TComMv rcMv;
     
    66306623    }
    66316624#endif
     6625#if INTER_VIEW_VECTOR_SCALING_C0116
     6626    Int iScale = 4096;
     6627    if((iCurrRefPOC != iNeibRefPOC)  )    // inter & inter
     6628        iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6629    else if(m_pcSlice->getIVScalingFlag())    // inter-view & inter-view
     6630        iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iNeibViewId, iNeibRefViewId );
     6631#else
    66326632    Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6633#endif
    66336634    if ( iScale == 4096 )
    66346635    {
     
    66396640      rcMv = cMvPred.scaleMv( iScale );
    66406641    }
    6641 #if LGE_DVMCP_A0126
     6642#if H3D_NBDV
    66426643    rcMv.m_bDvMcp = false;
    66436644#endif
     
    66526653  {
    66536654    iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) );
     6655#if INTER_VIEW_VECTOR_SCALING_C0116
     6656    iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id
     6657#endif
    66546658    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    66556659    TComMv rcMv;
     
    66646668    }
    66656669#endif
     6670#if INTER_VIEW_VECTOR_SCALING_C0116
     6671    Int iScale = 4096;
     6672    if((iCurrRefPOC != iNeibRefPOC))    // inter & inter
     6673        iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6674    else if(m_pcSlice->getIVScalingFlag())    // inter-view & inter-view
     6675        iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iNeibViewId, iNeibRefViewId );
     6676#else
    66666677    Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6678#endif
    66676679    if ( iScale == 4096 )
    66686680    {
     
    66736685      rcMv = cMvPred.scaleMv( iScale );
    66746686    }
    6675 #if LGE_DVMCP_A0126
     6687#if H3D_NBDV
    66766688    rcMv.m_bDvMcp = false;
    66776689#endif
     
    66866698}
    66876699
    6688 #if QC_MULTI_DIS_CAN_A0097
     6700#if H3D_NBDV
    66896701Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
    66906702{
    6691 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6692   Int  iDvMcpDispX[2] = {-1,};
    6693   Bool bDvMcpFlag [2] = { false, };
    6694   Int iCurrViewIdx = m_pcSlice->getViewId();
    6695 #endif
    6696 
    66976703  UInt uiAbsPartAddr = uiPartUnitIdx;
    66986704
     
    67026708  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    67036709  iColViewIdx = pColCU->getSlice()->getViewId();
    6704 
     6710#if MERL_VSP_C0152
     6711  //TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
     6712  if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0)
     6713  {
     6714    return false;
     6715  }
     6716#endif
    67056717
    67066718  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr))
     
    67086720    return false;
    67096721  }
    6710 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6711   Bool bColIsSkipped = pColCU->isSkipped( uiAbsPartAddr );
    6712 #endif
    67136722  for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++)
    67146723  {
    67156724    if(pColCU->getSlice()->isInterB())
    67166725    {
     6726#if !QC_NBDV_LDB_FIX_C0055
    67176727      if(ilist == 0 )
    67186728        eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir());
    67196729      else
    67206730        eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir());
     6731#else
     6732        eColRefPicList = RefPicList(ilist);
     6733#endif
    67216734    }
    67226735
     
    67326745    if ( iColViewIdx    == iColRefViewIdx ) // temporal vector
    67336746    {
    6734 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6735       if( iColViewIdx >0 )
    6736       {
    6737         TComMv tmpMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
    6738         if( tmpMv.m_bDvMcp && bColIsSkipped ) // DV-MCP SKIP
    6739         {
    6740           iDvMcpDispX[ilist] = tmpMv.m_iDvMcpDispX;
    6741           bDvMcpFlag [ilist] = true;
    6742           iTargetViewIdx  = 0; //iColRefViewIdx ;
    6743           iStartViewIdx   = 0; //iCurrViewIdx; //iColViewIdx   ;
    6744         }
    6745       }
    6746 #endif
    67476747      continue;
    67486748    }
     
    67506750    {
    67516751      rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
    6752 #if LGE_DVMCP_A0126
    67536752      rcMv.m_bDvMcp = false;
    6754 #endif
    67556753      iTargetViewIdx  = iColRefViewIdx ;
    67566754      iStartViewIdx   = iColViewIdx   ;
     
    67586756    }
    67596757  }
    6760 
    6761 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6762   for( Int ilist=0 ; ilist<2 ; ilist++ )
    6763   {
    6764     if( bDvMcpFlag[ilist] )
    6765     {
    6766       rcMv.setHor( iDvMcpDispX[ilist] );
    6767       rcMv.setVer( 0 );
    6768       rcMv.m_bDvMcp = true;
    6769       iTargetViewIdx  = 0; //iColRefViewIdx ;
    6770       iStartViewIdx   = iCurrViewIdx; //iColViewIdx   ;
    6771       return true;
    6772     }
    6773   }
    6774 #endif
    67756758
    67766759  return false;
     
    67846767 * \returns Bool
    67856768 */
    6786 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx )
     6769Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
     6770#if QC_TMVP_MRG_REFIDX_C0047
     6771  ,
     6772  Bool bMRG
     6773#endif
     6774)
    67876775{
    67886776  UInt uiAbsPartAddr = uiPartUnitIdx;
     
    67906778  RefPicList  eColRefPicList;
    67916779  Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale;
    6792 #if SONY_COLPIC_AVAILABILITY
    6793 #if QC_IV_AS_LT_B0046
    6794   Int iColViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx;
    6795 #else
    6796   Int iColViewOrderIdx, iColRefViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx;
    6797 #endif
    6798 #endif
    67996780  TComMv cColMv;
    6800 
    6801 #if SONY_COLPIC_AVAILABILITY
    6802   iCurrViewOrderIdx    = m_pcSlice->getViewOrderIdx();
    6803   iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx();
    6804 #endif
     6781#if INTER_VIEW_VECTOR_SCALING_C0115
     6782  Int iColViewId, iColRefViewId, iCurrViewId, iCurrRefViewId;
     6783#endif
     6784
    68056785  // use coldir.
    68066786#if COLLOCATED_REF_IDX
     
    68176797  iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
    68186798  iColPOC = pColCU->getSlice()->getPOC(); 
    6819 #if SONY_COLPIC_AVAILABILITY
    6820   iColViewOrderIdx = pColCU->getSlice()->getViewOrderIdx();
     6799#if INTER_VIEW_VECTOR_SCALING_C0115
     6800  iCurrViewId = m_pcSlice->getViewOrderIdx(); // will be changed to view_id   
     6801  iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); // will be changed to view_id
     6802  iColViewId = pColCU->getSlice()->getViewOrderIdx(); // will be changed to view_id
    68216803#endif
    68226804
     
    68266808  }
    68276809
    6828 #if !SONY_COLPIC_AVAILABILITY&!QC_IV_AS_LT_B0046
     6810#if !INTER_VIEW_VECTOR_SCALING_C0115&!QC_IV_AS_LT_B0046
    68296811  if( m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId() != m_pcSlice->getViewId() )
    68306812    return false;
     
    68536835  // Scale the vector.
    68546836  iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, iColRefIdx);
    6855 
     6837#if INTER_VIEW_VECTOR_SCALING_C0115
     6838  iColRefViewId = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx(); // will be changed to view_id
     6839#endif
    68566840#if !QC_IV_AS_LT_B0046
    6857 #if SONY_COLPIC_AVAILABILITY
    6858   iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx();
    6859 #else
    68606841  if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != pColCU->getSlice()->getViewId() )
    68616842  {
    68626843    return false;
    68636844  }
    6864 #endif
    68656845#else
    68666846  Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm();
     
    68686848  if(bIsCurrRefLongTerm != bIsColRefLongTerm)
    68696849  {
     6850#if QC_TMVP_MRG_REFIDX_C0047
     6851    cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
     6852    iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
     6853    if(bMRG )
     6854    {
     6855      Int iUpdRefIdx  = m_pcSlice->getNewRefIdx(eRefPicList);
     6856      if(iUpdRefIdx > 0 )
     6857      {
     6858        riRefIdx = iUpdRefIdx;
     6859        bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm();
     6860        iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
     6861#if INTER_VIEW_VECTOR_SCALING_C0115
     6862        iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); // will be changed to view_id
     6863#endif
     6864      }
     6865      else
     6866        return false;
     6867    }else
     6868    {
     6869#endif
    68706870    assert( ((iColPOC == iColRefPOC)&&(iCurrPOC != iCurrRefPOC))||((iColPOC != iColRefPOC)&&(iCurrPOC == iCurrRefPOC)));
    68716871    return false;
     6872#if QC_TMVP_MRG_REFIDX_C0047
     6873    }
     6874#endif
    68726875  }
    68736876#endif
     
    68906893      }
    68916894    }else
    6892 #if QC_MVHEVC_B0046
    6893       rcMv = cColMv; //inter-view
     6895#if INTER_VIEW_VECTOR_SCALING_C0115
     6896    {
     6897        if((iCurrPOC == iCurrRefPOC) && m_pcSlice->getIVScalingFlag())    // inter-view & inter-view
     6898            iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
     6899        else
     6900            iScale = 4096;            // inter & inter
     6901      if ( iScale == 4096 )
     6902      {
     6903        rcMv = cColMv;
     6904      }
     6905      else
     6906      {
     6907        rcMv = cColMv.scaleMv( iScale );
     6908      }
     6909  }
    68946910#else
    6895     {
    6896 #if SONY_COLPIC_AVAILABILITY
    6897       Int iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx();
    6898       iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx);
    6899       if ( iScale == 4096 )
    6900       {
    6901         rcMv = cColMv;
    6902       }
    6903       else
    6904       {
    6905         rcMv = cColMv.scaleMv( iScale );
    6906       }
    6907 #else
    6908       return false;
    6909 #endif
    6910     }
    6911 #endif
    6912   }
    6913 #else
    6914 #if SONY_COLPIC_AVAILABILITY
    6915   iScale = 0;
    6916   iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx();
    6917   if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC))
    6918     iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
    6919   else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC))
    6920     iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx);
    6921   else
    6922     return false;
    6923 
    6924 #else
    6925   iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
    6926 #endif
    6927   if ( iScale == 4096 )
    6928   {
    6929     rcMv = cColMv;
    6930   }
    6931   else
    6932   {
    6933     rcMv = cColMv.scaleMv( iScale );
    6934   }
    6935 #endif
     6911    rcMv = cColMv; //inter-view
     6912#endif
     6913  }
     6914#endif
     6915
    69366916  return true;
    69376917}
     
    70267006    return false;
    70277007  }
    7028  
     7008
    70297009  if( m_pcSlice->getRefPic( eRefPicList, iRefIdx )->getViewId() != m_pcSlice->getViewId() )
    70307010  {
     
    70717051    }
    70727052  }
     7053
     7054#if MERL_VSP_C0152 // Preventive
     7055  if (pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartIdxCenter) < 0) // NOT_VALID
     7056    return false;
     7057#endif
    70737058 
    70747059  // Scale the vector.
     
    71077092UInt TComDataCU::getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra)
    71087093{
    7109 #if !LOGI_INTRA_NAME_3MPM 
    7110   static const UChar aucIntraDirToScanIdx[MAX_CU_DEPTH][NUM_INTRA_MODE] =
    7111   {
    7112     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7113     },
    7114     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7115     },
    7116     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7117     },
    7118     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7119     },
    7120     {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0
    7121     },
    7122     {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0
    7123     },
    7124     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7125     },
    7126   };
    7127 #endif
    71287094 
    71297095  UInt uiCTXIdx;
     
    71557121#endif
    71567122
    7157 #if LOGI_INTRA_NAME_3MPM
    71587123    uiScanIdx = SCAN_ZIGZAG;
    71597124    if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for PU size
     
    71617126      uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0);
    71627127    }
    7163 #else
    7164     uiScanIdx = aucIntraDirToScanIdx[uiCTXIdx][uiDirMode];
    7165 #endif
    71667128  }
    71677129  else
     
    71807142#endif
    71817143    }
    7182 #if LOGI_INTRA_NAME_3MPM
    71837144    uiScanIdx = SCAN_ZIGZAG;
    71847145    if (uiCTXIdx >4 && uiCTXIdx < 7) //if multiple scans supported for PU size
     
    71867147      uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0);
    71877148    }
    7188 #else
    7189     uiScanIdx = aucIntraDirToScanIdx[max<Int>(uiCTXIdx-1,0)][uiDirMode];
    7190 #endif
    71917149  }
    71927150
     
    76807638      }
    76817639    }
    7682 #if LCU_SYNTAX_ALF
    76837640    rSGU.allBordersAvailable = true;
    76847641    for(Int b=0; b< NUM_SGU_BORDER; b++)
     
    76907647      }
    76917648    }
    7692 #endif
    76937649
    76947650  }
     
    77867742}
    77877743
     7744#if LGE_DMM3_SIMP_C0044
     7745Void TComDataCU::setWedgePredTexIntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
     7746{
     7747  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     7748
     7749  for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     7750  {
     7751    m_puiWedgePredTexIntraTabIdx[uiAbsPartIdx+ui] = uiTIdx;
     7752  }
     7753}
     7754#endif
     7755
    77887756Void TComDataCU::setWedgePredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth )
    77897757{
     
    78457813  memcpy( m_pePredMode + uiAbsPartIdxDst,  pcCU->getPredictionMode() + uiAbsPartIdxSrc, sizeof( m_pePredMode[0] ) * uiNumPartition );
    78467814  memcpy( m_puhInterDir + uiAbsPartIdxDst, pcCU->getInterDir() + uiAbsPartIdxSrc,       sizeof( m_puhInterDir[0] ) * uiNumPartition );
     7815
     7816#if MERL_VSP_C0152 && MTK_UNCONSTRAINED_MVI_B0083
     7817  memcpy( m_piVSPIndex + uiAbsPartIdxDst,  pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition );
     7818#endif
    78477819
    78487820#if !MTK_UNCONSTRAINED_MVI_B0083
     
    78807852// public functions for Multi-view tools
    78817853// -------------------------------------------------------------------------------------------------------------------
    7882 #if HHI_INTER_VIEW_MOTION_PRED
    7883 #if !QC_MULTI_DIS_CAN_A0097
     7854#if H3D_IVMP
     7855#if !H3D_NBDV
    78847856Int
    78857857TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
     
    78987870  return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge );
    78997871}
     7872#else //H3D_NBDV
     7873#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     7874Bool
     7875TComDataCU::getUnifiedMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge )
     7876{
     7877  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
     7878  ROFRS( pcDepthMapGenerator, false );
     7879  if (pDInfo->iN > 0 && pcDepthMapGenerator->getPdmCandidate(this, uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm, bMerge))
     7880    return true;
     7881  return false;
     7882}
    79007883#else
    79017884Int
    7902 TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo
    7903 #if QC_MRG_CANS_B0048
    7904   , Int* iPdm
    7905 #endif
    7906 )
     7885TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm )
    79077886{
    79087887  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
    79097888  ROFRS( pcDepthMapGenerator, 0 );
    7910   return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo
    7911 #if QC_MRG_CANS_B0048
    7912     , iPdm
    7913 #endif
    7914     );
     7889  return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm );
    79157890}
    79167891Bool
     
    79247899}
    79257900#endif
    7926 
     7901#endif //H3D_NBDV
    79277902
    79287903Bool     
     
    79357910#endif
    79367911
    7937 #if HHI_INTER_VIEW_RESIDUAL_PRED
     7912#if H3D_IVRP
    79387913Bool
    7939 TComDataCU::getResidualSamples( UInt uiPartIdx,
    7940 #if QC_SIMPLIFIEDIVRP_M24938
    7941   Bool bRecon ,
    7942 #endif
    7943   TComYuv* pcYuv )
     7914TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv )
    79447915{
    79457916  TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
    79467917  ROFRS( pcResidualGenerator, false );
    7947 #if QC_MULTI_DIS_CAN_A0097
     7918#if H3D_NBDV
    79487919  DisInfo cDisInfo;
    79497920  cDisInfo.iN = 0;
    79507921  PartSize m_peSaved =  getPartitionSize( 0 );
    79517922  m_pePartSize[0] =  SIZE_2Nx2N;
    7952 #if LGE_DVMCP_A0126
    7953 #if QC_SIMPLE_NBDV_B0047
    7954 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    7955   getDisMvpCand2( 0, 0,  &cDisInfo, false);
    7956 #else
    7957   getDisMvpCand2( 0, 0,  &cDisInfo);
    7958 #endif
    7959 #else
    7960   getDisMvpCand2( 0, 0,  &cDisInfo, true );
    7961 #endif
    7962 #else
    7963   getDisMvpCand        ( 0, 0,  &cDisInfo );
    7964 #endif
     7923  getDisMvpCandNBDV( 0, 0,  &cDisInfo, false );
    79657924  if( cDisInfo.iN == 0)
    79667925  {
     
    79707929  else
    79717930  {
    7972     Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor()
    7973 #if QC_SIMPLIFIEDIVRP_M24938
    7974       , bRecon
    7975 #endif
    7976       );
     7931#if MTK_RELEASE_DV_CONSTRAINT_C0129
     7932    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
     7933#else
     7934    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor(), bRecon );
     7935#endif
    79777936    m_pePartSize[0] = m_peSaved;
    79787937    return bAvailable;
    79797938  }
    79807939#else
    7981   return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv
    7982 #if QC_SIMPLIFIEDIVRP_M24938
    7983     , bRecon
    7984 #endif
    7985     );
     7940  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon );
    79867941#endif
    79877942}
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r189 r296  
    4949#include "TComPattern.h"
    5050
    51 #if HHI_INTER_VIEW_RESIDUAL_PRED
     51#if H3D_IVRP
    5252#include "TComYuv.h"
    5353#endif
     
    9191  UInt  height;   //!< number of pixels in height
    9292  Bool  isBorderAvailable[NUM_SGU_BORDER];  //!< the border availabilities
    93 #if LCU_SYNTAX_ALF
    9493  Bool  allBordersAvailable;
    95 #endif
    9694
    9795  NDBFBlockInfo():tileID(0), sliceID(0), startSU(0), endSU(0) {} //!< constructor
     
    143141#endif
    144142  Char*         m_pePredMode;         ///< array of prediction modes
    145 #if H0736_AVC_STYLE_QP_RANGE
    146143  Char*         m_phQP;               ///< array of QP values
    147 #else
    148   UChar*        m_phQP;               ///< array of QP values
    149 #endif
    150144  UChar*        m_puhTrIdx;           ///< array of transform indices
    151145  UChar*        m_nsqtPartIdx;        ///< array of absPartIdx mapping table, map zigzag to NSQT
     
    197191#endif
    198192  UChar*        m_puhMergeIndex;      ///< array of merge candidate indices
     193#if MERL_VSP_C0152
     194  Char*         m_piVSPIndex;         ///< array of VSP flags to indicate the current block uses synthetic predictor or not
     195                                      ///< value 0: non-VSP, value 1: VSP
     196#endif
    199197#if AMP_MRG
    200198  Bool          m_bIsMergeAMP;
     
    210208  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
    211209
    212 #if BURST_IPCM
    213210  Int           m_numSucIPCM;         ///< the number of succesive IPCM blocks associated with the current log2CUSize
    214211  Bool          m_lastCUSucIPCMFlag;  ///< True indicates that the last CU is IPCM and shares the same root as the current CU. 
    215 #endif
    216 #if HHI_INTER_VIEW_RESIDUAL_PRED
     212#if H3D_IVRP
    217213  Bool*         m_pbResPredAvailable; ///< array of residual prediction available flags
    218214  Bool*         m_pbResPredFlag;      ///< array of residual prediction flags
     
    237233  Bool          m_bDecSubCu;          ///< indicates decoder-mode
    238234  Double        m_dTotalCost;         ///< sum of partition RD costs
    239 #if FIX_RDO_NEGDIST
    240235  Dist          m_uiTotalDistortion;  ///< sum of partition distortion
    241 #else
    242   UInt          m_uiTotalDistortion;  ///< sum of partition distortion
    243 #endif
    244236  UInt          m_uiTotalBits;        ///< sum of partition bits
    245237  UInt          m_uiTotalBins;       ///< sum of partition bins
     
    262254#if HHI_DMM_PRED_TEX
    263255  UInt*         m_puiWedgePredTexTabIdx;
     256#if LGE_DMM3_SIMP_C0044
     257  UInt*         m_puiWedgePredTexIntraTabIdx;
     258#endif
    264259  Int*          m_piWedgePredTexDeltaDC1;
    265260  Int*          m_piWedgePredTexDeltaDC2;
     
    279274  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    280275  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    281 
     276#if MERL_VSP_C0152
     277  inline Bool   xAddVspMergeCand      ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
     278                                        UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo );
     279  inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ;
     280#endif
    282281  Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
    283   Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx );
    284 #if QC_MULTI_DIS_CAN_A0097
     282  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
     283#if QC_TMVP_MRG_REFIDX_C0047
     284  ,
     285  Bool bMRG = 0
     286#endif
     287  );
     288#if H3D_NBDV
    285289  Bool          xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
    286290#endif
    287291 
    288 #if !AMVP_PRUNING_SIMPLIFICATION
    289   /// remove redundant candidates
    290   Void          xUniqueMVPCand        ( AMVPInfo* pInfo );
    291 #endif
    292292
    293293  Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand );
     
    304304  Void xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr);
    305305
    306 #if !BURST_IPCM
    307   Int           getLastValidPartIdx   ( Int iAbsPartIdx );
    308 #endif
    309306
    310307public:
     
    324321 
    325322  Void          initCU                ( TComPic* pcPic, UInt uiCUAddr );
    326 #if H0736_AVC_STYLE_QP_RANGE
    327323  Void          initEstData           ( UInt uiDepth, Int qp );
    328324  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
    329 #else
    330   Void          initEstData           ( UInt uiDepth, UInt uiQP );
    331   Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP );
    332 #endif
    333325  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
    334326
     
    366358  Void          copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 );
    367359#endif
    368  
    369   // -------------------------------------------------------------------------------------------------------------------
     360
     361   // -------------------------------------------------------------------------------------------------------------------
    370362  // member functions for CU data
    371363  // -------------------------------------------------------------------------------------------------------------------
     
    398390  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
    399391 
    400 #if H0736_AVC_STYLE_QP_RANGE
    401392  Char*         getQP                 ()                        { return m_phQP;              }
    402393  Char          getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
    403394  Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
    404395  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
    405 #if BURST_IPCM
    406396  Int           getLastValidPartIdx   ( Int iAbsPartIdx );
    407 #endif
    408397  Char          getLastCodedQP        ( UInt uiAbsPartIdx );
    409 #else
    410   UChar*        getQP                 ()                        { return m_phQP;              }
    411   UChar         getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
    412   Void          setQP                 ( UInt uiIdx, UChar  uh ) { m_phQP[uiIdx] = uh;         }
    413   Void          setQPSubParts         ( UInt uiQP,   UInt uiAbsPartIdx, UInt uiDepth );
    414 #if BURST_IPCM
    415   Int           getLastValidPartIdx   ( Int iAbsPartIdx );
    416 #endif
    417   UChar         getLastCodedQP        ( UInt uiAbsPartIdx );
    418 #endif
    419398
    420399#if LOSSLESS_CODING
     
    471450  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
    472451  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     452
     453#if MERL_VSP_C0152
     454  Char*         getVSPIndex        ()                        { return m_piVSPIndex;        }
     455  Char          getVSPIndex        ( UInt uiIdx )            { return m_piVSPIndex[uiIdx]; }
     456  Void          setVSPIndex        ( UInt uiIdx, Int n )     { m_piVSPIndex[uiIdx] = n;    }
     457  Void          setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     458#endif
     459
    473460  template <typename T>
    474461  Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
     
    479466  Void          setICFlag             ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
    480467  Void          setICFlagSubParts     ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     468#if LGE_ILLUCOMP_DEPTH_C0046
     469  Bool          isICFlagRequired      (UInt uiAbsPartIdx, UInt uiDepth); //This modification is not needed after integrating JCT3V-C0137
     470#else
    481471  Bool          isICFlagRequired      (UInt uiAbsPartIdx);
     472#endif
    482473#endif
    483474
     
    517508  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
    518509
    519 #if BURST_IPCM
    520510  Int           getNumSucIPCM         ()                        { return m_numSucIPCM;             }
    521511  Void          setNumSucIPCM         ( Int num )               { m_numSucIPCM = num;              }
    522512  Bool          getLastCUSucIPCMFlag  ()                        { return m_lastCUSucIPCMFlag;        }
    523513  Void          setLastCUSucIPCMFlag  ( Bool flg )              { m_lastCUSucIPCMFlag = flg;         }
    524 #endif
    525514
    526515  /// get slice ID for SU
     
    539528                                          ,Bool bIndependentTileBoundaryEnabled );
    540529
    541 #if HHI_INTER_VIEW_MOTION_PRED
    542 #if !QC_MULTI_DIS_CAN_A0097
    543   Int           getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
    544   Bool          getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false );
     530#if H3D_IVMP
     531#if !H3D_NBDV
     532  Int           getPdmMergeCandidate      ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
     533  Bool          getPdmMvPred              ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false );
     534#else //!H3D_NBDV
     535#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     536  Bool          getUnifiedMvPredCan       ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
     537#else //QC_AMVP_MRG_UNIFY_IVCAN_C0051
     538  Bool          getPdmMvPredDisCan        ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false );
     539  Int           getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm );
     540#endif //QC_AMVP_MRG_UNIFY_IVCAN_C0051
     541  Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
     542  Void          getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false
     543#if MERL_VSP_C0152
     544                              , Bool bDepthRefine = false
     545#endif //MERL_VSP_C0152
     546    );
     547#endif // !H3D_NBDV
     548
     549
     550
     551#if MERL_VSP_C0152
     552#if LGE_SIMP_DVP_REFINE_C0112
     553  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false);
     554  Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
    545555#else
    546   Bool          getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false );
    547   Int           getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo
    548 #if QC_MRG_CANS_B0048
    549     , Int* iPdm
    550 #endif
    551   );
    552   Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
    553 #if LGE_DVMCP_A0126
    554 #if QC_SIMPLE_NBDV_B0047
    555   Void          getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo
    556 #if LGE_IVMP_PARALLEL_MERGE_B0136
    557     , Bool bParMerg = false
    558 #endif
    559     );
    560 #else
    561   Void          getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo, Bool bMerge=false, RefPicList eRefPicList=REF_PIC_LIST_X, Int iRefIdx=-1
    562 #if LGE_IVMP_PARALLEL_MERGE_B0136
    563     , Bool bParMerg = false
    564 #endif
    565     );
    566 #endif
    567 #endif
    568 
     556  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec);
     557  Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred);
     558#endif
    569559#endif
    570560  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
    571 #endif
    572 #if HHI_INTER_VIEW_RESIDUAL_PRED
     561#endif //  H3D_IVMP
     562#if H3D_IVRP
    573563  Bool*         getResPredAvail         ()                        { return m_pbResPredAvailable;        }
    574564  Bool          getResPredAvail         ( UInt uiIdx )            { return m_pbResPredAvailable[uiIdx]; }
     
    583573  Void          setResPredIndicator     ( Bool bAv, Bool bRP )    { m_pbResPredAvailable[0] = bAv; m_pbResPredFlag[0] = bRP; }
    584574#endif
    585 #if HHI_INTER_VIEW_RESIDUAL_PRED
    586   Bool          getResidualSamples( UInt uiPartIdx,
    587 #if QC_SIMPLIFIEDIVRP_M24938
    588     Bool bRecon ,
    589 #endif
    590     TComYuv* pcYuv = 0 );
     575#if H3D_IVRP
     576  Bool          getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 );
    591577#endif
    592578  // -------------------------------------------------------------------------------------------------------------------
     
    598584  Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight );
    599585#endif
    600 #if LG_RESTRICTEDRESPRED_M24766
     586#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    601587  Int           getResiPredMode(UInt uiPartAddr);
    602588  Void          getPUResiPredShift (Int *iPUPredResiShift, UInt uiAbsPartIndex);
     
    612598 
    613599  AMVP_MODE     getAMVPMode           ( UInt uiIdx );
    614 #if SHARP_INTERVIEW_DECOUPLE_B0111
     600#if H3D_IVMP
    615601  Void          fillMvpCandBase       ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
    616602  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1);
    617 #else
    618   Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
    619 #endif
    620 #if PARALLEL_MERGE
     603#endif
    621604  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
    622605  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
    623 #endif
    624606  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
    625607  Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
     
    665647
    666648  TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
    667 #if H0204_QP_PREDICTION
    668649  TComDataCU*   getQpMinCuAbove             ( UInt&  aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceEntropySliceRestriction=true );
    669 #endif
    670 #if H0736_AVC_STYLE_QP_RANGE
    671650  Char          getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
    672 #else
    673   UChar         getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
    674 #endif
    675651
    676652  TComDataCU*   getPUAboveRightAdi          ( UInt&  uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
     
    684660 
    685661  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    686 #if SIMP_MRG_PRUN
    687   Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
     662#if MERL_VSP_C0152
     663  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 );
    688664#else
    689   Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand );
    690 #endif
    691   Void          deriveLeftRightTopIdxGeneral  ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
    692   Void          deriveLeftBottomIdxGeneral    ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
     665  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
     666#endif
     667  Void          deriveLeftRightTopIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
     668  Void          deriveLeftBottomIdxGeneral  ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
    693669 
    694670 
     
    723699  UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
    724700
    725 #if HHI_INTER_VIEW_RESIDUAL_PRED
     701#if H3D_IVRP
    726702  UInt          getCtxResPredFlag               ( UInt   uiAbsPartIdx                                 );
    727703#endif
     
    740716 
    741717  Double&       getTotalCost()                  { return m_dTotalCost;        }
    742 #if FIX_RDO_NEGDIST
    743718  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
    744 #else
    745   UInt&         getTotalDistortion()            { return m_uiTotalDistortion; }
    746 #endif
    747719  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
    748720  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
     
    796768  Void  setWedgePredTexTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexTabIdx[uiIdx] = uh;      }
    797769  Void  setWedgePredTexTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
     770#if LGE_DMM3_SIMP_C0044
     771  UInt* getWedgePredTexIntraTabIdx             ()                      { return m_puiWedgePredTexIntraTabIdx;           }
     772  UInt  getWedgePredTexIntraTabIdx             ( UInt uiIdx )          { return m_puiWedgePredTexIntraTabIdx[uiIdx];    }
     773  Void  setWedgePredTexIntraTabIdx             ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexIntraTabIdx[uiIdx] = uh;      }
     774  Void  setWedgePredTexIntraTabIdxSubParts     ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
     775#endif
    798776  Int*  getWedgePredTexDeltaDC1           ()                      { return m_piWedgePredTexDeltaDC1;          }
    799777  Int   getWedgePredTexDeltaDC1           ( UInt uiIdx )          { return m_piWedgePredTexDeltaDC1[uiIdx];   }
  • trunk/source/Lib/TLibCommon/TComDepthMapGenerator.cpp

    r189 r296  
    4646#if DEPTH_MAP_GENERATION
    4747
    48 
    4948TComDepthMapGenerator::TComDepthMapGenerator()
    5049{
     
    7877  m_uiSubSampExpX       = uiSubSampExpX;
    7978  m_uiSubSampExpY       = uiSubSampExpY;
    80 #if !QC_MULTI_DIS_CAN_A0097
     79#if !H3D_NBDV
    8180  m_ppcYuv              = new TComYuv*    [ m_uiMaxDepth ];
    8281  m_ppcCU               = new TComDataCU* [ m_uiMaxDepth ];
     
    9291  m_cTmpPic.create( uiPicWidth >> m_uiSubSampExpX, uiPicHeight >> m_uiSubSampExpY, uiMaxCUWidth >> m_uiSubSampExpX, uiMaxCUHeight >> m_uiSubSampExpY, uiMaxCUDepth );
    9392  xSetChroma( &m_cTmpPic, ( 1 << uiOrgBitDepth ) >> 1 );
    94 #endif
     93#endif //!H3D_NBDV
    9594  m_bCreated    = true;
    9695}
     
    102101  {
    103102    m_bCreated    = false;
    104 #if !QC_MULTI_DIS_CAN_A0097
     103#if !H3D_NBDV
    105104    for( UInt uiDepth = 0; uiDepth < m_uiMaxDepth; uiDepth++ )
    106105    {
     
    117116    delete [] m_ppcCU;  m_ppcCU  = 0;
    118117    m_cTmpPic.destroy();
    119 #endif
     118#endif //!H3D_NBDV
    120119    m_uiMaxDepth          = 0;
    121120    m_uiOrgDepthBitDepth  = 0;
     
    377376}
    378377
    379 #if !QC_MULTI_DIS_CAN_A0097
     378#if !H3D_NBDV
    380379Bool
    381380TComDepthMapGenerator::predictDepthMap( TComPic* pcPic )
     
    562561  m_cTmpPic.dump( acFilename, ( pcPic->getPOC() != 0 )  );
    563562}
    564 #endif
    565 
    566 #if HHI_INTER_VIEW_MOTION_PRED
     563
     564#endif //!H3D_NBDV
     565
     566#if H3D_IVMP
    567567Void 
    568568TComDepthMapGenerator::covertOrgDepthMap( TComPic* pcPic )
     
    604604
    605605
    606 #if HHI_INTER_VIEW_MOTION_PRED
    607 #if QC_MULTI_DIS_CAN_A0097
    608 Int
    609 TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo
    610 #if QC_MRG_CANS_B0048
    611   , Int* iPdm
    612 #endif
    613 )
    614 #else
    615 Int
    616 TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
    617 #endif
    618 {
    619 #if MTK_INTERVIEW_MERGE_A0049
     606#if H3D_IVMP
     607#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     608Bool
     609TComDepthMapGenerator::getPdmCandidate(TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge )
     610{
    620611  AOF  ( m_bCreated && m_bInit );
    621 
    622 #if !QC_MULTI_DIS_CAN_A0097
    623   ROFRS( m_bPDMAvailable, 0 );
    624 #endif
    625 
    626612  TComSlice*    pcSlice     = pcCU->getSlice ();
    627613  TComSPS*      pcSPS       = pcSlice->getSPS();
    628614  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
     615
     616  TComPic*      pcRefPic    = pcSlice->getRefPic( eRefPicList, iRefIdx );
     617  UInt          uiRefViewId = pcRefPic->getSPS()->getViewId();
     618  Bool          bInterview  = ( uiRefViewId < m_uiCurrViewId );
     619  Bool          bPdmIView   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_IVIEW ) == PDM_USE_FOR_IVIEW );
     620  Bool          bPdmInter   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_INTER ) == PDM_USE_FOR_INTER );
    629621  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
    630   ROTRS( !bPdmMerge, 0 );
    631 
    632 #if QC_MRG_CANS_B0048
     622  if(!bMerge)
     623  {
     624    ROTRS( ( bInterview && !bMerge ) && !bPdmIView, false );
     625    ROTRS( (!bInterview && !bMerge ) && !bPdmInter, false );
     626    ROTRS(                  bMerge   && !bPdmMerge, false );
     627  }
     628  else
     629    ROTRS( !bPdmMerge, 0 );
     630
     631
    633632  Bool abPdmAvailable[4] = {false, false, false, false};
    634 #else
    635   Bool abPdmAvailable[2] = {false,false};
    636 #endif
    637633
    638634  Int iValid = 0;
     
    640636  for( UInt uiBId = 0; uiBId < m_uiCurrViewId && iValid==0; uiBId++ )
    641637  {
     638#if MTK_C0138_FIXED
     639    UInt        uiBaseId    = uiBId;
     640#else
    642641    UInt        uiBaseId    = m_auiBaseIdList[ uiBId ];
     642#endif
    643643    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
    644644    for( Int iRefListId = 0; iRefListId < 2 && iValid==0; iRefListId++ )
     
    659659  }
    660660  if (iValid == 0)
    661     return 0;
     661    return false;
    662662
    663663  //--- get base CU/PU and check prediction mode ---
    664664  TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( iViewId );
    665665  TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
    666 
    667 #if QC_MULTI_DIS_CAN_A0097
     666  if(bMerge || !bInterview)
     667  {
     668#if H3D_NBDV
     669    Int  iCurrPosX, iCurrPosY;
     670    UInt          uiPartAddr;
     671    Int           iWidth;
     672    Int           iHeight;
     673
     674    pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight );
     675    pcBaseRec->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
     676    iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
     677    iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
     678
     679    Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (pDInfo->m_acMvCand[0].getHor() + 2 ) >> 2 ) );
     680    Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (pDInfo->m_acMvCand[0].getVer() + 2 ) >> 2 ));
     681    Int         iBaseCUAddr;
     682    Int         iBaseAbsPartIdx;
     683    pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
     684#else //H3D_NBDV
     685    Int  iPrdDepth, iCurrPosX, iCurrPosY;
     686    Bool bAvailable  = xGetPredDepth( pcCU, uiPartIdx, iPrdDepth, &iCurrPosX, &iCurrPosY );
     687    AOF( bAvailable );
     688    TComPicYuv* pcBasePdm   = pcBasePic->getPredDepthMap();
     689    Int         iDisparity  = xGetDisparityFromVirtDepth( iViewId, iPrdDepth );
     690    Int         iShiftX     = m_uiSubSampExpX + 2;
     691    Int         iAddX       = ( 1 << iShiftX ) >> 1;
     692    Int         iBasePosX   = Clip3( 0, pcBasePdm->getWidth () - 1, iCurrPosX + ( ( iDisparity + iAddX ) >> iShiftX ) );
     693    Int         iBasePosY   = Clip3( 0, pcBasePdm->getHeight() - 1, iCurrPosY                               );
     694    Int         iBaseCUAddr;
     695    Int         iBaseAbsPartIdx;
     696    pcBaseRec->getCUAddrAndPartIdx( iBasePosX<< m_uiSubSampExpX , iBasePosY<< m_uiSubSampExpY , iBaseCUAddr, iBaseAbsPartIdx );
     697#endif // H3D_NBDV
     698    TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     699    if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTER || pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_SKIP )
     700    {
     701      for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )
     702      {
     703        RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
     704        if(!bMerge && eCurrRefPicList != eRefPicList)
     705          continue;
     706        Bool bLoop_stop = false;
     707        for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop)
     708        {
     709          RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
     710          TComMvField cBaseMvField;
     711          pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
     712          Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
     713          if (iBaseRefIdx >= 0)
     714          {
     715            Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx);
     716            if (iBaseRefPOC != pcSlice->getPOC())   
     717            {
     718              for (Int iPdmRefIdx = (bMerge?0: iRefIdx); iPdmRefIdx < (bMerge? pcSlice->getNumRefIdx( eCurrRefPicList ): (iRefIdx+1)); iPdmRefIdx++)
     719              {
     720                if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx))
     721                {
     722                  abPdmAvailable[ uiCurrRefListId ] = true;
     723                  TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
     724#if H3D_NBDV
     725                  if( bMerge )
     726                  {
     727                    cMv.m_bDvMcp = true;
     728                    cMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
     729                  }
     730#endif
     731                  pcCU->clipMv( cMv );
     732                  if(bMerge)
     733                  {
     734                    paiPdmRefIdx  [ uiCurrRefListId ] = iPdmRefIdx;
     735                    pacPdmMv      [ uiCurrRefListId ] = cMv;
     736                    bLoop_stop = true;
     737                    break;
     738                  }else
     739                  {
     740                    pacPdmMv  [0] = cMv;
     741                    return true;
     742                  }
     743                }
     744              }
     745            }
     746          }
     747        }
     748      }
     749    }
     750    if( bMerge )
     751      iPdm[0] = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 );
     752  }
     753  if(bMerge || bInterview)
     754  {
     755    for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ )
     756    {
     757      RefPicList  eRefPicListDMV       = RefPicList( iRefListId );
     758      Int         iNumRefPics       = pcSlice->getNumRefIdx( eRefPicListDMV );
     759      for( Int iPdmRefIdx = (bMerge ? 0: iRefIdx); iPdmRefIdx < (bMerge ? iNumRefPics: (iRefIdx+1) ); iPdmRefIdx++ )
     760      {
     761        if( pcSlice->getRefPOC( eRefPicListDMV, iPdmRefIdx ) == pcSlice->getPOC())
     762        {
     763          abPdmAvailable[ iRefListId+2 ] = true;
     764          paiPdmRefIdx  [ iRefListId+2 ] = iPdmRefIdx;
     765#if H3D_NBDV
     766          TComMv cMv = pDInfo->m_acMvCand[0];
     767          cMv.setVer(0);
     768#else
     769          TComMv cMv(iDisparity, 0);
     770#endif
     771          pcCU->clipMv( cMv );
     772          pacPdmMv      [ iRefListId + 2] = cMv;
     773          if(bMerge)
     774            break;
     775          else
     776          {
     777            pacPdmMv [0] = cMv;
     778            return true;
     779          }
     780        }
     781      }
     782    }
     783    iPdm[1] = ( abPdmAvailable[2] ? 1 : 0 ) + ( abPdmAvailable[3] ? 2 : 0 );
     784  }
     785  return false;
     786}
     787#else // QC_AMVP_MRG_UNIFY_IVCAN_C0051
     788#if H3D_NBDV
     789Int
     790TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm )
     791#else
     792Int
     793TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
     794#endif
     795{
     796  AOF  ( m_bCreated && m_bInit );
     797
     798#if !H3D_NBDV
     799  ROFRS( m_bPDMAvailable, 0 );
     800#endif
     801
     802  TComSlice*    pcSlice     = pcCU->getSlice ();
     803  TComSPS*      pcSPS       = pcSlice->getSPS();
     804  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
     805  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
     806  ROTRS( !bPdmMerge, 0 );
     807
     808  Bool abPdmAvailable[4] = {false, false, false, false};
     809
     810  Int iValid = 0;
     811  Int iViewId = 0;
     812  for( UInt uiBId = 0; uiBId < m_uiCurrViewId && iValid==0; uiBId++ )
     813  {
     814    UInt        uiBaseId    = m_auiBaseIdList[ uiBId ];
     815    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
     816    for( Int iRefListId = 0; iRefListId < 2 && iValid==0; iRefListId++ )
     817    {
     818      RefPicList  eRefPicListTest = RefPicList( iRefListId );
     819      Int         iNumRefPics = pcSlice->getNumRefIdx( eRefPicListTest ) ;
     820      for( Int iRefIndex = 0; iRefIndex < iNumRefPics; iRefIndex++ )
     821      {
     822        if(pcBasePic->getPOC() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getPOC()
     823          && pcBasePic->getViewId() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getViewId())
     824        {
     825          iValid=1;
     826          iViewId = uiBaseId;
     827          break;
     828        }
     829      }
     830    }
     831  }
     832  if (iValid == 0)
     833    return 0;
     834
     835  //--- get base CU/PU and check prediction mode ---
     836  TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( iViewId );
     837  TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
     838
     839#if H3D_NBDV
    668840  Int  iCurrPosX, iCurrPosY;
    669841  UInt          uiPartAddr;
     
    719891              paiPdmRefIdx  [ uiBaseRefListId ] = iPdmRefIdx;
    720892              TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
    721 #if LGE_DVMCP_A0126
     893#if H3D_NBDV
    722894              cMv.m_bDvMcp = true;
    723895              cMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
    724 #endif
     896#if MTK_RELEASE_DV_CONSTRAINT_C0129
     897              cMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer();
     898#endif
     899#endif //H3D_NBDV
    725900              pcCU->clipMv( cMv );
    726901              pacPdmMv      [ uiBaseRefListId ] = cMv;
     
    733908  }
    734909  Int iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 );
    735 #if QC_MRG_CANS_B0048
     910
    736911  iPdm[0] = iPdmInterDir;
    737 #else
    738   if (iPdmInterDir == 0)
    739   {
    740 #endif
    741912    for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ )
    742913    {
     
    744915      Int         iNumRefPics       = pcSlice->getNumRefIdx( eRefPicList );
    745916      for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
    746 {
     917      {
    747918        if( pcSlice->getRefPOC( eRefPicList, iPdmRefIdx ) == pcSlice->getPOC())
    748919        {
    749 #if QC_MRG_CANS_B0048
    750920          abPdmAvailable[ iRefListId+2 ] = true;
    751921          paiPdmRefIdx  [ iRefListId+2 ] = iPdmRefIdx;
    752 #else
    753           abPdmAvailable[ iRefListId ] = true;
    754           paiPdmRefIdx  [ iRefListId ] = iPdmRefIdx;
    755 #endif
    756 #if QC_MULTI_DIS_CAN_A0097
     922#if H3D_NBDV
    757923          TComMv cMv = pDInfo->m_acMvCand[0];
    758924          cMv.setVer(0);
     
    761927#endif
    762928          pcCU->clipMv( cMv );
    763 #if QC_MRG_CANS_B0048
    764929          pacPdmMv      [ iRefListId + 2] = cMv;
    765 #else
    766           pacPdmMv      [ iRefListId ] = cMv;
    767 #endif
    768930          break;
    769931        }
    770932      }
    771933    }
    772 #if QC_MRG_CANS_B0048
    773934    iPdmInterDir = ( abPdmAvailable[2] ? 1 : 0 ) + ( abPdmAvailable[3] ? 2 : 0 ) ;
    774935    iPdm[1] = iPdmInterDir;
    775 #else
    776     iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 ) ;
    777   }
    778 #endif
    779936
    780937  return iPdmInterDir;
    781 
    782 #else
    783   Int  iMaxNumInterPics  = 1;
    784   Int  iMaxNumAllPics    = 2;
    785 
    786   // inter-only
    787   Bool abPdmAvailable[2] = {false,false};
    788   for( Int iRefListId = 0; iRefListId < 2; iRefListId++ )
    789   {
    790     RefPicList  eRefPicList       = RefPicList( iRefListId );
    791     Int         iNumRefPics       = pcCU->getSlice()->getNumRefIdx( eRefPicList );
    792     TComMv      cMv;
    793     for( Int iPdmRefIdx = 0, iInterPics = 0; iPdmRefIdx < iNumRefPics && iInterPics < iMaxNumInterPics; iPdmRefIdx++ )
    794     {
    795       if( pcCU->getSlice()->getRefPOC( eRefPicList, iPdmRefIdx ) != pcCU->getSlice()->getPOC() )
    796       {
    797 #if QC_MULTI_DIS_CAN_A0097
    798         if( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) )       
    799 #else
    800         if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) )
    801 #endif
    802         {
    803           pcCU->clipMv( cMv );
    804           abPdmAvailable[ iRefListId ] = true;
    805           paiPdmRefIdx  [ iRefListId ] = iPdmRefIdx;
    806           pacPdmMv      [ iRefListId ] = cMv;
    807           break;
    808         }
    809         iInterPics++;
    810       }
    811     }
    812   }
    813   Int    iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 );
    814   if( 0==iPdmInterDir )
    815   { // check all, including inter view references
    816     for( Int iRefListId = 0; iRefListId < 2; iRefListId++ )
    817     {
    818       RefPicList  eRefPicList = RefPicList( iRefListId );
    819       Int         iNumRefPics = Min( iMaxNumAllPics, pcCU->getSlice()->getNumRefIdx( eRefPicList ) );
    820       TComMv      cMv;
    821       for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
    822       {
    823 #if QC_MULTI_DIS_CAN_A0097
    824         if ( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) )
    825 #else
    826         if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) )
    827 #endif
    828         {
    829           pcCU->clipMv( cMv );
    830           abPdmAvailable[ iRefListId ] = true;
    831           paiPdmRefIdx  [ iRefListId ] = iPdmRefIdx;
    832           pacPdmMv      [ iRefListId ] = cMv;
    833           break;
    834         }
    835       }
    836     }
    837     iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 );
    838   }
    839   return iPdmInterDir;
    840 #endif
    841 }
    842 
    843 #if QC_MULTI_DIS_CAN_A0097
     938}
     939
     940#if H3D_NBDV
    844941Bool
    845942TComDepthMapGenerator::getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge )
    846943{
    847 #if LGE_DVMCP_A0126
    848944  rcMv.m_bDvMcp = false;
    849 #endif
    850945  AOF  ( m_bCreated && m_bInit );
    851946  AOF  ( iRefIdx >= 0 );
    852947  AOF  ( pcCU );
    853   //ROFRS( m_bPDMAvailable, false );
    854948  TComSlice*    pcSlice     = pcCU->getSlice ();
    855949  TComSPS*      pcSPS       = pcSlice->getSPS();
     
    878972  for( UInt uiBId = 0; uiBId < m_uiCurrViewId; uiBId++ )
    879973  {
    880     UInt        uiBaseId    = uiBId;  //m_auiBaseIdList[ uiBId ];
     974    UInt        uiBaseId    = uiBId;
    881975
    882976    if (m_uiCurrViewId >1 && uiBaseId ==1 )
     
    9131007      {
    9141008        rcMv.set( cBaseMvField.getHor(), cBaseMvField.getVer() );
    915 #if LGE_DVMCP_A0126
    9161009        // save disparity vector when a merge candidate for IVMP is set as DV-MCP
    9171010        if( bMerge )
     
    9191012          rcMv.m_bDvMcp = true;
    9201013          rcMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
     1014#if MTK_RELEASE_DV_CONSTRAINT_C0129
     1015          rcMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer();
     1016#endif
    9211017        }
    9221018        else { // AMVP ?
    9231019          rcMv.m_bDvMcp = false;
    9241020        }
    925 #endif
    9261021        return true;
    9271022      }
     
    9301025  return false;
    9311026}
    932 #else
     1027#else // H3D_NBDV
    9331028Bool 
    9341029TComDepthMapGenerator::getPdmMvPred( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge )
     
    10141109  return false;
    10151110}
    1016 #endif
     1111#endif // H3D_NBDV
     1112#endif // QC_AMVP_MRG_UNIFY_IVCAN_C0051
    10171113
    10181114
     
    10561152  return        true;
    10571153}
    1058 #endif
    1059 
    1060 
    1061 
    1062 
    1063 
    1064 #if !QC_MULTI_DIS_CAN_A0097
     1154#endif //  H3D_IVMP
     1155
     1156
     1157
     1158
     1159
     1160#if !H3D_NBDV
    10651161/*=======================================================*
    10661162 *=====                                             =====*
     
    18561952  Int           iCurrPosY;
    18571953  pcPredDepthMap->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
    1858 #if SAIT_IMPROV_MOTION_PRED_M24829 // max disparity within PU
     1954#if H3D_IVMP // max disparity within PU
    18591955  Int DiWidth  = iCurrPosX+(iWidth  >> m_uiSubSampExpX);
    18601956  Int DiHeight = iCurrPosY+(iHeight >> m_uiSubSampExpY);
     
    18891985  return        true;
    18901986}
    1891 #endif
     1987#endif // H3D_NBDV
    18921988
    18931989#endif // DEPTH_MAP_GENERATION
  • trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h

    r210 r296  
    8080
    8181  UInt      getPdm  ()                            { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getPredDepthMapGeneration(); } return 0; }
    82 #if HHI_INTER_VIEW_RESIDUAL_PRED
     82#if H3D_IVRP
    8383  UInt      getResPrd ()                          { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getMultiviewResPredMode  (); } return 0; }
    8484#endif
     
    136136
    137137  Void  initViewComponent     ( TComPic*      pcPic );
    138 #if !QC_MULTI_DIS_CAN_A0097
     138#if !H3D_NBDV
    139139  Bool  predictDepthMap       ( TComPic*      pcPic );
    140140  Void  updateDepthMap        ( TComPic*      pcPic );
     
    142142#endif
    143143
    144 #if HHI_INTER_VIEW_MOTION_PRED
     144#if H3D_IVMP
    145145  Void  covertOrgDepthMap     ( TComPic*      pcPic );
    146146#endif
     
    150150  UInt  getSubSampExpY        ()                      { return m_uiSubSampExpY; }
    151151  Int   getDisparity          ( TComPic*      pcPic, Int iPosX, Int iPosY, UInt uiRefViewId );
    152 #if HHI_INTER_VIEW_MOTION_PRED
    153 #if QC_MULTI_DIS_CAN_A0097
    154   Int   getPdmMergeCandidate ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo
    155 #if QC_MRG_CANS_B0048
    156     , Int* iPdm
    157 #endif
    158     );
    159 
     152#if H3D_IVMP
     153#if H3D_NBDV
     154#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     155  Bool  getPdmCandidate       ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
     156#else
     157  Int   getPdmMergeCandidate  ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm );
    160158  Bool  getPdmMvPredDisCan    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
    161159  Bool  getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
     160#endif
    162161#else
    163162  Int   getPdmMergeCandidate  ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
     
    176175private:
    177176  // picture operations
    178 #if !QC_MULTI_DIS_CAN_A0097
     177#if !H3D_NBDV
    179178  Bool  xConvertDepthMapCurr2Ref  ( TComPic*    pcRef, TComPic* pcCur );
    180179  Bool  xConvertDepthMapRef2Curr  ( TComPic*    pcCur, TComPic* pcRef );
  • trunk/source/Lib/TLibCommon/TComLoopFilter.cpp

    r56 r296  
    8585// Public member functions
    8686// ====================================================================================================================
    87 #if DBL_CONTROL
    8887Void TComLoopFilter::setCfg( Bool DeblockingFilterControlPresent, UInt uiDisableDblkIdc, Int iBetaOffset_div2, Int iTcOffset_div2, Bool bLFCrossTileBoundary)
    89 #else
    90 Void TComLoopFilter::setCfg( UInt uiDisableDblkIdc, Int iBetaOffset_div2, Int iTcOffset_div2, Bool bLFCrossTileBoundary)
    91 #endif
    92 {
    93 #if !DBL_CONTROL
    94   m_uiDisableDeblockingFilterIdc  = uiDisableDblkIdc;
    95 #endif
     88{
    9689  m_bLFCrossTileBoundary = bLFCrossTileBoundary;
    9790
    98 #if DBL_CONTROL
    9991  if (DeblockingFilterControlPresent)
    10092  {
     
    109101    m_tcOffsetDiv2 = 0;
    110102  }
    111 #else
    112   m_betaOffsetDiv2 = iBetaOffset_div2;
    113   m_tcOffsetDiv2 = iTcOffset_div2;
    114 #endif
    115103}
    116104
     
    439427 
    440428  //-- Set BS for Intra MB : BS = 4 or 3
    441   if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) )
     429  if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ)
     430#if MERL_VSP_C0152
     431    || pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ)
     432#endif
     433     )
    442434  {
    443435    uiBs = 2;
     
    445437 
    446438  //-- Set BS for not Intra MB : BS = 2 or 1 or 0
    447   if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) )
    448   {
    449 #if NSQT_LFFIX
     439  if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ)
     440#if MERL_VSP_C0152
     441    && !pcCUP->getVSPIndex(uiPartP) && !pcCUQ->getVSPIndex(uiPartQ)
     442#endif
     443  )
     444  {
    450445    UInt nsPartQ = uiPartQ;
    451446    UInt nsPartP = uiPartP;
     
    460455
    461456    if ( m_aapucBS[iDir][uiAbsPartIdx] && (pcCUQ->getCbf( nsPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(nsPartQ)) != 0 || pcCUP->getCbf( nsPartP, TEXT_LUMA, pcCUP->getTransformIdx(nsPartP) ) != 0) )
    462 #else
    463     if ( m_aapucBS[iDir][uiAbsPartIdx] && (pcCUQ->getCbf( uiPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(uiPartQ)) != 0 || pcCUP->getCbf( uiPartP, TEXT_LUMA, pcCUP->getTransformIdx(uiPartP) ) != 0) )
    464 #endif
    465457    {
    466458      uiBs = 1;
     
    542534  }   // enf of "if( not Intra )"
    543535 
     536#if MERL_VSP_C0152
     537  if ( pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ))
     538  {
     539    uiBs = 0;
     540  }
     541#endif
     542
    544543  m_aapucBS[iDir][uiAbsPartIdx] = uiBs;
    545544}
     
    559558 
    560559  UInt  uiPelsInPart = g_uiMaxCUWidth >> g_uiMaxCUDepth;
    561 #if !DBL_H0473_PART_1
    562   UInt  PartIdxIncr = DEBLOCK_SMALLEST_BLOCK / uiPelsInPart ? DEBLOCK_SMALLEST_BLOCK / uiPelsInPart : 1;
    563   UInt  uiBlocksInPart = uiPelsInPart / DEBLOCK_SMALLEST_BLOCK ? uiPelsInPart / DEBLOCK_SMALLEST_BLOCK : 1;
    564 #endif
    565560  UInt  uiBsAbsIdx = 0, uiBs = 0;
    566561  Int   iOffset, iSrcStep;
     
    587582  }
    588583 
    589 #if !DBL_H0473_PART_1
    590   for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx+=PartIdxIncr )
    591   {
    592     uiBs = 0;
    593     for (UInt iIdxInside = 0; iIdxInside<PartIdxIncr; iIdxInside++)
    594     {
    595       uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx+iIdxInside);
    596       if (uiBs < m_aapucBS[iDir][uiBsAbsIdx])
    597       {
    598         uiBs = m_aapucBS[iDir][uiBsAbsIdx];
    599       }
    600     }
    601    
    602 #else
    603584  for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
    604585  {
    605586    uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx);
    606587    uiBs = m_aapucBS[iDir][uiBsAbsIdx];
    607 #endif
    608588    if ( uiBs )
    609589    {
     
    643623     
    644624     
    645 #if !DBL_H0473_PART_1     
    646       for (UInt iBlkIdx = 0; iBlkIdx< uiBlocksInPart; iBlkIdx ++)
    647       {
    648         Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0), iOffset);
    649         Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0), iOffset);
    650         Int dp3 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3), iOffset);
    651         Int dq3 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3), iOffset);
    652         Int d0 = dp0 + dq0;
    653         Int d3 = dp3 + dq3;
    654        
    655         Int dp4 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4), iOffset);
    656         Int dq4 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4), iOffset);
    657         Int dp7 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7), iOffset);
    658         Int dq7 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7), iOffset);
    659         Int d4 = dp4 + dq4;
    660         Int d7 = dp7 + dq7;
    661 #else
    662625        Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0), iOffset);
    663626        Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0), iOffset);
     
    670633        Int dq = dq0 + dq3;
    671634        Int d =  d0 + d3;
    672 #endif
    673635       
    674636        if (bPCMFilter)
     
    683645        bPartQNoFilter = bPartQNoFilter || (pcCU->isLosslessCoded(uiAbsZorderIdx) );
    684646#endif
    685 #if !DBL_H0473_PART_1         
    686         if (d0+d3 < iBeta)
    687         {
    688           Bool bFilterP = (dp0+dp3 < iSideThreshold);
    689           Bool bFilterQ = (dq0+dq3 < iSideThreshold);
    690          
    691           Bool sw =  xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0))
    692           && xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3));
    693          
    694 #else
    695647        if (d < iBeta)
    696648        {
     
    700652          Bool sw =  xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0))
    701653                  && xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+3));
    702 #endif
    703654
    704655          for ( Int i = 0; i < DEBLOCK_SMALLEST_BLOCK/2; i++)
    705656          {
    706 #if !DBL_H0473_PART_1         
    707             xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+i), iOffset, d0+d3, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
    708 #else
    709657            xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+i), iOffset, d, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
    710 #endif
    711658
    712659          }
    713660        }
    714 #if !DBL_H0473_PART_1             
    715         if (d4+d7 < iBeta)
    716         {
    717           Bool bFilterP = (dp4+dp7 < iSideThreshold);
    718           Bool bFilterQ = (dq4+dq7 < iSideThreshold);
    719          
    720           Bool sw =  xUseStrongFiltering( iOffset, 2*d4, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4))
    721           && xUseStrongFiltering( iOffset, 2*d7, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7));
    722           for ( Int i = DEBLOCK_SMALLEST_BLOCK/2; i < DEBLOCK_SMALLEST_BLOCK; i++)
    723           {
    724             xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+i), iOffset, d4+d7, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
    725           }
    726         }
    727       }
    728 #endif
    729661    }
    730662  }
     
    878810  if (sw)
    879811  {
    880 #if DBL_STRONG_FILTER_CLIP
    881812    piSrc[-iOffset]   = Clip3(m3-2*tc, m3+2*tc, ((m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3));
    882813    piSrc[0]          = Clip3(m4-2*tc, m4+2*tc, ((m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3));
     
    885816    piSrc[-iOffset*3] = Clip3(m1-2*tc, m1+2*tc, ((2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3));
    886817    piSrc[ iOffset*2] = Clip3(m6-2*tc, m6+2*tc, ((m3 + m4 + m5 + 3*m6 + 2*m7 +4 )>>3));
    887 #else
    888     piSrc[-iOffset] = ( m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3;
    889     piSrc[0] = ( m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3;
    890    
    891     piSrc[-iOffset*2] = ( m1 + m2 + m3 + m4 + 2)>>2;
    892     piSrc[ iOffset] = ( m3 + m4 + m5 + m6 + 2)>>2;
    893    
    894     piSrc[-iOffset*3] = ( 2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3;
    895     piSrc[ iOffset*2] = ( m3 + m4 + m5 + 3*m6 + 2*m7 +4 )>>3;
    896 #endif
    897818  }
    898819  else
  • trunk/source/Lib/TLibCommon/TComLoopFilter.h

    r56 r296  
    107107 
    108108  /// set configuration
    109 #if DBL_CONTROL
    110109  Void setCfg( Bool DeblockingFilterControlPresent, UInt uiDisableDblkIdc, Int betaOffsetDiv2, Int tcOffsetDiv2, Bool bLFCrossTileBoundary);
    111 #else
    112   Void setCfg( UInt uiDisableDblkIdc, Int betaOffsetDiv2, Int tcOffsetDiv2, Bool bLFCrossTileBoundary);
    113 #endif
    114110 
    115111  /// picture-level deblocking filter
  • trunk/source/Lib/TLibCommon/TComMotionInfo.cpp

    r189 r296  
    378378
    379379#if MTK_UNCONSTRAINED_MVI_B0083
    380 Void TComCUMvField::setUndefinedMv( Int iPartAddr, Int iNumPart, Char* pePredMode, UChar* puhInterDir, Int refIdx, Int InterDir )
     380Void TComCUMvField::setUndefinedMv( Int iPartAddr, Int iNumPart, Char* pePredMode, UChar* puhInterDir, Int refIdx, Int InterDir
     381                                   )
    381382{
    382383  PredMode predMode = MODE_INTRA;
     
    386387  {
    387388    predMode = static_cast<PredMode>( pePredMode[ iPartAddr+i ] );
    388     if( predMode==MODE_INTRA )
     389    if( predMode == MODE_INTRA )
    389390    {
    390391      m_pcMv[iPartAddr+i] = cMv;
  • trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r189 r296  
    5959
    6060// ====================================================================================================================
    61 #if QC_MULTI_DIS_CAN_A0097
     61#if H3D_NBDV
    6262typedef struct _DisCand
    6363{
     
    9494  Int getHor   () const { return  m_acMv.getHor(); }
    9595  Int getVer   () const { return  m_acMv.getVer(); }
    96 #if QC_MRG_CANS_B0048
     96#if H3D_IVMP
    9797  Bool operator== ( const TComMvField& rcMv ) const
    9898  {
  • trunk/source/Lib/TLibCommon/TComMv.h

    r189 r296  
    5757public:
    5858 
    59 #if LGE_DVMCP_A0126
     59#if H3D_NBDV
    6060  Bool  m_bDvMcp;       // is dv-mcp ?
    6161  Int   m_iDvMcpDispX;  // disparity for dv-mcp
     62#if MTK_RELEASE_DV_CONSTRAINT_C0129
     63  Int   m_iDvMcpDispY;  // disparity for dv-mcp
     64#endif
    6265#endif
    6366
     
    6972  m_iHor(0),
    7073  m_iVer(0)
    71 #if LGE_DVMCP_A0126
     74#if H3D_NBDV
    7275  , m_bDvMcp(false)
    7376  , m_iDvMcpDispX(0)
     77#if MTK_RELEASE_DV_CONSTRAINT_C0129
     78  , m_iDvMcpDispY(0)
     79#endif
    7480#endif
    7581  {
     
    7985  m_iHor(iHor),
    8086  m_iVer(iVer)
    81 #if LGE_DVMCP_A0126
     87#if H3D_NBDV
    8288  , m_bDvMcp(false)
    8389  , m_iDvMcpDispX(0)
     90#if MTK_RELEASE_DV_CONSTRAINT_C0129
     91  , m_iDvMcpDispY(0)
     92#endif
    8493#endif
    8594  {
     
    158167  const TComMv scaleMv( Int iScale ) const
    159168  {
    160 #if CLIPSCALEDMVP
    161169    Int mvx = Clip3( -32768, 32767, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8 );
    162170    Int mvy = Clip3( -32768, 32767, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8 );
    163171    return TComMv( mvx, mvy );
    164 #else
    165     return TComMv( (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8);
    166 #endif
    167172  }
    168173};// END CLASS DEFINITION TComMV
  • trunk/source/Lib/TLibCommon/TComPattern.cpp

    r189 r296  
    4747// ====================================================================================================================
    4848
    49 #if LOGI_INTRA_NAME_3MPM
    5049const UChar TComPattern::m_aucIntraFilter[5] =
    5150{
     
    5655  10, //64x64
    5756};
    58 #else
    59 const UChar TComPattern::m_aucIntraFilter[5][NUM_INTRA_MODE] =
    60 {
    61   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    62   }, //4x4
    63   {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    64   }, //8x8
    65   {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0
    66   }, //16x16
    67   {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
    68   }, //32x32
    69   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    70   }, //64x64
    71 };
    72 #endif
    7357
    7458// ====================================================================================================================
     
    682666  mapDMMtoIntraMode( uiDirMode );
    683667#endif
    684 #if LOGI_INTRA_NAME_3MPM
    685668  Int diff = min<Int>(abs((Int) uiDirMode - HOR_IDX), abs((Int)uiDirMode - VER_IDX));
    686669  UChar ucFiltIdx = diff > m_aucIntraFilter[log2BlkSize - 2] ? 1 : 0;
     
    689672    ucFiltIdx = 0; //no smoothing for DC or LM chroma
    690673  }
    691 #else
    692   UChar ucFiltIdx = m_aucIntraFilter[log2BlkSize - 2][uiDirMode];
    693 #endif
    694674
    695675  assert( ucFiltIdx <= 1 );
  • trunk/source/Lib/TLibCommon/TComPattern.h

    r189 r296  
    115115#endif
    116116
    117 #if LOGI_INTRA_NAME_3MPM
    118117  static const UChar m_aucIntraFilter[5];
    119 #else
    120   static const UChar m_aucIntraFilter[5][NUM_INTRA_MODE];
    121 #endif
    122118 
    123119public:
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r210 r296  
    5959#endif
    6060#endif
    61 #if HHI_INTER_VIEW_MOTION_PRED
     61#if H3D_IVMP
    6262  m_pcOrgDepthMap     = NULL;
    6363#endif
    64 #if HHI_INTER_VIEW_RESIDUAL_PRED
     64#if H3D_IVRP
    6565  m_pcResidual        = NULL;
    6666#endif
     
    7676  m_pcUsedPelsMap     = NULL;
    7777#endif
    78 #if SONY_COLPIC_AVAILABILITY
    79   m_iViewOrderIdx     = 0;
     78#if INTER_VIEW_VECTOR_SCALING_C0115
     79  m_iViewOrderIdx     = 0;    // will be changed to view_id
    8080#endif
    8181  m_aaiCodedScale     = 0;
     
    8484  m_bReduceBitsQTL    = 0;
    8585#endif
    86 #if QC_SIMPLE_NBDV_B0047
     86#if H3D_NBDV
    8787  m_bRapCheck = false;
    8888  m_eRapRefList = REF_PIC_LIST_0;
     
    157157#endif
    158158#endif
    159 #if HHI_INTER_VIEW_MOTION_PRED
     159#if H3D_IVMP
    160160  if( m_pcOrgDepthMap )
    161161  {
     
    165165  }
    166166#endif
    167 #if HHI_INTER_VIEW_RESIDUAL_PRED
     167#if H3D_IVRP
    168168  if( m_pcResidual )
    169169  {
     
    206206#endif
    207207
    208 #if HHI_INTER_VIEW_MOTION_PRED
     208#if H3D_IVMP
    209209Void
    210210TComPic::addOrgDepthMapBuffer()
     
    222222#endif
    223223
    224 #if HHI_INTER_VIEW_RESIDUAL_PRED
     224#if H3D_IVRP
    225225Void
    226226TComPic::addResidualBuffer()
     
    259259#endif
    260260
    261 #if HHI_INTER_VIEW_MOTION_PRED
     261#if H3D_IVMP
    262262Void
    263263TComPic::removeOrgDepthMapBuffer()
     
    272272#endif
    273273
    274 #if HHI_INTER_VIEW_RESIDUAL_PRED
     274#if H3D_IVRP
    275275Void
    276276TComPic::removeResidualBuffer()
     
    316316    m_pbValidSlice[s] = true;
    317317  }
    318 #if !LCU_SYNTAX_ALF
    319   if( pSliceStartAddress == NULL || (numSlices == 1 && numTiles == 1) )
    320   {
    321     return;
    322   }
    323 #endif
    324318  m_pSliceSUMap = new Int[maxNumSUInLCU * numLCUInPic];
    325319
     
    489483  }
    490484}
    491 #if QC_SIMPLE_NBDV_B0047
     485#if H3D_NBDV
    492486Bool TComPic::getDisCandRefPictures(Int iColPOC)
    493487{
  • trunk/source/Lib/TLibCommon/TComPic.h

    r210 r296  
    7777#endif
    7878
    79 #if HHI_INTER_VIEW_MOTION_PRED
     79#if H3D_IVMP
    8080  TComPicYuv*           m_pcOrgDepthMap;          //  original depth map
    81 #if QC_MULTI_DIS_CAN_A0097
    82   Bool          m_checked;
    83 #endif
    84 #if QC_SIMPLE_NBDV_B0047
     81#if H3D_NBDV
     82  Bool        m_checked;
    8583  UInt        m_uiRapRefIdx;
    8684  RefPicList  m_eRapRefList;
     
    8886#endif
    8987#endif
    90 #if HHI_INTER_VIEW_RESIDUAL_PRED
     88#if H3D_IVRP
    9189  TComPicYuv*           m_pcResidual;             //  residual buffer (coded or inter-view predicted residual)
    9290#endif
     
    112110  TComPicYuv*           m_pcUsedPelsMap;
    113111#endif
    114 #if SONY_COLPIC_AVAILABILITY
    115   Int                   m_iViewOrderIdx;
     112#if INTER_VIEW_VECTOR_SCALING_C0115
     113  Int                   m_iViewOrderIdx;    // will be changed to view_id
    116114#endif
    117115  Int**                 m_aaiCodedScale;
     
    167165
    168166#endif
    169 #if HHI_INTER_VIEW_MOTION_PRED
     167#if H3D_IVMP
    170168  TComPicYuv*   getOrgDepthMap()      { return  m_pcOrgDepthMap; }
    171 #if QC_MULTI_DIS_CAN_A0097
     169#if H3D_NBDV
    172170  Void          setCandPicCheckedFlag (Bool bchecked)   { m_checked = bchecked; }
    173171  Bool          getCandPicCheckedFlag ()                { return m_checked;}
     
    175173#endif
    176174
    177 #if HHI_INTER_VIEW_RESIDUAL_PRED
     175#if H3D_IVRP
    178176  TComPicYuv*   getResidual()         { return  m_pcResidual; }
    179177#endif
    180 #if QC_SIMPLE_NBDV_B0047
     178#if H3D_NBDV
    181179  UInt          getRapRefIdx()                         {return m_uiRapRefIdx;}
    182180  RefPicList    getRapRefList()                        {return m_eRapRefList;}
     
    188186#endif
    189187
    190 #if SONY_COLPIC_AVAILABILITY
    191   Void          setViewOrderIdx(Int i)                        { m_iViewOrderIdx = i; }
    192   Int           getViewOrderIdx()                             { return m_iViewOrderIdx; }
     188#if INTER_VIEW_VECTOR_SCALING_C0115
     189  Void          setViewOrderIdx(Int i)                        { m_iViewOrderIdx = i; }        // will be changed to view_id
     190  Int           getViewOrderIdx()                             { return m_iViewOrderIdx; }    // will be changed to view_id
    193191#endif
    194192
     
    252250  Void          addPrdDepthMapBuffer    ( UInt uiSubSampExpX, UInt uiSubSampExpY );
    253251#endif
    254 #if HHI_INTER_VIEW_MOTION_PRED
     252#if H3D_IVMP
    255253  Void          addOrgDepthMapBuffer    ();
    256254#endif
    257 #if HHI_INTER_VIEW_RESIDUAL_PRED
     255#if H3D_IVRP
    258256  Void          addResidualBuffer       ();
    259257#endif
     
    261259  Void          removePrdDepthMapBuffer ();
    262260#endif
    263 #if HHI_INTER_VIEW_MOTION_PRED
     261#if H3D_IVMP
    264262  Void          removeOrgDepthMapBuffer ();
    265263#endif
    266 #if HHI_INTER_VIEW_RESIDUAL_PRED
     264#if H3D_IVRP
    267265  Void          removeResidualBuffer    ();
    268266#endif
  • trunk/source/Lib/TLibCommon/TComPicSym.h

    r56 r296  
    133133  UInt        getNumPartInWidth()       { return m_uiNumPartInWidth;            }
    134134  UInt        getNumPartInHeight()      { return m_uiNumPartInHeight;           }
    135 #if !REMOVE_TILE_DEPENDENCE
    136   Void         setTileBoundaryIndependenceIdr( Int i )               { m_iTileBoundaryIndependenceIdr = i; }
    137   Int          getTileBoundaryIndependenceIdr()                      { return m_iTileBoundaryIndependenceIdr; }
    138 #endif
    139135  Void         setNumColumnsMinus1( Int i )                          { m_iNumColumnsMinus1 = i; }
    140136  Int          getNumColumnsMinus1()                                 { return m_iNumColumnsMinus1; } 
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r210 r296  
    5454{
    5555  m_piYuvExt = NULL;
     56#if MERL_VSP_C0152
     57  m_pDepth = (Int*) malloc(64*64*sizeof(Int)); // TODO: Use a smart way to determine the size of the array
     58  if (m_pDepth == NULL)
     59  {
     60      printf("ERROR: UKTGHU, No memory allocated.\n");
     61  }
     62#endif
    5663}
    5764
     
    5966{
    6067 
     68#if MERL_VSP_C0152
     69  if (m_pDepth != NULL)
     70  {
     71      free(m_pDepth);
     72  }
     73#endif
    6174  delete[] m_piYuvExt;
    6275
     
    190203
    191204  // Map the mode index to main prediction direction and angle
    192 #if LOGI_INTRA_NAME_3MPM
    193205  assert( dirMode > 0 ); //no planar
    194206  Bool modeDC        = dirMode < 2;
     
    196208  Bool modeVer       = !modeDC && !modeHor;
    197209  Int intraPredAngle = modeVer ? (Int)dirMode - VER_IDX : modeHor ? -((Int)dirMode - HOR_IDX) : 0;
    198 #else
    199   Bool modeDC        = dirMode == 0;
    200   Bool modeVer       = !modeDC && (dirMode < 18);
    201   Bool modeHor       = !modeDC && !modeVer;
    202   Int intraPredAngle = modeVer ? dirMode - 9 : modeHor ? dirMode - 25 : 0;
    203 #endif
    204210  Int absAng         = abs(intraPredAngle);
    205211  Int signAng        = intraPredAngle < 0 ? -1 : 1;
     
    284290        for (k=0;k<blkSize;k++)
    285291        {
    286 #if REMOVE_DIV_OPERATION
    287292          pDst[k*dstStride] = Clip ( pDst[k*dstStride] + (( refSide[k+1] - refSide[0] ) >> 1) );
    288 #else
    289           pDst[k*dstStride] = Clip ( pDst[k*dstStride] + ( refSide[k+1] - refSide[0] ) / 2 );
    290 #endif
    291293        }
    292294      }
     
    363365  else
    364366  {
    365 #if LOGI_INTRA_NAME_3MPM
    366367    xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, true );
    367 #else
    368     xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, true );
    369 #endif
    370368
    371369    if( (uiDirMode == DC_IDX ) && bAbove && bLeft )
     
    392390  {
    393391    // Create the prediction
    394 #if LOGI_INTRA_NAME_3MPM
    395392    xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, false );
    396 #else
    397     xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, false );
    398 #endif
    399393  }
    400394}
     
    605599
    606600#if DEPTH_MAP_GENERATION
     601#if MERL_VSP_C0152
     602Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     603#else
    607604Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     605#endif
     606#else
     607#if MERL_VSP_C0152
     608Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx )
    608609#else
    609610Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
     611#endif
    610612#endif
    611613{
     
    635637      {
    636638#if DEPTH_MAP_GENERATION
     639#if MERL_VSP_C0152
     640        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     641#else
    637642        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     643#endif
     644#else
     645#if MERL_VSP_C0152
     646        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
    638647#else
    639648        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
    640649#endif
     650#endif
    641651      }
    642652      else
    643653      {
    644654#if DEPTH_MAP_GENERATION
     655#if MERL_VSP_C0152
     656        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     657#else       
    645658        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     659#endif
     660#else
     661#if MERL_VSP_C0152
     662        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
    646663#else
    647664        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
     665#endif
    648666#endif
    649667      }
     
    666684      {
    667685#if DEPTH_MAP_GENERATION
     686#if MERL_VSP_C0152
     687        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     688#else
    668689        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     690#endif
     691#else
     692#if MERL_VSP_C0152
     693        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
    669694#else
    670695        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
    671696#endif
     697#endif
    672698      }
    673699      else
    674700      {
    675701#if DEPTH_MAP_GENERATION
     702#if MERL_VSP_C0152
     703        xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     704#else
    676705        xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     706#endif
     707#else
     708#if MERL_VSP_C0152
     709        xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
    677710#else
    678711        xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
     712#endif
    679713#endif
    680714      }
     
    704738      {
    705739#if DEPTH_MAP_GENERATION
     740#if MERL_VSP_C0152
     741        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     742#else
    706743        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     744#endif
     745#else
     746#if MERL_VSP_C0152
     747        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
    707748#else
    708749        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
    709 #endif   
    710       }
    711       else
    712       {
     750#endif
     751#endif
     752  }
     753  else
     754  {
    713755#if DEPTH_MAP_GENERATION
     756#if MERL_VSP_C0152
     757        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     758#else
    714759        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     760#endif
     761#else
     762#if MERL_VSP_C0152
     763        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
    715764#else
    716765        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
    717 #endif   
     766#endif
     767#endif
    718768      }
    719769#if DEPTH_MAP_GENERATION
     770#if MERL_VSP_C0152
     771      xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     772#else
    720773      xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     774#endif
     775#else
     776#if MERL_VSP_C0152
     777      xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
    721778#else
    722779      xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
    723 #endif 
     780#endif
     781#endif
    724782#if LGE_ILLUCOMP_B0045
    725783      if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr))
    726784#else
    727       if ( pcCU->getSlice()->getPPS()->getUseWP() )
     785      if( pcCU->getSlice()->getPPS()->getUseWP())
    728786#endif
    729787      {
     
    736794      {
    737795#if DEPTH_MAP_GENERATION
     796#if MERL_VSP_C0152
     797        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     798#else
    738799        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     800#endif
     801#else
     802#if MERL_VSP_C0152
     803        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
    739804#else
    740805        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
     806#endif
     807#endif   
     808      }
     809      else
     810      {
     811#if DEPTH_MAP_GENERATION
     812#if MERL_VSP_C0152
     813        xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     814#else
     815        xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     816#endif   
     817#else
     818#if MERL_VSP_C0152
     819        xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
     820#else
     821        xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
    741822#endif
    742       }
    743       else
    744       {
     823#endif
     824      }
     825    }
     826  }
     827  return;
     828}
     829
     830#if MTK_MDIVRP_C0138
     831Void TComPrediction::residualPrediction(TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred)
     832{
     833  Int         iWidth;
     834  Int         iHeight;
     835  UInt        uiPartAddr;
     836
     837  pcCU->getPartIndexAndSize( 0, uiPartAddr, iWidth, iHeight );
     838
     839  Bool bResAvail = false;
     840
     841  bResAvail = pcCU->getResidualSamples( 0, true, pcYuvResPred );
     842
     843  assert (bResAvail);
     844
     845  pcYuvPred->add(pcYuvResPred, iWidth, iHeight);
     846}
     847#endif
     848
    745849#if DEPTH_MAP_GENERATION
    746         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
    747 #else
    748         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
    749 #endif
    750       }
    751     }
    752   }
    753   return;
    754 }
    755 
    756 
    757 
    758 #if DEPTH_MAP_GENERATION
     850#if MERL_VSP_C0152
     851Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
     852#else
    759853Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
     854#endif
     855#else
     856#if MERL_VSP_C0152
     857Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
    760858#else
    761859Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
    762860#endif
    763 {
     861#endif
     862{
     863#if MERL_VSP_C0152
     864  Int  iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );   
     865  Int  vspIdx  = pcCU->getVSPIndex(uiPartAddr);
     866  if (vspIdx != 0)
     867  {
     868    if (iRefIdx >= 0)
     869    {
     870      printf("vspIdx = %d, iRefIdx = %d\n", vspIdx, iRefIdx);
     871    }
     872    assert (iRefIdx < 0); // assert (iRefIdx == NOT_VALID);
     873  }
     874  else
     875  {
     876    assert (iRefIdx >= 0);
     877  }
     878#else
    764879  Int         iRefIdx     = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           assert (iRefIdx >= 0);
    765   TComMv      cMv         = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     880#endif
     881
     882  TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
    766883  pcCU->clipMv(cMv);
    767884
     
    784901  if( pcCU->getSlice()->getSPS()->isDepth() )
    785902  {
    786     UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 );
    787     UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0;
     903#if MERL_VSP_C0152
     904    if (vspIdx != 0)
     905    { // depth, vsp
     906      // get depth estimator here
     907      TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
     908      TComPicYuv* pcBaseViewDepthPicYuv = NULL;
     909      if (vspIdx < 4) // spatial
     910      {
     911        pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     912      }
     913      Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     914      Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     915      Int* pShiftLUT;
     916      Int iShiftPrec;
     917      pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
     918      //using disparity to find the depth block of the base view as the depth block estimator of the current block
     919      //using depth block estimator and base view texture to get Backward warping
     920      xPredInterLumaBlkFromDM  ( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,     pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     921      xPredInterChromaBlkFromDM( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1,  pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     922    }
     923    else
     924    {
     925#endif
     926      UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 );
     927      UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0;
     928#if LGE_ILLUCOMP_DEPTH_C0046
     929    Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId());
     930#endif
    788931#if DEPTH_MAP_GENERATION
    789     xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset );
    790 #else
    791     xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset );
    792 #endif
     932    xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset
     933#if LGE_ILLUCOMP_DEPTH_C0046
     934        , bICFlag
     935#endif
     936        );
     937#else
     938      xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset );
     939#endif
     940#if MERL_VSP_C0152
     941    }
     942#endif// MERL_VSP_C0152 //else
    793943  }
    794944  else
    795945  {
    796946#endif
     947#if MERL_VSP_C0152
     948    if ( vspIdx != 0 )
     949    { // texture, vsp
     950      TComPic*    pRefPicBaseTxt        = pcCU->getSlice()->getRefPicBaseTxt();
     951      TComPicYuv* pcBaseViewTxtPicYuv   = pRefPicBaseTxt->getPicYuvRec();
     952      TComPicYuv* pcBaseViewDepthPicYuv = NULL;
     953      if (vspIdx < 4) // spatial
     954      {
     955        TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
     956        pcBaseViewDepthPicYuv     = pRefPicBaseDepth->getPicYuvRec();
     957      }
     958      Int iBlkX = ( pcCU->getAddr() % pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     959      Int iBlkY = ( pcCU->getAddr() / pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     960      Int* pShiftLUT;
     961      Int iShiftPrec;
     962      pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
     963
     964      //using disparity to find the depth block of the base view as the depth block estimator of the current block
     965      //using depth block estimator and base view texture to get Backward warping
     966      xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     967      xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     968    }
     969    else//texture not VSP
     970    {
     971#endif //MERL_VSP_C0152
    797972#if LGE_ILLUCOMP_B0045
    798     Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId());
    799 
    800     xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag);
    801 #else
    802   xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
    803 #endif
     973      Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId());
     974
     975      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag);
     976#else
     977      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
     978#endif
     979#if MERL_VSP_C0152
     980     } //texture not VSP
     981#endif
    804982#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
    805983  }
     984#endif
     985
     986#if MERL_VSP_C0152
     987  if ( vspIdx == 0 )//Not VSP
     988  {
    806989#endif
    807990#if LGE_ILLUCOMP_B0045
     
    812995  xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
    813996#endif
     997#if MERL_VSP_C0152
     998   }
     999#endif
    8141000}
    8151001
    8161002
    8171003#if DEPTH_MAP_GENERATION
     1004#if MERL_VSP_C0152
     1005Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     1006#else
    8181007Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     1008#endif
     1009#else
     1010#if MERL_VSP_C0152
     1011Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx )
    8191012#else
    8201013Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx )
     1014#endif
    8211015#endif
    8221016{
     
    8291023    iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
    8301024
     1025#if MERL_VSP_C0152
     1026    if(!pcCU->getVSPIndex(uiPartAddr))
     1027    {
     1028      if ( iRefIdx[iRefList] < 0 )
     1029      {
     1030        continue;
     1031      }
     1032    }
     1033    else
     1034    {
     1035      if ( iRefList== REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID
     1036      {
     1037        continue;
     1038      }
     1039    }
     1040#else
    8311041    if ( iRefIdx[iRefList] < 0 )
    8321042    {
    8331043      continue;
    8341044    }
     1045#endif
    8351046
    8361047    assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );
     
    8401051    {
    8411052#if DEPTH_MAP_GENERATION
     1053#if MERL_VSP_C0152
     1054      xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     1055#else
    8421056      xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     1057#endif
     1058#else
     1059#if MERL_VSP_C0152
     1060      xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
    8431061#else
    8441062      xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
    8451063#endif
     1064#endif
    8461065    }
    8471066    else
     
    8501069      {
    8511070#if DEPTH_MAP_GENERATION
     1071#if MERL_VSP_C0152
     1072        xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     1073#else
    8521074        xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     1075#endif
     1076#else
     1077#if MERL_VSP_C0152
     1078        xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
    8531079#else
    8541080        xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
    8551081#endif
     1082#endif
    8561083      }
    8571084      else
    8581085      {
    8591086#if DEPTH_MAP_GENERATION
     1087#if MERL_VSP_C0152
     1088        xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     1089#else
    8601090        xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     1091#endif
     1092#else
     1093#if MERL_VSP_C0152
     1094        xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false );
    8611095#else
    8621096        xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false );
    8631097#endif
     1098#endif
    8641099      }
    8651100    }
     
    8681103  if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() )
    8691104  {
     1105#if MERL_VSP_C0152
     1106    if(pcCU->getVSPIndex(uiPartAddr))
     1107      m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
     1108    else
     1109#endif
    8701110    xWeightedPredictionBi( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
    8711111  }
     
    8791119    else
    8801120    {
     1121#if MERL_VSP_C0152
     1122      if(pcCU->getVSPIndex(uiPartAddr))
     1123        m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
     1124      else
     1125#endif
     1126      xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1127    }
     1128#else
    8811129    xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
    882   }
    883 #else
    884     xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
    885 #endif
    886   }
    887 }
     1130#endif
     1131  }
     1132}
     1133
     1134
    8881135
    8891136Void
    8901137#if DEPTH_MAP_GENERATION
    891 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset )
     1138TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset
     1139#if LGE_ILLUCOMP_DEPTH_C0046
     1140, Bool bICFlag
     1141#endif
     1142)
    8921143#else
    8931144TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset )
     
    9411192    }
    9421193  }
     1194
     1195#if LGE_ILLUCOMP_DEPTH_C0046
     1196  if(bICFlag)
     1197  {
     1198    Int a, b, iShift;
     1199    TComMv tTmpMV(pcMv->getHor()<<2, pcMv->getVer()<<2);
     1200
     1201    piRefY      = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     1202    piDstY      = rpcYuv->getLumaAddr( uiPartAddr );
     1203
     1204    xGetLLSICPrediction(pcCU, &tTmpMV, pcPicYuvRef, a, b, iShift);
     1205
     1206    for( Int y = 0; y < iHeight; y++, piDstY += iDstStride, piRefY += iRefStride )
     1207    {
     1208      for( Int x = 0; x < iWidth; x++ )
     1209      {
     1210        if(uiOffset)
     1211        {
     1212          Int iIFshift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
     1213          piDstY[ x ] = ( (a*piDstY[ x ]+a*IF_INTERNAL_OFFS) >> iShift ) + b*(1<<iIFshift) - IF_INTERNAL_OFFS;
     1214        }
     1215        else
     1216          piDstY[ x ] = Clip( ( (a*piDstY[ x ]) >> iShift ) + b );
     1217      }
     1218    }
     1219  }
     1220#endif
    9431221}
    9441222
     
    11191397}
    11201398
     1399#if MERL_VSP_C0152
     1400// Input:
     1401// refPic: Ref picture. Full picture, with padding
     1402// posX, posY:     PU position, texture
     1403// size_x, size_y: PU size
     1404// partAddr: z-order index
     1405// mv: disparity vector. derived from neighboring blocks
     1406//
     1407// Output: dstPic, PU predictor 64x64
     1408Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     1409                                            , TComYuv *&dstPic )
     1410{
     1411  Int widthLuma;
     1412  Int heightLuma;
     1413
     1414  if (isDepth)
     1415  {
     1416    widthLuma   =  pPicBaseDepth->getWidth();
     1417    heightLuma  =  pPicBaseDepth->getHeight();
     1418  }
     1419  else
     1420  {
     1421    widthLuma   =  refPic->getWidth();
     1422    heightLuma  =  refPic->getHeight();
     1423  }
     1424
     1425#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1426  Int widthDepth  = pPicBaseDepth->getWidth();
     1427  Int heightDepth = pPicBaseDepth->getHeight();
     1428#endif
     1429
     1430  Int nTxtPerDepthX = widthLuma  / ( pPicBaseDepth->getWidth() );  // texture pixel # per depth pixel
     1431  Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() );
     1432
     1433  Int refStride = refPic->getStride();
     1434  Int dstStride = dstPic->getStride();
     1435  Int depStride =  pPicBaseDepth->getStride();
     1436
     1437  Int depthPosX = Clip3(0,   widthLuma - size_x - 1,  (posX/nTxtPerDepthX) + (mv->getHor()>>2));
     1438  Int depthPosY = Clip3(0,   heightLuma- size_y - 1,  (posY/nTxtPerDepthY) + (mv->getVer()>>2));
     1439
     1440  Pel *ref    = refPic->getLumaAddr() + posX + posY * refStride;
     1441  Pel *dst    = dstPic->getLumaAddr(partAddr);
     1442  Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;
     1443
     1444#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1445#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1446  Int  dW = size_x>>1;
     1447  Int  dH = size_y>>1;
     1448#endif
     1449#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1450  Int  dW = size_x>>2;
     1451  Int  dH = size_y>>2;
     1452#endif
     1453  {
     1454    Pel* depthi = depth;
     1455    for (Int j = 0; j < dH; j++)
     1456    {
     1457      for (Int i = 0; i < dW; i++)
     1458      {
     1459        Pel* depthTmp;
     1460#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1461        if (depthPosX + (i<<1) < widthDepth)
     1462          depthTmp = depthi + (i << 1);
     1463        else
     1464          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1465#endif
     1466#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1467        if (depthPosX + (i<<2) < widthDepth)
     1468          depthTmp = depthi + (i << 2);
     1469        else
     1470          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1471#endif
     1472        Int maxV = 0;
     1473        for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj++)
     1474        {
     1475          Int iX = 0;
     1476          for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki++)
     1477          {
     1478            if (maxV < depthTmp[iX])
     1479              maxV = depthTmp[iX];
     1480#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1481            if (depthPosX + (i<<1) + blocki < widthDepth - 1)
     1482#else // MERL_VSP_BLOCKSIZE_C0152 == 4
     1483            if (depthPosX + (i<<2) + blocki < widthDepth - 1)
     1484#endif
     1485              iX++;
     1486          }
     1487#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1488          if (depthPosY + (j<<1) + blockj < heightDepth - 1)
     1489#else // MERL_VSP_BLOCKSIZE_C0152 == 4
     1490          if (depthPosY + (j<<2) + blockj < heightDepth - 1)
     1491#endif
     1492            depthTmp += depStride;
     1493        }
     1494        m_pDepth[i+j*dW] = maxV;
     1495      } // end of i < dW
     1496#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1497      if (depthPosY + ((j+1)<<1) < heightDepth)
     1498        depthi += (depStride << 1);
     1499      else
     1500        depthi  = depth + (heightDepth-depthPosY-1)*depStride;
     1501#endif
     1502#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1503      if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
     1504        depthi += (depStride << 2);
     1505      else
     1506        depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
     1507#endif
     1508    }
     1509  }
     1510#endif
     1511 
     1512#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1513  Int yDepth = 0;
     1514#endif
     1515  for ( Int yTxt = 0; yTxt < size_y; yTxt += nTxtPerDepthY )
     1516  {
     1517    for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth++ )
     1518    {
     1519      Pel rep_depth = 0; // to store the depth value used for warping
     1520#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1521      rep_depth = depth[xDepth];
     1522#endif
     1523#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1524      rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
     1525#endif
     1526#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1527      rep_depth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW];
     1528#endif
     1529
     1530      assert( rep_depth >= 0 && rep_depth <= 255 );
     1531      Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec;
     1532      Int refOffset = xTxt + (disparity >> 2);
     1533      Int xFrac = disparity & 0x3;
     1534      Int absX  = posX + refOffset;
     1535
     1536      if (xFrac == 0)
     1537        absX = Clip3(0, widthLuma-1, absX);
     1538      else
     1539        absX = Clip3(4, widthLuma-5, absX);
     1540
     1541      refOffset = absX - posX;
     1542
     1543      assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
     1544      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true );
     1545    }
     1546    ref   += refStride*nTxtPerDepthY;
     1547    dst   += dstStride*nTxtPerDepthY;
     1548    depth += depStride;
     1549#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1550    yDepth++;
     1551#endif
     1552  }
     1553}
     1554
     1555Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     1556                                               , TComYuv *&dstPic )
     1557{
     1558  Int refStride = refPic->getCStride();
     1559  Int dstStride = dstPic->getCStride();
     1560  Int depStride = pPicBaseDepth->getStride();
     1561
     1562  Int widthChroma, heightChroma;
     1563  if( isDepth)
     1564  {
     1565     widthChroma   = pPicBaseDepth->getWidth()>>1;
     1566     heightChroma  = pPicBaseDepth->getHeight()>>1;
     1567  }
     1568  else
     1569  {
     1570     widthChroma   = refPic->getWidth()>>1;
     1571     heightChroma  = refPic->getHeight()>>1;
     1572  }
     1573
     1574  // Below is only for Texture chroma component
     1575
     1576  Int widthDepth  = pPicBaseDepth->getWidth();
     1577  Int heightDepth = pPicBaseDepth->getHeight();
     1578
     1579  Int nTxtPerDepthX, nTxtPerDepthY;  // Number of texture samples per one depth sample
     1580  Int nDepthPerTxtX, nDepthPerTxtY;  // Number of depth samples per one texture sample
     1581
     1582  Int depthPosX;  // Starting position in depth image
     1583  Int depthPosY;
     1584
     1585  if ( widthChroma > widthDepth )
     1586  {
     1587    nTxtPerDepthX = widthChroma / widthDepth;
     1588    nDepthPerTxtX = 1;
     1589    depthPosX = posX / nTxtPerDepthX + (mv->getHor()>>2);        //mv denotes the disparity for VSP
     1590  }
     1591  else
     1592  {
     1593    nTxtPerDepthX = 1;
     1594    nDepthPerTxtX = widthDepth / widthChroma;
     1595    depthPosX = posX * nDepthPerTxtX + (mv->getHor()>>2);        //mv denotes the disparity for VSP
     1596  }
     1597  depthPosX = Clip3(0, widthDepth - (size_x<<1) - 1, depthPosX);
     1598 
     1599  if ( heightChroma > heightDepth )
     1600  {
     1601    nTxtPerDepthY = heightChroma / heightDepth;
     1602    nDepthPerTxtY = 1;
     1603    depthPosY = posY / nTxtPerDepthY + (mv->getVer()>>2);     //mv denotes the disparity for VSP
     1604  }
     1605  else
     1606  {
     1607    nTxtPerDepthY = 1;
     1608    nDepthPerTxtY = heightDepth / heightChroma;
     1609    depthPosY = posY * nDepthPerTxtY + (mv->getVer()>>2);     //mv denotes the disparity for VSP
     1610  }
     1611  depthPosY = Clip3(0, heightDepth - (size_y<<1) - 1, depthPosY);
     1612
     1613  Pel *refCb  = refPic->getCbAddr() + posX + posY * refStride;
     1614  Pel *refCr  = refPic->getCrAddr() + posX + posY * refStride;
     1615  Pel *dstCb  = dstPic->getCbAddr(partAddr);
     1616  Pel *dstCr  = dstPic->getCrAddr(partAddr);
     1617  Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;  // move the pointer to the current depth pixel position
     1618 
     1619  Int refStrideBlock = refStride * nTxtPerDepthY;
     1620  Int dstStrideBlock = dstStride * nTxtPerDepthY;
     1621  Int depStrideBlock = depStride * nDepthPerTxtY;
     1622
     1623  if (isDepth)
     1624  {
     1625     // DT: Since the call for this function is redundant, ..
     1626     for (Int y = 0; y < size_y; y++)
     1627     {
     1628       for (Int x = 0; x < size_x; x++)
     1629       {
     1630         dstCb[x] = 128;
     1631         dstCr[x] = 128;
     1632       }
     1633       dstCb += dstStride;
     1634       dstCr += dstStride;
     1635     }
     1636     return;
     1637  }
     1638 
     1639  if ( widthChroma > widthDepth ) // We assume
     1640  {
     1641    assert( heightChroma > heightDepth );
     1642    printf("This branch should never been reached.\n");
     1643    exit(0);
     1644  }
     1645  else
     1646  {
     1647#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1648  Int  dW = size_x;
     1649  Int  dH = size_y;
     1650  Int  sW = 2; // search window size
     1651  Int  sH = 2;
     1652#endif
     1653#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1654  Int  dW = size_x;
     1655  Int  dH = size_y;
     1656  Int  sW = 2; // search window size
     1657  Int  sH = 2;
     1658#endif
     1659#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1660  Int  dW = size_x>>1;
     1661  Int  dH = size_y>>1;
     1662  Int  sW = 4; // search window size
     1663  Int  sH = 4;
     1664#endif
     1665
     1666  {
     1667    Pel* depthi = depth;
     1668    for (Int j = 0; j < dH; j++)
     1669    {
     1670      for (Int i = 0; i < dW; i++)
     1671      {
     1672        Pel* depthTmp;
     1673#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1674        depthTmp = depthi + (i << 1);
     1675#endif
     1676#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1677        if (depthPosX + (i<<1) < widthDepth)
     1678          depthTmp = depthi + (i << 1);
     1679        else
     1680          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1681#endif
     1682#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1683        if (depthPosX + (i<<2) < widthDepth)
     1684          depthTmp = depthi + (i << 2);
     1685        else
     1686          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1687#endif
     1688        Int maxV = 0;
     1689        for (Int blockj = 0; blockj < sH; blockj++)
     1690        {
     1691          Int iX = 0;
     1692          for (Int blocki = 0; blocki < sW; blocki++)
     1693          {
     1694            if (maxV < depthTmp[iX])
     1695              maxV = depthTmp[iX];
     1696            if (depthPosX + i*sW + blocki < widthDepth - 1)
     1697              iX++;
     1698          }
     1699          if (depthPosY + j*sH + blockj < heightDepth - 1)
     1700            depthTmp += depStride;
     1701        }
     1702        m_pDepth[i+j*dW] = maxV;
     1703      } // end of i < dW
     1704#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1705      if (depthPosY + ((j+1)<<1) < heightDepth)
     1706        depthi += (depStride << 1);
     1707      else
     1708        depthi  = depth + (heightDepth-1)*depStride;
     1709#endif
     1710#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1711      if (depthPosY + ((j+1)<<1) < heightDepth)
     1712        depthi += (depStride << 1);
     1713      else
     1714        depthi  = depth + (heightDepth-depthPosY-1)*depStride;
     1715#endif
     1716#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1717      if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
     1718        depthi += (depStride << 2);
     1719      else
     1720        depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
     1721#endif
     1722    }
     1723  }
     1724
     1725
     1726    // (size_x, size_y) is Chroma block size
     1727    for ( Int yTxt = 0, yDepth = 0; yTxt < size_y; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY )
     1728    {
     1729      for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX )
     1730      {
     1731        Pel rep_depth = 0; // to store the depth value used for warping
     1732#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1733        rep_depth = m_pDepth[(xTxt) + (yTxt)*dW];
     1734#endif
     1735#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1736        rep_depth = m_pDepth[(xTxt) + (yTxt)*dW];
     1737#endif
     1738#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1739        rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
     1740#endif
     1741
     1742      // calculate the offset in the reference picture
     1743        Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec;
     1744        Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image
     1745        Int xFrac = disparity & 0x7;
     1746        Int absX  = posX + refOffset;
     1747
     1748        if (xFrac == 0)
     1749          absX = Clip3(0, widthChroma-1, absX);
     1750        else
     1751          absX = Clip3(4, widthChroma-5, absX);
     1752
     1753        refOffset = absX - posX;
     1754
     1755        assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 );
     1756        assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
     1757        m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
     1758        m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
     1759      }
     1760      refCb += refStrideBlock;
     1761      refCr += refStrideBlock;
     1762      dstCb += dstStrideBlock;
     1763      dstCr += dstStrideBlock;
     1764      depth += depStrideBlock;
     1765    }
     1766  }
     1767}
     1768
     1769#endif // MERL_VSP_C0152
     1770
    11211771#if DEPTH_MAP_GENERATION
    11221772Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY )
     
    17042354  iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
    17052355  iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
     2356#if FIX_LGE_ILLUCOMP_B0045
     2357  iRefX   = iCUPelX + (pMv->getHor() >> 2);
     2358  iRefY   = iCUPelY + (pMv->getVer() >> 2);
     2359#else
    17062360  iRefX   = iCUPelX + (pMv->getHor() >> 3);
    17072361  iRefY   = iCUPelY + (pMv->getVer() >> 3);
     2362#endif
    17082363  uiWidth = pcCU->getWidth(0) >> 1;
    17092364  uiHeight = pcCU->getHeight(0) >> 1;
     
    19192574  UInt  uiWedgeStride   = pcWedgelet->getStride();
    19202575
     2576#if HS_REFERENCE_SUBSAMPLE_C0154
     2577  Int subSamplePix;
     2578  if ( pcWedgelet->getWidth() == 32 )
     2579  {
     2580    subSamplePix = 2;
     2581  }
     2582  else
     2583  {
     2584    subSamplePix = 1;
     2585  }
     2586#endif
     2587
    19212588  if( bAbove )
    19222589  {
     2590#if HS_REFERENCE_SUBSAMPLE_C0154
     2591    for( Int k = 0; k < pcWedgelet->getWidth(); k+=subSamplePix )
     2592#else
    19232593    for( Int k = 0; k < pcWedgelet->getWidth(); k++ )
     2594#endif
    19242595    {
    19252596      if( true == pabWedgePattern[k] )
     
    19372608  if( bLeft )
    19382609  {
     2610#if HS_REFERENCE_SUBSAMPLE_C0154
     2611    for( Int k = 0; k < pcWedgelet->getHeight(); k+=subSamplePix )
     2612#else
    19392613    for( Int k = 0; k < pcWedgelet->getHeight(); k++ )
     2614#endif
    19402615    {
    19412616      if( true == pabWedgePattern[k*uiWedgeStride] )
     
    21162791}
    21172792
     2793#if LGE_DMM3_SIMP_C0044
     2794/**
     2795 - fetch best Wedgelet pattern at decoder
     2796 */
     2797UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt IntraTabIdx)
     2798{
     2799  assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );
     2800
     2801  UInt          uiBestTabIdx = 0;
     2802  TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
     2803  TComDataCU*   pcColTexCU = pcPicTex->getCU(pcCU->getAddr());
     2804  UInt          uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     2805  Int           uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
     2806
     2807  std::vector< std::vector<UInt> > pauiWdgLstSz = g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]];
     2808
     2809  if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 )
     2810  {
     2811    std::vector<UInt>* pauiWdgLst = &pauiWdgLstSz[uiColTexIntraDir-2];
     2812    uiBestTabIdx    =   pauiWdgLst->at(IntraTabIdx);
     2813  }
     2814  else
     2815  {
     2816    WedgeNodeList* pacWedgeNodeList = &g_aacWedgeNodeLists[(g_aucConvertToBit[uiWidth])];
     2817    uiBestTabIdx = pacWedgeNodeList->at(IntraTabIdx).getPatternIdx();
     2818  }
     2819
     2820  return uiBestTabIdx;
     2821}
     2822#endif
     2823
     2824#if LGE_DMM3_SIMP_C0044
     2825/**
     2826 - calculate best Wedgelet pattern at encoder
     2827 */
     2828UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Pel* piOrigi, UInt uiStride, UInt & ruiIntraTabIdx)
     2829#else
    21182830UInt TComPrediction::getBestWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight )
     2831#endif
    21192832{
    21202833  assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );
     
    21442857  Int  iDC2 = 0;
    21452858  WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
    2146 
    2147 #if HHIQC_DMMFASTSEARCH_B0039
     2859#if LGE_DMM3_SIMP_C0044
     2860  ruiIntraTabIdx  = 0;
     2861#endif
    21482862  TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
    21492863  TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr());
     
    21582872    {
    21592873      UInt uiIdx     =   pauiWdgLst->at(uiIdxW);
     2874#if LGE_DMM3_SIMP_C0044
     2875      calcWedgeDCs       ( &(pacWedgeList->at(uiIdx)), piOrigi,   uiWidth,      iDC1, iDC2 );
     2876#else
    21602877      calcWedgeDCs       ( &(pacWedgeList->at(uiIdx)), piRefBlkY, uiWidth,      iDC1, iDC2 );
     2878#endif
    21612879      assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred,    uiPredStride, iDC1, iDC2 );
    21622880
     2881#if LGE_DMM3_SIMP_C0044
     2882      UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piOrigi, uiStride, uiWidth, uiHeight, WedgeDist_SAD );
     2883#else
    21632884      UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD );
     2885#endif
    21642886
    21652887      if( uiActDist < uiBestDist || uiBestDist == MAX_UINT )
     
    21672889        uiBestDist   = uiActDist;
    21682890        uiBestTabIdx = uiIdx;
     2891#if LGE_DMM3_SIMP_C0044
     2892        ruiIntraTabIdx = uiIdxW;
     2893#endif
    21692894      }
    21702895    }
     
    21772902    for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ )
    21782903    {
     2904#if LGE_DMM3_SIMP_C0044
     2905      calcWedgeDCs       ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piOrigi, uiWidth,      iDC1, iDC2 );
     2906#else
    21792907      calcWedgeDCs       ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piRefBlkY, uiWidth,      iDC1, iDC2 );
     2908#endif
    21802909      assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piPred,    uiPredStride, iDC1, iDC2 );
    21812910
     2911#if LGE_DMM3_SIMP_C0044
     2912      UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piOrigi, uiStride, uiWidth, uiHeight, WedgeDist_SAD );
     2913#else
    21822914      UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD );
     2915#endif
    21832916
    21842917      if( uiActDist < uiBestNodeDist || uiBestNodeDist == MAX_UINT )
     
    21862919        uiBestNodeDist = uiActDist;
    21872920        uiBestNodeId   = uiNodeId;
    2188       }
    2189     }
    2190 
     2921#if LGE_DMM3_SIMP_C0044
     2922        ruiIntraTabIdx = uiNodeId;
     2923#endif
     2924      }
     2925    }
     2926#if LGE_DMM3_SIMP_C0044
     2927    uiBestTabIdx = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx();
     2928#else
    21912929    // refinement
    21922930    uiBestDist   = uiBestNodeDist;
     
    22082946      }
    22092947    }
    2210   }
    2211 #else
    2212   for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ )
    2213   {
    2214     calcWedgeDCs       ( &(pacWedgeList->at(uiIdx)), piRefBlkY, uiWidth,      iDC1, iDC2 );
    2215     assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred,    uiPredStride, iDC1, iDC2 );
    2216 
    2217     UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD );
    2218 
    2219     if( uiActDist < uiBestDist || uiBestDist == MAX_UINT )
    2220     {
    2221       uiBestDist   = uiActDist;
    2222       uiBestTabIdx = uiIdx;
    2223     }
    2224   }
    2225 #endif
     2948#endif
     2949  }
    22262950
    22272951  cPredYuv.destroy();
     
    22622986  {
    22632987    // decoder: get and store wedge pattern in CU
     2988      // decoder: get and store wedge pattern in CU
     2989#if LGE_DMM3_SIMP_C0044
     2990    UInt uiIntraTabIdx   = pcCU->getWedgePredTexIntraTabIdx ( uiAbsPartIdx );
     2991    uiTextureWedgeTabIdx = getBestWedgeFromTex( pcCU, uiAbsPartIdx, (UInt)iWidth, (UInt)iHeight, uiIntraTabIdx );
     2992#else
    22642993    uiTextureWedgeTabIdx = getBestWedgeFromTex( pcCU, uiAbsPartIdx, (UInt)iWidth, (UInt)iHeight );
     2994#endif
    22652995
    22662996    UInt uiDepth = (pcCU->getDepth(0)) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1);
     
    22773007  getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
    22783008
     3009#if HHI_DMM_DELTADC_Q1_C0034
     3010#else
    22793011  if( bDelta )
    22803012  {
     
    22823014    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
    22833015  }
     3016#endif
    22843017
    22853018  // assign wedge pred DCs to prediction
     
    23023035  getWedgePredDCs( pcContourWedge, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
    23033036
     3037#if HHI_DMM_DELTADC_Q1_C0034
     3038#else
    23043039  if( bDelta )
    23053040  {
     
    23073042    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
    23083043  }
     3044#endif
    23093045
    23103046  // assign wedge pred DCs to prediction
     
    23153051  delete pcContourWedge;
    23163052}
    2317 #endif
     3053#endif // HHI_DMM_PRED_TEX
    23183054
    23193055#if HHI_DMM_WEDGE_INTRA
     
    24833219  getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
    24843220
     3221#if HHI_DMM_DELTADC_Q1_C0034
     3222#else
    24853223  if( bDelta )
    24863224  {
     
    24883226    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
    24893227  }
     3228#endif
    24903229
    24913230  // assign wedge pred DCs to prediction
     
    25243263  getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
    25253264
     3265#if HHI_DMM_DELTADC_Q1_C0034
     3266#else
    25263267  if( bDelta )
    25273268  {
     
    25293270    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
    25303271  }
     3272#endif
    25313273
    25323274  // assign wedge pred DCs to prediction
     
    26133355
    26143356  // 2nd step: derive wedge direction
    2615 #if LOGI_INTRA_NAME_3MPM
    26163357  Int uiPreds[3] = {-1, -1, -1};
    2617 #else
    2618   Int uiPreds[2] = {-1, -1};
    2619 #endif
    26203358  Int iMode = -1;
    26213359  Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 
    26223360
    26233361  UInt uiDirMode = 0;
    2624 #if LOGI_INTRA_NAME_3MPM
    26253362  if( iMode >= 0 ) { iPredNum = iMode; }
    26263363  if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; }
     
    26323369  Bool modeVer       = !modeHor;
    26333370  Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0;
    2634 #else
    2635   if( iPredNum == 1 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[0]]; }
    2636   if( iPredNum == 2 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[1]]; }
    2637 
    2638   if( uiDirMode == 0 ) {  return false; } // no DC
    2639 
    2640   Bool modeVer       = (uiDirMode < 18);
    2641   Bool modeHor       = !modeVer;
    2642   Int intraPredAngle = modeVer ? uiDirMode - 9 : modeHor ? uiDirMode - 25 : 0;
    2643 #endif
    26443371  Int absAng         = abs(intraPredAngle);
    26453372  Int signAng        = intraPredAngle < 0 ? -1 : 1;
     
    29603687  Int*  ptrSrc  = pcTComPattern->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt );
    29613688  Int   sw      = ( iWidth<<1 ) + 1;
    2962 #if !LOGI_INTRA_NAME_3MPM
    2963   uiDirMode     = g_aucAngIntraModeOrder[ uiDirMode ];
    2964 #endif
    29653689  xPredIntraAngDepth( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode );
    29663690}
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r210 r296  
    7878  UInt   m_uiaShift[ 63 ];       // Table for multiplication to substitue of division operation
    7979
     80#if MERL_VSP_C0152
     81  Int*   m_pDepth; ///< Local variable, to store a depth block, just to prevent allocate memory every time
     82#endif
     83
    8084  Void xPredIntraAng            ( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter );
    8185  Void xPredIntraPlanar         ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
     
    8387  // motion compensation functions
    8488#if DEPTH_MAP_GENERATION
     89#if MERL_VSP_C0152
     90  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,        Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
     91#else
    8592  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
     93#endif
     94#else
     95#if MERL_VSP_C0152
     96  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,        Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false          );
    8697#else
    8798  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false          );
    8899#endif
    89 
    90 #if DEPTH_MAP_GENERATION
     100#endif
     101
     102#if DEPTH_MAP_GENERATION
     103#if MERL_VSP_C0152
     104  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,   Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
     105#else
    91106  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
    92   Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
     107#endif
     108  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset
     109#if LGE_ILLUCOMP_DEPTH_C0046
     110      , Bool bICFlag = false
     111#endif
     112      );
     113#else
     114#if MERL_VSP_C0152
     115  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,     UInt uiAbsPartIdx,     Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx          );
    93116#else
    94117  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx          );
     118#endif
    95119  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
     120#endif
     121#if MERL_VSP_C0152
     122  Void xPredInterUniBWVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi=false );
     123  Void xPredInterBiBWVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
    96124#endif
    97125
     
    108136#endif
    109137  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
    110  
     138
     139#if MERL_VSP_C0152
     140  Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     141                                  , TComYuv *&dstPic );
     142  Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     143                                  , TComYuv *&dstPic );
     144#endif
    111145  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    112146#if LGE_ILLUCOMP_B0045
     
    146180  // inter
    147181#if DEPTH_MAP_GENERATION
     182#if MERL_VSP_C0152
     183  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     184#else
    148185  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     186#endif
     187#else
     188#if MERL_VSP_C0152
     189  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx,, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
    149190#else
    150191  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
    151192#endif
    152  
     193#endif
     194
     195#if MTK_MDIVRP_C0138
     196  Void residualPrediction         (TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred);
     197#endif
     198
    153199  // motion vector prediction
    154200  Void getMvPredAMVP              ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred );
     
    176222#if HHI_DMM_PRED_TEX
    177223  Void  getBestContourFromTex   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );
     224#if LGE_DMM3_SIMP_C0044
     225  UInt  getBestWedgeFromTex     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Pel * piOrgi, UInt uiStride, UInt &ruiIntraTabIdx);//encoder
     226  UInt  getBestWedgeFromTex     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt IntraTabIdx);//decoder
     227#else
    178228  UInt  getBestWedgeFromTex     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
     229#endif
    179230  Void  copyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
    180231#endif
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r189 r296  
    181181}
    182182
    183 #if HHI_INTER_VIEW_MOTION_PRED
     183#if H3D_IVMP
    184184Void
    185185TComRdCost::setLambdaMVReg( Double dLambda )
  • trunk/source/Lib/TLibCommon/TComRdCost.h

    r189 r296  
    203203#endif
    204204  Void    setLambda      ( Double dLambda );
    205 #if HHI_INTER_VIEW_MOTION_PRED
     205#if H3D_IVMP
    206206  Void    setLambdaMVReg ( Double dLambda );
    207207#endif
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r189 r296  
    4444
    4545
    46 #if HHI_INTER_VIEW_RESIDUAL_PRED
     46#if H3D_IVRP
    4747
    4848
     
    184184  AOF  ( pcPic );
    185185
     186#if MTK_MDIVRP_C0138
     187  if (pcPic->getSPS()->getViewId() != 0)
     188  {
     189    return;
     190  }
     191#endif
     192
    186193  if( pcPic->getPOC() == 0 )
    187194  {
     
    219226}
    220227
    221 #if QC_MULTI_DIS_CAN_A0097
     228#if H3D_NBDV
     229#if MTK_RELEASE_DV_CONSTRAINT_C0129
    222230Bool
    223 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp
    224 #if QC_SIMPLIFIEDIVRP_M24938
    225   , Bool bRecon
    226 #endif
    227  )
     231TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon  )
    228232#else
    229233Bool
    230 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv
    231 #if QC_SIMPLIFIEDIVRP_M24938
    232   , Bool bRecon
    233 #endif
    234   )
    235 #endif
     234TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon  )
     235#endif
     236#else
     237Bool
     238TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon )
     239#endif //H3D_NBDV
    236240{
    237241  AOF(  pcCU );
     
    243247  iBlkHeight  = pcCU->getHeight ( 0 );
    244248  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos );
    245 #if QC_MULTI_DIS_CAN_A0097
    246   return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp
    247 #if QC_SIMPLIFIEDIVRP_M24938
    248     , bRecon
    249 #endif
    250   );
    251 #else
    252   return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv
    253 #if QC_SIMPLIFIEDIVRP_M24938
    254     , bRecon
    255 #endif
    256     );
    257 #endif
     249#if H3D_NBDV
     250#if MTK_RELEASE_DV_CONSTRAINT_C0129
     251  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);   
     252#else
     253  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);
     254#endif
     255#else
     256  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon);
     257#endif // H3D_NBDV
    258258}
    259259 
    260 #if QC_MULTI_DIS_CAN_A0097
     260#if H3D_NBDV
     261#if MTK_RELEASE_DV_CONSTRAINT_C0129
    261262Bool
    262 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
    263 #if QC_SIMPLIFIEDIVRP_M24938
    264   , Bool bRecon
    265 #endif
    266 )
     263TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) 
    267264#else
    268265Bool
    269 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
    270 #if QC_SIMPLIFIEDIVRP_M24938
    271   , Bool bRecon
    272 #endif
    273   )
    274 #endif
    275 {
     266TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, Bool bRecon)
     267#endif
     268#else
     269Bool
     270TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon)
     271#endif
     272{
     273#if MTK_C0138_FIXED
     274  UInt  uiBaseViewId  = 0;
     275#else
    276276  UInt  uiBaseViewId  = m_pcDepthMapGenerator->getBaseViewId( 0 );
    277 
     277#endif
    278278  if( !pcYuv )
    279279  {
    280280    pcYuv = m_ppcYuvTmp[1];
    281281  }
    282 #if QC_SIMPLIFIEDIVRP_M24938
    283282  UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
    284 #endif
    285 #if QC_MULTI_DIS_CAN_A0097
    286   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp
    287 #if QC_SIMPLIFIEDIVRP_M24938
    288     , &uiXPosInRefView , &uiYPosInRefView , bRecon
    289 #endif 
    290   );
    291 #else
    292   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv
    293 #if QC_SIMPLIFIEDIVRP_M24938
    294     , &uiXPosInRefView , &uiYPosInRefView , bRecon
    295 #endif
    296     );
    297 #endif
    298 #if QC_SIMPLIFIEDIVRP_M24938
     283#if H3D_NBDV
     284#if MTK_RELEASE_DV_CONSTRAINT_C0129
     285  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
     286#else
     287  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
     288#endif
     289#else
     290  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon    );
     291#endif
     292#if MTK_MDIVRP_C0138
     293  return true;
     294#else
    299295  return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight );
    300 #else
    301   return xIsNonZero( pcYuv, uiBlkWidth, uiBlkHeight );
    302 #endif
    303 }
    304 
    305 #if QC_SIMPLIFIEDIVRP_M24938
     296#endif
     297}
     298
    306299Bool TComResidualGenerator::xIsNonZeroByCBF( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight )
    307300{
     
    329322  return( false );
    330323}
    331 #endif
    332324
    333325
     
    419411  Pel*    pRes      = pcCUResidual->getLumaAddr();
    420412  UInt    uiLumaTrMode, uiChromaTrMode;
    421 #if LG_RESTRICTEDRESPRED_M24766
     413#if LG_RESTRICTEDRESPRED_M24766  && !MTK_MDIVRP_C0138
    422414  Int     iPUPredResiShift[4];
    423415#endif
    424416  pcCU->convertTransIdx             ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode );
    425 #if H0736_AVC_STYLE_QP_RANGE
    426417    m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    427 #else
    428     m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    429 #endif
    430418  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    431419  // chroma Cb
     
    434422  piCoeff     = pcCU->getCoeffCb();
    435423  pRes        = pcCUResidual->getCbAddr();
    436 #if H0736_AVC_STYLE_QP_RANGE
    437424    m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    438 #else
    439     m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC() );
    440 #endif
    441425  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    442426  // chroma Cr
     
    445429  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    446430
     431#if !MTK_MDIVRP_C0138
    447432  if( pcCU->getResPredFlag( 0 ) )
    448433  {
    449434    AOF( pcCU->getResPredAvail( 0 ) );
    450     Bool bOK = pcCU->getResidualSamples( 0,
    451 #if QC_SIMPLIFIEDIVRP_M24938
    452       true,
    453 #endif
    454       m_ppcYuvTmp[0] );
     435    Bool bOK = pcCU->getResidualSamples( 0, true, m_ppcYuvTmp[0] );
    455436    AOF( bOK );
    456437#if LG_RESTRICTEDRESPRED_M24766
     
    461442#endif
    462443  }
     444#endif
    463445
    464446  //===== clear inter-view predicted parts =====
     
    517499
    518500
    519 #if QC_MULTI_DIS_CAN_A0097
     501#if H3D_NBDV
     502#if MTK_RELEASE_DV_CONSTRAINT_C0129
     503Void 
     504TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp
     505                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon )
     506#else // MTK_RELEASE_DV_CONSTRAINT_C0129
    520507Void 
    521508TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
    522 #if QC_SIMPLIFIEDIVRP_M24938
    523   , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
    524 #endif
    525 )
    526 #else
     509                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon)
     510#endif // MTK_RELEASE_DV_CONSTRAINT_C0129
     511#else // H3D_NBDV
    527512Void 
    528513TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
    529 #if QC_SIMPLIFIEDIVRP_M24938
    530   , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
    531 #endif
    532   )
    533 #endif
     514                                             , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  )
     515#endif // H3D_NBDV
    534516{
    535517  //===== set and check some basic variables =====
     
    548530
    549531  //===== get disparity =====
    550 #if QC_MULTI_DIS_CAN_A0097
     532#if H3D_NBDV
     533#if MTK_RELEASE_DV_CONSTRAINT_C0129
     534  Int iDisparity_y = iDisp.getVer();
     535  Int iDisparity   = iDisp.getHor();
     536#else
    551537  Int iDisparity = iDisp;
    552 #else
     538#endif
     539#else //H3D_NBDV
    553540  Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX();
    554541  Int           iMidPosY    = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY();
    555542  Int           iDisparity  = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId );
    556 #endif
     543#endif //H3D_NBDV
    557544  //===== compensate luma =====
    558545  Int           iYWidth     = Int( uiBlkWidth  );
     
    562549  Int           iYRefPosX0  = Int( uiXPos )     + ( iDisparity >> 2 );
    563550  Int           iYRefPosX1  = iYRefPosX0        + 1;
     551#if MTK_RELEASE_DV_CONSTRAINT_C0129
     552  Int           iYMaxPosY   = Int( uiPicHeight ) - 1;
     553  Int           iYWeight3   = ( iDisparity_y & 3 );
     554  Int           iYWeight2   = 4 - iYWeight3;
     555  Int           iYRefPosY0  = Max( 0, Min( iYMaxPosY, Int( uiYPos )     + ( iDisparity_y >> 2 )) );
     556  Int           iYRefPosY1  = Max( 0, Min( iYMaxPosY, iYRefPosY0 + 1 ));
     557#endif
    564558  Int           iYMaxPosX   = Int( uiPicWidth ) - 1;
    565559  Int           iSrcStrideY = pcBaseRes->getStride   ();
    566560  Int           iDesStrideY = pcYuv    ->getStride   ();
     561#if MTK_RELEASE_DV_CONSTRAINT_C0129
     562  Pel*          pSrcSamplesY0= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY0 * iSrcStrideY;
     563  Pel*          pSrcSamplesY1= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY1 * iSrcStrideY;
     564#else
    567565  Pel*          pSrcSamplesY= pcBaseRes->getLumaAddr ( 0 ) + uiYPos * iSrcStrideY;
     566#endif
    568567  Pel*          pDesSamplesY= pcYuv    ->getLumaAddr ();
    569568
    570 #if QC_SIMPLIFIEDIVRP_M24938
     569
    571570  if( puiXPosInRefView != NULL )
    572571    *puiXPosInRefView = Max( 0, Min( iYMaxPosX, iYRefPosX0 ) );
     
    575574  if( bRecon == false )
    576575    return;
    577 #endif
    578 
     576
     577#if MTK_RELEASE_DV_CONSTRAINT_C0129
     578  for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY )
     579#else
    579580  for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY += iSrcStrideY, pDesSamplesY += iDesStrideY )
     581#endif
    580582  {
    581583    for( Int iX = 0; iX < iYWidth; iX++ )
     
    583585      Int iXPic0        = Max( 0, Min( iYMaxPosX, iYRefPosX0 + iX ) );
    584586      Int iXPic1        = Max( 0, Min( iYMaxPosX, iYRefPosX1 + iX ) );
     587#if MTK_RELEASE_DV_CONSTRAINT_C0129
     588      Pel Temp1,Temp2;
     589      Temp1 =( iYWeight0 * pSrcSamplesY0[iXPic0] + iYWeight1 * pSrcSamplesY0[iXPic1] + 2 ) >> 2;
     590      Temp2 =( iYWeight0 * pSrcSamplesY1[iXPic0] + iYWeight1 * pSrcSamplesY1[iXPic1] + 2 ) >> 2;
     591      pDesSamplesY[iX]  = ( iYWeight2 * Temp1 + iYWeight3 * Temp2 + 2 ) >> 2;
     592#else
    585593      pDesSamplesY[iX]  = ( iYWeight0 * pSrcSamplesY[iXPic0] + iYWeight1 * pSrcSamplesY[iXPic1] + 2 ) >> 2;
     594#endif
    586595    }
    587596  }
     
    594603  Int           iCRefPosX0  = Int( uiXPos     >> 1 ) + ( iDisparity >> 3 );
    595604  Int           iCRefPosX1  = iCRefPosX0             + 1;
     605#if MTK_RELEASE_DV_CONSTRAINT_C0129
     606  Int           iCMaxPosY   = Int( uiPicHeight >> 1 ) - 1;
     607  Int           iCWeight3   = ( iDisparity_y & 7 );
     608  Int           iCWeight2   = 8 - iCWeight3;
     609  Int           iCRefPosY0  = Max( 0, Min( iCMaxPosY, Int( uiYPos >> 1 )     + ( iDisparity_y >> 3 )) );
     610  Int           iCRefPosY1  = Max( 0, Min( iCMaxPosY, iCRefPosY0 + 1 ));
     611#endif
    596612  Int           iCMaxPosX   = Int( uiPicWidth >> 1 ) - 1;
    597613  Int           iSrcStrideC = pcBaseRes->getCStride();
    598614  Int           iDesStrideC = pcYuv    ->getCStride();
     615#if MTK_RELEASE_DV_CONSTRAINT_C0129
     616  Pel*          pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC;
     617  Pel*          pSrcSamplesU1= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC;
     618  Pel*          pSrcSamplesV0= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC;
     619  Pel*          pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC;
     620#else
    599621  Pel*          pSrcSamplesU= pcBaseRes->getCbAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
    600622  Pel*          pSrcSamplesV= pcBaseRes->getCrAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
     623#endif
    601624  Pel*          pDesSamplesU= pcYuv    ->getCbAddr ();
    602625  Pel*          pDesSamplesV= pcYuv    ->getCrAddr ();
     626#if MTK_RELEASE_DV_CONSTRAINT_C0129
     627  for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU0 += iSrcStrideC, pSrcSamplesU1 += iSrcStrideC, pDesSamplesU += iDesStrideC,
     628                                          pSrcSamplesV0 += iSrcStrideC, pSrcSamplesV1 += iSrcStrideC, pDesSamplesV += iDesStrideC )
     629#else
    603630  for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU += iSrcStrideC, pDesSamplesU += iDesStrideC,
    604631                                          pSrcSamplesV += iSrcStrideC, pDesSamplesV += iDesStrideC )
     632#endif
    605633  {
    606634    for( Int iX = 0; iX < iCWidth; iX++ )
     
    608636      Int iXPic0        = Max( 0, Min( iCMaxPosX, iCRefPosX0 + iX ) );
    609637      Int iXPic1        = Max( 0, Min( iCMaxPosX, iCRefPosX1 + iX ) );
     638#if MTK_RELEASE_DV_CONSTRAINT_C0129
     639      Pel Temp1,Temp2;
     640      Temp1 =( iCWeight0 * pSrcSamplesU0[iXPic0] + iCWeight1 * pSrcSamplesU0[iXPic1] + 4 ) >> 3;
     641      Temp2 =( iCWeight0 * pSrcSamplesU1[iXPic0] + iCWeight1 * pSrcSamplesU1[iXPic1] + 4 ) >> 3;
     642      pDesSamplesU[iX]  = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3;
     643      Temp1 =( iCWeight0 * pSrcSamplesV0[iXPic0] + iCWeight1 * pSrcSamplesV0[iXPic1] + 4 ) >> 3;
     644      Temp2 =( iCWeight0 * pSrcSamplesV1[iXPic0] + iCWeight1 * pSrcSamplesV1[iXPic1] + 4 ) >> 3;
     645      pDesSamplesV[iX]  = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3;
     646#else
    610647      pDesSamplesU[iX]  = ( iCWeight0 * pSrcSamplesU[iXPic0] + iCWeight1 * pSrcSamplesU[iXPic1] + 4 ) >> 3;
    611648      pDesSamplesV[iX]  = ( iCWeight0 * pSrcSamplesV[iXPic0] + iCWeight1 * pSrcSamplesV[iXPic1] + 4 ) >> 3;
     649#endif
    612650    }
    613651  }
     
    705743
    706744
    707 #endif // HHI_INTER_VIEW_RESIDUAL_PRED
    708 
     745#endif // H3D_IVRP
     746
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.h

    r189 r296  
    5050
    5151
    52 #if HHI_INTER_VIEW_RESIDUAL_PRED
     52#if H3D_IVRP
    5353
    5454class TComResidualGenerator
     
    6969  Void  setRecResidualPic     ( TComPic*      pcPic );
    7070
    71 #if QC_MULTI_DIS_CAN_A0097
    72   Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Int iDisp
    73 #if QC_SIMPLIFIEDIVRP_M24938
    74     , Bool bRecon
     71#if H3D_NBDV
     72#if MTK_RELEASE_DV_CONSTRAINT_C0129
     73  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp_x, Bool bRecon );
     74  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , TComMv iDisp_x, Bool bRecon );
     75#else
     76  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon );
     77  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp, Bool bRecon );
    7578#endif
    76 );
    77   Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp
    78 #if QC_SIMPLIFIEDIVRP_M24938
    79     , Bool bRecon
    80 #endif 
    81   );
    82 #else
    83   Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv
    84 #if QC_SIMPLIFIEDIVRP_M24938
    85     , Bool bRecon
    86 #endif
    87     );
    88   Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
    89 #if QC_SIMPLIFIEDIVRP_M24938
    90     , Bool bRecon
    91 #endif
    92     );
    93 #endif
     79#else // H3D_NBDV
     80  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon );
     81  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon );
     82#endif // H3D_NBDV
    9483
    9584private:
     
    10089  Void  xClearIntViewResidual ( TComDataCU*   pcCU,  TComYuv* pcCUResidual, UInt uiPartIdx    );
    10190  Void  xClearResidual        (                      TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
    102 #if QC_MULTI_DIS_CAN_A0097
    103   Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
    104 #if QC_SIMPLIFIEDIVRP_M24938
    105     , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
     91#if H3D_NBDV
     92#if MTK_RELEASE_DV_CONSTRAINT_C0129
     93  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );   
     94#else
     95  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );
    10696#endif
    107   );
    10897#else
    109   Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
    110 #if QC_SIMPLIFIEDIVRP_M24938
    111     , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
    112 #endif
    113     );
     98  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );
    11499#endif
    115100  Bool  xIsNonZero            ( TComYuv*      pcYuv, UInt uiBlkWidth, UInt uiBlkHeight );
    116 #if QC_SIMPLIFIEDIVRP_M24938
    117101  Bool  xIsNonZeroByCBF       ( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight );
    118 #endif
    119 
    120102  Void  xDumpResidual         ( TComPic*      pcPic, char* pFilenameBase );
    121 
    122103private:
    123104  // general parameters
     
    140121#endif // __TCOM_RESIDUAL_GENERATOR__
    141122
    142 #endif // HHI_INTER_VIEW_RESIDUAL_PRED
     123#endif // H3D_IVRP
    143124
    144125
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r189 r296  
    174174    g_aacWedgeRefLists.clear();
    175175  }
    176 #if HHIQC_DMMFASTSEARCH_B0039
     176
    177177  if ( !g_aacWedgeNodeLists.empty() )
    178178  {
     
    183183    g_aacWedgeNodeLists.clear();
    184184  }
    185 #endif
     185
    186186#endif
    187187}
     
    306306
    307307#if RWTH_SDC_DLT_B0036
     308#if SAIT_SDC_C0096
     309UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, PLANAR_IDX };
     310#else
    308311UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, DMM_WEDGE_PREDDIR_IDX, PLANAR_IDX };
     312#endif
    309313#endif
    310314
     
    413417};
    414418
    415 #if !LOGI_INTRA_NAME_3MPM
    416 // Mapping each Unified Directional Intra prediction direction to DCT/DST transform
    417 // 0 implies use DCT, 1 implies DST
    418 
    419 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    420 const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE+NUM_DMM_MODE] =
    421 #else
    422 const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE] =
    423 #endif
    424 { //0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
    425   1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
    426 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
    427   , 0, 0, 0, 0, 0, 0, 0, 0
    428 #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    429   , 0, 0, 0, 0
    430 #endif
    431 };
    432 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    433 const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE+NUM_DMM_MODE] =
    434 #else
    435 const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE] =
    436 #endif
    437 { //0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
    438   1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0
    439 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
    440   , 0, 0, 0, 0, 0, 0, 0, 0
    441 #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    442   , 0, 0, 0, 0
    443 #endif
    444 };
    445 #endif
    446419
    447420
     
    478451const UChar g_aucConvertTxtTypeToIdx[4] = { 0, 1, 1, 2 };
    479452
    480 #if !LOGI_INTRA_NAME_3MPM
    481 // ====================================================================================================================
    482 // Angular Intra prediction
    483 // ====================================================================================================================
    484 
    485 // g_aucAngIntraModeOrder
    486 //   Indexing this array with the mode indicated in the bitstream
    487 //   gives a logical index used in the prediction functions.
    488 const UChar g_aucAngIntraModeOrder[NUM_INTRA_MODE] =
    489 {     //  ModeOrder LogicalOrderInPredFunctions
    490   34, //  PLANAR_IDX PLANAR PLANAR
    491   9,  //  0 VER     DC
    492   25, //  1 HOR     VER-8 (diagonal from top-left to bottom-right = HOR-8)
    493   0,  //  2 DC      VER-7
    494   1,  //  4 VER-8   VER-6
    495   5,  //  5 VER-4   VER-5
    496   13, //  6 VER+4   VER-4
    497   17, //  7 VER+8   VER-3
    498   21, //  8 HOR-4   VER-2
    499   29, //  9 HOR+4   VER-1
    500   33, // 10 HOR+8   VER
    501   3,  // 11 VER-6   VER+1
    502   7,  // 12 VER-2   VER+2
    503   11, // 13 VER+2   VER+3
    504   15, // 14 VER+6   VER+4
    505   19, // 15 HOR-6   VER+5
    506   23, // 16 HOR-2   VER+6
    507   27, // 17 HOR+2   VER+7
    508   31, // 18 HOR+6   VER+8
    509   2,  // 19 VER-7   HOR-7
    510   4,  // 20 VER-5   HOR-6
    511   6,  // 21 VER-3   HOR-5
    512   8,  // 22 VER-1   HOR-4
    513   10, // 23 VER+1   HOR-3
    514   12, // 24 VER+3   HOR-2
    515   14, // 25 VER+5   HOR-1
    516   16, // 26 VER+7   HOR
    517   18, // 27 HOR-7   HOR+1
    518   20, // 28 HOR-5   HOR+2
    519   22, // 29 HOR-3   HOR+3
    520   24, // 30 HOR-1   HOR+4
    521   26, // 31 HOR+1   HOR+5
    522   28, // 32 HOR+3   HOR+6
    523   30, // 33 HOR+5   HOR+7
    524   32, // 34 HOR+7   HOR+8
    525   0, // LM_CHROMA_IDX
    526 };
    527 
    528 const UChar g_aucIntraModeNumAng[7] =
    529 {
    530   4,  //   2x2
    531   18,  //   4x4
    532   35,  //   8x8
    533   35,  //  16x16
    534   35,  //  32x32
    535   35,  //  64x64
    536   6   // 128x128
    537 };
    538 
    539 const UChar g_aucIntraModeBitsAng[7] =
    540 {
    541   2,  //   2x2     3   1+1
    542   5,  //   4x4    17   4+1
    543   6,  //   8x8    34   5+esc
    544   6,  //  16x16   34   5+esc
    545   6,  //  32x32   34   5+esc
    546   6,  //  64x64   34   5+esc
    547   3   // 128x128   5   2+1
    548 };
    549 #endif
    550453
    551454// ====================================================================================================================
     
    587490};
    588491
     492#if LGE_DMM3_SIMP_C0044
     493const UChar g_aucWedgeTexPredBitsListIdx[7] =
     494{
     495  0,   //   2x2
     496  6,   //   4x4   
     497  9,  //   8x8   
     498  9,  //  16x16   
     499  9,  //  32x32   
     500  0,  //  64x64   
     501  0    // 128x128 
     502};
     503#endif
     504
    589505const UChar g_aucIntraSizeIdxToWedgeSize[7] =
    590506{
     
    630546};
    631547
    632 #if MULTILEVEL_SIGMAP_EXT
    633548const UInt g_sigLastScan8x8[ 4 ][ 4 ] =
    634549{
     
    639554};
    640555UInt g_sigLastScanCG32x32[ 64 ];
    641 #endif
    642556
    643557UInt* g_auiNonSquareSigLastScan[ 4 ];
     
    645559const UInt g_uiMinInGroup[ 10 ] = {0,1,2,3,4,6,8,12,16,24};
    646560const UInt g_uiGroupIdx[ 32 ]   = {0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9};
    647 #if LAST_CTX_REDUCTION
    648561const UInt g_uiLastCtx[ 28 ]    =
    649562{
     
    653566  10, 11, 12, 12, 13, 13, 14, 14, 2, 2    // 32x32  10
    654567};
    655 #else
    656 const UInt g_uiLastCtx[ 28 ]    =
    657 {
    658   0,   1,  2,  2,                         // 4x4    4
    659   3,   4,  5,  5, 6,  6,                  // 8x8    6 
    660   7,   8,  9,  9, 10, 10, 11, 11,         // 16x16  8
    661   12, 13, 14, 14, 15, 15, 16, 16, 17, 17  // 32x32  10
    662 };
    663 #endif
    664568
    665569// Rice parameters for absolute transform levels
    666 #if EIGHT_BITS_RICE_CODE
    667570const UInt g_auiGoRiceRange[5] =
    668571{
     
    674577  8, 7, 6, 5, 4
    675578};
    676 #else
    677 const UInt g_auiGoRiceRange[4] =
    678 {
    679   7, 20, 42, 70
    680 };
    681 
    682 const UInt g_auiGoRicePrefixLen[4] =
    683 {
    684   8, 10, 10, 8
    685 };
    686 #endif
    687 
    688 #if EIGHT_BITS_RICE_CODE
     579
    689580const UInt g_aauiGoRiceUpdate[5][24] =
    690581{
    691 #if RESTRICT_GR1GR2FLAG_NUMBER
    692582  {
    693583    0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
     
    705595    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
    706596  }
    707 #else
    708   {
    709     0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    710   },
    711   {
    712     1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    713   },
    714   {
    715     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    716   },
    717   {
    718     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    719   },
    720   {
    721     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
    722   }
    723 #endif
    724 };
    725 #else
    726 const UInt g_aauiGoRiceUpdate[4][16] =
    727 {
    728 #if RESTRICT_GR1GR2FLAG_NUMBER
    729   {
    730     0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
    731   },
    732   {
    733     1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
    734   },
    735   {
    736     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
    737   },
    738   {
    739     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    740   }
    741 #else 
    742   {
    743     0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3
    744   },
    745   {
    746     1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3
    747   },
    748   {
    749     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3
    750   },
    751   {
    752     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
    753   }
    754 #endif
    755 };
    756 #endif
     597};
    757598
    758599// initialize g_auiFrameScanXY
     
    808649  if( iWidth < 16 )
    809650  {
    810 #if MULTILEVEL_SIGMAP_EXT
    811651  UInt* pBuffTemp = pBuffD;
    812652  if( iWidth == 8 )
     
    814654    pBuffTemp = g_sigLastScanCG32x32;
    815655  }
    816 #endif
    817656  for( UInt uiScanLine = 0; uiNextScanPos < uiNumScanPos; uiScanLine++ )
    818657  {
     
    826665    while( iPrimDim >= 0 && iScndDim < iWidth )
    827666    {
    828 #if MULTILEVEL_SIGMAP_EXT
    829667      pBuffTemp[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ;
    830 #else
    831       pBuffD[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ;
    832 #endif
    833668      uiNextScanPos++;
    834669      iScndDim++;
     
    837672  }
    838673  }
    839 #if MULTILEVEL_SIGMAP_EXT
    840674  if( iWidth > 4 )
    841 #else
    842   else
    843 #endif
    844675  {
    845676    UInt uiNumBlkSide = iWidth >> 2;
     
    851682      uiNextScanPos   = 0;
    852683      UInt initBlkPos = g_auiSigLastScan[ SCAN_DIAG ][ log2Blk ][ uiBlk ];
    853 #if MULTILEVEL_SIGMAP_EXT
    854684      if( iWidth == 32 )
    855685      {
    856686        initBlkPos = g_sigLastScanCG32x32[ uiBlk ];
    857687      }
    858 #endif
    859688      UInt offsetY    = initBlkPos / uiNumBlkSide;
    860689      UInt offsetX    = initBlkPos - offsetY * uiNumBlkSide;
     
    983812}
    984813
    985 #if SCALING_LIST
    986814Int g_quantIntraDefault4x4[16] =
    987815{
     
    1022850  24,25,28,33,41,54,71,91
    1023851};
    1024 #else
    1025 Int g_quantIntraDefault4x4[16] =
    1026 {
    1027    6,13,20,28,
    1028   13,20,28,32,
    1029   20,28,32,37,
    1030   28,32,37,42
    1031 };
    1032 Int g_quantInterDefault4x4[16] =
    1033 {
    1034   10,14,20,24,
    1035   14,20,24,27,
    1036   20,24,27,30,
    1037   24,27,30,34
    1038 };
    1039 
    1040 Int g_quantIntraDefault8x8[64] =
    1041 {
    1042    6,10,13,16,18,23,25,27,
    1043   10,11,16,18,23,25,27,29,
    1044   13,16,18,23,25,27,29,31,
    1045   16,18,23,25,27,29,31,33,
    1046   18,23,25,27,29,31,33,36,
    1047   23,25,27,29,31,33,36,38,
    1048   25,27,29,31,33,36,38,40,
    1049   27,29,31,33,36,38,40,42
    1050 };
    1051 
    1052 Int g_quantInterDefault8x8[64] =
    1053 {
    1054    9,13,15,17,19,21,22,24,
    1055   13,13,17,19,21,22,24,25,
    1056   15,17,19,21,22,24,25,27,
    1057   17,19,21,22,24,25,27,28,
    1058   19,21,22,24,25,27,28,30,
    1059   21,22,24,25,27,28,30,32,
    1060   22,24,25,27,28,30,32,33,
    1061   24,25,27,28,30,32,33,35
    1062 };
    1063 
    1064 Int g_quantIntraDefault16x16[256] =
    1065 {
    1066   16,16,16,16,16,16,16,16,17,17,18,19,21,22,24,27,
    1067   16,16,16,16,16,16,16,16,17,18,18,20,21,23,25,27,
    1068   16,16,16,16,16,16,16,17,17,18,19,20,22,23,25,28,
    1069   16,16,16,16,16,16,17,17,18,19,20,21,23,25,27,29,
    1070   16,16,16,16,17,17,18,19,20,21,22,23,25,27,29,31,
    1071   16,16,16,16,17,18,19,20,22,23,24,26,27,29,32,34,
    1072   16,16,16,17,18,19,21,23,24,25,27,29,31,33,36,39,
    1073   16,16,17,17,19,20,23,25,27,29,31,33,35,38,41,44,
    1074   17,17,17,18,20,22,24,27,30,32,35,38,41,44,47,51,
    1075   17,18,18,19,21,23,25,29,32,36,40,43,47,51,55,60,
    1076   18,18,19,20,22,24,27,31,35,40,44,49,54,59,65,70,
    1077   19,20,20,21,23,26,29,33,38,43,49,56,62,69,75,82,
    1078   21,21,22,23,25,27,31,35,41,47,54,62,70,79,88,97,
    1079   22,23,23,25,27,29,33,38,44,51,59,69,79,90,101,113,
    1080   24,25,25,27,29,32,36,41,47,55,65,75,88,101,115,130,
    1081   27,27,28,29,31,34,39,44,51,60,70,82,97,113,130,149
    1082 };
    1083 
    1084 Int g_quantInterDefault16x16[256] =
    1085 {
    1086   16,16,16,16,16,16,16,16,17,17,18,19,20,21,22,27,
    1087   16,16,16,16,16,16,16,17,17,18,19,20,21,22,27,27,
    1088   16,16,16,16,16,16,17,17,18,19,20,21,22,27,27,28,
    1089   16,16,16,16,16,17,17,18,19,20,21,22,27,27,28,29,
    1090   16,16,16,16,17,17,18,19,20,21,22,27,27,28,29,30,
    1091   16,16,16,17,17,18,19,20,21,22,27,27,28,29,30,32,
    1092   16,16,17,17,18,19,20,21,22,27,27,28,29,30,32,36,
    1093   16,17,17,18,19,20,21,22,27,27,28,29,30,32,36,40,
    1094   17,17,18,19,20,21,22,27,27,28,29,30,32,36,40,45,
    1095   17,18,19,20,21,22,27,27,28,29,30,32,36,40,45,52,
    1096   18,19,20,21,22,27,27,28,29,30,32,36,40,45,52,59,
    1097   19,20,21,22,27,27,28,29,30,32,36,40,45,52,59,68,
    1098   20,21,22,27,27,28,29,30,32,36,40,45,52,59,68,79,
    1099   21,22,27,27,28,29,30,32,36,40,45,52,59,68,79,91,
    1100   22,27,27,28,29,30,32,36,40,45,52,59,68,79,91,103,
    1101   27,27,28,29,30,32,36,40,45,52,59,68,79,91,103,117
    1102 };
    1103 
    1104 Int g_quantIntraDefault32x32[1024] =
    1105 {
    1106   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,27,28,
    1107   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,23,23,24,25,27,28,
    1108   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,20,20,21,22,23,24,25,26,27,28,
    1109   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,21,22,23,24,25,26,27,28,
    1110   16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,20,21,22,23,23,24,25,26,28,29,
    1111   16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,19,20,21,21,22,23,24,25,26,27,28,30,
    1112   16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,18,18,19,19,20,20,21,21,22,23,24,25,26,27,28,29,30,
    1113   16,16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,19,19,20,20,21,21,22,23,24,25,26,27,28,29,30,31,
    1114   16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,19,20,20,21,21,22,22,23,24,25,26,27,28,29,30,31,33,
    1115   16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,20,20,21,22,22,23,23,24,25,26,27,28,29,30,31,33,34,
    1116   16,16,16,16,16,16,16,17,17,18,18,19,19,20,20,21,22,22,23,23,24,25,26,26,27,28,29,30,32,33,34,36,
    1117   16,16,16,16,16,16,17,17,18,18,19,20,20,21,21,22,23,23,24,25,25,26,27,28,29,30,31,32,33,35,36,38,
    1118   16,16,16,16,16,16,17,17,18,19,19,20,21,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,36,37,39,40,
    1119   16,16,16,16,16,17,17,18,18,19,20,21,22,23,24,24,25,26,27,28,29,30,31,32,33,34,35,37,38,39,41,43,
    1120   16,16,16,16,17,17,17,18,19,20,20,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,41,42,44,46,
    1121   16,16,17,17,17,17,18,18,19,20,21,22,23,24,26,27,28,29,31,32,33,34,35,37,38,39,41,42,44,45,47,49,
    1122   17,17,17,17,17,18,18,19,20,20,22,23,24,25,27,28,30,31,32,34,35,36,38,39,41,42,44,45,47,49,51,53,
    1123   17,17,17,17,18,18,19,19,20,21,22,23,25,26,28,29,31,33,34,36,37,39,41,42,44,45,47,49,51,53,55,57,
    1124   17,17,18,18,18,18,19,20,21,22,23,24,25,27,29,31,32,34,36,38,40,42,43,45,47,49,51,53,55,57,60,62,
    1125   18,18,18,18,19,19,20,20,21,22,23,25,26,28,30,32,34,36,38,40,42,44,46,48,51,53,55,57,60,62,65,67,
    1126   18,18,18,19,19,19,20,21,22,23,24,25,27,29,31,33,35,37,40,42,44,47,49,52,54,57,59,62,65,67,70,73,
    1127   19,19,19,19,20,20,21,21,22,23,25,26,28,30,32,34,36,39,42,44,47,50,52,55,58,61,64,67,70,73,76,79,
    1128   19,19,20,20,20,21,21,22,23,24,26,27,29,31,33,35,38,41,43,46,49,52,56,59,62,65,69,72,75,79,82,86,
    1129   20,20,20,21,21,21,22,23,24,25,26,28,30,32,34,37,39,42,45,48,52,55,59,62,66,70,74,77,81,85,89,93,
    1130   21,21,21,21,22,22,23,24,25,26,27,29,31,33,35,38,41,44,47,51,54,58,62,66,70,74,79,83,88,92,97,101,
    1131   22,22,22,22,23,23,24,25,26,27,28,30,32,34,36,39,42,45,49,53,57,61,65,70,74,79,84,89,94,99,104,110,
    1132   22,23,23,23,23,24,25,26,27,28,29,31,33,35,38,41,44,47,51,55,59,64,69,74,79,84,90,95,101,107,113,119,
    1133   23,23,24,24,24,25,26,27,28,29,30,32,34,37,39,42,45,49,53,57,62,67,72,77,83,89,95,101,108,114,121,128,
    1134   24,24,25,25,25,26,27,28,29,30,32,33,36,38,41,44,47,51,55,60,65,70,75,81,88,94,101,108,115,122,130,138,
    1135   25,25,26,26,26,27,28,29,30,31,33,35,37,39,42,45,49,53,57,62,67,73,79,85,92,99,107,114,122,131,139,148,
    1136   27,27,27,27,28,28,29,30,31,33,34,36,39,41,44,47,51,55,60,65,70,76,82,89,97,104,113,121,130,139,149,159,
    1137   28,28,28,28,29,30,30,31,33,34,36,38,40,43,46,49,53,57,62,67,73,79,86,93,101,110,119,128,138,148,159,170
    1138 };
    1139 
    1140 Int g_quantInterDefault32x32[1024] =
    1141 {
    1142   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,
    1143   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,
    1144   16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,
    1145   16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,
    1146   16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,
    1147   16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,
    1148   16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,
    1149   16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,
    1150   16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,
    1151   16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,
    1152   16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,
    1153   16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,
    1154   16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,
    1155   16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,
    1156   16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,
    1157   16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,
    1158   17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,
    1159   17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,
    1160   17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,
    1161   18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,
    1162   18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,
    1163   19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,
    1164   19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,
    1165   20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,
    1166   21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,
    1167   22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,
    1168   22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,
    1169   23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,
    1170   24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,
    1171   25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,
    1172   26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,123,
    1173   28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,123,131
    1174 };
    1175 #endif
    1176852UInt g_scalingListSize   [4] = {16,64,256,1024};
    1177853UInt g_scalingListSizeX  [4] = { 4, 8, 16,  32};
     
    1183859std::vector< std::vector<TComWedgeRef> > g_aacWedgeRefLists;
    1184860
    1185 #if HHIQC_DMMFASTSEARCH_B0039
    1186861std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    1187862std::vector< std::vector< TComWedgeNode> >      g_aacWedgeNodeLists;
    1188 #endif
    1189863
    1190864Void initWedgeLists()
     
    1199873    g_aacWedgeRefLists.push_back( acWedgeRefList );
    1200874
    1201 #if HHIQC_DMMFASTSEARCH_B0039
    1202875    // create WedgeNodeList
    1203876    std::vector<TComWedgeNode> acWedgeNodeList;
     
    1260933    }
    1261934    g_aacWedgeNodeLists.push_back( acWedgeNodeList );
    1262 #endif
     935
    1263936  }
    1264937  return;
     
    1298971      for( Int iL = 0; iL < uiBlockSize; iL++ )
    1299972      {
    1300 #if HHIQC_DMMFASTSEARCH_B0039
    1301973        cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) );
    1302 #else
    1303         cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes );
    1304 #endif
    1305974        addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList );
    1306975      }
    1307976    }
    1308977  }
    1309 #if HHIQC_DMMFASTSEARCH_B0039
    1310978  UInt uiThrSz = DMM3_SIMPLIFY_TR;
    1311979
     
    1325993  }
    1326994  g_aauiWdgLstM3.push_back(auiWdgListSz);
    1327 #endif
    1328995}
    1329996
     
    13611028  if( bValid )
    13621029  {
    1363 #if HHIQC_DMMFASTSEARCH_B0039
    1364   cWedgelet.findClosetAngle();
    1365 #endif
     1030    cWedgelet.findClosetAngle();
    13661031    racWedgeList.push_back( cWedgelet );
    13671032    TComWedgeRef cWedgeRef;
     
    13701035  }
    13711036}
    1372 #endif
     1037#endif //HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    13731038
    13741039//! \}
  • trunk/source/Lib/TLibCommon/TComRom.h

    r189 r296  
    135135extern const UInt   g_uiLastCtx[ 28 ];
    136136
    137 #if EIGHT_BITS_RICE_CODE
    138137extern const UInt   g_auiGoRiceRange[5];                  //!< maximum value coded with Rice codes
    139138extern const UInt   g_auiGoRicePrefixLen[5];              //!< prefix length for each maximum value
    140139extern const UInt   g_aauiGoRiceUpdate[5][24];            //!< parameter update rules for Rice codes
    141 #else
    142 extern const UInt   g_auiGoRiceRange[4];                  //!< maximum value coded with Rice codes
    143 extern const UInt   g_auiGoRicePrefixLen[4];              //!< prefix length for each maximum value
    144 extern const UInt   g_aauiGoRiceUpdate[4][16];            //!< parameter update rules for Rice codes
    145 #endif
    146140 
    147 #if MULTILEVEL_SIGMAP_EXT
    148141extern const UInt   g_sigLastScan8x8[ 4 ][ 4 ];           //!< coefficient group scan order for 8x8 TUs
    149142extern       UInt   g_sigLastScanCG32x32[ 64 ];
    150 #endif
    151143
    152144// ====================================================================================================================
     
    188180extern const WedgeResolution g_aeWedgeResolutionList[5];
    189181extern const UChar           g_aucWedgeFullBitsListIdx[7];
     182#if LGE_DMM3_SIMP_C0044
     183extern const UChar           g_aucWedgeTexPredBitsListIdx[7];
     184#endif
    190185extern const UChar           g_aucIntraSizeIdxToWedgeSize[7];
    191186
     
    193188extern       std::vector< std::vector<TComWedgeRef> >  g_aacWedgeRefLists;
    194189
    195 #if HHIQC_DMMFASTSEARCH_B0039
     190#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    196191extern       std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    197192extern       std::vector< std::vector<TComWedgeNode> >       g_aacWedgeNodeLists;
     
    199194
    200195#if RWTH_SDC_DLT_B0036
     196#if SAIT_SDC_C0096
     197#define RWTH_SDC_NUM_PRED_MODES 3
     198#else
    201199#define RWTH_SDC_NUM_PRED_MODES 4
     200#endif
    202201extern      UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES];
    203202#endif
     
    207206Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList );
    208207
    209 #if DEFAULT_DC
    210208__inline Void mapDMMtoIntraMode(  UInt& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? DC_IDX : dirMode; }
    211209__inline Void mapDMMtoIntraMode(   Int& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? DC_IDX : dirMode; }
    212 #else
    213 __inline Void mapDMMtoIntraMode(  UInt& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? PLANAR_IDX : dirMode; }
    214 __inline Void mapDMMtoIntraMode(   Int& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? PLANAR_IDX : dirMode; }
    215 #endif
    216210#endif
    217211
     
    280274#define MAX_MATRIX_COEF_NUM 64     ///< max coefficient number for quantization matrix
    281275#define MAX_MATRIX_SIZE_NUM 8      ///< max size number for quantization matrix
    282 #if SCALING_LIST
    283276#define SCALING_LIST_DC 16         ///< default DC value
    284 #endif
    285277enum ScalingListDIR
    286278{
     
    329321  },
    330322};
    331 #if SCALING_LIST
    332323static const char MatrixType_DC[4][12][22] =
    333324{
     
    349340  },
    350341};
    351 #endif
    352342extern Int g_quantIntraDefault4x4[16];
    353343extern Int g_quantIntraDefault8x8[64];
  • trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r56 r296  
    6666  m_pClipTable = NULL;
    6767  m_pClipTableBase = NULL;
    68 #if SAO_UNIT_INTERLEAVING
    6968  m_lumaTableBo = NULL;
    70 #else
    71   m_ppLumaTableBo0 = NULL;
    72   m_ppLumaTableBo1 = NULL;
    73 #endif
    7469  m_iUpBuff1 = NULL;
    7570  m_iUpBuff2 = NULL;
     
    136131  2,
    137132  2,
    138 #if !SAO_UNIT_INTERLEAVING
    139   1,
    140 #endif
    141133  1
    142134};
     
    161153  SAO_EO_LEN,
    162154  SAO_EO_LEN,
    163 #if !SAO_UNIT_INTERLEAVING
    164   SAO_BO_LEN,
    165 #endif
    166155  SAO_BO_LEN
    167156};
     
    259248   * m_iNumTotalParts must allow for sufficient storage in any allocated arrays */
    260249  m_iNumTotalParts  = max(3,m_aiNumCulPartsLevel[m_uiMaxSplitLevel]);
    261 #if !SAO_UNIT_INTERLEAVING
    262   UInt auiTable[2][LUMA_GROUP_NUM] =
    263   {{0, 0, 0, 0, 0, 0, 0, 0,
    264   1, 2, 3, 4, 5, 6, 7, 8,
    265   9,10,11,12,13,14,15,16,
    266   0, 0, 0, 0, 0, 0, 0, 0},
    267 
    268   {1, 2, 3, 4, 5, 6, 7, 8,
    269   0, 0, 0, 0, 0, 0, 0, 0,
    270   0, 0, 0, 0, 0, 0, 0, 0,
    271   9,10,11,12,13,14,15,16}};
    272 #endif
    273250
    274251  UInt uiInternalBitDepth = g_uiBitDepth+g_uiBitIncrement;
     
    276253  UInt uiBoRangeShift = uiInternalBitDepth - SAO_BO_BITS;
    277254
    278 #if SAO_UNIT_INTERLEAVING
    279255  m_lumaTableBo = new Pel [uiPixelRange];
    280256  for (Int k2=0; k2<uiPixelRange; k2++)
     
    282258    m_lumaTableBo[k2] = 1 + (k2>>uiBoRangeShift);
    283259  }
    284 #else
    285   m_ppLumaTableBo0 = new Pel [uiPixelRange];
    286   m_ppLumaTableBo1 = new Pel [uiPixelRange];
    287   for (Int k2=0; k2<uiPixelRange; k2++)
    288   {
    289     m_ppLumaTableBo0[k2] = auiTable[0][k2>>uiBoRangeShift];
    290     m_ppLumaTableBo1[k2] = auiTable[1][k2>>uiBoRangeShift];
    291   }
    292 #endif
    293260  m_iUpBuff1 = new Int[m_iPicWidth+2];
    294261  m_iUpBuff2 = new Int[m_iPicWidth+2];
     
    345312    delete [] m_iOffsetBo; m_iOffsetBo = NULL;
    346313  }
    347 #if SAO_UNIT_INTERLEAVING
    348314  if (m_lumaTableBo)
    349315  {
    350316    delete[] m_lumaTableBo; m_lumaTableBo = NULL;
    351317  }
    352 #else
    353   if (m_ppLumaTableBo0)
    354   {
    355     delete[] m_ppLumaTableBo0; m_ppLumaTableBo0 = NULL;
    356   }
    357   if (m_ppLumaTableBo1)
    358   {
    359     delete[] m_ppLumaTableBo1; m_ppLumaTableBo1 = NULL;
    360   }
    361 #endif
    362318
    363319
     
    416372    pcSaoParam->iNumClass[j] = m_iNumClass[j];
    417373  }
    418 #if SAO_UNIT_INTERLEAVING
    419374  pcSaoParam->numCuInWidth  = m_iNumCuInWidth;
    420375  pcSaoParam->numCuInHeight = m_iNumCuInHeight;
     
    422377  pcSaoParam->saoLcuParam[1] = new SaoLcuParam [m_iNumCuInHeight*m_iNumCuInWidth];
    423378  pcSaoParam->saoLcuParam[2] = new SaoLcuParam [m_iNumCuInHeight*m_iNumCuInWidth];
    424 #endif
    425379}
    426380
     
    448402
    449403  pSaoPart->UpPartIdx = iParentPartIdx;
    450 #if !SAO_UNIT_INTERLEAVING
    451   pSaoPart->bEnableFlag =  0;
    452 #endif
    453404  pSaoPart->iBestType   = -1;
    454405  pSaoPart->iLength     =  0;
    455406
    456 #if SAO_UNIT_INTERLEAVING
    457407  pSaoPart->bandPosition = 0;
    458408
    459409  for (j=0;j<MAX_NUM_SAO_OFFSETS;j++)
    460 #else
    461   for (j=0;j<MAX_NUM_SAO_CLASS;j++)
    462 #endif
    463410  {
    464411    pSaoPart->iOffset[j] = 0;
     
    545492  pcSaoParam->psSaoPart[1] = 0;
    546493  pcSaoParam->psSaoPart[2] = 0;
    547 #if SAO_UNIT_INTERLEAVING
    548494  if( pcSaoParam->saoLcuParam[0])
    549495  {
     
    558504    delete [] pcSaoParam->saoLcuParam[2]; pcSaoParam->saoLcuParam[2] = NULL;
    559505  }
    560 #endif
    561506}
    562507
     
    572517    for(Int i=0; i< m_aiNumCulPartsLevel[m_uiMaxSplitLevel]; i++)
    573518    {
    574 #if !SAO_UNIT_INTERLEAVING
    575       pcSaoParam->psSaoPart[c][i].bEnableFlag   =  0;
    576 #endif
    577519      pcSaoParam->psSaoPart[c][i].iBestType     = -1;
    578520      pcSaoParam->psSaoPart[c][i].iLength       =  0;
     
    582524      pcSaoParam->psSaoPart[c][i].iMinDist      = MAX_INT;
    583525      pcSaoParam->psSaoPart[c][i].iMinRate      = MAX_INT;
    584 #if SAO_UNIT_INTERLEAVING
    585526      pcSaoParam->psSaoPart[c][i].bandPosition = 0;
    586527      for (Int j=0;j<MAX_NUM_SAO_OFFSETS;j++)
    587 #else
    588       for (Int j=0;j<MAX_NUM_SAO_CLASS;j++)
    589 #endif
    590528      {
    591529        pcSaoParam->psSaoPart[c][i].iOffset[j] = 0;
     
    594532      }
    595533    }
    596 #if SAO_UNIT_INTERLEAVING
    597534    pcSaoParam->oneUnitFlag[0]   = 0;
    598535    pcSaoParam->oneUnitFlag[1]   = 0;
     
    601538    resetLcuPart(pcSaoParam->saoLcuParam[1]);
    602539    resetLcuPart(pcSaoParam->saoLcuParam[2]);
    603 #endif
    604540  }
    605541}
     
    882818      break;
    883819    }   
    884 #if SAO_UNIT_INTERLEAVING
    885820  case SAO_BO:
    886 #else
    887   case SAO_BO_0:
    888   case SAO_BO_1:
    889 #endif
    890821    {
    891822      for (y=0; y< height; y++)
     
    11081039      break;
    11091040    }   
    1110 #if SAO_UNIT_INTERLEAVING
    11111041  case SAO_BO:
    1112 #else
    1113   case SAO_BO_0:
    1114   case SAO_BO_1:
    1115 #endif
    11161042    {
    11171043      for (y=0; y<iLcuHeight; y++)
     
    11341060  }
    11351061}
    1136 #if !SAO_UNIT_INTERLEAVING
    1137 /** sample adaptive offset process for one partition
    1138  * \param   *psQTPart,  uiPartIdx,  iYCbCr
    1139  */
    1140 Void TComSampleAdaptiveOffset::processSaoOnePart(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr)
    1141 {
    1142   int  i;
    1143   UInt uiEdgeType, uiTypeIdx;
    1144   Pel* ppLumaTable = NULL;
    1145   SAOQTPart*  pOnePart= &(psQTPart[uiPartIdx]);
    1146 
    1147   static Int iOffset[LUMA_GROUP_NUM];
    1148   Int LcuIdxX;
    1149   Int LcuIdxY;
    1150   Int iAddr;
    1151   Int iFrameWidthInCU = m_pcPic->getFrameWidthInCU();
    1152 
    1153   if(pOnePart->bEnableFlag)
    1154   {
    1155     uiTypeIdx = pOnePart->iBestType;
    1156     if (uiTypeIdx == SAO_BO_0 || uiTypeIdx == SAO_BO_1)
    1157     {
    1158       for (i=0;i<pOnePart->iLength;i++)
    1159         iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;
    1160 
    1161       if (uiTypeIdx == SAO_BO_0 )
    1162       {
    1163         ppLumaTable = m_ppLumaTableBo0;
    1164       }
    1165       if (uiTypeIdx == SAO_BO_1 )
    1166       {
    1167         ppLumaTable = m_ppLumaTableBo1;
    1168       }
    1169 
    1170 #if FULL_NBIT
    1171       for (i=0;i<(1<<(g_uiBitDepth));i++)
    1172 #else
    1173       for (i=0;i<(1<<(g_uiBitIncrement+8));i++)
    1174 #endif
    1175       {
    1176         m_iOffsetBo[i] = m_pClipTable[i + iOffset[ppLumaTable[i]]];
    1177       }
    1178 
    1179     }
    1180     if (uiTypeIdx == SAO_EO_0 || uiTypeIdx == SAO_EO_1 || uiTypeIdx == SAO_EO_2 || uiTypeIdx == SAO_EO_3)
    1181     {
    1182       for (i=0;i<pOnePart->iLength;i++)
    1183       {
    1184         iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;
    1185       }
    1186       for (uiEdgeType=0;uiEdgeType<6;uiEdgeType++)
    1187       {
    1188         m_iOffsetEo[uiEdgeType]= iOffset[m_auiEoTable[uiEdgeType]];
    1189       }
    1190     }
    1191     for (LcuIdxY = pOnePart->StartCUY; LcuIdxY<= pOnePart->EndCUY; LcuIdxY++)
    1192     {
    1193       for (LcuIdxX = pOnePart->StartCUX; LcuIdxX<= pOnePart->EndCUX; LcuIdxX++)
    1194       {
    1195         iAddr = LcuIdxY * iFrameWidthInCU + LcuIdxX;
    1196         processSaoCu(iAddr, uiTypeIdx, iYCbCr);
    1197       }
    1198     }
    1199   }
    1200 }
    1201 
    1202 /** Process quadtree sample adaptive offset
    1203  * \param  psQTPart, uiPartIdx, iYCbCr
    1204  */
    1205 Void TComSampleAdaptiveOffset::processSaoQuadTree(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr)
    1206 {
    1207   SAOQTPart*  pSaoPart= &(psQTPart[uiPartIdx]);
    1208 
    1209   if (uiPartIdx == 0)
    1210   {
    1211     initTmpSaoQuadTree(psQTPart, iYCbCr);
    1212     xSaoAllPart(psQTPart, iYCbCr);
    1213     return;
    1214   }
    1215 
    1216   if (!pSaoPart->bSplit)
    1217   {
    1218     if (pSaoPart->bEnableFlag)
    1219     {
    1220       processSaoOnePart(psQTPart, uiPartIdx, iYCbCr);
    1221     }
    1222     return;
    1223   }
    1224 
    1225   if (pSaoPart->PartLevel < m_uiMaxSplitLevel)
    1226   {
    1227     processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[0], iYCbCr);
    1228     processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[1], iYCbCr);
    1229     processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[2], iYCbCr);
    1230     processSaoQuadTree(psQTPart, pSaoPart->DownPartsIdx[3], iYCbCr);
    1231   }
    1232 }
    1233 
    1234 /** run SAO processing in LCU order
    1235  * \param *psQTPart,  iYCbCr
    1236  */
    1237 Void TComSampleAdaptiveOffset::xSaoAllPart(SAOQTPart *psQTPart, Int iYCbCr)
    1238 {
    1239   int  i;
    1240   UInt uiEdgeType;
    1241   Pel* ppLumaTable = NULL;
    1242   Int  iTypeIdx;
    1243 
    1244   static Int iOffset[LUMA_GROUP_NUM];
    1245   Int LcuIdxX;
    1246   Int LcuIdxY;
    1247   Int iAddr;
    1248   Int iFrameWidthInCU = m_pcPic->getFrameWidthInCU();
    1249   Int iFrameHeightInCU = m_pcPic->getFrameHeightInCU();
    1250   Int iPartIdx;
    1251   Pel *pRec;
    1252   Int iPicWidthTmp;
    1253   Int iStride;
    1254   Pel *pTmpUSwap;
    1255   Int iIsChroma = (iYCbCr == 0) ? 0:1;
    1256 
    1257   SAOQTPart*  pOnePart;
    1258 
    1259   for (LcuIdxY = 0; LcuIdxY< iFrameHeightInCU; LcuIdxY++)
    1260   {
    1261     iAddr = LcuIdxY * iFrameWidthInCU;
    1262     if (iYCbCr == 0)
    1263     {
    1264       pRec  = m_pcPic->getPicYuvRec()->getLumaAddr(iAddr);
    1265       iStride = m_pcPic->getStride();
    1266       iPicWidthTmp = m_iPicWidth;
    1267     }
    1268     else if (iYCbCr == 1)
    1269     {
    1270       pRec  = m_pcPic->getPicYuvRec()->getCbAddr(iAddr);
    1271       iStride = m_pcPic->getCStride();
    1272       iPicWidthTmp = m_iPicWidth>>1;
    1273     }
    1274     else
    1275     {
    1276       pRec  = m_pcPic->getPicYuvRec()->getCrAddr(iAddr);
    1277       iStride = m_pcPic->getCStride();
    1278       iPicWidthTmp = m_iPicWidth>>1;
    1279     }
    1280 
    1281 //     pRec += iStride*(m_uiMaxCUHeight-1);
    1282     for (i=0;i<(m_uiMaxCUHeight>>iIsChroma)+1;i++)
    1283     {
    1284       m_pTmpL1[i] = pRec[0];
    1285       pRec+=iStride;
    1286     }
    1287     pRec-=(iStride<<1);
    1288 
    1289     memcpy(m_pTmpU2, pRec, sizeof(Pel)*iPicWidthTmp);
    1290 
    1291     for (LcuIdxX = 0; LcuIdxX< iFrameWidthInCU; LcuIdxX++)
    1292     {
    1293       iAddr = LcuIdxY * iFrameWidthInCU + LcuIdxX;
    1294       iPartIdx = m_iLcuPartIdx[iAddr];
    1295       if (iPartIdx>=0)
    1296       {
    1297         pOnePart = &(psQTPart[iPartIdx]);
    1298         iTypeIdx = pOnePart->iBestType;
    1299         if (iTypeIdx>=0)
    1300         {
    1301           if (iTypeIdx == SAO_BO_0 || iTypeIdx == SAO_BO_1)
    1302           {
    1303             for (i=0;i<pOnePart->iLength;i++)
    1304               iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;
    1305 
    1306             if (iTypeIdx == SAO_BO_0 )
    1307             {
    1308               ppLumaTable = m_ppLumaTableBo0;
    1309             }
    1310             if (iTypeIdx == SAO_BO_1 )
    1311             {
    1312               ppLumaTable = m_ppLumaTableBo1;
    1313             }
    1314 
    1315 #if FULL_NBIT
    1316             for (i=0;i<(1<<(g_uiBitDepth));i++)
    1317 #else
    1318             for (i=0;i<(1<<(g_uiBitIncrement+8));i++)
    1319 #endif
    1320             {
    1321               m_iOffsetBo[i] = m_pClipTable[i + iOffset[ppLumaTable[i]]];
    1322             }
    1323 
    1324           }
    1325           if (iTypeIdx == SAO_EO_0 || iTypeIdx == SAO_EO_1 || iTypeIdx == SAO_EO_2 || iTypeIdx == SAO_EO_3)
    1326           {
    1327             for (i=0;i<pOnePart->iLength;i++)
    1328             {
    1329               iOffset[i+1] = pOnePart->iOffset[i] << m_uiSaoBitIncrease;
    1330             }
    1331             for (uiEdgeType=0;uiEdgeType<6;uiEdgeType++)
    1332             {
    1333               m_iOffsetEo[uiEdgeType]= iOffset[m_auiEoTable[uiEdgeType]];
    1334             }
    1335           }
    1336           processSaoCu(iAddr, iTypeIdx, iYCbCr);
    1337         }
    1338       }
    1339       else
    1340       {
    1341         if (LcuIdxX != (iFrameWidthInCU-1))
    1342         {
    1343           if( m_iLcuPartIdx[iAddr+1] >=0)
    1344           {
    1345             if (iYCbCr == 0)
    1346             {
    1347               pRec  = m_pcPic->getPicYuvRec()->getLumaAddr(iAddr);
    1348               iStride = m_pcPic->getStride();
    1349             }
    1350             else if (iYCbCr == 1)
    1351             {
    1352               pRec  = m_pcPic->getPicYuvRec()->getCbAddr(iAddr);
    1353               iStride = m_pcPic->getCStride();
    1354             }
    1355             else
    1356             {
    1357               pRec  = m_pcPic->getPicYuvRec()->getCrAddr(iAddr);
    1358               iStride = m_pcPic->getCStride();
    1359             }
    1360             Int iWidthShift = m_uiMaxCUWidth>>iIsChroma;
    1361             for (i=0;i<(m_uiMaxCUHeight>>iIsChroma)+1;i++)
    1362             {
    1363               m_pTmpL1[i] = pRec[iWidthShift-1];
    1364               pRec+=iStride;
    1365             }
    1366           }
    1367         }
    1368       }
    1369     }
    1370     pTmpUSwap = m_pTmpU1;
    1371     m_pTmpU1  = m_pTmpU2;
    1372     m_pTmpU2  = pTmpUSwap;
    1373   }
    1374 }
    1375 
    1376 /** initialize buffer for quadtree boundary
    1377  * \param *psQTPart,  iYCbCr
    1378  */
    1379 Void TComSampleAdaptiveOffset::initTmpSaoQuadTree(SAOQTPart *psQTPart, Int iYCbCr)
    1380 {
    1381   Pel *pRec;
    1382   Int iPicWidthTmp;
    1383  
    1384 
    1385   memset(m_iLcuPartIdx,-1, sizeof(Int)*m_iNumCuInWidth*m_iNumCuInHeight);
    1386   convertSaoQt2Lcu(psQTPart, 0);
    1387 
    1388   if (iYCbCr == 0)
    1389   {
    1390     pRec       = m_pcPic->getPicYuvRec()->getLumaAddr();
    1391     iPicWidthTmp = m_iPicWidth;
    1392   }
    1393   else if (iYCbCr == 1)
    1394   {
    1395     pRec       = m_pcPic->getPicYuvRec()->getCbAddr();
    1396     iPicWidthTmp =  m_iPicWidth>>1;
    1397   }
    1398   else
    1399   {
    1400     pRec       = m_pcPic->getPicYuvRec()->getCrAddr();
    1401     iPicWidthTmp =  m_iPicWidth>>1;
    1402   }
    1403 
    1404   memcpy(m_pTmpU1, pRec, sizeof(Pel)*iPicWidthTmp);
    1405 }
    1406 
    1407 /** recursive covert quadtree partition index to each LCU
    1408  * \param psQTPart, uiPartIdx 
    1409  */
    1410 Void TComSampleAdaptiveOffset::convertSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx)
    1411 {
    1412 
    1413   SAOQTPart*  pSaoPart= &(psQTPart[uiPartIdx]);
    1414 
    1415   if (!pSaoPart->bSplit)
    1416   {
    1417     xSaoQt2Lcu(psQTPart, uiPartIdx);
    1418     return;
    1419   }
    1420 
    1421   if (pSaoPart->PartLevel < m_uiMaxSplitLevel)
    1422   {
    1423     convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[0]);
    1424     convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[1]);
    1425     convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[2]);
    1426     convertSaoQt2Lcu(psQTPart, pSaoPart->DownPartsIdx[3]);
    1427   }
    1428 }
    1429 
    1430 /** assign quadtree partition index to each LCU
    1431  * \param psQTPart, uiPartIdx 
    1432  */
    1433 
    1434 Void TComSampleAdaptiveOffset::xSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx)
    1435 {
    1436   Int LcuIdxX;
    1437   Int LcuIdxY;
    1438   Int iAddr;
    1439   Int iFrameWidthInCU = m_iNumCuInWidth;
    1440 
    1441   for (LcuIdxY = psQTPart[uiPartIdx].StartCUY; LcuIdxY<= psQTPart[uiPartIdx].EndCUY; LcuIdxY++)
    1442   {
    1443     for (LcuIdxX = psQTPart[uiPartIdx].StartCUX; LcuIdxX<= psQTPart[uiPartIdx].EndCUX; LcuIdxX++)
    1444     {
    1445       iAddr = LcuIdxY * iFrameWidthInCU + LcuIdxX;
    1446       if (psQTPart[uiPartIdx].bEnableFlag)
    1447       {
    1448         m_iLcuPartIdx[iAddr] = (Int)uiPartIdx;
    1449       }
    1450       else
    1451       {
    1452         m_iLcuPartIdx[iAddr] = -1;
    1453       }
    1454     }
    1455   }
    1456 }
    1457 #endif
    14581062/** Sample adaptive offset process
    14591063 * \param pcPic, pcSaoParam 
     
    14741078    }
    14751079
    1476 #if SAO_UNIT_INTERLEAVING
    14771080    if (m_saoInterleavingFlag)
    14781081    {
     
    14961099
    14971100
    1498 #else
    1499     Int iY  = 0;
    1500     processSaoQuadTree( pcSaoParam->psSaoPart[iY], 0 , iY);
    1501 
    1502     Int iCb = 1;
    1503     Int iCr = 2;
    1504     if (pcSaoParam->bSaoFlag[iCb])
    1505     {
    1506       processSaoQuadTree( pcSaoParam->psSaoPart[iCb], 0 , iCb);
    1507     }
    1508     if (pcSaoParam->bSaoFlag[iCr])
    1509     {
    1510       processSaoQuadTree( pcSaoParam->psSaoPart[iCr], 0 , iCr);
    1511     }
    1512 #endif
    15131101    m_pcPic = NULL;
    15141102  }
     
    15331121  }
    15341122}
    1535 #if SAO_UNIT_INTERLEAVING
    15361123/** Process SAO all units
    15371124 * \param saoLcuParam SAO LCU parameters
     
    17891376
    17901377
    1791 #endif
    17921378
    17931379//! \}
  • trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r56 r296  
    5252#define SAO_BO_BITS                   5
    5353#define LUMA_GROUP_NUM                (1<<SAO_BO_BITS)
    54 #if SAO_UNIT_INTERLEAVING
    5554#define MAX_NUM_SAO_OFFSETS           4
    5655#define MAX_NUM_SAO_CLASS             33
    57 #else
    58 #define MAX_NUM_SAO_CLASS             32
    59 #endif
    6056// ====================================================================================================================
    6157// Class definition
     
    9591  Pel   *m_pClipTable;
    9692  Pel   *m_pClipTableBase;
    97 #if SAO_UNIT_INTERLEAVING
    9893  Pel   *m_lumaTableBo;
    99 #else
    100   Pel   *m_ppLumaTableBo0;
    101   Pel   *m_ppLumaTableBo1;
    102 #endif
    10394  Int   *m_iUpBuff1;
    10495  Int   *m_iUpBuff2;
     
    115106  Pel* m_pTmpL2;
    116107  Int* m_iLcuPartIdx;
    117 #if SAO_UNIT_INTERLEAVING
    118108  Int     m_maxNumOffsetsPerPic;
    119109  Bool    m_saoInterleavingFlag;
    120 #else
    121   Void initTmpSaoQuadTree(SAOQTPart *psQTPart, Int iYCbCr);
    122   Void disableSaoOnePart(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr);
    123   Void xSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx);
    124   Void convertSaoQt2Lcu(SAOQTPart *psQTPart,UInt uiPartIdx);
    125   Void xSaoAllPart(SAOQTPart *psQTPart, Int iYCbCr);
    126 #endif
    127110public:
    128111  TComSampleAdaptiveOffset         ();
     
    151134  Void processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int iSaoType, UInt xPos, UInt yPos, UInt width, UInt height, Bool* pbBorderAvail);
    152135
    153 #if SAO_UNIT_INTERLEAVING
    154136  Void resetLcuPart(SaoLcuParam* saoLcuParam);
    155137  Void convertQT2SaoUnit(SAOParam* saoParam, UInt partIdx, Int yCbCr);
     
    158140  Void setSaoInterleavingFlag (Bool bVal)  {m_saoInterleavingFlag = bVal;}
    159141  Bool getSaoInterleavingFlag ()           {return m_saoInterleavingFlag;}
    160 #endif
    161142};
    162143
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r210 r296  
    110110, m_cabacInitIdc                 ( -1 )
    111111#endif
    112 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    113112, m_numEntryPointOffsets          ( 0 )
    114 #endif
    115 #if SONY_COLPIC_AVAILABILITY
    116 , m_iViewOrderIdx                 ( 0 )
    117 #endif
    118113#if LGE_ILLUCOMP_B0045
    119114, m_bApplyIC                      ( false )
    120115#endif
     116#if INTER_VIEW_VECTOR_SCALING_C0115
     117, m_bIVScalingFlag                (false)
     118, m_iViewOrderIdx                 ( 0 )        // will be changed to view_id
     119#endif
    121120{
    122121  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
    123  
     122
    124123  initEqualRef();
    125124 
     
    196195  m_cabacInitFlag        = false;
    197196#endif
    198 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    199197  m_numEntryPointOffsets = 0;
     198#if QC_TMVP_MRG_REFIDX_C0047
     199  m_aiNewRefIdx[0]                  = -1;
     200  m_aiNewRefIdx[1]                  = -1;
    200201#endif
    201202}
     
    419420    }
    420421  }
     422#if QC_TMVP_MRG_REFIDX_C0047
     423  Int  iCurrPOC = this->getPOC();
     424  for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )//just to get one updated ref idx for merge in each L0/L1 direction, if it is not avaialbe, it is still -1
     425  {       
     426    if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0)
     427        continue;
     428
     429    Bool bZeroIdxInterViewFlag =  ( this->getRefPic(RefPicList(uiRefListIdx), 0)->getPOC() == iCurrPOC ) ? true : false;
     430    for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
     431    {
     432      if ( (bZeroIdxInterViewFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() != iCurrPOC ) ||
     433           (!bZeroIdxInterViewFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() == iCurrPOC ) )
     434      {
     435        this->setNewRefIdx(RefPicList(uiRefListIdx),i);
     436        break;
     437      }
     438    }
     439  }
     440
     441#endif
    421442}
    422443
     
    621642    }
    622643  }
    623 #if H0566_TLA
    624644  if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
    625 #else
    626   if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found
    627 #endif
    628645  {
    629646    pocCRA = getPOC();
     
    678695      bRefreshPending = false;
    679696    }
    680 #if H0566_TLA
    681697    if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
    682 #else
    683     if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found
    684 #endif
    685698    {
    686699      bRefreshPending = true;
     
    698711  m_iPOC                 = pSrc->m_iPOC;
    699712  m_viewId               = pSrc->m_viewId;
    700 #if SONY_COLPIC_AVAILABILITY
    701   m_iViewOrderIdx        = pSrc->m_iViewOrderIdx;
     713#if INTER_VIEW_VECTOR_SCALING_C0115   
     714  m_iViewOrderIdx        = pSrc->m_iViewOrderIdx;// will be changed to view_id
     715  m_bIVScalingFlag       = pSrc->m_bIVScalingFlag;
    702716#endif
    703717  m_eNalUnitType         = pSrc->m_eNalUnitType;
     
    804818
    805819  m_saoEnabledFlag = pSrc->m_saoEnabledFlag;
    806 #if SAO_UNIT_INTERLEAVING
    807820  m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag;
    808821  m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb;
    809822  m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr;
    810 #endif
    811823#if CABAC_INIT_FLAG
    812824  m_cabacInitFlag                = pSrc->m_cabacInitFlag;
    813825#endif
    814 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    815826  m_numEntryPointOffsets  = pSrc->m_numEntryPointOffsets;
    816 #endif
    817 
    818 #if H0111_MVD_L1_ZERO
     827
    819828  m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero;
    820 #endif
    821829}
    822830
     
    830838Void TComSlice::setTLayerInfo( UInt uiTLayer )
    831839{
    832 #if !H0566_TLA
    833   // If temporal_id_nesting_flag == 1, then num_temporal_layer_switching_point_flags shall be inferred to be 0 and temporal_layer_switching_point_flag shall be inferred to be 1 for all temporal layers
    834   if ( m_pcSPS->getTemporalIdNestingFlag() )
    835   {
    836     m_pcPPS->setNumTLayerSwitchingFlags( 0 );
    837     for ( UInt i = 0; i < MAX_TLAYER; i++ )
    838     {
    839       m_pcPPS->setTLayerSwitchingFlag( i, true );
    840     }
    841   }
    842   else
    843   {
    844     for ( UInt i = m_pcPPS->getNumTLayerSwitchingFlags(); i < MAX_TLAYER; i++ )
    845     {
    846       m_pcPPS->setTLayerSwitchingFlag( i, false );
    847     }
    848   }
    849 #endif
    850840
    851841  m_uiTLayer = uiTLayer;
    852 #if !H0566_TLA
    853   m_bTLayerSwitchingFlag = m_pcPPS->getTLayerSwitchingFlag( uiTLayer );
    854 #endif
    855 }
    856 
    857 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS
     842}
     843
     844#if H0566_TLA_SET_FOR_SWITCHING_POINTS
    858845/** Function for checking if this is a switching-point
    859846*/
     
    933920/** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet.
    934921*/
    935 #if START_DECODING_AT_CRA
    936922Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess)
    937 #else
    938 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag)
    939 #endif
    940923{
    941924  TComPic* rpcPic;
     
    983966    if(isAvailable == 0)   
    984967    {           
    985 #if START_DECODING_AT_CRA
    986968      if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess)
    987969      {
    988 #endif
    989970        if(!pReferencePictureSet->getUsed(i) )
    990971        {
     
    1000981          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
    1001982        }
    1002 #if START_DECODING_AT_CRA
    1003       }
    1004 #endif
     983      }
    1005984    }
    1006985  } 
     
    10271006    if(isAvailable == 0)   
    10281007    {           
    1029 #if START_DECODING_AT_CRA
    10301008      if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess)
    10311009      {
    1032 #endif
    10331010        if(!pReferencePictureSet->getUsed(i) )
    10341011        {
     
    10441021          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
    10451022        }
    1046 #if START_DECODING_AT_CRA
    1047       }
    1048 #endif
     1023      }
    10491024    }
    10501025  }   
     
    11121087    Int rIdx =  this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1;
    11131088    Int deltaRPS = pReferencePictureSet->getDeltaRPS();
    1114 #if RPS_IN_SPS
    11151089    TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx);
    1116 #else
    1117     TComReferencePictureSet* pcRefRPS = this->getPPS()->getRPSList()->getReferencePictureSet(rIdx);
    1118 #endif
    11191090    Int iRefPics = pcRefRPS->getNumberOfPictures();
    11201091    Int iNewIdc=0;
     
    11431114    pcRPS->setNumRefIdc(iNewIdc);
    11441115    pcRPS->setDeltaRPS(deltaRPS);
    1145 #if RPS_IN_SPS
    11461116    pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());
    1147 #else
    1148     pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getPPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());
    1149 #endif
    11501117  }
    11511118
     
    13821349    Int iRefStride = pcRefPicYuvOrg->getStride();
    13831350    Int iSumOrgSAD = 0;
     1351#if LGE_ILLUCOMP_DEPTH_C0046
     1352    Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05;
     1353#else
    13841354    double dThresholdOrgSAD = 0.05;
     1355#endif
    13851356    // Histogram building - luminance
    13861357    for ( Int y = 0; y < iHeight; y++)
     
    15091480, m_picWidthInLumaSamples     (352)
    15101481, m_picHeightInLumaSamples    (288)
    1511 #if PIC_CROPPING
    15121482, m_picCroppingFlag           (false)
    15131483, m_picCropLeftOffset         (  0)
     
    15151485, m_picCropTopOffset          (  0)
    15161486, m_picCropBottomOffset       (  0)
    1517 #endif
    15181487, m_uiMaxCUWidth              ( 32)
    15191488, m_uiMaxCUHeight             ( 32)
     
    15211490, m_uiMinTrDepth              (  0)
    15221491, m_uiMaxTrDepth              (  1)
    1523 #if RPS_IN_SPS
    15241492, m_bLongTermRefsPresent      (false)
    1525 #endif
    1526 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1527 , m_numReorderFrames          (  0)
    1528 #endif
    15291493, m_iNumberOfUsableInterViewRefs( 0 )
    15301494, m_uiQuadtreeTULog2MaxSize   (  0)
     
    15381502, m_bDisInter4x4              (  1)
    15391503, m_bUseALF                   (false)
    1540 #if LCU_SYNTAX_ALF
    15411504, m_bALFCoefInSlice           (false)
    1542 #endif
    1543 #if !PIC_CROPPING
    1544 , m_bUsePAD                   (false)
    1545 #endif
    15461505, m_bUseLMChroma              (false)
    15471506, m_bUseLComb                 (false)
    15481507, m_bLCMod                    (false)
    1549 #if H0412_REF_PIC_LIST_RESTRICTION
    15501508#if QC_MVHEVC_B0046
    15511509, m_restrictedRefPicListsFlag   (  0)
     
    15541512#endif
    15551513, m_listsModificationPresentFlag(  0)
    1556 #endif
    15571514, m_uiBitDepth                (  8)
    15581515, m_uiBitIncrement            (  0)
    1559 #if H0736_AVC_STYLE_QP_RANGE
    15601516, m_qpBDOffsetY               (  0)
    15611517, m_qpBDOffsetC               (  0)
    1562 #endif
    15631518#if LOSSLESS_CODING
    15641519, m_useLossless               (false)
     
    15831538, m_bTemporalIdNestingFlag    (false)
    15841539, m_scalingListEnabledFlag    (false)
    1585 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1586 , m_uiMaxDecFrameBuffering    (  0)
    1587 , m_uiMaxLatencyIncrease      (  0)
    1588 #endif
    1589 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    15901540,  m_tilesOrEntropyCodingSyncIdc( 0 )
    15911541,  m_numSubstreams              ( 0 )
    1592 #endif
    15931542#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    15941543, m_bUseDMM                   (false)
     
    16031552  // AMVP parameter
    16041553  ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) );
    1605 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    16061554  for ( Int i = 0; i < MAX_TLAYER; i++ )
    16071555  {
     
    16101558    m_numReorderPics[i]       = 0;
    16111559  }
    1612 #endif
    16131560
    16141561  m_uiViewId              = 0;
     
    16261573  ::memset( m_aiPdmOffset,        0x00, sizeof( m_aiPdmOffset         ) );
    16271574#endif
    1628 #if HHI_INTER_VIEW_MOTION_PRED
     1575#if H3D_IVMP
    16291576  m_uiMultiviewMvPredMode    = 0;
    16301577#endif
     
    17481695, m_iChromaQpOffset             (0)
    17491696, m_iChromaQpOffset2nd          (0)
    1750 #if !RPS_IN_SPS
    1751 , m_bLongTermRefsPresent        (false)
    1752 #endif
    1753 #if !H0566_TLA
    1754 , m_uiNumTlayerSwitchingFlags   (0)
    1755 #endif
    17561697, m_iSliceGranularity           (0)
    17571698, m_iTileBehaviorControlPresentFlag (0)
     
    17591700, m_iColumnRowInfoPresent        (0)
    17601701, m_iUniformSpacingIdr           (0)
    1761 #if !REMOVE_TILE_DEPENDENCE
    1762 , m_iTileBoundaryIndependenceIdr (0)
    1763 #endif
    17641702, m_iNumColumnsMinus1            (0)
    17651703, m_puiColumnWidth               (NULL)
    17661704, m_iNumRowsMinus1               (0)
    17671705, m_puiRowHeight                 (NULL)
    1768 #if !WPP_SIMPLIFICATION
    1769 ,  m_iEntropyCodingSynchro      (0)
    1770 ,  m_bCabacIstateReset          (false)
    1771 #endif
    17721706,  m_iNumSubstreams             (1)
    1773 #if MULTIBITS_DATA_HIDING
    17741707, m_signHideFlag(0)
    17751708, m_signHidingThreshold(0)
    1776 #endif
    17771709#if CABAC_INIT_FLAG
    17781710, m_cabacInitPresentFlag        (false)
     
    17831715#endif
    17841716{
    1785 #if !H0566_TLA
    1786   for ( UInt i = 0; i < MAX_TLAYER; i++ )
    1787   {
    1788     m_abTLayerSwitchingFlag[i] = false;
    1789   }
    1790 #endif
    17911717}
    17921718
     
    18601786
    18611787  m_uiPredDepthMapGeneration = uiPdmGenMode;
    1862 #if HHI_INTER_VIEW_MOTION_PRED
     1788#if H3D_IVMP
    18631789  m_uiMultiviewMvPredMode    = uiPdmMvPredMode;
    18641790#endif
     
    20561982: m_bRefPicListModificationFlagL0 (false)
    20571983, m_bRefPicListModificationFlagL1 (false)
    2058 #if !H0137_0138_LIST_MODIFICATION
    2059 , m_uiNumberOfRefPicListModificationsL0 (0)
    2060 , m_uiNumberOfRefPicListModificationsL1 (0)
    2061 #endif
    2062 {
    2063 #if !H0137_0138_LIST_MODIFICATION
    2064   ::memset( m_ListIdcL0, 0, sizeof(m_ListIdcL0) );
    2065 #endif
     1984{
    20661985  ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) );
    2067 #if !H0137_0138_LIST_MODIFICATION
    2068   ::memset( m_ListIdcL1, 0, sizeof(m_ListIdcL1) );
    2069 #endif
    20701986  ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) );
    20711987}
     
    20811997  m_bSaoEnabled = false;
    20821998  m_pSaoParam = NULL;
    2083 #if LCU_SYNTAX_ALF
    20841999  m_alfParamSet = NULL;
    2085 #else
    2086   m_pAlfParam = NULL;
    2087 #endif
    20882000  m_scalingList = NULL;
    20892001  m_scalingListEnabled = false;
     
    21052017  m_bSaoEnabled = src.m_bSaoEnabled;
    21062018  m_pSaoParam   = src.m_pSaoParam;
    2107 #if LCU_SYNTAX_ALF
    21082019  m_alfParamSet    = src.m_alfParamSet;
    2109 #else
    2110   m_pAlfParam   = src.m_pAlfParam;
    2111 #endif
    21122020  m_scalingList = src.m_scalingList;
    21132021  m_scalingListEnabled = src.m_scalingListEnabled;
    2114 #if SAO_UNIT_INTERLEAVING
    21152022  m_saoInterleavingFlag = src.m_saoInterleavingFlag;
    2116 #endif
    21172023
    21182024  return *this;
     
    21352041Void TComAPS::createAlfParam()
    21362042{
    2137 #if LCU_SYNTAX_ALF
    21382043  m_alfParamSet = new AlfParamSet;
    2139 #else
    2140   m_pAlfParam = new ALFParam;
    2141 #endif
    21422044}
    21432045Void TComAPS::destroyAlfParam()
    21442046{
    2145 #if LCU_SYNTAX_ALF
    21462047  if(m_alfParamSet != NULL)
    21472048  {
     
    21492050    m_alfParamSet = NULL;
    21502051  }
    2151 #else
    2152   if(m_pAlfParam != NULL)
    2153   {
    2154     delete m_pAlfParam;
    2155     m_pAlfParam = NULL;
    2156   }
    2157 #endif
    21582052}
    21592053
     
    21912085 * \returns true if use default quantization matrix in all size
    21922086*/
    2193 #if SCALING_LIST
    21942087Bool TComSlice::checkDefaultScalingList()
    21952088{
     
    22082101  return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32
    22092102}
    2210 #else
    2211 Bool TComSlice::checkDefaultScalingList()
    2212 {
    2213   UInt i;
    2214   Int *dst=0;
    2215   Int *src=0;
    2216   UInt defaultCounter=0;
    2217 
    2218   //4x4
    2219   for(i=0;i<SCALING_LIST_NUM;i++)
    2220   {
    2221     src = (i<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4;
    2222     dst = getScalingList()->getScalingListAddress(SCALING_LIST_4x4,i);
    2223     if(::memcmp(dst,src,sizeof(UInt)*16) == 0) defaultCounter++;
    2224   }
    2225 
    2226   //8x8
    2227   for(i=0;i<SCALING_LIST_NUM;i++)
    2228   {
    2229     src = (i<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
    2230     dst = getScalingList()->getScalingListAddress(SCALING_LIST_8x8,i);
    2231     if(::memcmp(dst,src,sizeof(UInt)*64) == 0) defaultCounter++;
    2232   }
    2233   //16x16
    2234   for(i=0;i<SCALING_LIST_NUM;i++)
    2235   {
    2236     src = (i<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16;
    2237     dst = getScalingList()->getScalingListAddress(SCALING_LIST_16x16,i);
    2238     if(::memcmp(dst,src,sizeof(UInt)*256) == 0) defaultCounter++;
    2239   }
    2240   //32x32
    2241   for(i=0;i<SCALING_LIST_NUM_32x32;i++)
    2242   {
    2243     src = (i<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32;
    2244     dst = getScalingList()->getScalingListAddress(SCALING_LIST_32x32,i*3);
    2245     if(::memcmp(dst,src,sizeof(UInt)*1024) == 0) defaultCounter++;
    2246   }
    2247   return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32
    2248 }
    2249 #endif
    22502103/** get scaling matrix from RefMatrixID
    22512104 * \param sizeId size index
     
    22552108Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId )
    22562109{
    2257 #if SCALING_LIST
    22582110  ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    2259 #else
    2260   ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*g_scalingListSize[sizeId]);
    2261 #endif
    22622111}
    22632112/** parse syntax infomation
     
    22832132  for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++)
    22842133  {
    2285 #if SCALING_LIST
    22862134    size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]);
    2287 #else
    2288     size = g_scalingListSize[sizeIdc];
    2289 #endif
    22902135    for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++)
    22912136    {
     
    23132158        src[i] = data;
    23142159      }
    2315 #if SCALING_LIST
    23162160      //set DC value for default matrix check
    23172161      setScalingListDC(sizeIdc,listIdc,src[0]);
     
    23392183          setScalingListDC(sizeIdc,listIdc,data);
    23402184      }
    2341 #endif
    23422185    }
    23432186  }
     
    23542197    for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++)
    23552198    {
    2356 #if SCALING_LIST
    23572199      m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])];
    2358 #else
    2359       m_scalingListCoef[sizeId][listId] = new Int [g_scalingListSize[sizeId]];
    2360 #endif
    23612200    }
    23622201  }
     
    23912230      src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
    23922231      break;
    2393 #if SCALING_LIST
    23942232    case SCALING_LIST_16x16:
    23952233      src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
     
    23982236      src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
    23992237      break;
    2400 #else
    2401     case SCALING_LIST_16x16:
    2402       src = (listId<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16;
    2403       break;
    2404     case SCALING_LIST_32x32:
    2405       src = (listId<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32;
    2406       break;
    2407 #endif
    24082238    default:
    24092239      assert(0);
     
    24192249Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId)
    24202250{
    2421 #if SCALING_LIST
    24222251  ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    24232252  setUseDefaultScalingMatrixFlag(sizeId,listId,true);
    24242253  setScalingListDC(sizeId,listId,SCALING_LIST_DC);
    2425 #else
    2426   ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*(Int)g_scalingListSize[sizeId]);
    2427 #endif
    2428 }
    2429 #if SCALING_LIST
     2254}
    24302255/** check DC value of matrix for default matrix signaling
    24312256 */
     
    24452270  }
    24462271}
    2447 #endif
    24482272
    24492273ParameterSetManager::ParameterSetManager()
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r210 r296  
    5454class TComDepthMapGenerator;
    5555#endif
    56 #if HHI_INTER_VIEW_RESIDUAL_PRED
     56#if H3D_IVRP
    5757class TComResidualGenerator;
    5858#endif
     
    6868// ====================================================================================================================
    6969
    70 #if RPS_IN_SPS
    7170/// Reference Picture Set class
    7271class TComReferencePictureSet
     
    142141  Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);
    143142};
    144 #endif
    145143
    146144#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
     
    179177  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER];
    180178  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
    181  
     179#if INTER_VIEW_VECTOR_SCALING_C0115
     180  Bool          m_bIVScalingFlag;
     181#endif
    182182public:
    183183  TComVPS();
     
    213213  Void    setDependentLayer(UInt v, UInt layer)                     { m_uiDependentLayer[layer] = v;    }
    214214  UInt    getDependentLayer(UInt layer)                             { return m_uiDependentLayer[layer]; }
     215#endif
     216#if INTER_VIEW_VECTOR_SCALING_C0115
     217  Bool getIVScalingFlag( )                                   { return m_bIVScalingFlag; }
     218  Void setIVScalingFlag(Bool b)                              { m_bIVScalingFlag = b;    }
    215219#endif
    216220  Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
     
    270274  UInt        m_picWidthInLumaSamples;
    271275  UInt        m_picHeightInLumaSamples;
    272 #if PIC_CROPPING
    273276  Bool        m_picCroppingFlag;
    274277  Int         m_picCropLeftOffset;
     
    276279  Int         m_picCropTopOffset;
    277280  Int         m_picCropBottomOffset;
    278 #else
    279   Int         m_aiPad[2];
    280 #endif
    281281  UInt        m_uiMaxCUWidth;
    282282  UInt        m_uiMaxCUHeight;
     
    284284  UInt        m_uiMinTrDepth;
    285285  UInt        m_uiMaxTrDepth;
    286 #if RPS_IN_SPS
    287286  TComRPSList* m_RPSList;
    288287  Bool        m_bLongTermRefsPresent;
    289 #endif
    290 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    291288  Int         m_numReorderPics[MAX_TLAYER];
    292 #else
    293   Int         m_maxNumberOfReferencePictures;
    294   Int         m_numReorderFrames;
    295 #endif
    296289 
    297290  Int         m_iNumberOfUsableInterViewRefs;
     
    309302  Bool        m_useAMP;
    310303  Bool        m_bUseALF;
    311 #if LCU_SYNTAX_ALF
    312304  Bool        m_bALFCoefInSlice;
    313 #endif
    314 #if !PIC_CROPPING
    315   Bool        m_bUsePAD;
    316 #endif
    317305  Bool        m_bUseLMChroma; // JL:
    318306
     
    321309  Bool        m_useNSQT;
    322310 
    323 #if H0412_REF_PIC_LIST_RESTRICTION
    324311  Bool        m_restrictedRefPicListsFlag;
    325312  Bool        m_listsModificationPresentFlag;
    326 #endif
    327313
    328314  // Parameter
     
    330316  UInt        m_uiBitDepth;
    331317  UInt        m_uiBitIncrement;
    332 #if H0736_AVC_STYLE_QP_RANGE
    333318  Int         m_qpBDOffsetY;
    334319  Int         m_qpBDOffsetC;
    335 #endif
    336320
    337321#if LOSSLESS_CODING
     
    375359
    376360  Bool        m_scalingListEnabledFlag;
    377 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    378361  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER];
    379362  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
    380 #else
    381   UInt        m_uiMaxDecFrameBuffering;
    382   UInt        m_uiMaxLatencyIncrease;
    383 #endif
    384363
    385364  Bool        m_useDF;
    386365
    387 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    388366  UInt        m_tilesOrEntropyCodingSyncIdc;
    389367  Int         m_numSubstreams;
    390 #endif
    391368
    392369#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    409386#endif
    410387
    411 #if HHI_INTER_VIEW_MOTION_PRED
     388#if H3D_IVMP
    412389  UInt  m_uiMultiviewMvPredMode;
    413390#endif
    414 #if HHI_INTER_VIEW_RESIDUAL_PRED
     391#if H3D_IVRP
    415392  UInt  m_uiMultiviewResPredMode;
    416393#endif
     
    419396  TComDepthMapGenerator* m_pcDepthMapGenerator;
    420397#endif
    421 #if HHI_INTER_VIEW_RESIDUAL_PRED
     398#if H3D_IVRP
    422399  TComResidualGenerator* m_pcResidualGenerator;
    423400#endif
     
    446423  UInt getPicHeightInLumaSamples      ()         { return  m_picHeightInLumaSamples;   }
    447424
    448 #if PIC_CROPPING
    449425  Bool getPicCroppingFlag() const          { return m_picCroppingFlag; }
    450426  Void setPicCroppingFlag(Bool val)        { m_picCroppingFlag = val; }
     
    457433  Int  getPicCropBottomOffset() const      { return m_picCropBottomOffset; }
    458434  Void setPicCropBottomOffset(Int val)     { m_picCropBottomOffset = val; }
    459 #endif
    460435
    461436  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
     
    489464  UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
    490465  UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
    491 #if !PIC_CROPPING
    492   Void setPad         (Int iPad[2]) { m_aiPad[0] = iPad[0]; m_aiPad[1] = iPad[1]; }
    493 #endif
    494 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    495466  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
    496467  Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
    497 #else
    498   Void setMaxNumberOfReferencePictures( Int u )  { m_maxNumberOfReferencePictures = u;    }
    499   Int  getMaxNumberOfReferencePictures()         { return m_maxNumberOfReferencePictures; }
    500   Void setNumReorderFrames( Int i )              { m_numReorderFrames = i;    }
    501   Int  getNumReorderFrames()                     { return m_numReorderFrames; }
    502 #endif
    503 #if RPS_IN_SPS
    504468  Void      setRPSList( TComRPSList* RPSList )   { m_RPSList = RPSList;       }
    505469  TComRPSList* getRPSList()                      { return m_RPSList;          }
    506470  Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
    507471  Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
    508 #endif
    509472
    510473  Void setNumberOfUsableInterViewRefs( Int number )      { m_iNumberOfUsableInterViewRefs = number;    }
     
    513476  Int  getUsableInterViewRef( Int pos )                  { return m_aiUsableInterViewRefs[pos];        }
    514477
    515 #if !PIC_CROPPING
    516   Void setPadX        ( Int  u ) { m_aiPad[0] = u; }
    517   Void setPadY        ( Int  u ) { m_aiPad[1] = u; }
    518   Int  getPad         ( Int  u ) { assert(u < 2); return m_aiPad[u];}
    519   Int* getPad         ( )        { return m_aiPad; }
    520 #endif
    521478 
    522479  // physical transform
     
    526483  // Tool list
    527484  Bool getUseALF      ()         { return m_bUseALF;        }
    528 #if LCU_SYNTAX_ALF
    529485  Void setUseALFCoefInSlice(Bool b) {m_bALFCoefInSlice = b;}
    530486  Bool getUseALFCoefInSlice()    {return m_bALFCoefInSlice;}
    531 #endif
    532 
    533 #if !PIC_CROPPING
    534   Bool getUsePAD      ()         { return m_bUsePAD;        }
    535   Void setUsePAD      ( Bool b ) { m_bUsePAD   = b;         }
    536 #endif
     487
    537488  Void setUseALF      ( Bool b ) { m_bUseALF  = b;          }
    538489  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
     
    551502  Void setUseNSQT( Bool b ) { m_useNSQT = b; }
    552503 
    553 #if H0412_REF_PIC_LIST_RESTRICTION
    554504  Bool getRestrictedRefPicListsFlag    ()          { return m_restrictedRefPicListsFlag;   }
    555505  Void setRestrictedRefPicListsFlag    ( Bool b )  { m_restrictedRefPicListsFlag = b;      }
    556506  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
    557507  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
    558 #endif
    559508
    560509  // AMVP mode (for each depth)
     
    571520  UInt      getBitIncrement ()         { return m_uiBitIncrement; }
    572521  Void      setBitIncrement ( UInt u ) { m_uiBitIncrement = u;    }
    573 #if H0736_AVC_STYLE_QP_RANGE
    574522  Int       getQpBDOffsetY  ()             { return m_qpBDOffsetY;   }
    575523  Void      setQpBDOffsetY  ( Int value  ) { m_qpBDOffsetY = value;  }
    576524  Int       getQpBDOffsetC  ()             { return m_qpBDOffsetC;   }
    577525  Void      setQpBDOffsetC  ( Int value  ) { m_qpBDOffsetC = value;  }
    578 #endif
    579526
    580527  Void      setLFCrossSliceBoundaryFlag     ( Bool   bValue  )    { m_bLFCrossSliceBoundaryFlag = bValue; }
     
    619566  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
    620567  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
    621 #if !REMOVE_TILE_DEPENDENCE
    622   Void     setTileBoundaryIndependenceIdr   ( Int i )           { m_iTileBoundaryIndependenceIdr = i; }
    623   Int      getTileBoundaryIndependenceIdr   ()                  { return m_iTileBoundaryIndependenceIdr; }
    624 #endif
    625568  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
    626569  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
     
    655598  Bool getScalingListFlag       ()         { return m_scalingListEnabledFlag;     }
    656599  Void setScalingListFlag       ( Bool b ) { m_scalingListEnabledFlag  = b;       }
    657 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    658600  UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
    659601  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
    660602  UInt getMaxLatencyIncrease  (UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
    661603  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
    662 #else
    663   UInt getMaxDecFrameBuffering  ()            { return m_uiMaxDecFrameBuffering; }
    664   Void setMaxDecFrameBuffering  ( UInt ui )   { m_uiMaxDecFrameBuffering = ui;   }
    665   UInt getMaxLatencyIncrease    ()            { return m_uiMaxLatencyIncrease;   }
    666   Void setMaxLatencyIncrease    ( UInt ui )   { m_uiMaxLatencyIncrease= ui;      }
    667 #endif
    668 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    669604  UInt getTilesOrEntropyCodingSyncIdc ()                    { return m_tilesOrEntropyCodingSyncIdc;   }
    670605  Void setTilesOrEntropyCodingSyncIdc ( UInt val )          { m_tilesOrEntropyCodingSyncIdc = val;    }
    671606  Int  getNumSubstreams               ()                    { return m_numSubstreams;                 }
    672607  Void setNumSubstreams               ( Int numSubstreams ) { m_numSubstreams = numSubstreams;        }
    673 #endif
    674608
    675609#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    705639  Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 );
    706640#endif
    707 #if HHI_INTER_VIEW_RESIDUAL_PRED
     641#if H3D_IVRP
    708642  Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
    709643#endif
     
    716650#endif
    717651
    718 #if HHI_INTER_VIEW_MOTION_PRED
     652#if H3D_IVMP
    719653  UInt  getMultiviewMvPredMode   ()          { return m_uiMultiviewMvPredMode;    }
    720654#endif
    721 #if HHI_INTER_VIEW_RESIDUAL_PRED
     655#if H3D_IVRP
    722656  UInt  getMultiviewResPredMode  ()          { return m_uiMultiviewResPredMode;   }
    723657#endif
     
    727661  TComDepthMapGenerator*  getDepthMapGenerator()                                              { return m_pcDepthMapGenerator; }
    728662#endif
    729 #if HHI_INTER_VIEW_RESIDUAL_PRED
     663#if H3D_IVRP
    730664  Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
    731665  TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
     
    733667};
    734668
    735 #if !RPS_IN_SPS
    736 /// Reference Picture Set class
    737 class TComReferencePictureSet
    738 {
    739 private:
    740   Int m_numberOfPictures;
    741   Int m_numberOfNegativePictures;
    742   Int m_numberOfPositivePictures;
    743   Int m_numberOfLongtermPictures;
    744   Int  m_deltaPOC[MAX_NUM_REF_PICS];
    745   Int  m_POC[MAX_NUM_REF_PICS];
    746   Bool m_used[MAX_NUM_REF_PICS];
    747   Bool m_interRPSPrediction;
    748   Int  m_deltaRIdxMinus1;   
    749   Int  m_deltaRPS;
    750   Int  m_numRefIdc;
    751   Int  m_refIdc[MAX_NUM_REF_PICS+1];
    752 
    753 public:
    754   TComReferencePictureSet();
    755   virtual ~TComReferencePictureSet();
    756 
    757   Void setUsed(Int bufferNum, Bool used);
    758   Void setDeltaPOC(Int bufferNum, Int deltaPOC);
    759   Void setPOC(Int bufferNum, Int deltaPOC);
    760   Void setNumberOfPictures(Int numberOfPictures);
    761 
    762   Int  getUsed(Int bufferNum);
    763   Int  getDeltaPOC(Int bufferNum);
    764   Int  getPOC(Int bufferNum);
    765   Int  getNumberOfPictures();
    766 
    767   Void setNumberOfNegativePictures(Int number)  { m_numberOfNegativePictures = number; }
    768   Int  getNumberOfNegativePictures()            { return m_numberOfNegativePictures; }
    769   Void setNumberOfPositivePictures(Int number)  { m_numberOfPositivePictures = number; }
    770   Int  getNumberOfPositivePictures()            { return m_numberOfPositivePictures; }
    771   Void setNumberOfLongtermPictures(Int number)  { m_numberOfLongtermPictures = number; }
    772   Int  getNumberOfLongtermPictures()            { return m_numberOfLongtermPictures; }
    773 
    774   Void setInterRPSPrediction(Bool flag)         { m_interRPSPrediction = flag; }
    775   Bool getInterRPSPrediction()                  { return m_interRPSPrediction; }
    776   Void setDeltaRIdxMinus1(Int x)                { m_deltaRIdxMinus1 = x; }
    777   Int  getDeltaRIdxMinus1()                     { return m_deltaRIdxMinus1; }
    778   Void setDeltaRPS(Int x)                       { m_deltaRPS = x; }
    779   Int  getDeltaRPS()                            { return m_deltaRPS; }
    780   Void setNumRefIdc(Int x)                      { m_numRefIdc = x; }
    781   Int  getNumRefIdc()                           { return m_numRefIdc; }
    782 
    783   Void setRefIdc(Int bufferNum, Int refIdc);
    784   Int  getRefIdc(Int bufferNum);
    785 
    786   Void sortDeltaPOC();
    787   Void printDeltaPOC();
    788 };
    789 
    790 /// Reference Picture Set set class
    791 class TComRPSList
    792 {
    793 private:
    794   Int  m_numberOfReferencePictureSets;
    795   TComReferencePictureSet* m_referencePictureSets;
    796  
    797 public:
    798   TComRPSList();
    799   virtual ~TComRPSList();
    800  
    801   Void  create  (Int numberOfEntries);
    802   Void  destroy ();
    803 
    804 
    805   TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum);
    806   Int getNumberOfReferencePictureSets();
    807   Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);
    808 };
    809 #endif
    810669
    811670/// Reference Picture Lists class
     
    815674  UInt      m_bRefPicListModificationFlagL0; 
    816675  UInt      m_bRefPicListModificationFlagL1; 
    817 #if !H0137_0138_LIST_MODIFICATION
    818   UInt      m_uiNumberOfRefPicListModificationsL0;
    819   UInt      m_uiNumberOfRefPicListModificationsL1;
    820   UInt      m_ListIdcL0[32];
    821 #endif
    822676  UInt      m_RefPicSetIdxL0[32];
    823 #if !H0137_0138_LIST_MODIFICATION
    824   UInt      m_ListIdcL1[32];
    825 #endif
    826677  UInt      m_RefPicSetIdxL1[32];
    827678   
     
    837688  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
    838689  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
    839 #if !H0137_0138_LIST_MODIFICATION
    840   UInt       getNumberOfRefPicListModificationsL0() { return m_uiNumberOfRefPicListModificationsL0; }
    841   Void       setNumberOfRefPicListModificationsL0(UInt nr) { m_uiNumberOfRefPicListModificationsL0 = nr; }
    842   UInt       getNumberOfRefPicListModificationsL1() { return m_uiNumberOfRefPicListModificationsL1; }
    843   Void       setNumberOfRefPicListModificationsL1(UInt nr) { m_uiNumberOfRefPicListModificationsL1 = nr; }
    844   Void       setListIdcL0(UInt idx, UInt idc) { m_ListIdcL0[idx] = idc; }
    845   UInt       getListIdcL0(UInt idx) { return m_ListIdcL0[idx]; }
    846 #endif
    847690  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
    848691  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
    849 #if !H0137_0138_LIST_MODIFICATION
    850   Void       setListIdcL1(UInt idx, UInt idc) { m_ListIdcL1[idx] = idc; }
    851   UInt       getListIdcL1(UInt idx) { return m_ListIdcL1[idx]; }
    852 #endif
    853692  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
    854693  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
     
    867706  // access channel
    868707  TComSPS*    m_pcSPS;
    869 #if !RPS_IN_SPS
    870   TComRPSList* m_RPSList;
    871 #endif
    872708  UInt        m_uiMaxCuDQPDepth;
    873709  UInt        m_uiMinCuDQPSize;
     
    876712  Int        m_iChromaQpOffset2nd;
    877713
    878 #if !RPS_IN_SPS
    879   Bool        m_bLongTermRefsPresent;
    880 #endif
    881 
    882 #if !H0566_TLA
    883   UInt        m_uiNumTlayerSwitchingFlags;            // num_temporal_layer_switching_point_flags
    884   Bool        m_abTLayerSwitchingFlag[ MAX_TLAYER ];  // temporal_layer_switching_point_flag
    885 #endif
     714
    886715
    887716  Int         m_iSliceGranularity;
     
    890719  UInt        m_uiBiPredIdc;              // Use of Weighting Bi-Prediction (B_SLICE)
    891720
    892 #if H0388
    893721  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
    894 #endif
    895722
    896723  Int      m_iTileBehaviorControlPresentFlag;
     
    898725  Int      m_iColumnRowInfoPresent;
    899726  Int      m_iUniformSpacingIdr;
    900 #if !REMOVE_TILE_DEPENDENCE
    901   Int      m_iTileBoundaryIndependenceIdr;
    902 #endif
    903727  Int      m_iNumColumnsMinus1;
    904728  UInt*    m_puiColumnWidth;
     
    907731 
    908732  Int      m_iEntropyCodingMode; // !!! in PPS now, but also remains in slice header!
    909 #if !WPP_SIMPLIFICATION 
    910   Int      m_iEntropyCodingSynchro;
    911   Bool     m_bCabacIstateReset;
    912 #endif
    913733  Int      m_iNumSubstreams;
    914734
    915735  Bool     m_enableTMVPFlag;
    916736
    917 #if MULTIBITS_DATA_HIDING
    918737  Int      m_signHideFlag;
    919738  Int      m_signHidingThreshold;
    920 #endif
    921739
    922740#if CABAC_INIT_FLAG
     
    927745#endif
    928746#endif
    929 #if DBL_CONTROL
    930747  Bool     m_DeblockingFilterControlPresent;
    931 #endif
    932 #if PARALLEL_MERGE
    933748  UInt m_log2ParallelMergeLevelMinus2;
    934 #endif
    935749public:
    936750  TComPPS();
     
    951765  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
    952766
    953 #if !H0566_TLA
    954   UInt      getNumTLayerSwitchingFlags()                                  { return m_uiNumTlayerSwitchingFlags; }
    955   Void      setNumTLayerSwitchingFlags( UInt uiNumTlayerSwitchingFlags )  { assert( uiNumTlayerSwitchingFlags < MAX_TLAYER ); m_uiNumTlayerSwitchingFlags = uiNumTlayerSwitchingFlags; }
    956 
    957   Bool      getTLayerSwitchingFlag( UInt uiTLayer )                       { assert( uiTLayer < MAX_TLAYER ); return m_abTLayerSwitchingFlag[ uiTLayer ]; }
    958   Void      setTLayerSwitchingFlag( UInt uiTLayer, Bool bValue )          { m_abTLayerSwitchingFlag[ uiTLayer ] = bValue; }
    959 #endif
    960 
    961 #if !RPS_IN_SPS
    962   Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
    963   Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
    964 #endif
     767
    965768  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
    966769  TComSPS*  getSPS              ()         { return m_pcSPS;          }
    967 #if !RPS_IN_SPS
    968   Void      setRPSList          ( TComRPSList* RPSList ) { m_RPSList = RPSList; }
    969   TComRPSList* getRPSList       ()         { return m_RPSList;        }
    970 #endif
    971770  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
    972771  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
     
    985784  Void setWPBiPredIdc               ( UInt u )  { m_uiBiPredIdc = u;        }
    986785
    987 #if H0388
    988786  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
    989787  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
    990 #endif
    991788
    992789  Void    setTileBehaviorControlPresentFlag        ( Int i )             { m_iTileBehaviorControlPresentFlag = i;    }
     
    998795  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
    999796  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
    1000 #if !REMOVE_TILE_DEPENDENCE
    1001   Void     setTileBoundaryIndependenceIdr   ( Int i )           { m_iTileBoundaryIndependenceIdr = i; }
    1002   Int      getTileBoundaryIndependenceIdr   ()                  { return m_iTileBoundaryIndependenceIdr; }
    1003 #endif
    1004797  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
    1005798  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
     
    1034827  Void     setEntropyCodingMode(Int iEntropyCodingMode)       { m_iEntropyCodingMode = iEntropyCodingMode; }
    1035828  Int      getEntropyCodingMode()                             { return m_iEntropyCodingMode; }
    1036 #if !WPP_SIMPLIFICATION
    1037   Void     setEntropyCodingSynchro(Int iEntropyCodingSynchro) { m_iEntropyCodingSynchro = iEntropyCodingSynchro; }
    1038   Int      getEntropyCodingSynchro()                          { return m_iEntropyCodingSynchro; }
    1039   Void     setCabacIstateReset(Bool bCabacIstateReset)        { m_bCabacIstateReset = bCabacIstateReset; }
    1040   Bool     getCabacIstateReset()                              { return m_bCabacIstateReset; }
    1041 #endif
    1042829  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
    1043830  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
    1044831
    1045 #if MULTIBITS_DATA_HIDING
    1046832  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
    1047833  Void      setTSIG( Int tsig )                 { m_signHidingThreshold = tsig; }
    1048834  Int       getSignHideFlag()                    { return m_signHideFlag; }
    1049835  Int       getTSIG()                            { return m_signHidingThreshold; }
    1050 #endif
    1051836
    1052837  Void     setEnableTMVPFlag( Bool b )  { m_enableTMVPFlag = b;    }
     
    1063848#endif
    1064849#endif
    1065 #if DBL_CONTROL
    1066850  Void setDeblockingFilterControlPresent    ( Bool bValue )       { m_DeblockingFilterControlPresent = bValue; }
    1067851  Bool getDeblockingFilterControlPresent    ()                    { return m_DeblockingFilterControlPresent; }
    1068 #endif
    1069 #if PARALLEL_MERGE
    1070852  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
    1071853  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
    1072 #endif
    1073854};
    1074855
     
    1087868  Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
    1088869  Void     processDefaultMarix            (UInt sizeId, UInt listId);
    1089 #if SCALING_LIST
    1090870  Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
    1091871  Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
     
    1093873  Void     setUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId, Bool b)   { m_useDefaultScalingMatrixFlag[sizeId][listId] = b;    } //!< set default matrix enabled/disabled in each matrix
    1094874  Bool     getUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId)           { return m_useDefaultScalingMatrixFlag[sizeId][listId]; } //!< get default matrix enabled/disabled in each matrix
    1095 #endif
    1096875  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
    1097876  Bool     xParseScalingList              (char* pchFile);
     
    1100879  Void     init                    ();
    1101880  Void     destroy                 ();
    1102 #if SCALING_LIST
    1103881  Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
    1104882  Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
    1105 #endif
    1106883  UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
    1107884  Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
     
    1124901  Bool      getAlfEnabled ()          {return m_bAlfEnabled;     }  //!< get ALF enabled/disabled in APS
    1125902
    1126 #if LCU_SYNTAX_ALF
    1127903  AlfParamSet* getAlfParam   ()          {return m_alfParamSet;}
    1128 #else
    1129   ALFParam* getAlfParam   ()          {return m_pAlfParam;       }  //!< get ALF parameters in APS
    1130 #endif
    1131904  SAOParam* getSaoParam   ()          {return m_pSaoParam;       }  //!< get SAO parameters in APS
    1132905
     
    1151924  Bool      getScalingListEnabled ()          { return m_scalingListEnabled; }  //!< get ScalingList enabled/disabled in APS
    1152925  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in APS
    1153 #if SAO_UNIT_INTERLEAVING
    1154926  Bool     getSaoInterleavingFlag() {return m_saoInterleavingFlag;}             //!< get SAO interleaving flag in APS
    1155927  Void     setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;}    //!< set SAO interleaving flag in APS
    1156 #endif
    1157928
    1158929private:
     
    1161932  Bool        m_bAlfEnabled;  //!< ALF enabled/disabled in APS (true for enabled)
    1162933  SAOParam*   m_pSaoParam;    //!< SAO parameter object pointer
    1163 #if LCU_SYNTAX_ALF
    1164934  AlfParamSet*   m_alfParamSet;
    1165 #else
    1166   ALFParam*   m_pAlfParam;    //!< ALF parameter object pointer
    1167 #endif
    1168935  Bool        m_loopFilterOffsetInAPS;       //< offset for deblocking filter in 0 = slice header, 1 = APS
    1169936  Bool        m_loopFilterDisable;           //< Deblocking filter enabled/disabled in APS
     
    1172939  Bool        m_scalingListEnabled;     //!< ScalingList enabled/disabled in APS (true for enabled)
    1173940  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
    1174 #if SAO_UNIT_INTERLEAVING
    1175941  Bool        m_saoInterleavingFlag;    //!< SAO interleaving flag
    1176 #endif
    1177942
    1178943public:
     
    1206971  bool       m_alfEnabledFlag;
    1207972  bool       m_saoEnabledFlag;
    1208 #if SAO_UNIT_INTERLEAVING
    1209973  bool       m_saoInterleavingFlag;   ///< SAO interleaving flag
    1210974  bool       m_saoEnabledFlagCb;      ///< SAO Cb enabled flag
    1211975  bool       m_saoEnabledFlagCr;      ///< SAO Cr enabled flag
    1212 #endif
    1213976  Int         m_iPPSId;               ///< picture parameter set ID
    1214 #if H0388
    1215977  Bool        m_PicOutputFlag;        ///< pic_output_flag
    1216 #endif
    1217978  Int         m_iPOC;
    1218979  Int         m_iLastIDR;
     
    12481009
    12491010  Bool        m_bCheckLDC;
     1011#if QC_TMVP_MRG_REFIDX_C0047
     1012  Int         m_aiNewRefIdx    [2];
     1013#endif
    12501014
    12511015  //  Data
     
    12651029#endif
    12661030#if QC_IV_AS_LT_B0046
    1267   Bool                  m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture
     1031  Bool        m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture
    12681032#endif
    12691033  TComSPS*    m_pcSPS;
     
    13281092#endif
    13291093
    1330 #if H0111_MVD_L1_ZERO
    13311094  Bool       m_bLMvdL1Zero;
    1332 #endif
    1333 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    13341095  Int         m_numEntryPointOffsets;
    1335 #endif
    13361096
    13371097  Int        m_viewId;
     
    13401100  Int        m_aaiCodedOffset[2][MAX_VIEW_NUM];
    13411101
    1342 #if SONY_COLPIC_AVAILABILITY|QC_MVHEVC_B0046
    1343   Int         m_iViewOrderIdx;
    1344 #endif
    13451102#if LGE_ILLUCOMP_B0045
    13461103  Bool        m_bApplyIC;
     1104#endif
     1105#if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046
     1106  Bool       m_bIVScalingFlag;
     1107  Int        m_iViewOrderIdx;    // will be changed to view_id
     1108#endif
     1109
     1110#if MERL_VSP_C0152
     1111  TComPic*     m_apcRefPicBaseTxt;
     1112  TComPic*     m_apcRefPicBaseDepth;
     1113  Int*         m_aiShiftLUT;
     1114  Int          m_iShiftPrec;
    13471115#endif
    13481116
     
    13801148  Void      setAPSId        ( Int Id)          { m_iAPSId =Id;    } //!< set APS ID
    13811149  Int       getAPSId        ()                 { return m_iAPSId; } //!< get APS ID
    1382 #if H0388
    13831150  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
    13841151  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
    1385 #endif
    13861152  Void      setAlfEnabledFlag(Bool s) {m_alfEnabledFlag =s; }
    13871153  Bool      getAlfEnabledFlag() { return m_alfEnabledFlag; }
    13881154  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
    13891155  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
    1390 #if SAO_UNIT_INTERLEAVING
    13911156  Void      setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag
    13921157  Bool      getSaoInterleavingFlag() { return m_saoInterleavingFlag;  } //!< get SAO interleaving flag
     
    13951160  Void      setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; }       //!< set SAO Cr enabled flag
    13961161  Bool      getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; }        //!< get SAO Cr enabled flag
    1397 #endif
    13981162  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
    13991163  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
     
    14301194  Int       getRefViewId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefViewIdList[e][iRefIdx]; }
    14311195  TComPic*  getTexturePic       () const                        { return  m_pcTexturePic; }
    1432 #if SONY_COLPIC_AVAILABILITY
    1433   Int       getViewOrderIdx     ()                                  { return  m_iViewOrderIdx;              }
    1434 #endif
    14351196  Int       getDepth            ()                              { return  m_iDepth;                     }
    14361197  UInt      getColDir           ()                              { return  m_uiColDir;                   }
     
    14401201#endif
    14411202  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
    1442 #if H0111_MVD_L1_ZERO
    14431203  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    1444 #endif
    14451204  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
    14461205  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
     
    14821241  Void      setRefViewId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefViewIdList[e][iRefIdx] = i; }
    14831242  Void      setTexturePic       ( TComPic *pcTexturePic )       { m_pcTexturePic = pcTexturePic; }
    1484 #if SONY_COLPIC_AVAILABILITY
    1485   Void      setViewOrderIdx     ( Int i )                       { m_iViewOrderIdx     = i;      }
    1486 #endif
    14871243  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
    14881244  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
     
    14991255#endif
    15001256  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
    1501 #if H0111_MVD_L1_ZERO
    15021257  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
    1503 #endif 
    15041258
    15051259  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
     
    15391293  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
    15401294
    1541 #if !H0566_TLA
    1542   Bool getTLayerSwitchingFlag()                            { return m_bTLayerSwitchingFlag;          }
    1543   Void setTLayerSwitchingFlag( Bool bValue )               { m_bTLayerSwitchingFlag = bValue;        }
    1544 #endif
    15451295
    15461296  Void setTLayerInfo( UInt uiTLayer );
    15471297  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum );
    15481298  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
    1549 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS
     1299#if H0566_TLA_SET_FOR_SWITCHING_POINTS
    15501300  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
    15511301#endif
    1552 #if START_DECODING_AT_CRA
    15531302  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess = 0);
    1554 #else
    1555   Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag);
    1556 #endif
    15571303  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
    15581304
     
    16281374  Int       getCABACinitIDC()         {return m_cabacInitIdc;    }  //!< get CABAC initial IDC number
    16291375#endif
    1630 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    16311376  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
    16321377  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
    1633 #endif
    16341378
    16351379  Void setViewId( Int viewId )       { m_viewId = viewId;   }
     
    16531397  Bool      getApplyIC            ()  { return m_bApplyIC; }
    16541398  Void      xSetApplyIC           ();
     1399#endif
     1400#if QC_TMVP_MRG_REFIDX_C0047
     1401  Int       getNewRefIdx        ( RefPicList e )                { return  m_aiNewRefIdx[e];     }
     1402  Void      setNewRefIdx        ( RefPicList e, Int i )         { m_aiNewRefIdx[e]    = i;      }
     1403#endif
     1404#if INTER_VIEW_VECTOR_SCALING_C0115
     1405  Void setIVScalingFlag( Bool val )         { m_bIVScalingFlag = val;     }
     1406  Bool getIVScalingFlag()                   { return m_bIVScalingFlag;    }
     1407  Void setViewOrderIdx     ( Int i )        { m_iViewOrderIdx     = i;    }   // will be changed to view_id
     1408  Int  getViewOrderIdx     ()               { return  m_iViewOrderIdx;    }   // will be changed to view_id
     1409#endif
     1410
     1411#if MERL_VSP_C0152
     1412  TComPic*     getRefPicBaseTxt          ()                        { return  m_apcRefPicBaseTxt; }
     1413  Void         setRefPicBaseTxt          ( TComPic* RefPic)        { m_apcRefPicBaseTxt = RefPic; }
     1414  TComPic*     getRefPicBaseDepth        ()                        { return  m_apcRefPicBaseDepth; }
     1415  Void         setRefPicBaseDepth        ( TComPic* RefPic)        { m_apcRefPicBaseDepth = RefPic; }
     1416
     1417  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
     1418  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; }
    16551419#endif
    16561420
  • trunk/source/Lib/TLibCommon/TComTrQuant.cpp

    r56 r296  
    180180
    181181
    182 #if H0736_AVC_STYLE_QP_RANGE
    183182/** Set qP for Quantization.
    184183 * \param qpy QPy
     
    214213  m_cQP.setQpParam( qpScaled, bLowpass, eSliceType );
    215214}
    216 #else
    217 /// Including Chroma QP Parameter setting
    218 Void TComTrQuant::setQPforQuant( Int iQP, Bool bLowpass, SliceType eSliceType, TextType eTxtType, Int Shift)
    219 {
    220   iQP = Clip3( MIN_QP, MAX_QP, iQP + Shift );
    221  
    222   if(eTxtType != TEXT_LUMA) //Chroma
    223   {
    224     iQP  = g_aucChromaScale[ iQP ];
    225   }
    226  
    227   m_cQP.setQpParam( iQP, bLowpass, eSliceType );
    228 }
    229 #endif
    230215
    231216#if MATRIX_MULT
     
    421406 *  \param shift specifies right shift after 1D transform
    422407 */
    423 #if !UNIFIED_TRANSFORM
    424 void partialButterfly4(short src[4][4],short dst[4][4],int shift)
    425 {
    426   int j; 
    427   int E[2],O[2];
    428   int add = 1<<(shift-1);
    429 
    430   for (j=0; j<4; j++)
    431   {   
    432     /* E and O */
    433     E[0] = src[j][0] + src[j][3];
    434     O[0] = src[j][0] - src[j][3];
    435     E[1] = src[j][1] + src[j][2];
    436     O[1] = src[j][1] - src[j][2];
    437 
    438     dst[0][j] = (g_aiT4[0][0]*E[0] + g_aiT4[0][1]*E[1] + add)>>shift;
    439     dst[2][j] = (g_aiT4[2][0]*E[0] + g_aiT4[2][1]*E[1] + add)>>shift;
    440     dst[1][j] = (g_aiT4[1][0]*O[0] + g_aiT4[1][1]*O[1] + add)>>shift;
    441     dst[3][j] = (g_aiT4[3][0]*O[0] + g_aiT4[3][1]*O[1] + add)>>shift;
    442   }
    443 }
    444 #endif
    445408
    446409void partialButterfly4(short *src,short *dst,int shift, int line)
     
    470433// Fast DST Algorithm. Full matrix multiplication for DST and Fast DST algorithm
    471434// give identical results
    472 #if UNIFIED_TRANSFORM
    473435void fastForwardDst(short *block,short *coeff,int shift)  // input block, output coeff
    474 #else
    475 void fastForwardDst(short block[4][4],short coeff[4][4],int shift)  // input block, output coeff
    476 #endif
    477436{
    478437  int i, c[4];
     
    481440  {
    482441    // Intermediate Variables
    483 #if UNIFIED_TRANSFORM
    484442    c[0] = block[4*i+0] + block[4*i+3];
    485443    c[1] = block[4*i+1] + block[4*i+3];
     
    491449    coeff[ 8+i] =  ( 29 * c[2] + 55 * c[0]         - c[3]               + rnd_factor ) >> shift;
    492450    coeff[12+i] =  ( 55 * c[2] - 29 * c[1]         + c[3]               + rnd_factor ) >> shift;
    493 #else
    494     c[0] = block[i][0] + block[i][3];
    495     c[1] = block[i][1] + block[i][3];
    496     c[2] = block[i][0] - block[i][1];
    497     c[3] = 74* block[i][2];
    498    
    499     coeff[0][i] =  ( 29 * c[0] + 55 * c[1]         + c[3]               + rnd_factor ) >> shift;
    500     coeff[1][i] =  ( 74 * (block[i][0]+ block[i][1] - block[i][3])      + rnd_factor ) >> shift;
    501     coeff[2][i] =  ( 29 * c[2] + 55 * c[0]         - c[3]               + rnd_factor ) >> shift;
    502     coeff[3][i] =  ( 55 * c[2] - 29 * c[1]         + c[3]               + rnd_factor ) >> shift;
    503 #endif
    504   }
    505 }
    506 
    507 #if UNIFIED_TRANSFORM
     451  }
     452}
     453
    508454void fastInverseDst(short *tmp,short *block,int shift)  // input tmp, output block
    509 #else
    510 void fastInverseDst(short tmp[4][4],short block[4][4],int shift)  // input tmp, output block
    511 #endif
    512455{
    513456  int i, c[4];
     
    516459  { 
    517460    // Intermediate Variables
    518 #if UNIFIED_TRANSFORM
    519461    c[0] = tmp[  i] + tmp[ 8+i];
    520462    c[1] = tmp[8+i] + tmp[12+i];
     
    526468    block[4*i+2] = Clip3( -32768, 32767, ( 74 * (tmp[i] - tmp[8+i]  + tmp[12+i])      + rnd_factor ) >> shift );
    527469    block[4*i+3] = Clip3( -32768, 32767, ( 55 * c[0] + 29 * c[2]     - c[3]               + rnd_factor ) >> shift );
    528 #else
    529     c[0] = tmp[0][i] + tmp[2][i];
    530     c[1] = tmp[2][i] + tmp[3][i];
    531     c[2] = tmp[0][i] - tmp[3][i];
    532     c[3] = 74* tmp[1][i];
    533 
    534     block[i][0] = Clip3( -32768, 32767, ( 29 * c[0] + 55 * c[1]     + c[3]               + rnd_factor ) >> shift );
    535     block[i][1] = Clip3( -32768, 32767, ( 55 * c[2] - 29 * c[1]     + c[3]               + rnd_factor ) >> shift );
    536     block[i][2] = Clip3( -32768, 32767, ( 74 * (tmp[0][i] - tmp[2][i]  + tmp[3][i])      + rnd_factor ) >> shift );
    537     block[i][3] = Clip3( -32768, 32767, ( 55 * c[0] + 29 * c[2]     - c[3]               + rnd_factor ) >> shift );
    538 #endif
    539   }
    540 }
    541 #if !UNIFIED_TRANSFORM
    542 /** 4x4 forward transform (2D)
    543  *  \param block input data (residual)
    544  *  \param coeff output data (transform coefficients)
    545  *  \param uiMode is Intra Prediction mode used in Mode-Dependent DCT/DST only
    546  */
    547 void xTr4(short block[4][4],short coeff[4][4],UInt uiMode)
    548 {
    549 #if FULL_NBIT
    550   int shift_1st = 1 + g_uiBitDepth - 8; // log2(4) - 1 + g_uiBitDepth - 8
    551 #else
    552   int shift_1st = 1 + g_uiBitIncrement; // log2(4) - 1 + g_uiBitIncrement
    553 #endif
    554   int shift_2nd = 8;                    // log2(4) + 6
    555   short tmp[4][4];
    556 #if LOGI_INTRA_NAME_3MPM
    557   if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25)))    // Check for DCT or DST
    558 #else
    559   if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode])// Check for DCT or DST
    560 #endif
    561   {
    562     fastForwardDst(block,tmp,shift_1st); // Forward DST BY FAST ALGORITHM, block input, tmp output
    563   }
    564   else 
    565   {
    566     partialButterfly4(block,tmp,shift_1st);
    567   }
    568 
    569 #if LOGI_INTRA_NAME_3MPM
    570   if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34)))    // Check for DCT or DST
    571 #else
    572   if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] )   // Check for DCT or DST
    573 #endif
    574   {
    575     fastForwardDst(tmp,coeff,shift_2nd); // Forward DST BY FAST ALGORITHM, tmp input, coeff output
    576   }
    577   else 
    578   {
    579     partialButterfly4(tmp,coeff,shift_2nd);
    580   }   
    581 }
    582 
    583 /** 4x4 inverse transform implemented using partial butterfly structure (1D)
    584  *  \param src   input data (transform coefficients)
    585  *  \param dst   output data (residual)
    586  *  \param shift specifies right shift after 1D transform
    587  */
    588 void partialButterflyInverse4(short src[4][4],short dst[4][4],int shift)
    589 {
    590   int j;   
    591   int E[2],O[2];
    592   int add = 1<<(shift-1);
    593 
    594   for (j=0; j<4; j++)
    595   {   
    596     /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */   
    597     O[0] = g_aiT4[1][0]*src[1][j] + g_aiT4[3][0]*src[3][j];
    598     O[1] = g_aiT4[1][1]*src[1][j] + g_aiT4[3][1]*src[3][j];
    599     E[0] = g_aiT4[0][0]*src[0][j] + g_aiT4[2][0]*src[2][j];
    600     E[1] = g_aiT4[0][1]*src[0][j] + g_aiT4[2][1]*src[2][j];
    601    
    602     /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
    603     dst[j][0] = Clip3( -32768, 32767, (E[0] + O[0] + add)>>shift );
    604     dst[j][1] = Clip3( -32768, 32767, (E[1] + O[1] + add)>>shift );
    605     dst[j][2] = Clip3( -32768, 32767, (E[1] - O[1] + add)>>shift );
    606     dst[j][3] = Clip3( -32768, 32767, (E[0] - O[0] + add)>>shift );
    607   }
    608 }
    609 #endif
     470  }
     471}
    610472
    611473void partialButterflyInverse4(short *src,short *dst,int shift, int line)
     
    634496}
    635497
    636 #if !UNIFIED_TRANSFORM
    637 /** 4x4 inverse transform (2D)
    638  *  \param coeff input data (transform coefficients)
    639  *  \param block output data (residual)
    640  *  \param uiMode is Intra Prediction mode used in Mode-Dependent DCT/DST only
    641  */
    642 void xITr4(short coeff[4][4],short block[4][4], UInt uiMode)
    643 {
    644   int shift_1st = SHIFT_INV_1ST;
    645 #if FULL_NBIT
    646   int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);
    647 #else
    648   int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;
    649 #endif
    650   short tmp[4][4];
    651  
    652 #if LOGI_INTRA_NAME_3MPM
    653   if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34)))    // Check for DCT or DST
    654 #else
    655   if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] )    // Check for DCT or DST
    656 #endif
    657   {
    658     fastInverseDst(coeff,tmp,shift_1st);    // Inverse DST by FAST Algorithm, coeff input, tmp output
    659   }
    660   else
    661   {
    662     partialButterflyInverse4(coeff,tmp,shift_1st);   
    663   }
    664 #if LOGI_INTRA_NAME_3MPM
    665   if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25)))    // Check for DCT or DST
    666 #else
    667   if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode] )    // Check for DCT or DST
    668 #endif
    669   {
    670     fastInverseDst(tmp,block,shift_2nd); // Inverse DST by FAST Algorithm, tmp input, coeff output
    671   }
    672   else
    673   {
    674     partialButterflyInverse4(tmp,block,shift_2nd);
    675   }   
    676 }
    677 
    678 /** 8x8 forward transform implemented using partial butterfly structure (1D)
    679  *  \param src   input data (residual)
    680  *  \param dst   output data (transform coefficients)
    681  *  \param shift specifies right shift after 1D transform
    682  */
    683 void partialButterfly8(short src[8][8],short dst[8][8],int shift)
    684 {
    685   int j,k; 
    686   int E[4],O[4];
    687   int EE[2],EO[2];
    688   int add = 1<<(shift-1);
    689 
    690   for (j=0; j<8; j++)
    691   {   
    692     /* E and O*/
    693     for (k=0;k<4;k++)
    694     {
    695       E[k] = src[j][k] + src[j][7-k];
    696       O[k] = src[j][k] - src[j][7-k];
    697     }   
    698     /* EE and EO */
    699     EE[0] = E[0] + E[3];   
    700     EO[0] = E[0] - E[3];
    701     EE[1] = E[1] + E[2];
    702     EO[1] = E[1] - E[2];
    703 
    704     dst[0][j] = (g_aiT8[0][0]*EE[0] + g_aiT8[0][1]*EE[1] + add)>>shift;
    705     dst[4][j] = (g_aiT8[4][0]*EE[0] + g_aiT8[4][1]*EE[1] + add)>>shift;
    706     dst[2][j] = (g_aiT8[2][0]*EO[0] + g_aiT8[2][1]*EO[1] + add)>>shift;
    707     dst[6][j] = (g_aiT8[6][0]*EO[0] + g_aiT8[6][1]*EO[1] + add)>>shift;
    708 
    709     dst[1][j] = (g_aiT8[1][0]*O[0] + g_aiT8[1][1]*O[1] + g_aiT8[1][2]*O[2] + g_aiT8[1][3]*O[3] + add)>>shift;
    710     dst[3][j] = (g_aiT8[3][0]*O[0] + g_aiT8[3][1]*O[1] + g_aiT8[3][2]*O[2] + g_aiT8[3][3]*O[3] + add)>>shift;
    711     dst[5][j] = (g_aiT8[5][0]*O[0] + g_aiT8[5][1]*O[1] + g_aiT8[5][2]*O[2] + g_aiT8[5][3]*O[3] + add)>>shift;
    712     dst[7][j] = (g_aiT8[7][0]*O[0] + g_aiT8[7][1]*O[1] + g_aiT8[7][2]*O[2] + g_aiT8[7][3]*O[3] + add)>>shift;
    713   }
    714 }
    715 #endif
    716498
    717499void partialButterfly8(short *src,short *dst,int shift, int line)
     
    751533}
    752534
    753 #if !UNIFIED_TRANSFORM
    754 /** 8x8 forward transform (2D)
    755  *  \param block input data (residual)
    756  *  \param coeff  output data (transform coefficients)
    757  */
    758 void xTr8(short block[8][8],short coeff[8][8])
    759 {
    760 #if FULL_NBIT
    761   int shift_1st = 2 + g_uiBitDepth - 8; // log2(8) - 1 + g_uiBitDepth - 8
    762 #else
    763   int shift_1st = 2 + g_uiBitIncrement; // log2(8) - 1 + g_uiBitIncrement
    764 #endif
    765   int shift_2nd = 9;                    // log2(8) + 6
    766   short tmp[8][8];
    767 
    768   partialButterfly8(block,tmp,shift_1st);
    769   partialButterfly8(tmp,coeff,shift_2nd);
    770 }
    771 
    772 /** 8x8 inverse transform implemented using partial butterfly structure (1D)
    773  *  \param src   input data (transform coefficients)
    774  *  \param dst   output data (residual)
    775  *  \param shift specifies right shift after 1D transform
    776  */
    777 void partialButterflyInverse8(short src[8][8],short dst[8][8],int shift)
     535
     536void partialButterflyInverse8(short *src,short *dst,int shift, int line)
    778537{
    779538  int j,k;   
     
    782541  int add = 1<<(shift-1);
    783542
    784   for (j=0; j<8; j++)
     543  for (j=0; j<line; j++)
    785544  {   
    786545    /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
    787546    for (k=0;k<4;k++)
    788547    {
    789       O[k] = g_aiT8[ 1][k]*src[ 1][j] + g_aiT8[ 3][k]*src[ 3][j] + g_aiT8[ 5][k]*src[ 5][j] + g_aiT8[ 7][k]*src[ 7][j];
    790     }
    791    
    792     EO[0] = g_aiT8[2][0]*src[2][j] + g_aiT8[6][0]*src[6][j];
    793     EO[1] = g_aiT8[2][1]*src[2][j] + g_aiT8[6][1]*src[6][j];
    794     EE[0] = g_aiT8[0][0]*src[0][j] + g_aiT8[4][0]*src[4][j];
    795     EE[1] = g_aiT8[0][1]*src[0][j] + g_aiT8[4][1]*src[4][j];
     548      O[k] = g_aiT8[ 1][k]*src[line] + g_aiT8[ 3][k]*src[3*line] + g_aiT8[ 5][k]*src[5*line] + g_aiT8[ 7][k]*src[7*line];
     549    }
     550
     551    EO[0] = g_aiT8[2][0]*src[ 2*line ] + g_aiT8[6][0]*src[ 6*line ];
     552    EO[1] = g_aiT8[2][1]*src[ 2*line ] + g_aiT8[6][1]*src[ 6*line ];
     553    EE[0] = g_aiT8[0][0]*src[ 0      ] + g_aiT8[4][0]*src[ 4*line ];
     554    EE[1] = g_aiT8[0][1]*src[ 0      ] + g_aiT8[4][1]*src[ 4*line ];
    796555
    797556    /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
     
    802561    for (k=0;k<4;k++)
    803562    {
    804       dst[j][k]   = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
    805       dst[j][k+4] = Clip3( -32768, 32767, (E[3-k] - O[3-k] + add)>>shift );
    806     }       
    807   }
    808 }
    809 #endif
    810 
    811 void partialButterflyInverse8(short *src,short *dst,int shift, int line)
    812 {
    813   int j,k;   
    814   int E[4],O[4];
    815   int EE[2],EO[2];
    816   int add = 1<<(shift-1);
    817 
    818   for (j=0; j<line; j++)
    819   {   
    820     /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
    821     for (k=0;k<4;k++)
    822     {
    823       O[k] = g_aiT8[ 1][k]*src[line] + g_aiT8[ 3][k]*src[3*line] + g_aiT8[ 5][k]*src[5*line] + g_aiT8[ 7][k]*src[7*line];
    824     }
    825 
    826     EO[0] = g_aiT8[2][0]*src[ 2*line ] + g_aiT8[6][0]*src[ 6*line ];
    827     EO[1] = g_aiT8[2][1]*src[ 2*line ] + g_aiT8[6][1]*src[ 6*line ];
    828     EE[0] = g_aiT8[0][0]*src[ 0      ] + g_aiT8[4][0]*src[ 4*line ];
    829     EE[1] = g_aiT8[0][1]*src[ 0      ] + g_aiT8[4][1]*src[ 4*line ];
    830 
    831     /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
    832     E[0] = EE[0] + EO[0];
    833     E[3] = EE[0] - EO[0];
    834     E[1] = EE[1] + EO[1];
    835     E[2] = EE[1] - EO[1];
    836     for (k=0;k<4;k++)
    837     {
    838563      dst[ k   ] = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
    839564      dst[ k+4 ] = Clip3( -32768, 32767, (E[3-k] - O[3-k] + add)>>shift );
     
    844569}
    845570
    846 #if !UNIFIED_TRANSFORM
    847 /** 8x8 inverse transform (2D)
    848  *  \param coeff input data (transform coefficients)
    849  *  \param block output data (residual)
    850  */
    851 void xITr8(short coeff[8][8],short block[8][8])
     571
     572void partialButterfly16(short *src,short *dst,int shift, int line)
     573{
     574  int j,k;
     575  int E[8],O[8];
     576  int EE[4],EO[4];
     577  int EEE[2],EEO[2];
     578  int add = 1<<(shift-1);
     579
     580  for (j=0; j<line; j++)
     581  {   
     582    /* E and O*/
     583    for (k=0;k<8;k++)
     584    {
     585      E[k] = src[k] + src[15-k];
     586      O[k] = src[k] - src[15-k];
     587    }
     588    /* EE and EO */
     589    for (k=0;k<4;k++)
     590    {
     591      EE[k] = E[k] + E[7-k];
     592      EO[k] = E[k] - E[7-k];
     593    }
     594    /* EEE and EEO */
     595    EEE[0] = EE[0] + EE[3];   
     596    EEO[0] = EE[0] - EE[3];
     597    EEE[1] = EE[1] + EE[2];
     598    EEO[1] = EE[1] - EE[2];
     599
     600    dst[ 0      ] = (g_aiT16[ 0][0]*EEE[0] + g_aiT16[ 0][1]*EEE[1] + add)>>shift;       
     601    dst[ 8*line ] = (g_aiT16[ 8][0]*EEE[0] + g_aiT16[ 8][1]*EEE[1] + add)>>shift;   
     602    dst[ 4*line ] = (g_aiT16[ 4][0]*EEO[0] + g_aiT16[ 4][1]*EEO[1] + add)>>shift;       
     603    dst[ 12*line] = (g_aiT16[12][0]*EEO[0] + g_aiT16[12][1]*EEO[1] + add)>>shift;
     604
     605    for (k=2;k<16;k+=4)
     606    {
     607      dst[ k*line ] = (g_aiT16[k][0]*EO[0] + g_aiT16[k][1]*EO[1] + g_aiT16[k][2]*EO[2] + g_aiT16[k][3]*EO[3] + add)>>shift;     
     608    }
     609
     610    for (k=1;k<16;k+=2)
     611    {
     612      dst[ k*line ] = (g_aiT16[k][0]*O[0] + g_aiT16[k][1]*O[1] + g_aiT16[k][2]*O[2] + g_aiT16[k][3]*O[3] +
     613        g_aiT16[k][4]*O[4] + g_aiT16[k][5]*O[5] + g_aiT16[k][6]*O[6] + g_aiT16[k][7]*O[7] + add)>>shift;
     614    }
     615
     616    src += 16;
     617    dst ++;
     618
     619  }
     620}
     621
     622
     623void partialButterflyInverse16(short *src,short *dst,int shift, int line)
     624{
     625  int j,k; 
     626  int E[8],O[8];
     627  int EE[4],EO[4];
     628  int EEE[2],EEO[2];
     629  int add = 1<<(shift-1);
     630
     631  for (j=0; j<line; j++)
     632  {   
     633    /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
     634    for (k=0;k<8;k++)
     635    {
     636      O[k] = g_aiT16[ 1][k]*src[ line] + g_aiT16[ 3][k]*src[ 3*line] + g_aiT16[ 5][k]*src[ 5*line] + g_aiT16[ 7][k]*src[ 7*line] +
     637        g_aiT16[ 9][k]*src[ 9*line] + g_aiT16[11][k]*src[11*line] + g_aiT16[13][k]*src[13*line] + g_aiT16[15][k]*src[15*line];
     638    }
     639    for (k=0;k<4;k++)
     640    {
     641      EO[k] = g_aiT16[ 2][k]*src[ 2*line] + g_aiT16[ 6][k]*src[ 6*line] + g_aiT16[10][k]*src[10*line] + g_aiT16[14][k]*src[14*line];
     642    }
     643    EEO[0] = g_aiT16[4][0]*src[ 4*line ] + g_aiT16[12][0]*src[ 12*line ];
     644    EEE[0] = g_aiT16[0][0]*src[ 0      ] + g_aiT16[ 8][0]*src[ 8*line  ];
     645    EEO[1] = g_aiT16[4][1]*src[ 4*line ] + g_aiT16[12][1]*src[ 12*line ];
     646    EEE[1] = g_aiT16[0][1]*src[ 0      ] + g_aiT16[ 8][1]*src[ 8*line  ];
     647
     648    /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
     649    for (k=0;k<2;k++)
     650    {
     651      EE[k] = EEE[k] + EEO[k];
     652      EE[k+2] = EEE[1-k] - EEO[1-k];
     653    }   
     654    for (k=0;k<4;k++)
     655    {
     656      E[k] = EE[k] + EO[k];
     657      E[k+4] = EE[3-k] - EO[3-k];
     658    }   
     659    for (k=0;k<8;k++)
     660    {
     661      dst[k]   = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
     662      dst[k+8] = Clip3( -32768, 32767, (E[7-k] - O[7-k] + add)>>shift );
     663    }   
     664    src ++;
     665    dst += 16;
     666  }
     667}
     668
     669
     670void partialButterfly32(short *src,short *dst,int shift, int line)
     671{
     672  int j,k;
     673  int E[16],O[16];
     674  int EE[8],EO[8];
     675  int EEE[4],EEO[4];
     676  int EEEE[2],EEEO[2];
     677  int add = 1<<(shift-1);
     678
     679  for (j=0; j<line; j++)
     680  {   
     681    /* E and O*/
     682    for (k=0;k<16;k++)
     683    {
     684      E[k] = src[k] + src[31-k];
     685      O[k] = src[k] - src[31-k];
     686    }
     687    /* EE and EO */
     688    for (k=0;k<8;k++)
     689    {
     690      EE[k] = E[k] + E[15-k];
     691      EO[k] = E[k] - E[15-k];
     692    }
     693    /* EEE and EEO */
     694    for (k=0;k<4;k++)
     695    {
     696      EEE[k] = EE[k] + EE[7-k];
     697      EEO[k] = EE[k] - EE[7-k];
     698    }
     699    /* EEEE and EEEO */
     700    EEEE[0] = EEE[0] + EEE[3];   
     701    EEEO[0] = EEE[0] - EEE[3];
     702    EEEE[1] = EEE[1] + EEE[2];
     703    EEEO[1] = EEE[1] - EEE[2];
     704
     705    dst[ 0       ] = (g_aiT32[ 0][0]*EEEE[0] + g_aiT32[ 0][1]*EEEE[1] + add)>>shift;
     706    dst[ 16*line ] = (g_aiT32[16][0]*EEEE[0] + g_aiT32[16][1]*EEEE[1] + add)>>shift;
     707    dst[ 8*line  ] = (g_aiT32[ 8][0]*EEEO[0] + g_aiT32[ 8][1]*EEEO[1] + add)>>shift;
     708    dst[ 24*line ] = (g_aiT32[24][0]*EEEO[0] + g_aiT32[24][1]*EEEO[1] + add)>>shift;
     709    for (k=4;k<32;k+=8)
     710    {
     711      dst[ k*line ] = (g_aiT32[k][0]*EEO[0] + g_aiT32[k][1]*EEO[1] + g_aiT32[k][2]*EEO[2] + g_aiT32[k][3]*EEO[3] + add)>>shift;
     712    }       
     713    for (k=2;k<32;k+=4)
     714    {
     715      dst[ k*line ] = (g_aiT32[k][0]*EO[0] + g_aiT32[k][1]*EO[1] + g_aiT32[k][2]*EO[2] + g_aiT32[k][3]*EO[3] +
     716        g_aiT32[k][4]*EO[4] + g_aiT32[k][5]*EO[5] + g_aiT32[k][6]*EO[6] + g_aiT32[k][7]*EO[7] + add)>>shift;
     717    }       
     718    for (k=1;k<32;k+=2)
     719    {
     720      dst[ k*line ] = (g_aiT32[k][ 0]*O[ 0] + g_aiT32[k][ 1]*O[ 1] + g_aiT32[k][ 2]*O[ 2] + g_aiT32[k][ 3]*O[ 3] +
     721        g_aiT32[k][ 4]*O[ 4] + g_aiT32[k][ 5]*O[ 5] + g_aiT32[k][ 6]*O[ 6] + g_aiT32[k][ 7]*O[ 7] +
     722        g_aiT32[k][ 8]*O[ 8] + g_aiT32[k][ 9]*O[ 9] + g_aiT32[k][10]*O[10] + g_aiT32[k][11]*O[11] +
     723        g_aiT32[k][12]*O[12] + g_aiT32[k][13]*O[13] + g_aiT32[k][14]*O[14] + g_aiT32[k][15]*O[15] + add)>>shift;
     724    }
     725    src += 32;
     726    dst ++;
     727  }
     728}
     729
     730
     731void partialButterflyInverse32(short *src,short *dst,int shift, int line)
     732{
     733  int j,k; 
     734  int E[16],O[16];
     735  int EE[8],EO[8];
     736  int EEE[4],EEO[4];
     737  int EEEE[2],EEEO[2];
     738  int add = 1<<(shift-1);
     739
     740  for (j=0; j<line; j++)
     741  {   
     742    /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
     743    for (k=0;k<16;k++)
     744    {
     745      O[k] = g_aiT32[ 1][k]*src[ line  ] + g_aiT32[ 3][k]*src[ 3*line  ] + g_aiT32[ 5][k]*src[ 5*line  ] + g_aiT32[ 7][k]*src[ 7*line  ] +
     746        g_aiT32[ 9][k]*src[ 9*line  ] + g_aiT32[11][k]*src[ 11*line ] + g_aiT32[13][k]*src[ 13*line ] + g_aiT32[15][k]*src[ 15*line ] +
     747        g_aiT32[17][k]*src[ 17*line ] + g_aiT32[19][k]*src[ 19*line ] + g_aiT32[21][k]*src[ 21*line ] + g_aiT32[23][k]*src[ 23*line ] +
     748        g_aiT32[25][k]*src[ 25*line ] + g_aiT32[27][k]*src[ 27*line ] + g_aiT32[29][k]*src[ 29*line ] + g_aiT32[31][k]*src[ 31*line ];
     749    }
     750    for (k=0;k<8;k++)
     751    {
     752      EO[k] = g_aiT32[ 2][k]*src[ 2*line  ] + g_aiT32[ 6][k]*src[ 6*line  ] + g_aiT32[10][k]*src[ 10*line ] + g_aiT32[14][k]*src[ 14*line ] +
     753        g_aiT32[18][k]*src[ 18*line ] + g_aiT32[22][k]*src[ 22*line ] + g_aiT32[26][k]*src[ 26*line ] + g_aiT32[30][k]*src[ 30*line ];
     754    }
     755    for (k=0;k<4;k++)
     756    {
     757      EEO[k] = g_aiT32[4][k]*src[ 4*line ] + g_aiT32[12][k]*src[ 12*line ] + g_aiT32[20][k]*src[ 20*line ] + g_aiT32[28][k]*src[ 28*line ];
     758    }
     759    EEEO[0] = g_aiT32[8][0]*src[ 8*line ] + g_aiT32[24][0]*src[ 24*line ];
     760    EEEO[1] = g_aiT32[8][1]*src[ 8*line ] + g_aiT32[24][1]*src[ 24*line ];
     761    EEEE[0] = g_aiT32[0][0]*src[ 0      ] + g_aiT32[16][0]*src[ 16*line ];   
     762    EEEE[1] = g_aiT32[0][1]*src[ 0      ] + g_aiT32[16][1]*src[ 16*line ];
     763
     764    /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
     765    EEE[0] = EEEE[0] + EEEO[0];
     766    EEE[3] = EEEE[0] - EEEO[0];
     767    EEE[1] = EEEE[1] + EEEO[1];
     768    EEE[2] = EEEE[1] - EEEO[1];   
     769    for (k=0;k<4;k++)
     770    {
     771      EE[k] = EEE[k] + EEO[k];
     772      EE[k+4] = EEE[3-k] - EEO[3-k];
     773    }   
     774    for (k=0;k<8;k++)
     775    {
     776      E[k] = EE[k] + EO[k];
     777      E[k+8] = EE[7-k] - EO[7-k];
     778    }   
     779    for (k=0;k<16;k++)
     780    {
     781      dst[k]    = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
     782      dst[k+16] = Clip3( -32768, 32767, (E[15-k] - O[15-k] + add)>>shift );
     783    }
     784    src ++;
     785    dst += 32;
     786  }
     787}
     788
     789
     790/** MxN forward transform (2D)
     791*  \param block input data (residual)
     792*  \param coeff output data (transform coefficients)
     793*  \param iWidth input data (width of transform)
     794*  \param iHeight input data (height of transform)
     795*/
     796void xTrMxN(short *block,short *coeff, int iWidth, int iHeight, UInt uiMode)
     797{
     798#if FULL_NBIT
     799  int shift_1st = g_aucConvertToBit[iWidth]  + 1 + g_uiBitDepth - 8; // log2(iWidth) - 1 + g_uiBitDepth - 8
     800#else
     801  int shift_1st = g_aucConvertToBit[iWidth]  + 1 + g_uiBitIncrement; // log2(iWidth) - 1 + g_uiBitIncrement
     802#endif
     803  int shift_2nd = g_aucConvertToBit[iHeight]  + 8;                   // log2(iHeight) + 6
     804
     805  short tmp[ 64 * 64 ];
     806
     807  if( iWidth == 16 && iHeight == 4)
     808  {
     809    partialButterfly16( block, tmp, shift_1st, iHeight );
     810    partialButterfly4( tmp, coeff, shift_2nd, iWidth );
     811  }
     812  else if( iWidth == 32 && iHeight == 8 )
     813  {
     814    partialButterfly32( block, tmp, shift_1st, iHeight );
     815    partialButterfly8( tmp, coeff, shift_2nd, iWidth );
     816  }
     817  else if( iWidth == 4 && iHeight == 16)
     818  {
     819    partialButterfly4( block, tmp, shift_1st, iHeight );
     820    partialButterfly16( tmp, coeff, shift_2nd, iWidth );
     821  }
     822  else if( iWidth == 8 && iHeight == 32 )
     823  {
     824    partialButterfly8( block, tmp, shift_1st, iHeight );
     825    partialButterfly32( tmp, coeff, shift_2nd, iWidth );
     826  }
     827  else if( iWidth == 4 && iHeight == 4)
     828  {
     829    if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25)))    // Check for DCT or DST
     830    {
     831      fastForwardDst(block,tmp,shift_1st); // Forward DST BY FAST ALGORITHM, block input, tmp output
     832    }
     833    else 
     834    {
     835      partialButterfly4(block, tmp, shift_1st, iHeight);
     836    }
     837    if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34)))    // Check for DCT or DST
     838    {
     839      fastForwardDst(tmp,coeff,shift_2nd); // Forward DST BY FAST ALGORITHM, tmp input, coeff output
     840    }
     841    else 
     842    {
     843      partialButterfly4(tmp, coeff, shift_2nd, iWidth);
     844    }   
     845  }
     846  else if( iWidth == 8 && iHeight == 8)
     847  {
     848    partialButterfly8( block, tmp, shift_1st, iHeight );
     849    partialButterfly8( tmp, coeff, shift_2nd, iWidth );
     850  }
     851  else if( iWidth == 16 && iHeight == 16)
     852  {
     853    partialButterfly16( block, tmp, shift_1st, iHeight );
     854    partialButterfly16( tmp, coeff, shift_2nd, iWidth );
     855  }
     856  else if( iWidth == 32 && iHeight == 32)
     857  {
     858    partialButterfly32( block, tmp, shift_1st, iHeight );
     859    partialButterfly32( tmp, coeff, shift_2nd, iWidth );
     860  }
     861}
     862/** MxN inverse transform (2D)
     863*  \param coeff input data (transform coefficients)
     864*  \param block output data (residual)
     865*  \param iWidth input data (width of transform)
     866*  \param iHeight input data (height of transform)
     867*/
     868void xITrMxN(short *coeff,short *block, int iWidth, int iHeight, UInt uiMode)
    852869{
    853870  int shift_1st = SHIFT_INV_1ST;
     
    857874  int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;
    858875#endif
    859   short tmp[8][8];
    860  
    861   partialButterflyInverse8(coeff,tmp,shift_1st);
    862   partialButterflyInverse8(tmp,block,shift_2nd);
    863 }
    864 
    865 /** 16x16 forward transform implemented using partial butterfly structure (1D)
    866  *  \param src   input data (residual)
    867  *  \param dst   output data (transform coefficients)
    868  *  \param shift specifies right shift after 1D transform
    869  */
    870 void partialButterfly16(short src[16][16],short dst[16][16],int shift)
    871 {
    872   int j,k;
    873   int E[8],O[8];
    874   int EE[4],EO[4];
    875   int EEE[2],EEO[2];
    876   int add = 1<<(shift-1);
    877 
    878   for (j=0; j<16; j++)
    879   {   
    880     /* E and O*/
    881     for (k=0;k<8;k++)
    882     {
    883       E[k] = src[j][k] + src[j][15-k];
    884       O[k] = src[j][k] - src[j][15-k];
    885     }
    886     /* EE and EO */
    887     for (k=0;k<4;k++)
    888     {
    889       EE[k] = E[k] + E[7-k];
    890       EO[k] = E[k] - E[7-k];
    891     }
    892     /* EEE and EEO */
    893     EEE[0] = EE[0] + EE[3];   
    894     EEO[0] = EE[0] - EE[3];
    895     EEE[1] = EE[1] + EE[2];
    896     EEO[1] = EE[1] - EE[2];
    897 
    898     dst[ 0][j] = (g_aiT16[ 0][0]*EEE[0] + g_aiT16[ 0][1]*EEE[1] + add)>>shift;       
    899     dst[ 8][j] = (g_aiT16[ 8][0]*EEE[0] + g_aiT16[ 8][1]*EEE[1] + add)>>shift;   
    900     dst[ 4][j] = (g_aiT16[ 4][0]*EEO[0] + g_aiT16[ 4][1]*EEO[1] + add)>>shift;       
    901     dst[12][j] = (g_aiT16[12][0]*EEO[0] + g_aiT16[12][1]*EEO[1] + add)>>shift;
    902 
    903     for (k=2;k<16;k+=4)
    904     {
    905       dst[k][j] = (g_aiT16[k][0]*EO[0] + g_aiT16[k][1]*EO[1] + g_aiT16[k][2]*EO[2] + g_aiT16[k][3]*EO[3] + add)>>shift;     
    906     }
    907    
    908     for (k=1;k<16;k+=2)
    909     {
    910       dst[k][j] = (g_aiT16[k][0]*O[0] + g_aiT16[k][1]*O[1] + g_aiT16[k][2]*O[2] + g_aiT16[k][3]*O[3] +
    911                      g_aiT16[k][4]*O[4] + g_aiT16[k][5]*O[5] + g_aiT16[k][6]*O[6] + g_aiT16[k][7]*O[7] + add)>>shift;
    912     }
    913 
    914   }
    915 }
    916 #endif
    917 
    918 void partialButterfly16(short *src,short *dst,int shift, int line)
    919 {
    920   int j,k;
    921   int E[8],O[8];
    922   int EE[4],EO[4];
    923   int EEE[2],EEO[2];
    924   int add = 1<<(shift-1);
    925 
    926   for (j=0; j<line; j++)
    927   {   
    928     /* E and O*/
    929     for (k=0;k<8;k++)
    930     {
    931       E[k] = src[k] + src[15-k];
    932       O[k] = src[k] - src[15-k];
    933     }
    934     /* EE and EO */
    935     for (k=0;k<4;k++)
    936     {
    937       EE[k] = E[k] + E[7-k];
    938       EO[k] = E[k] - E[7-k];
    939     }
    940     /* EEE and EEO */
    941     EEE[0] = EE[0] + EE[3];   
    942     EEO[0] = EE[0] - EE[3];
    943     EEE[1] = EE[1] + EE[2];
    944     EEO[1] = EE[1] - EE[2];
    945 
    946     dst[ 0      ] = (g_aiT16[ 0][0]*EEE[0] + g_aiT16[ 0][1]*EEE[1] + add)>>shift;       
    947     dst[ 8*line ] = (g_aiT16[ 8][0]*EEE[0] + g_aiT16[ 8][1]*EEE[1] + add)>>shift;   
    948     dst[ 4*line ] = (g_aiT16[ 4][0]*EEO[0] + g_aiT16[ 4][1]*EEO[1] + add)>>shift;       
    949     dst[ 12*line] = (g_aiT16[12][0]*EEO[0] + g_aiT16[12][1]*EEO[1] + add)>>shift;
    950 
    951     for (k=2;k<16;k+=4)
    952     {
    953       dst[ k*line ] = (g_aiT16[k][0]*EO[0] + g_aiT16[k][1]*EO[1] + g_aiT16[k][2]*EO[2] + g_aiT16[k][3]*EO[3] + add)>>shift;     
    954     }
    955 
    956     for (k=1;k<16;k+=2)
    957     {
    958       dst[ k*line ] = (g_aiT16[k][0]*O[0] + g_aiT16[k][1]*O[1] + g_aiT16[k][2]*O[2] + g_aiT16[k][3]*O[3] +
    959         g_aiT16[k][4]*O[4] + g_aiT16[k][5]*O[5] + g_aiT16[k][6]*O[6] + g_aiT16[k][7]*O[7] + add)>>shift;
    960     }
    961 
    962     src += 16;
    963     dst ++;
    964 
    965   }
    966 }
    967 
    968 #if !UNIFIED_TRANSFORM
    969 /** 16x16 forward transform (2D)
    970  *  \param block input data (residual)
    971  *  \param coeff output data (transform coefficients)
    972  */
    973 void xTr16(short block[16][16],short coeff[16][16])
    974 {
    975  #if FULL_NBIT
    976   int shift_1st = 3 + g_uiBitDepth - 8; // log2(16) - 1 + g_uiBitDepth - 8
    977 #else
    978   int shift_1st = 3 + g_uiBitIncrement; // log2(16) - 1 + g_uiBitIncrement
    979 #endif
    980   int shift_2nd = 10;                   // log2(16) + 6
    981   short tmp[16][16];
    982 
    983   partialButterfly16(block,tmp,shift_1st);
    984   partialButterfly16(tmp,coeff,shift_2nd);
    985 }
    986 
    987 /** 16x16 inverse transform implemented using partial butterfly structure (1D)
    988  *  \param src   input data (transform coefficients)
    989  *  \param dst   output data (residual)
    990  *  \param shift specifies right shift after 1D transform
    991  */
    992 void partialButterflyInverse16(short src[16][16],short dst[16][16],int shift)
    993 {
    994   int j,k; 
    995   int E[8],O[8];
    996   int EE[4],EO[4];
    997   int EEE[2],EEO[2];
    998   int add = 1<<(shift-1);
    999 
    1000   for (j=0; j<16; j++)
    1001   {   
    1002     /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
    1003     for (k=0;k<8;k++)
    1004     {
    1005       O[k] = g_aiT16[ 1][k]*src[ 1][j] + g_aiT16[ 3][k]*src[ 3][j] + g_aiT16[ 5][k]*src[ 5][j] + g_aiT16[ 7][k]*src[ 7][j] +
    1006              g_aiT16[ 9][k]*src[ 9][j] + g_aiT16[11][k]*src[11][j] + g_aiT16[13][k]*src[13][j] + g_aiT16[15][k]*src[15][j];
    1007     }
    1008     for (k=0;k<4;k++)
    1009     {
    1010       EO[k] = g_aiT16[ 2][k]*src[ 2][j] + g_aiT16[ 6][k]*src[ 6][j] + g_aiT16[10][k]*src[10][j] + g_aiT16[14][k]*src[14][j];
    1011     }
    1012     EEO[0] = g_aiT16[4][0]*src[4][j] + g_aiT16[12][0]*src[12][j];
    1013     EEE[0] = g_aiT16[0][0]*src[0][j] + g_aiT16[ 8][0]*src[ 8][j];
    1014     EEO[1] = g_aiT16[4][1]*src[4][j] + g_aiT16[12][1]*src[12][j];
    1015     EEE[1] = g_aiT16[0][1]*src[0][j] + g_aiT16[ 8][1]*src[ 8][j];
    1016 
    1017     /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
    1018     for (k=0;k<2;k++)
    1019     {
    1020       EE[k] = EEE[k] + EEO[k];
    1021       EE[k+2] = EEE[1-k] - EEO[1-k];
    1022     }   
    1023     for (k=0;k<4;k++)
    1024     {
    1025       E[k] = EE[k] + EO[k];
    1026       E[k+4] = EE[3-k] - EO[3-k];
    1027     }   
    1028     for (k=0;k<8;k++)
    1029     {
    1030       dst[j][k]   = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
    1031       dst[j][k+8] = Clip3( -32768, 32767, (E[7-k] - O[7-k] + add)>>shift );
    1032     }       
    1033   }
    1034 }
    1035 #endif
    1036 
    1037 void partialButterflyInverse16(short *src,short *dst,int shift, int line)
    1038 {
    1039   int j,k; 
    1040   int E[8],O[8];
    1041   int EE[4],EO[4];
    1042   int EEE[2],EEO[2];
    1043   int add = 1<<(shift-1);
    1044 
    1045   for (j=0; j<line; j++)
    1046   {   
    1047     /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
    1048     for (k=0;k<8;k++)
    1049     {
    1050       O[k] = g_aiT16[ 1][k]*src[ line] + g_aiT16[ 3][k]*src[ 3*line] + g_aiT16[ 5][k]*src[ 5*line] + g_aiT16[ 7][k]*src[ 7*line] +
    1051         g_aiT16[ 9][k]*src[ 9*line] + g_aiT16[11][k]*src[11*line] + g_aiT16[13][k]*src[13*line] + g_aiT16[15][k]*src[15*line];
    1052     }
    1053     for (k=0;k<4;k++)
    1054     {
    1055       EO[k] = g_aiT16[ 2][k]*src[ 2*line] + g_aiT16[ 6][k]*src[ 6*line] + g_aiT16[10][k]*src[10*line] + g_aiT16[14][k]*src[14*line];
    1056     }
    1057     EEO[0] = g_aiT16[4][0]*src[ 4*line ] + g_aiT16[12][0]*src[ 12*line ];
    1058     EEE[0] = g_aiT16[0][0]*src[ 0      ] + g_aiT16[ 8][0]*src[ 8*line  ];
    1059     EEO[1] = g_aiT16[4][1]*src[ 4*line ] + g_aiT16[12][1]*src[ 12*line ];
    1060     EEE[1] = g_aiT16[0][1]*src[ 0      ] + g_aiT16[ 8][1]*src[ 8*line  ];
    1061 
    1062     /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
    1063     for (k=0;k<2;k++)
    1064     {
    1065       EE[k] = EEE[k] + EEO[k];
    1066       EE[k+2] = EEE[1-k] - EEO[1-k];
    1067     }   
    1068     for (k=0;k<4;k++)
    1069     {
    1070       E[k] = EE[k] + EO[k];
    1071       E[k+4] = EE[3-k] - EO[3-k];
    1072     }   
    1073     for (k=0;k<8;k++)
    1074     {
    1075       dst[k]   = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
    1076       dst[k+8] = Clip3( -32768, 32767, (E[7-k] - O[7-k] + add)>>shift );
    1077     }   
    1078     src ++;
    1079     dst += 16;
    1080   }
    1081 }
    1082 
    1083 #if !UNIFIED_TRANSFORM
    1084 /** 16x16 inverse transform (2D)
    1085  *  \param coeff input data (transform coefficients)
    1086  *  \param block output data (residual)
    1087  */
    1088 void xITr16(short coeff[16][16],short block[16][16])
    1089 {
    1090   int shift_1st = SHIFT_INV_1ST;
    1091 #if FULL_NBIT
    1092   int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);
    1093 #else
    1094   int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;
    1095 #endif
    1096   short tmp[16][16];
    1097  
    1098   partialButterflyInverse16(coeff,tmp,shift_1st);
    1099   partialButterflyInverse16(tmp,block,shift_2nd);
    1100 }
    1101 
    1102 /** 32x32 forward transform implemented using partial butterfly structure (1D)
    1103  *  \param src   input data (residual)
    1104  *  \param dst   output data (transform coefficients)
    1105  *  \param shift specifies right shift after 1D transform
    1106  */
    1107 void partialButterfly32(short src[32][32],short dst[32][32],int shift)
    1108 {
    1109   int j,k;
    1110   int E[16],O[16];
    1111   int EE[8],EO[8];
    1112   int EEE[4],EEO[4];
    1113   int EEEE[2],EEEO[2];
    1114   int add = 1<<(shift-1);
    1115 
    1116   for (j=0; j<32; j++)
    1117   {   
    1118     /* E and O*/
    1119     for (k=0;k<16;k++)
    1120     {
    1121       E[k] = src[j][k] + src[j][31-k];
    1122       O[k] = src[j][k] - src[j][31-k];
    1123     }
    1124     /* EE and EO */
    1125     for (k=0;k<8;k++)
    1126     {
    1127       EE[k] = E[k] + E[15-k];
    1128       EO[k] = E[k] - E[15-k];
    1129     }
    1130     /* EEE and EEO */
    1131     for (k=0;k<4;k++)
    1132     {
    1133       EEE[k] = EE[k] + EE[7-k];
    1134       EEO[k] = EE[k] - EE[7-k];
    1135     }
    1136     /* EEEE and EEEO */
    1137     EEEE[0] = EEE[0] + EEE[3];   
    1138     EEEO[0] = EEE[0] - EEE[3];
    1139     EEEE[1] = EEE[1] + EEE[2];
    1140     EEEO[1] = EEE[1] - EEE[2];
    1141 
    1142     dst[ 0][j] = (g_aiT32[ 0][0]*EEEE[0] + g_aiT32[ 0][1]*EEEE[1] + add)>>shift;
    1143     dst[16][j] = (g_aiT32[16][0]*EEEE[0] + g_aiT32[16][1]*EEEE[1] + add)>>shift;
    1144     dst[ 8][j] = (g_aiT32[ 8][0]*EEEO[0] + g_aiT32[ 8][1]*EEEO[1] + add)>>shift;
    1145     dst[24][j] = (g_aiT32[24][0]*EEEO[0] + g_aiT32[24][1]*EEEO[1] + add)>>shift;
    1146     for (k=4;k<32;k+=8)
    1147     {
    1148       dst[k][j] = (g_aiT32[k][0]*EEO[0] + g_aiT32[k][1]*EEO[1] + g_aiT32[k][2]*EEO[2] + g_aiT32[k][3]*EEO[3] + add)>>shift;
    1149     }       
    1150     for (k=2;k<32;k+=4)
    1151     {
    1152       dst[k][j] = (g_aiT32[k][0]*EO[0] + g_aiT32[k][1]*EO[1] + g_aiT32[k][2]*EO[2] + g_aiT32[k][3]*EO[3] +
    1153                      g_aiT32[k][4]*EO[4] + g_aiT32[k][5]*EO[5] + g_aiT32[k][6]*EO[6] + g_aiT32[k][7]*EO[7] + add)>>shift;
    1154     }       
    1155     for (k=1;k<32;k+=2)
    1156     {
    1157       dst[k][j] = (g_aiT32[k][ 0]*O[ 0] + g_aiT32[k][ 1]*O[ 1] + g_aiT32[k][ 2]*O[ 2] + g_aiT32[k][ 3]*O[ 3] +
    1158                      g_aiT32[k][ 4]*O[ 4] + g_aiT32[k][ 5]*O[ 5] + g_aiT32[k][ 6]*O[ 6] + g_aiT32[k][ 7]*O[ 7] +
    1159                      g_aiT32[k][ 8]*O[ 8] + g_aiT32[k][ 9]*O[ 9] + g_aiT32[k][10]*O[10] + g_aiT32[k][11]*O[11] +
    1160                      g_aiT32[k][12]*O[12] + g_aiT32[k][13]*O[13] + g_aiT32[k][14]*O[14] + g_aiT32[k][15]*O[15] + add)>>shift;
    1161     }
    1162   }
    1163 }
    1164 #endif
    1165 
    1166 void partialButterfly32(short *src,short *dst,int shift, int line)
    1167 {
    1168   int j,k;
    1169   int E[16],O[16];
    1170   int EE[8],EO[8];
    1171   int EEE[4],EEO[4];
    1172   int EEEE[2],EEEO[2];
    1173   int add = 1<<(shift-1);
    1174 
    1175   for (j=0; j<line; j++)
    1176   {   
    1177     /* E and O*/
    1178     for (k=0;k<16;k++)
    1179     {
    1180       E[k] = src[k] + src[31-k];
    1181       O[k] = src[k] - src[31-k];
    1182     }
    1183     /* EE and EO */
    1184     for (k=0;k<8;k++)
    1185     {
    1186       EE[k] = E[k] + E[15-k];
    1187       EO[k] = E[k] - E[15-k];
    1188     }
    1189     /* EEE and EEO */
    1190     for (k=0;k<4;k++)
    1191     {
    1192       EEE[k] = EE[k] + EE[7-k];
    1193       EEO[k] = EE[k] - EE[7-k];
    1194     }
    1195     /* EEEE and EEEO */
    1196     EEEE[0] = EEE[0] + EEE[3];   
    1197     EEEO[0] = EEE[0] - EEE[3];
    1198     EEEE[1] = EEE[1] + EEE[2];
    1199     EEEO[1] = EEE[1] - EEE[2];
    1200 
    1201     dst[ 0       ] = (g_aiT32[ 0][0]*EEEE[0] + g_aiT32[ 0][1]*EEEE[1] + add)>>shift;
    1202     dst[ 16*line ] = (g_aiT32[16][0]*EEEE[0] + g_aiT32[16][1]*EEEE[1] + add)>>shift;
    1203     dst[ 8*line  ] = (g_aiT32[ 8][0]*EEEO[0] + g_aiT32[ 8][1]*EEEO[1] + add)>>shift;
    1204     dst[ 24*line ] = (g_aiT32[24][0]*EEEO[0] + g_aiT32[24][1]*EEEO[1] + add)>>shift;
    1205     for (k=4;k<32;k+=8)
    1206     {
    1207       dst[ k*line ] = (g_aiT32[k][0]*EEO[0] + g_aiT32[k][1]*EEO[1] + g_aiT32[k][2]*EEO[2] + g_aiT32[k][3]*EEO[3] + add)>>shift;
    1208     }       
    1209     for (k=2;k<32;k+=4)
    1210     {
    1211       dst[ k*line ] = (g_aiT32[k][0]*EO[0] + g_aiT32[k][1]*EO[1] + g_aiT32[k][2]*EO[2] + g_aiT32[k][3]*EO[3] +
    1212         g_aiT32[k][4]*EO[4] + g_aiT32[k][5]*EO[5] + g_aiT32[k][6]*EO[6] + g_aiT32[k][7]*EO[7] + add)>>shift;
    1213     }       
    1214     for (k=1;k<32;k+=2)
    1215     {
    1216       dst[ k*line ] = (g_aiT32[k][ 0]*O[ 0] + g_aiT32[k][ 1]*O[ 1] + g_aiT32[k][ 2]*O[ 2] + g_aiT32[k][ 3]*O[ 3] +
    1217         g_aiT32[k][ 4]*O[ 4] + g_aiT32[k][ 5]*O[ 5] + g_aiT32[k][ 6]*O[ 6] + g_aiT32[k][ 7]*O[ 7] +
    1218         g_aiT32[k][ 8]*O[ 8] + g_aiT32[k][ 9]*O[ 9] + g_aiT32[k][10]*O[10] + g_aiT32[k][11]*O[11] +
    1219         g_aiT32[k][12]*O[12] + g_aiT32[k][13]*O[13] + g_aiT32[k][14]*O[14] + g_aiT32[k][15]*O[15] + add)>>shift;
    1220     }
    1221     src += 32;
    1222     dst ++;
    1223   }
    1224 }
    1225 
    1226 #if !UNIFIED_TRANSFORM
    1227 /** 32x32 forward transform (2D)
    1228  *  \param block input data (residual)
    1229  *  \param coeff output data (transform coefficients)
    1230  */
    1231 void xTr32(short block[32][32],short coeff[32][32])
    1232 {
    1233  #if FULL_NBIT
    1234   int shift_1st = 4 + g_uiBitDepth - 8; // log2(32) - 1 + g_uiBitDepth - 8
    1235 #else
    1236   int shift_1st = 4 + g_uiBitIncrement; // log2(32) - 1 + g_uiBitIncrement
    1237 #endif
    1238   int shift_2nd = 11;                   // log2(32) + 6
    1239   short tmp[32][32];
    1240 
    1241   partialButterfly32(block,tmp,shift_1st);
    1242   partialButterfly32(tmp,coeff,shift_2nd);
    1243 }
    1244 
    1245 /** 32x32 inverse transform implemented using partial butterfly structure (1D)
    1246  *  \param src   input data (transform coefficients)
    1247  *  \param dst   output data (residual)
    1248  *  \param shift specifies right shift after 1D transform
    1249  */
    1250 void partialButterflyInverse32(short src[32][32],short dst[32][32],int shift)
    1251 {
    1252   int j,k; 
    1253   int E[16],O[16];
    1254   int EE[8],EO[8];
    1255   int EEE[4],EEO[4];
    1256   int EEEE[2],EEEO[2];
    1257   int add = 1<<(shift-1);
    1258 
    1259   for (j=0; j<32; j++)
    1260   {   
    1261     /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
    1262     for (k=0;k<16;k++)
    1263     {
    1264       O[k] = g_aiT32[ 1][k]*src[ 1][j] + g_aiT32[ 3][k]*src[ 3][j] + g_aiT32[ 5][k]*src[ 5][j] + g_aiT32[ 7][k]*src[ 7][j] +
    1265              g_aiT32[ 9][k]*src[ 9][j] + g_aiT32[11][k]*src[11][j] + g_aiT32[13][k]*src[13][j] + g_aiT32[15][k]*src[15][j] +
    1266              g_aiT32[17][k]*src[17][j] + g_aiT32[19][k]*src[19][j] + g_aiT32[21][k]*src[21][j] + g_aiT32[23][k]*src[23][j] +
    1267              g_aiT32[25][k]*src[25][j] + g_aiT32[27][k]*src[27][j] + g_aiT32[29][k]*src[29][j] + g_aiT32[31][k]*src[31][j];
    1268     }
    1269     for (k=0;k<8;k++)
    1270     {
    1271       EO[k] = g_aiT32[ 2][k]*src[ 2][j] + g_aiT32[ 6][k]*src[ 6][j] + g_aiT32[10][k]*src[10][j] + g_aiT32[14][k]*src[14][j] +
    1272               g_aiT32[18][k]*src[18][j] + g_aiT32[22][k]*src[22][j] + g_aiT32[26][k]*src[26][j] + g_aiT32[30][k]*src[30][j];
    1273     }
    1274     for (k=0;k<4;k++)
    1275     {
    1276       EEO[k] = g_aiT32[4][k]*src[4][j] + g_aiT32[12][k]*src[12][j] + g_aiT32[20][k]*src[20][j] + g_aiT32[28][k]*src[28][j];
    1277     }
    1278     EEEO[0] = g_aiT32[8][0]*src[8][j] + g_aiT32[24][0]*src[24][j];
    1279     EEEO[1] = g_aiT32[8][1]*src[8][j] + g_aiT32[24][1]*src[24][j];
    1280     EEEE[0] = g_aiT32[0][0]*src[0][j] + g_aiT32[16][0]*src[16][j];   
    1281     EEEE[1] = g_aiT32[0][1]*src[0][j] + g_aiT32[16][1]*src[16][j];
    1282 
    1283     /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
    1284     EEE[0] = EEEE[0] + EEEO[0];
    1285     EEE[3] = EEEE[0] - EEEO[0];
    1286     EEE[1] = EEEE[1] + EEEO[1];
    1287     EEE[2] = EEEE[1] - EEEO[1];   
    1288     for (k=0;k<4;k++)
    1289     {
    1290       EE[k] = EEE[k] + EEO[k];
    1291       EE[k+4] = EEE[3-k] - EEO[3-k];
    1292     }   
    1293     for (k=0;k<8;k++)
    1294     {
    1295       E[k] = EE[k] + EO[k];
    1296       E[k+8] = EE[7-k] - EO[7-k];
    1297     }   
    1298     for (k=0;k<16;k++)
    1299     {
    1300       dst[j][k]    = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
    1301       dst[j][k+16] = Clip3( -32768, 32767, (E[15-k] - O[15-k] + add)>>shift );
    1302     }       
    1303   }
    1304 }
    1305 #endif
    1306 
    1307 void partialButterflyInverse32(short *src,short *dst,int shift, int line)
    1308 {
    1309   int j,k; 
    1310   int E[16],O[16];
    1311   int EE[8],EO[8];
    1312   int EEE[4],EEO[4];
    1313   int EEEE[2],EEEO[2];
    1314   int add = 1<<(shift-1);
    1315 
    1316   for (j=0; j<line; j++)
    1317   {   
    1318     /* Utilizing symmetry properties to the maximum to minimize the number of multiplications */
    1319     for (k=0;k<16;k++)
    1320     {
    1321       O[k] = g_aiT32[ 1][k]*src[ line  ] + g_aiT32[ 3][k]*src[ 3*line  ] + g_aiT32[ 5][k]*src[ 5*line  ] + g_aiT32[ 7][k]*src[ 7*line  ] +
    1322         g_aiT32[ 9][k]*src[ 9*line  ] + g_aiT32[11][k]*src[ 11*line ] + g_aiT32[13][k]*src[ 13*line ] + g_aiT32[15][k]*src[ 15*line ] +
    1323         g_aiT32[17][k]*src[ 17*line ] + g_aiT32[19][k]*src[ 19*line ] + g_aiT32[21][k]*src[ 21*line ] + g_aiT32[23][k]*src[ 23*line ] +
    1324         g_aiT32[25][k]*src[ 25*line ] + g_aiT32[27][k]*src[ 27*line ] + g_aiT32[29][k]*src[ 29*line ] + g_aiT32[31][k]*src[ 31*line ];
    1325     }
    1326     for (k=0;k<8;k++)
    1327     {
    1328       EO[k] = g_aiT32[ 2][k]*src[ 2*line  ] + g_aiT32[ 6][k]*src[ 6*line  ] + g_aiT32[10][k]*src[ 10*line ] + g_aiT32[14][k]*src[ 14*line ] +
    1329         g_aiT32[18][k]*src[ 18*line ] + g_aiT32[22][k]*src[ 22*line ] + g_aiT32[26][k]*src[ 26*line ] + g_aiT32[30][k]*src[ 30*line ];
    1330     }
    1331     for (k=0;k<4;k++)
    1332     {
    1333       EEO[k] = g_aiT32[4][k]*src[ 4*line ] + g_aiT32[12][k]*src[ 12*line ] + g_aiT32[20][k]*src[ 20*line ] + g_aiT32[28][k]*src[ 28*line ];
    1334     }
    1335     EEEO[0] = g_aiT32[8][0]*src[ 8*line ] + g_aiT32[24][0]*src[ 24*line ];
    1336     EEEO[1] = g_aiT32[8][1]*src[ 8*line ] + g_aiT32[24][1]*src[ 24*line ];
    1337     EEEE[0] = g_aiT32[0][0]*src[ 0      ] + g_aiT32[16][0]*src[ 16*line ];   
    1338     EEEE[1] = g_aiT32[0][1]*src[ 0      ] + g_aiT32[16][1]*src[ 16*line ];
    1339 
    1340     /* Combining even and odd terms at each hierarchy levels to calculate the final spatial domain vector */
    1341     EEE[0] = EEEE[0] + EEEO[0];
    1342     EEE[3] = EEEE[0] - EEEO[0];
    1343     EEE[1] = EEEE[1] + EEEO[1];
    1344     EEE[2] = EEEE[1] - EEEO[1];   
    1345     for (k=0;k<4;k++)
    1346     {
    1347       EE[k] = EEE[k] + EEO[k];
    1348       EE[k+4] = EEE[3-k] - EEO[3-k];
    1349     }   
    1350     for (k=0;k<8;k++)
    1351     {
    1352       E[k] = EE[k] + EO[k];
    1353       E[k+8] = EE[7-k] - EO[7-k];
    1354     }   
    1355     for (k=0;k<16;k++)
    1356     {
    1357       dst[k]    = Clip3( -32768, 32767, (E[k] + O[k] + add)>>shift );
    1358       dst[k+16] = Clip3( -32768, 32767, (E[15-k] - O[15-k] + add)>>shift );
    1359     }
    1360     src ++;
    1361     dst += 32;
    1362   }
    1363 }
    1364 
    1365 #if !UNIFIED_TRANSFORM
    1366 /** 32x32 inverse transform (2D)
    1367  *  \param coeff input data (transform coefficients)
    1368  *  \param block output data (residual)
    1369  */
    1370 void xITr32(short coeff[32][32],short block[32][32])
    1371 {
    1372   int shift_1st = SHIFT_INV_1ST;
    1373 #if FULL_NBIT
    1374   int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);
    1375 #else
    1376   int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;
    1377 #endif
    1378   short tmp[32][32];
    1379  
    1380   partialButterflyInverse32(coeff,tmp,shift_1st);
    1381   partialButterflyInverse32(tmp,block,shift_2nd);
    1382 }
    1383 #endif
    1384 
    1385 /** MxN forward transform (2D)
    1386 *  \param block input data (residual)
    1387 *  \param coeff output data (transform coefficients)
    1388 *  \param iWidth input data (width of transform)
    1389 *  \param iHeight input data (height of transform)
    1390 */
    1391 #if UNIFIED_TRANSFORM
    1392 void xTrMxN(short *block,short *coeff, int iWidth, int iHeight, UInt uiMode)
    1393 #else
    1394 void xTrMxN(short *block,short *coeff, int iWidth, int iHeight)
    1395 #endif
    1396 {
    1397 #if FULL_NBIT
    1398   int shift_1st = g_aucConvertToBit[iWidth]  + 1 + g_uiBitDepth - 8; // log2(iWidth) - 1 + g_uiBitDepth - 8
    1399 #else
    1400   int shift_1st = g_aucConvertToBit[iWidth]  + 1 + g_uiBitIncrement; // log2(iWidth) - 1 + g_uiBitIncrement
    1401 #endif
    1402   int shift_2nd = g_aucConvertToBit[iHeight]  + 8;                   // log2(iHeight) + 6
    1403 
    1404   short tmp[ 64 * 64 ];
    1405 
    1406   if( iWidth == 16 && iHeight == 4)
    1407   {
    1408     partialButterfly16( block, tmp, shift_1st, iHeight );
    1409     partialButterfly4( tmp, coeff, shift_2nd, iWidth );
    1410   }
    1411   else if( iWidth == 32 && iHeight == 8 )
    1412   {
    1413     partialButterfly32( block, tmp, shift_1st, iHeight );
    1414     partialButterfly8( tmp, coeff, shift_2nd, iWidth );
    1415   }
    1416   else if( iWidth == 4 && iHeight == 16)
    1417   {
    1418     partialButterfly4( block, tmp, shift_1st, iHeight );
    1419     partialButterfly16( tmp, coeff, shift_2nd, iWidth );
    1420   }
    1421   else if( iWidth == 8 && iHeight == 32 )
    1422   {
    1423     partialButterfly8( block, tmp, shift_1st, iHeight );
    1424     partialButterfly32( tmp, coeff, shift_2nd, iWidth );
    1425   }
    1426 #if UNIFIED_TRANSFORM
    1427   else if( iWidth == 4 && iHeight == 4)
    1428   {
    1429 #if LOGI_INTRA_NAME_3MPM
    1430     if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25)))    // Check for DCT or DST
    1431 #else
    1432     if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode])// Check for DCT or DST
    1433 #endif
    1434     {
    1435       fastForwardDst(block,tmp,shift_1st); // Forward DST BY FAST ALGORITHM, block input, tmp output
    1436     }
    1437     else 
    1438     {
    1439       partialButterfly4(block, tmp, shift_1st, iHeight);
    1440     }
    1441 #if LOGI_INTRA_NAME_3MPM
    1442     if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34)))    // Check for DCT or DST
    1443 #else
    1444     if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] )   // Check for DCT or DST
    1445 #endif
    1446     {
    1447       fastForwardDst(tmp,coeff,shift_2nd); // Forward DST BY FAST ALGORITHM, tmp input, coeff output
    1448     }
    1449     else 
    1450     {
    1451       partialButterfly4(tmp, coeff, shift_2nd, iWidth);
    1452     }   
    1453   }
    1454   else if( iWidth == 8 && iHeight == 8)
    1455   {
    1456     partialButterfly8( block, tmp, shift_1st, iHeight );
    1457     partialButterfly8( tmp, coeff, shift_2nd, iWidth );
    1458   }
    1459   else if( iWidth == 16 && iHeight == 16)
    1460   {
    1461     partialButterfly16( block, tmp, shift_1st, iHeight );
    1462     partialButterfly16( tmp, coeff, shift_2nd, iWidth );
    1463   }
    1464   else if( iWidth == 32 && iHeight == 32)
    1465   {
    1466     partialButterfly32( block, tmp, shift_1st, iHeight );
    1467     partialButterfly32( tmp, coeff, shift_2nd, iWidth );
    1468   }
    1469 #endif
    1470 }
    1471 /** MxN inverse transform (2D)
    1472 *  \param coeff input data (transform coefficients)
    1473 *  \param block output data (residual)
    1474 *  \param iWidth input data (width of transform)
    1475 *  \param iHeight input data (height of transform)
    1476 */
    1477 #if UNIFIED_TRANSFORM
    1478 void xITrMxN(short *coeff,short *block, int iWidth, int iHeight, UInt uiMode)
    1479 #else
    1480 void xITrMxN(short *coeff,short *block, int iWidth, int iHeight)
    1481 #endif
    1482 {
    1483   int shift_1st = SHIFT_INV_1ST;
    1484 #if FULL_NBIT
    1485   int shift_2nd = SHIFT_INV_2ND - ((short)g_uiBitDepth - 8);
    1486 #else
    1487   int shift_2nd = SHIFT_INV_2ND - g_uiBitIncrement;
    1488 #endif
    1489876
    1490877  short tmp[ 64*64];
     
    1509896    partialButterflyInverse8(tmp,block,shift_2nd,iHeight);
    1510897  }
    1511 #if UNIFIED_TRANSFORM
    1512898  else if( iWidth == 4 && iHeight == 4)
    1513899  {
    1514 #if LOGI_INTRA_NAME_3MPM
    1515900    if (uiMode != REG_DCT && (!uiMode || (uiMode>=11 && uiMode <= 34)))    // Check for DCT or DST
    1516 #else
    1517     if (uiMode != REG_DCT && g_aucDCTDSTMode_Vert[uiMode] )    // Check for DCT or DST
    1518 #endif
    1519901    {
    1520902      fastInverseDst(coeff,tmp,shift_1st);    // Inverse DST by FAST Algorithm, coeff input, tmp output
     
    1524906      partialButterflyInverse4(coeff,tmp,shift_1st,iWidth);   
    1525907    }
    1526 #if LOGI_INTRA_NAME_3MPM
    1527908    if (uiMode != REG_DCT && (!uiMode || (uiMode>=2 && uiMode <= 25)))    // Check for DCT or DST
    1528 #else
    1529     if (uiMode != REG_DCT && g_aucDCTDSTMode_Hor[uiMode] )    // Check for DCT or DST
    1530 #endif
    1531909    {
    1532910      fastInverseDst(tmp,block,shift_2nd); // Inverse DST by FAST Algorithm, tmp input, coeff output
     
    1552930    partialButterflyInverse32(tmp,block,shift_2nd,iHeight);
    1553931  }
    1554 #endif
    1555932}
    1556933
    1557934#endif //MATRIX_MULT
    1558935
    1559 #if MULTIBITS_DATA_HIDING
    1560936// To minimize the distortion only. No rate is considered.
    1561937Void TComTrQuant::signBitHidingHDQ( TComDataCU* pcCU, TCoeff* pQCoef, TCoeff* pCoef, UInt const *scan, Int* deltaU, Int width, Int height )
     
    16841060  return;
    16851061}
    1686 #endif
    16871062
    16881063Void TComTrQuant::xQuant( TComDataCU* pcCU,
     
    17151090  else
    17161091  {
    1717 #if MULTIBITS_DATA_HIDING
    17181092    const UInt   log2BlockSize   = g_aucConvertToBit[ iWidth ] + 2;
    17191093
     
    17401114
    17411115    Int deltaU[32*32] ;
    1742 #endif
    17431116
    17441117#if ADAPTIVE_QP_SELECTION
     
    17461119    Int iQpBase = pcCU->getSlice()->getSliceQpBase();
    17471120
    1748 #if H0736_AVC_STYLE_QP_RANGE
    17491121    Int qpScaled;
    17501122    Int qpBDOffset = (eTType == TEXT_LUMA)? pcCU->getSlice()->getSPS()->getQpBDOffsetY() : pcCU->getSlice()->getSPS()->getQpBDOffsetC();
     
    17681140    }
    17691141    cQpBase.setQpParam(qpScaled, false, pcCU->getSlice()->getSliceType());
    1770 #else
    1771     if(eTType != TEXT_LUMA)
    1772     {
    1773       iQpBase = g_aucChromaScale[iQpBase];
    1774     }
    1775     cQpBase.setQpParam(iQpBase, false, pcCU->getSlice()->getSliceType());
    1776 #endif
    17771142#endif
    17781143
     
    18111176#endif
    18121177
    1813 #if MULTIBITS_DATA_HIDING
    18141178    Int qBits8 = iQBits-8;
    1815 #endif
    18161179    for( Int n = 0; n < iWidth*iHeight; n++ )
    18171180    {
     
    18291192      }
    18301193      iLevel = (Int)((tmpLevel + iAdd ) >> iQBits);
    1831 #if MULTIBITS_DATA_HIDING
    18321194      deltaU[uiBlockPos] = (Int)((tmpLevel - (iLevel<<iQBits) )>> qBits8);
    1833 #endif
    18341195#else
    18351196      iLevel = ((Int64)abs(iLevel) * piQuantCoeff[uiBlockPos] + iAdd ) >> iQBits;
    1836 #if MULTIBITS_DATA_HIDING
    18371197      deltaU[uiBlockPos] = (Int)( ((Int64)abs(iLevel) * piQuantCoeff[uiBlockPos] - (iLevel<<iQBits) )>> qBits8 );
    1838 #endif
    18391198#endif
    18401199      uiAcSum += iLevel;
     
    18421201      piQCoef[uiBlockPos] = Clip3( -32768, 32767, iLevel );
    18431202    } // for n
    1844 #if MULTIBITS_DATA_HIDING
    18451203    if( pcCU->getSlice()->getPPS()->getSignHideFlag() )
    18461204    {
     
    18501208      }
    18511209    }
    1852 #endif
    18531210  } //if RDOQ
    18541211  //return;
     
    18881245  iShift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - iTransformShift;
    18891246
    1890 #if DEQUANT_CLIPPING
    18911247  TCoeff clipQCoef;
    18921248  const Int bitRange = min( 15, ( Int )( 12 + uiLog2TrSize + uiBitDepth - m_cQP.m_iPer) );
    18931249  const Int levelLimit = 1 << bitRange;
    1894 #endif
    18951250
    18961251  if(getUseScalingList())
     
    19111266      for( Int n = 0; n < iWidth*iHeight; n++ )
    19121267      {
    1913 #if DEQUANT_CLIPPING
    19141268        clipQCoef = Clip3( -32768, 32767, piQCoef[n] );
    19151269        iCoeffQ = ((clipQCoef * piDequantCoef[n]) + iAdd ) >> (iShift -  m_cQP.m_iPer);
    1916 #else
    1917         iCoeffQ = ((piQCoef[n] * piDequantCoef[n]) + iAdd ) >> (iShift -  m_cQP.m_iPer);
    1918 #endif
    19191270        piCoef[n] = Clip3(-32768,32767,iCoeffQ);
    19201271      }
     
    19241275      for( Int n = 0; n < iWidth*iHeight; n++ )
    19251276      {
    1926 #if DEQUANT_CLIPPING
    19271277        clipQCoef = Clip3( -levelLimit, levelLimit - 1, piQCoef[n] );
    19281278        iCoeffQ = (clipQCoef * piDequantCoef[n]) << (m_cQP.m_iPer - iShift);
    1929 #else
    1930         iCoeffQ = (piQCoef[n] * piDequantCoef[n]) << (m_cQP.m_iPer - iShift);
    1931 #endif
    19321279        piCoef[n] = Clip3(-32768,32767,iCoeffQ);
    19331280      }
     
    19411288    for( Int n = 0; n < iWidth*iHeight; n++ )
    19421289    {
    1943 #if DEQUANT_CLIPPING
    19441290      clipQCoef = Clip3( -32768, 32767, piQCoef[n] );
    19451291      iCoeffQ = ( clipQCoef * scale + iAdd ) >> iShift;
    1946 #else
    1947       iCoeffQ = ( piQCoef[n] * scale + iAdd ) >> iShift;
    1948 #endif
    19491292      piCoef[n] = Clip3(-32768,32767,iCoeffQ);
    19501293    }
     
    21341477  xTr(piBlkResi,psCoeff,uiStride,(UInt)iSize,uiMode);
    21351478#else
    2136 #if UNIFIED_TRANSFORM
    21371479  Int j;
    2138 #else
    2139   Int iSize = iWidth;
    2140   if( iWidth != iHeight)
    2141 #endif
    21421480  {
    21431481    short block[ 64 * 64 ];
     
    21491487      }
    21501488    }
    2151 #if UNIFIED_TRANSFORM
    21521489    xTrMxN( block, coeff, iWidth, iHeight, uiMode );
    2153 #else
    2154     xTrMxN( block, coeff, iWidth, iHeight );
    2155 #endif
    21561490    for ( j = 0; j < iHeight * iWidth; j++ )
    21571491    {   
     
    21601494    return ;
    21611495  }
    2162 #if !UNIFIED_TRANSFORM
    2163   if (iSize==4)
    2164   {   
    2165     short block[4][4];   
    2166     short coeff[4][4];
    2167     for (j=0; j<4; j++)
    2168     {   
    2169       memcpy(block[j],piBlkResi+j*uiStride,4*sizeof(short));     
    2170     }
    2171     xTr4(block,coeff,uiMode);
    2172     for (j=0; j<4; j++)
    2173     {   
    2174       for (k=0; k<4; k++)
    2175       {       
    2176         psCoeff[j*4+k] = coeff[j][k];
    2177       }   
    2178     }   
    2179   }
    2180   else if (iSize==8)
    2181   {
    2182     short block[8][8];
    2183     short coeff[8][8];
    2184 
    2185     for (j=0; j<8; j++)
    2186     {   
    2187       memcpy(block[j],piBlkResi+j*uiStride,8*sizeof(short));
    2188     }
    2189 
    2190     xTr8(block,coeff);       
    2191     for (j=0; j<8; j++)
    2192     {   
    2193       for (k=0; k<8; k++)
    2194       {       
    2195         psCoeff[j*8+k] = coeff[j][k];
    2196       }   
    2197     }
    2198   }
    2199   else if (iSize==16)
    2200   {   
    2201     short block[16][16];
    2202     short coeff[16][16];
    2203 
    2204     for (j=0; j<16; j++)
    2205     {   
    2206       memcpy(block[j],piBlkResi+j*uiStride,16*sizeof(short));
    2207     }
    2208     xTr16(block,coeff);       
    2209     for (j=0; j<16; j++)
    2210     {   
    2211       for (k=0; k<16; k++)
    2212       {       
    2213         psCoeff[j*16+k] = coeff[j][k];
    2214       }   
    2215     }
    2216   }
    2217   else if (iSize==32)
    2218   {   
    2219     short block[32][32];
    2220     short coeff[32][32];
    2221 
    2222     for (j=0; j<32; j++)
    2223     {   
    2224       memcpy(block[j],piBlkResi+j*uiStride,32*sizeof(short));
    2225     }
    2226     xTr32(block,coeff);       
    2227     for (j=0; j<32; j++)
    2228     {   
    2229       for (k=0; k<32; k++)
    2230       {       
    2231         psCoeff[j*32+k] = coeff[j][k];
    2232       }   
    2233     }
    2234   }
    2235 #endif
    22361496#endif 
    22371497}
     
    22551515  xITr(plCoef,pResidual,uiStride,(UInt)iSize,uiMode);
    22561516#else
    2257 #if UNIFIED_TRANSFORM
    22581517  Int j;
    2259 #else
    2260   Int j,k;
    2261   Int iSize = iWidth;
    2262   if( iWidth != iHeight )
    2263 #endif
    22641518  {
    22651519    short block[ 64 * 64 ];
     
    22691523      coeff[j] = (short)plCoef[j];
    22701524    }
    2271 #if UNIFIED_TRANSFORM
    22721525    xITrMxN( coeff, block, iWidth, iHeight, uiMode );
    2273 #else
    2274     xITrMxN( coeff, block, iWidth, iHeight );
    2275 #endif
    22761526    {
    22771527      for ( j = 0; j < iHeight; j++ )
     
    22821532    return ;
    22831533  }
    2284 #if !UNIFIED_TRANSFORM
    2285   if (iSize==4)
    2286   {   
    2287     short block[4][4];
    2288     short coeff[4][4];
    2289 
    2290     for (j=0; j<4; j++)
    2291     {   
    2292       for (k=0; k<4; k++)
    2293       {       
    2294         coeff[j][k] = (short)plCoef[j*4+k];
    2295       }   
    2296     }
    2297     xITr4(coeff,block,uiMode);
    2298     for (j=0; j<4; j++)
    2299     {   
    2300       memcpy(pResidual+j*uiStride,block[j],4*sizeof(short));
    2301     }   
    2302   }
    2303   else if (iSize==8)
    2304   {
    2305     short block[8][8];
    2306     short coeff[8][8];
    2307 
    2308     for (j=0; j<8; j++)
    2309     {   
    2310       for (k=0; k<8; k++)
    2311       {       
    2312         coeff[j][k] = (short)plCoef[j*8+k];
    2313       }   
    2314     }
    2315     xITr8(coeff,block);       
    2316     for (j=0; j<8; j++)
    2317     {   
    2318       memcpy(pResidual+j*uiStride,block[j],8*sizeof(short));
    2319     }
    2320   }
    2321   else if (iSize==16)
    2322   {
    2323     short block[16][16];
    2324     short coeff[16][16];
    2325 
    2326     for (j=0; j<16; j++)
    2327     {   
    2328       for (k=0; k<16; k++)
    2329       {       
    2330         coeff[j][k] = (short)plCoef[j*16+k];
    2331       }   
    2332     }
    2333     xITr16(coeff,block);       
    2334     for (j=0; j<16; j++)
    2335     {   
    2336       memcpy(pResidual+j*uiStride,block[j],16*sizeof(short));
    2337     }
    2338   }
    2339 
    2340   else if (iSize==32)
    2341   {
    2342     short block[32][32];
    2343     short coeff[32][32];
    2344 
    2345     for (j=0; j<32; j++)
    2346     {   
    2347       for (k=0; k<32; k++)
    2348       {       
    2349         coeff[j][k] = (short)plCoef[j*32+k];
    2350       }   
    2351     }
    2352     xITr32(coeff,block);       
    2353     for (j=0; j<32; j++)
    2354     {   
    2355       memcpy(pResidual+j*uiStride,block[j],32*sizeof(short));
    2356     }   
    2357   }
    2358 #endif
    23591534#endif 
    23601535}
     
    24421617  ::memset( pdCostCoeff, 0, sizeof(Double) *  uiMaxNumCoeff );
    24431618  ::memset( pdCostSig,   0, sizeof(Double) *  uiMaxNumCoeff );
    2444 #if MULTIBITS_DATA_HIDING
    24451619  Int rateIncUp   [ 32 * 32 ];
    24461620  Int rateIncDown [ 32 * 32 ];
     
    24511625  ::memset( sigRateDelta, 0, sizeof(Int) *  uiMaxNumCoeff );
    24521626  ::memset( deltaU,       0, sizeof(Int) *  uiMaxNumCoeff );
    2453 #endif
    24541627
    24551628  const UInt * scanCG;
     
    24571630  {
    24581631    scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlkSize > 3 ? uiLog2BlkSize-2-1 : 0  ];
    2459 #if MULTILEVEL_SIGMAP_EXT
    24601632    if( uiLog2BlkSize == 3 )
    24611633    {
     
    24661638      scanCG = g_sigLastScanCG32x32;
    24671639    }
    2468 #endif
    24691640  }
    24701641  else
     
    24861657  dTemp                       = dErrScale;
    24871658
    2488 #if RESTRICT_GR1GR2FLAG_NUMBER
    24891659  UInt    c1Idx     = 0;
    24901660  UInt    c2Idx     = 0;
    24911661  Int     baseLevel;
    2492 #endif
    24931662
    24941663  const UInt * scan;
     
    25021671  }
    25031672
    2504 #if !MULTILEVEL_SIGMAP_EXT
    2505   if (blockType < 4)
    2506   {
    2507   for( Int iScanPos = (Int) uiMaxNumCoeff-1; iScanPos >= 0; iScanPos-- )
    2508   {
    2509     //===== quantization =====
    2510     UInt    uiBlkPos          = scan[iScanPos];
    2511     // set coeff
    2512     uiQ  = piQCoef[uiBlkPos];
    2513     dTemp = pdErrScale[uiBlkPos];
    2514     Int lLevelDouble          = plSrcCoeff[ uiBlkPos ];
    2515     lLevelDouble              = (Int)min<Int64>(((Int64)abs(lLevelDouble) * uiQ), MAX_INT-(1 << (iQBits - 1)));
    2516 #if ADAPTIVE_QP_SELECTION
    2517     if( m_bUseAdaptQpSelect )
    2518     {
    2519       piArlDstCoeff[uiBlkPos]   = (Int)(( lLevelDouble + iAddC) >> iQBitsC );
    2520     }
    2521 #endif
    2522     UInt uiMaxAbsLevel        = (lLevelDouble + (1 << (iQBits - 1))) >> iQBits;
    2523     uiMaxAbsLevel=plSrcCoeff[ uiBlkPos ]>=0 ? min<UInt>(uiMaxAbsLevel,32767): min<UInt>(uiMaxAbsLevel,32768);
    2524     Double dErr               = Double( lLevelDouble );
    2525     pdCostCoeff0[ iScanPos ]  = dErr * dErr * dTemp;
    2526     d64BlockUncodedCost      += pdCostCoeff0[ iScanPos ];
    2527     piDstCoeff[ uiBlkPos ]    = uiMaxAbsLevel;
    2528 
    2529     if ( uiMaxAbsLevel > 0 && iLastScanPos < 0 )
    2530     {
    2531       iLastScanPos            = iScanPos;
    2532 #if LEVEL_CTX_LUMA_RED
    2533       uiCtxSet                = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2;
    2534 #else
    2535       uiCtxSet                = iScanPos < SCAN_SET_SIZE ? 0 : 3;
    2536       uiCtxSet                = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;
    2537 #endif
    2538     }   
    2539 
    2540     if ( iLastScanPos >= 0 )
    2541     {
    2542       //===== coefficient level estimation =====
    2543       UInt  uiLevel;
    2544       UInt  uiOneCtx         = 4 * uiCtxSet + c1;
    2545 #if RESTRICT_GR1GR2FLAG_NUMBER
    2546       UInt  uiAbsCtx         = uiCtxSet + c2;
    2547 #else
    2548       UInt  uiAbsCtx         = 3 * uiCtxSet + c2;
    2549 #endif
    2550 
    2551       if( iScanPos == iLastScanPos )
    2552       {
    2553 #if RESTRICT_GR1GR2FLAG_NUMBER
    2554         uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx, iQBits, dTemp, 1 );
    2555 #else
    2556         uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam, iQBits, dTemp, 1 );
    2557 #endif
    2558       }
    2559       else
    2560       {
    2561         UInt   uiPosY        = uiBlkPos >> uiLog2BlkSize;
    2562         UInt   uiPosX        = uiBlkPos - ( uiPosY << uiLog2BlkSize );
    2563         UShort uiCtxSig      = getSigCtxInc( piDstCoeff, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
    2564 #if RESTRICT_GR1GR2FLAG_NUMBER
    2565         uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx, iQBits, dTemp, 0 );
    2566 #else
    2567         uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ], lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam, iQBits, dTemp, 0 );
    2568 #endif
    2569 #if MULTIBITS_DATA_HIDING
    2570         sigRateDelta[ uiBlkPos ] = m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 1 ] - m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 0 ];
    2571 #endif
    2572       }
    2573 #if MULTIBITS_DATA_HIDING
    2574       deltaU[ uiBlkPos ]        = (lLevelDouble - ((Int)uiLevel << iQBits)) >> (iQBits-8);
    2575       if( uiLevel > 0 )
    2576       {
    2577 #if RESTRICT_GR1GR2FLAG_NUMBER   
    2578         Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx );
    2579         rateIncUp   [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow;
    2580         rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow;
    2581 #else 
    2582         Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam );
    2583         rateIncUp   [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;
    2584         rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;
    2585 #endif
    2586       }
    2587       else // uiLevel == 0
    2588       {
    2589         rateIncUp   [ uiBlkPos ] = m_pcEstBitsSbac->m_greaterOneBits[ uiOneCtx ][ 0 ];
    2590       }
    2591 #endif
    2592       piDstCoeff[ uiBlkPos ] = uiLevel;
    2593       d64BaseCost           += pdCostCoeff [ iScanPos ];
    2594 
    2595 #if RESTRICT_GR1GR2FLAG_NUMBER
    2596       baseLevel = (c1Idx < C1FLAG_NUMBER) ? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;
    2597       if( uiLevel >= baseLevel )
    2598       {
    2599 #if EIGHT_BITS_RICE_CODE
    2600         uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel, 23 ) ];
    2601 #else
    2602         uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel, 15 ) ];
    2603 #endif
    2604       }
    2605       if ( uiLevel >= 1)
    2606       {
    2607         c1Idx ++;
    2608       }
    2609 #endif
    2610 
    2611       //===== update bin model =====
    2612       if( uiLevel > 1 )
    2613       {
    2614         c1 = 0;
    2615         c2 += (c2 < 2);
    2616         uiNumOne++;
    2617 #if RESTRICT_GR1GR2FLAG_NUMBER
    2618         c2Idx ++;
    2619 #else
    2620         if( uiLevel > 2 )
    2621         {
    2622 #if EIGHT_BITS_RICE_CODE
    2623           uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 23 ) ];
    2624 #else
    2625           uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 15 ) ];
    2626 #endif
    2627         }
    2628 #endif
    2629       }
    2630       else if( (c1 < 3) && (c1 > 0) && uiLevel)
    2631       {
    2632         c1++;
    2633       }
    2634 
    2635       //===== context set update =====
    2636       if( ( iScanPos % SCAN_SET_SIZE == 0 ) && ( iScanPos > 0 ) )
    2637       {
    2638         c1                = 1;
    2639         c2                = 0;
    2640         uiGoRiceParam     = 0;
    2641 
    2642 #if RESTRICT_GR1GR2FLAG_NUMBER
    2643         c1Idx   = 0;
    2644         c2Idx   = 0;
    2645 #endif
    2646 #if LEVEL_CTX_LUMA_RED
    2647         uiCtxSet          = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2;
    2648 #else
    2649         uiCtxSet          = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;
    2650 #endif
    2651         if( uiNumOne > 0 )
    2652         {
    2653           uiCtxSet++;
    2654 #if !LEVEL_CTX_LUMA_RED
    2655           if(uiNumOne > 3 && eTType==TEXT_LUMA)
    2656           {
    2657             uiCtxSet++;
    2658           }
    2659 #endif
    2660         }
    2661         uiNumOne    >>= 1;
    2662       }
    2663     }
    2664     else
    2665     {
    2666       d64BaseCost    += pdCostCoeff0[ iScanPos ];
    2667     }
    2668   }
    2669   }
    2670   else //(uiLog2BlkSize > 3), for 16x16 and 32x32 TU
    2671   {     
    2672 #endif
    26731673    ::memset( pdCostCoeffGroupSig,   0, sizeof(Double) * MLS_GRP_NUM );
    26741674    ::memset( uiSigCoeffGroupFlag,   0, sizeof(UInt) * MLS_GRP_NUM );
     
    26831683      UInt uiCGPosY   = uiCGBlkPos / uiNumBlkSide;
    26841684      UInt uiCGPosX   = uiCGBlkPos - (uiCGPosY * uiNumBlkSide);
    2685 #if MULTILEVEL_SIGMAP_EXT
    26861685      if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) )
    26871686      {
     
    26891688        uiCGPosX = (uiScanIdx == SCAN_VER ? uiCGBlkPos : 0);
    26901689      }
    2691 #endif
    26921690      ::memset( &rdStats, 0, sizeof (coeffGroupRDStats));
    26931691       
     
    27181716        {
    27191717          iLastScanPos            = iScanPos;
    2720 #if LEVEL_CTX_LUMA_RED
    27211718          uiCtxSet                = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2;
    2722 #else
    2723           uiCtxSet                = (iScanPos < SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;
    2724 #endif
    27251719          iCGLastScanPos          = iCGScanPos;
    27261720        }
     
    27311725          UInt  uiLevel;
    27321726          UInt  uiOneCtx         = 4 * uiCtxSet + c1;
    2733 #if RESTRICT_GR1GR2FLAG_NUMBER
    27341727          UInt  uiAbsCtx         = uiCtxSet + c2;
    2735 #else
    2736           UInt  uiAbsCtx         = 3 * uiCtxSet + c2;
    2737 #endif
    27381728
    27391729          if( iScanPos == iLastScanPos )
    27401730          {
    2741 #if RESTRICT_GR1GR2FLAG_NUMBER 
    27421731            uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ],
    27431732                                                   lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam,
    27441733                                                   c1Idx, c2Idx, iQBits, dTemp, 1 );
    2745 #else
    2746             uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ],
    2747                                                    lLevelDouble, uiMaxAbsLevel, 0, uiOneCtx, uiAbsCtx, uiGoRiceParam,
    2748                                                    iQBits, dTemp, 1 );
    2749 #endif
    27501734          }
    27511735          else
     
    27541738            UInt   uiPosX        = uiBlkPos - ( uiPosY << uiLog2BlkSize );
    27551739            UShort uiCtxSig      = getSigCtxInc( piDstCoeff, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
    2756 #if RESTRICT_GR1GR2FLAG_NUMBER
    27571740            uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ],
    27581741                                                   lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam,
    27591742                                                   c1Idx, c2Idx, iQBits, dTemp, 0 );
    2760 #else
    2761             uiLevel              = xGetCodedLevel( pdCostCoeff[ iScanPos ], pdCostCoeff0[ iScanPos ], pdCostSig[ iScanPos ],
    2762                                                    lLevelDouble, uiMaxAbsLevel, uiCtxSig, uiOneCtx, uiAbsCtx, uiGoRiceParam,
    2763                                                    iQBits, dTemp, 0 );
    2764 #endif
    2765 #if MULTIBITS_DATA_HIDING
    27661743            sigRateDelta[ uiBlkPos ] = m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 1 ] - m_pcEstBitsSbac->significantBits[ uiCtxSig ][ 0 ];
    2767 #endif
    27681744          }
    2769 #if MULTIBITS_DATA_HIDING
    27701745          deltaU[ uiBlkPos ]        = (lLevelDouble - ((Int)uiLevel << iQBits)) >> (iQBits-8);
    27711746          if( uiLevel > 0 )
    27721747          {
    2773 #if RESTRICT_GR1GR2FLAG_NUMBER   
    27741748            Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx );
    27751749            rateIncUp   [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow;
    27761750            rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam, c1Idx, c2Idx ) - rateNow;
    2777 #else
    2778             Int rateNow = xGetICRate( uiLevel, uiOneCtx, uiAbsCtx, uiGoRiceParam );
    2779             rateIncUp   [ uiBlkPos ] = xGetICRate( uiLevel+1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;
    2780             rateIncDown [ uiBlkPos ] = xGetICRate( uiLevel-1, uiOneCtx, uiAbsCtx, uiGoRiceParam ) - rateNow;
    2781 #endif
    27821751          }
    27831752          else // uiLevel == 0
     
    27851754            rateIncUp   [ uiBlkPos ] = m_pcEstBitsSbac->m_greaterOneBits[ uiOneCtx ][ 0 ];
    27861755          }
    2787 #endif
    27881756          piDstCoeff[ uiBlkPos ] = uiLevel;
    27891757          d64BaseCost           += pdCostCoeff [ iScanPos ];
    27901758
    27911759
    2792 #if RESTRICT_GR1GR2FLAG_NUMBER
    27931760          baseLevel = (c1Idx < C1FLAG_NUMBER) ? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;
    27941761          if( uiLevel >= baseLevel )
    27951762          {
    2796 #if EIGHT_BITS_RICE_CODE
    27971763            uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel , 23 ) ];
    2798 #else
    2799             uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - baseLevel, 15 ) ];
    2800 #endif
    28011764          }
    28021765          if ( uiLevel >= 1)
     
    28041767            c1Idx ++;
    28051768          }
    2806 #endif
    28071769
    28081770          //===== update bin model =====
     
    28121774            c2 += (c2 < 2);
    28131775            uiNumOne++;
    2814 #if RESTRICT_GR1GR2FLAG_NUMBER
    28151776            c2Idx ++;
    2816 #else
    2817             if( uiLevel > 2 )
    2818             {
    2819 #if EIGHT_BITS_RICE_CODE
    2820               uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 23 ) ];
    2821 #else
    2822               uiGoRiceParam = g_aauiGoRiceUpdate[ uiGoRiceParam ][ min<UInt>( uiLevel - 3, 15 ) ];
    2823 #endif
    2824             }
    2825 #endif
    28261777          }
    28271778          else if( (c1 < 3) && (c1 > 0) && uiLevel)
     
    28371788            uiGoRiceParam     = 0;
    28381789
    2839 #if RESTRICT_GR1GR2FLAG_NUMBER
    28401790            c1Idx   = 0;
    28411791            c2Idx   = 0;
    2842 #endif
    2843 #if LEVEL_CTX_LUMA_RED
    28441792            uiCtxSet          = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 2;
    2845 #else
    2846             uiCtxSet          = (iScanPos == SCAN_SET_SIZE || eTType!=TEXT_LUMA) ? 0 : 3;
    2847 #endif
    28481793            if( uiNumOne > 0 )
    28491794            {
    28501795              uiCtxSet++;
    2851 #if !LEVEL_CTX_LUMA_RED
    2852               if( uiNumOne > 3 && eTType==TEXT_LUMA)
    2853               {
    2854                 uiCtxSet++;
    2855               }
    2856 #endif
    28571796            }
    28581797            uiNumOne    >>= 1;
     
    28821821      if (iCGLastScanPos >= 0)
    28831822      {
    2884 #if REMOVE_INFER_SIGGRP
    28851823        if( iCGScanPos )
    2886 #else
    2887 #if MULTILEVEL_SIGMAP_EXT
    2888         if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiScanIdx, uiWidth, uiHeight ) && (iCGScanPos != 0) )
    2889 #else
    2890         if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiWidth, uiHeight ) && (iCGScanPos != 0) )
    2891 #endif
    2892 #endif
    28931824        {
    28941825          if (uiSigCoeffGroupFlag[ uiCGBlkPos ] == 0)
    28951826          {
    2896 #if MULTILEVEL_SIGMAP_EXT
    28971827            UInt  uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiScanIdx, uiWidth, uiHeight);
    2898 #else
    2899             UInt  uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiWidth, uiHeight);
    2900 #endif
    29011828            d64BaseCost += xGetRateSigCoeffGroup(0, uiCtxSig) - rdStats.d64SigCost;; 
    29021829            pdCostCoeffGroupSig[ iCGScanPos ] = xGetRateSigCoeffGroup(0, uiCtxSig); 
     
    29151842
    29161843              // add SigCoeffGroupFlag cost to total cost
    2917 #if MULTILEVEL_SIGMAP_EXT
    29181844              UInt  uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiScanIdx, uiWidth, uiHeight);
    2919 #else
    2920               UInt  uiCtxSig = getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiWidth, uiHeight);
    2921 #endif
    29221845              if (iCGScanPos < iCGLastScanPos)
    29231846              {
     
    29581881          } // end if if (uiSigCoeffGroupFlag[ uiCGBlkPos ] == 0)
    29591882        }
    2960 #if REMOVE_INFER_SIGGRP
    29611883        else
    29621884        {
    29631885          uiSigCoeffGroupFlag[ uiCGBlkPos ] = 1;
    29641886        }
    2965 #else
    2966         else // if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY ) && (uiCGScanPos != 0) && (uiSigCoeffGroupFlag[ uiCGBlkPos ] != 0) )
    2967         {
    2968           uiSigCoeffGroupFlag[ uiCGBlkPos ] = 1;
    2969         } // end if ( !bothCGNeighboursOne( uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY ) && (uiCGScanPos != 0) && (uiSigCoeffGroupFlag[ uiCGBlkPos ] != 0) )
    2970 #endif
    29711887      }
    29721888    } //end for (iCGScanPos)
    2973 #if !MULTILEVEL_SIGMAP_EXT
    2974   }
    2975 #endif
    29761889
    29771890  //===== estimate last position =====
     
    29981911  }
    29991912
    3000 #if !MULTILEVEL_SIGMAP_EXT
    3001   if (blockType < 4)
    3002   {
    3003   for( Int iScanPos = iLastScanPos; iScanPos >= 0; iScanPos-- )
    3004   {
    3005     UInt   uiBlkPos     = scan[iScanPos];
    3006     if( piDstCoeff[ uiBlkPos ] )
    3007     {
    3008       UInt   uiPosY       = uiBlkPos >> uiLog2BlkSize;
    3009       UInt   uiPosX       = uiBlkPos - ( uiPosY << uiLog2BlkSize );
    3010       Double d64CostLast= uiScanIdx == SCAN_VER ? xGetRateLast( uiPosY, uiPosX, uiWidth ) : xGetRateLast( uiPosX, uiPosY, uiWidth );
    3011       Double totalCost = d64BaseCost + d64CostLast - pdCostSig[ iScanPos ];
    3012       if( totalCost < d64BestCost )
    3013       {
    3014         iBestLastIdxP1  = iScanPos + 1;
    3015         d64BestCost     = totalCost;
    3016       }
    3017       if( piDstCoeff[ uiBlkPos ] > 1 )
    3018       {
    3019         break;
    3020       }
    3021       d64BaseCost      -= pdCostCoeff[ iScanPos ];
    3022       d64BaseCost      += pdCostCoeff0[ iScanPos ];
    3023     }
    3024     else
    3025     {
    3026       d64BaseCost      -= pdCostSig[ iScanPos ];
    3027     }
    3028   }
    3029   }
    3030   else //if (uiLog2BlkSize < 4)
    3031   {
    3032 #endif
    30331913    Bool bFoundLast = false;
    30341914    for (Int iCGScanPos = iCGLastScanPos; iCGScanPos >= 0; iCGScanPos--)
     
    30411921        for (Int iScanPosinCG = uiCGSize-1; iScanPosinCG >= 0; iScanPosinCG--)
    30421922        {
    3043 #if MULTILEVEL_SIGMAP_EXT
    30441923          iScanPos = iCGScanPos*uiCGSize + iScanPosinCG;
    3045 #else
    3046           Int iScanPos = iCGScanPos*uiCGSize + iScanPosinCG;
    3047 #endif
    30481924          if (iScanPos > iLastScanPos) continue;
    30491925          UInt   uiBlkPos     = scan[iScanPos];
     
    30811957      } // end if (uiSigCoeffGroupFlag[ uiCGBlkPos ])
    30821958    } // end for
    3083 #if !MULTILEVEL_SIGMAP_EXT
    3084   } //if (uiLog2BlkSize < 4)
    3085 #endif
    30861959
    30871960  for ( Int scanPos = 0; scanPos < iBestLastIdxP1; scanPos++ )
     
    30991972  }
    31001973
    3101 #if MULTIBITS_DATA_HIDING
    31021974  if( pcCU->getSlice()->getPPS()->getSignHideFlag() && uiAbsSum>=2)
    31031975  {
     
    32262098    }
    32272099  }
    3228 #endif
    32292100}
    32302101
     
    33112182  const TCoeff *pData = pcCoeff + posX + posY * width;
    33122183 
    3313 #if !SIGMAP_CTX_SUBBLOCK
    3314   Int thred = std::max(height, width) >> 2;
    3315 #endif
    33162184 
    33172185  Int cnt = 0;
     
    33412209
    33422210  cnt = ( cnt + 1 ) >> 1;
    3343 #if SIGMAP_CTX_SUBBLOCK
    33442211  return (( textureType == TEXT_LUMA && ((posX>>2) + (posY>>2)) > 0 ) ? 4 : 1) + offset + cnt;
    3345 #else
    3346   return (( textureType == TEXT_LUMA && posX + posY >= thred ) ? 4 : 1) + offset + cnt;
    3347 #endif
    33482212}
    33492213
     
    33732237                                            UShort                          ui16CtxNumAbs,
    33742238                                            UShort                          ui16AbsGoRice,
    3375 #if RESTRICT_GR1GR2FLAG_NUMBER
    33762239                                            UInt                            c1Idx,
    33772240                                            UInt                            c2Idx,
    3378 #endif
    33792241                                            Int                             iQBits,
    33802242                                            Double                          dTemp,
     
    34072269  {
    34082270    Double dErr         = Double( lLevelDouble  - ( uiAbsLevel << iQBits ) );
    3409 #if RESTRICT_GR1GR2FLAG_NUMBER
    34102271    Double dCurrCost    = dErr * dErr * dTemp + xGetICRateCost( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx );
    3411 #else
    3412     Double dCurrCost    = dErr * dErr * dTemp + xGetICRateCost( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice );
    3413 #endif
    34142272    dCurrCost          += dCurrCostSig;
    34152273
     
    34362294                                               UShort                          ui16CtxNumAbs,
    34372295                                               UShort                          ui16AbsGoRice
    3438 #if RESTRICT_GR1GR2FLAG_NUMBER
    34392296                                            ,  UInt                            c1Idx,
    34402297                                               UInt                            c2Idx
    3441 #endif
    34422298                                               ) const
    34432299{
    34442300  Double iRate = xGetIEPRate();
    3445 #if RESTRICT_GR1GR2FLAG_NUMBER
    34462301  UInt baseLevel  =  (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;
    34472302
     
    34762331  }
    34772332  else
    3478 #endif
    34792333  if( uiAbsLevel == 1 )
    34802334  {
     
    34882342  else
    34892343  {
    3490 #if RESTRICT_GR1GR2FLAG_NUMBER
    34912344    assert (0);
    3492 #else
    3493     UInt uiSymbol     = uiAbsLevel - 3;
     2345  }
     2346  return xGetICost( iRate );
     2347}
     2348
     2349__inline Int TComTrQuant::xGetICRate  ( UInt                            uiAbsLevel,
     2350                                       UShort                          ui16CtxNumOne,
     2351                                       UShort                          ui16CtxNumAbs,
     2352                                       UShort                          ui16AbsGoRice
     2353                                     , UInt                            c1Idx,
     2354                                       UInt                            c2Idx
     2355                                       ) const
     2356{
     2357  Int iRate = 0;
     2358  UInt baseLevel  =  (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;
     2359
     2360  if ( uiAbsLevel >= baseLevel )
     2361  {
     2362    UInt uiSymbol     = uiAbsLevel - baseLevel;
    34942363    UInt uiMaxVlc     = g_auiGoRiceRange[ ui16AbsGoRice ];
    34952364    Bool bExpGolomb   = ( uiSymbol > uiMaxVlc );
     
    35072376
    35082377    iRate += ui16NumBins << 15;
    3509     iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ];
    3510     iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 1 ];
    3511 #endif
    3512   }
    3513   return xGetICost( iRate );
    3514 }
    3515 
    3516 #if MULTIBITS_DATA_HIDING
    3517 __inline Int TComTrQuant::xGetICRate  ( UInt                            uiAbsLevel,
    3518                                        UShort                          ui16CtxNumOne,
    3519                                        UShort                          ui16CtxNumAbs,
    3520                                        UShort                          ui16AbsGoRice
    3521 #if RESTRICT_GR1GR2FLAG_NUMBER
    3522                                      , UInt                            c1Idx,
    3523                                        UInt                            c2Idx
    3524 #endif
    3525                                        ) const
    3526 {
    3527   Int iRate = 0;
    3528 #if RESTRICT_GR1GR2FLAG_NUMBER
    3529   UInt baseLevel  =  (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;
    3530 
    3531   if ( uiAbsLevel >= baseLevel )
    3532   {
    3533     UInt uiSymbol     = uiAbsLevel - baseLevel;
    3534     UInt uiMaxVlc     = g_auiGoRiceRange[ ui16AbsGoRice ];
    3535     Bool bExpGolomb   = ( uiSymbol > uiMaxVlc );
    3536 
    3537     if( bExpGolomb )
    3538     {
    3539       uiAbsLevel  = uiSymbol - uiMaxVlc;
    3540       int iEGS    = 1;  for( UInt uiMax = 2; uiAbsLevel >= uiMax; uiMax <<= 1, iEGS += 2 );
    3541       iRate      += iEGS << 15;
    3542       uiSymbol    = min<UInt>( uiSymbol, ( uiMaxVlc + 1 ) );
    3543     }
    3544 
    3545     UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1;
    3546     UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice;
    3547 
    3548     iRate += ui16NumBins << 15;
    35492378
    35502379    if (c1Idx < C1FLAG_NUMBER)
     
    35592388  }
    35602389  else
    3561 #endif
    35622390  if( uiAbsLevel == 0 )
    35632391  {
     
    35752403  else
    35762404  {
    3577 #if RESTRICT_GR1GR2FLAG_NUMBER
    35782405    assert(0);
    3579 #else
    3580     UInt uiSymbol     = uiAbsLevel - 3;
    3581     UInt uiMaxVlc     = g_auiGoRiceRange[ ui16AbsGoRice ];
    3582     Bool bExpGolomb   = ( uiSymbol > uiMaxVlc );
    3583 
    3584     if( bExpGolomb )
    3585     {
    3586       uiAbsLevel  = uiSymbol - uiMaxVlc;
    3587       int iEGS    = 1;  for( UInt uiMax = 2; uiAbsLevel >= uiMax; uiMax <<= 1, iEGS += 2 );
    3588       iRate      += iEGS << 15;
    3589       uiSymbol    = min<UInt>( uiSymbol, ( uiMaxVlc + 1 ) );
    3590     }
    3591 
    3592     UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1;
    3593     UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice;
    3594 
    3595     iRate += ui16NumBins << 15;
    3596     iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ];
    3597     iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 1 ];
    3598 #endif
    35992406  }
    36002407  return iRate;
    36012408}
    3602 #endif
    36032409
    36042410__inline Double TComTrQuant::xGetRateSigCoeffGroup  ( UShort                    uiSignificanceCoeffGroup,
     
    36742480                                           const UInt                      uiCGPosX,
    36752481                                           const UInt                      uiCGPosY,
    3676 #if MULTILEVEL_SIGMAP_EXT
    36772482                                           const UInt                      scanIdx,
    3678 #endif
    36792483                                           Int width, Int height)
    36802484{
     
    36842488  width >>= 2;
    36852489  height >>= 2;
    3686 #if MULTILEVEL_SIGMAP_EXT
    36872490  if( width == 2 && height == 2 ) // 8x8
    36882491  {
     
    36982501    }
    36992502  }
    3700 #endif
    37012503  if( uiCGPosX < width - 1 )
    37022504  {
     
    37072509    uiLower = (uiSigCoeffGroupFlag[ (uiCGPosY  + 1 ) * width + uiCGPosX ] != 0);
    37082510  }
    3709 #if REMOVE_INFER_SIGGRP
    37102511  return (uiRight || uiLower);
    3711 #else
    3712   return uiRight + uiLower;
    3713 #endif
    3714 
    3715 }
    3716 #if !REMOVE_INFER_SIGGRP
    3717 // return 1 if both right neighbour and lower neighour are 1's
    3718 Bool TComTrQuant::bothCGNeighboursOne ( const UInt*                   uiSigCoeffGroupFlag,
    3719                                        const UInt                      uiCGPosX,
    3720                                        const UInt                      uiCGPosY,
    3721 #if MULTILEVEL_SIGMAP_EXT
    3722                                        const UInt                      scanIdx,
    3723 #endif
    3724                                        Int width, Int height)
    3725 {
    3726   UInt uiRight = 0;
    3727   UInt uiLower = 0;
    3728 
    3729   width >>= 2;
    3730   height >>= 2;
    3731 #if MULTILEVEL_SIGMAP_EXT
    3732   if( width == 2 && height == 2 ) // 8x8
    3733   {
    3734     if( scanIdx == SCAN_HOR ) 
    3735     {
    3736       width = 1;
    3737       height = 4;
    3738     }
    3739     else if( scanIdx == SCAN_VER )
    3740     {
    3741       width = 4;
    3742       height = 1;
    3743     }
    3744   }
    3745 #endif
    3746   if( uiCGPosX < width - 1 )
    3747   {
    3748     uiRight = (uiSigCoeffGroupFlag[ uiCGPosY * width + uiCGPosX + 1 ] != 0);
    3749   }
    3750   if (uiCGPosY < height - 1 )
    3751   {
    3752     uiLower = (uiSigCoeffGroupFlag[ (uiCGPosY  + 1 ) * width + uiCGPosX ] != 0);
    3753   }
    3754  
    3755   return (uiRight & uiLower);
    3756 }
    3757 #endif
     2512
     2513}
    37582514/** set quantized matrix coefficient for encode
    37592515 * \param scalingList quantaized matrix address
     
    38422598  UInt width = g_scalingListSizeX[sizeId];
    38432599  UInt height = g_scalingListSizeX[sizeId];
    3844 #if SCALING_LIST
    38452600  UInt ratio = g_scalingListSizeX[sizeId]/min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]);
    3846 #endif
    38472601  Int *quantcoeff;
    38482602  Int *coeff = scalingList->getScalingListAddress(sizeId,listId);
    38492603  quantcoeff   = getQuantCoeff(listId, qp, sizeId, SCALING_LIST_SQT);
    38502604
    3851 #if SCALING_LIST
    38522605  processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId));
    3853 #else
    3854   processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width,1,(Int)g_scalingListSizeX[sizeId],0);
    3855 #endif
    38562606
    38572607  if(sizeId == SCALING_LIST_32x32 || sizeId == SCALING_LIST_16x16) //for NSQT
    38582608  {
    38592609    quantcoeff   = getQuantCoeff(listId, qp, sizeId-1,SCALING_LIST_VER);
    3860 #if SCALING_LIST
    38612610    processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width>>2,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId));
    3862 #else
    3863     processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height,width>>2,1,(Int)g_scalingListSizeX[sizeId],0);
    3864 #endif
    38652611
    38662612    quantcoeff   = getQuantCoeff(listId, qp, sizeId-1,SCALING_LIST_HOR);
    3867 #if SCALING_LIST
    38682613    processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height>>2,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId));
    3869 #else
    3870     processScalingListEnc(coeff,quantcoeff,g_quantScales[qp]<<4,height>>2,width,1,(Int)g_scalingListSizeX[sizeId],0);
    3871 #endif
    38722614  }
    38732615}
     
    38822624  UInt width = g_scalingListSizeX[sizeId];
    38832625  UInt height = g_scalingListSizeX[sizeId];
    3884 #if SCALING_LIST
    38852626  UInt ratio = g_scalingListSizeX[sizeId]/min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]);
    3886 #endif
    38872627  Int *dequantcoeff;
    38882628  Int *coeff = scalingList->getScalingListAddress(sizeId,listId);
    38892629
    38902630  dequantcoeff = getDequantCoeff(listId, qp, sizeId,SCALING_LIST_SQT);
    3891 #if SCALING_LIST
    38922631  processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId));
    3893 #else
    3894   processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width,1,(Int)g_scalingListSizeX[sizeId],0);
    3895 #endif
    38962632
    38972633  if(sizeId == SCALING_LIST_32x32 || sizeId == SCALING_LIST_16x16)
    38982634  {
    38992635    dequantcoeff   = getDequantCoeff(listId, qp, sizeId-1,SCALING_LIST_VER);
    3900 #if SCALING_LIST
    39012636    processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width>>2,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId));
    3902 #else
    3903     processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height,width>>2,1,(Int)g_scalingListSizeX[sizeId],0);
    3904 #endif
    39052637
    39062638    dequantcoeff   = getDequantCoeff(listId, qp, sizeId-1,SCALING_LIST_HOR);
    39072639
    3908 #if SCALING_LIST
    39092640    processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height>>2,width,ratio,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),scalingList->getScalingListDC(sizeId,listId));
    3910 #else
    3911     processScalingListDec(coeff,dequantcoeff,g_invQuantScales[qp],height>>2,width,1,min(MAX_MATRIX_SIZE_NUM,(Int)g_scalingListSizeX[sizeId]),0);
    3912 #endif
    39132641  }
    39142642}
     
    40042732    }
    40052733  }
    4006 #if SCALING_LIST
    40072734  if(ratio > 1)
    40082735  {
    40092736    quantcoeff[0] = quantScales / dc;
    40102737  }
    4011 #endif
    40122738}
    40132739/** set quantized matrix coefficient for decode
     
    40322758    }
    40332759  }
    4034 #if SCALING_LIST
    40352760  if(ratio > 1)
    40362761  {
    40372762    dequantcoeff[0] = invQuantScales * dc;
    40382763  }
    4039 #endif
    40402764}
    40412765
  • trunk/source/Lib/TLibCommon/TComTrQuant.h

    r56 r296  
    8989  Int m_iBits;
    9090   
    91 #if H0736_AVC_STYLE_QP_RANGE
    9291  Void setQpParam( Int qpScaled, Bool bLowpass, SliceType eSliceType )
    9392  {
     
    9796    m_iBits = QP_BITS + m_iPer;
    9897  }
    99 #else
    100   Void setQpParam( Int iQP, Bool bLowpass, SliceType eSliceType )
    101   {
    102     assert ( iQP >= MIN_QP && iQP <= MAX_QP );
    103     m_iQP   = iQP;
    104    
    105     m_iPer  = (iQP + 6*g_uiBitIncrement)/6;
    106 #if FULL_NBIT
    107     m_iPer += g_uiBitDepth - 8;
    108 #endif
    109     m_iRem  = iQP % 6;
    110    
    111     m_iBits = QP_BITS + m_iPer;
    112   }
    113 #endif
    11498 
    11599  Void clear()
     
    165149 
    166150  // Misc functions
    167 #if H0736_AVC_STYLE_QP_RANGE
    168151  Void setQPforQuant( Int qpy, Bool bLowpass, SliceType eSliceType, TextType eTxtType, Int qpBdOffset, Int chromaQPOffset);
    169 #else
    170   Void setQPforQuant( Int iQP, Bool bLowpass, SliceType eSliceType, TextType eTxtType, Int Shift);
    171 #endif
    172152
    173153#if RDOQ_CHROMA_LAMBDA
     
    192172                                       const UInt                       uiCGPosX,
    193173                                       const UInt                       uiCGPosY,
    194 #if MULTILEVEL_SIGMAP_EXT
    195174                                       const UInt                     scanIdx,
    196 #endif
    197175                                       Int width, Int height);
    198 #if !REMOVE_INFER_SIGGRP 
    199   static Bool bothCGNeighboursOne  ( const UInt*                      uiSigCoeffGroupFlag,
    200                                     const UInt                       uiCGPosX,
    201                                     const UInt                       uiCGPosY,
    202 #if MULTILEVEL_SIGMAP_EXT
    203                                     const UInt                       scanIdx,
    204 #endif
    205                                     Int width, Int height);
    206 #endif
    207176  Void initScalingList                      ();
    208177  Void destroyScalingList                   ();
     
    259228  Void xT   ( UInt uiMode,Pel* pResidual, UInt uiStride, Int* plCoeff, Int iWidth, Int iHeight );
    260229 
    261 #if MULTIBITS_DATA_HIDING
    262230  Void signBitHidingHDQ( TComDataCU* pcCU, TCoeff* pQCoef, TCoeff* pCoef, UInt const *scan, Int* deltaU, Int width, Int height );
    263 #endif
    264231
    265232  // quantization
     
    298265                                             UShort                          ui16CtxNumAbs,
    299266                                             UShort                          ui16AbsGoRice,
    300 #if RESTRICT_GR1GR2FLAG_NUMBER
    301267                                             UInt                            c1Idx, 
    302268                                             UInt                            c2Idx, 
    303 #endif
    304269                                             Int                             iQBits,
    305270                                             Double                          dTemp,
     
    309274                                     UShort                          ui16CtxNumAbs,
    310275                                     UShort                          ui16AbsGoRice
    311 #if RESTRICT_GR1GR2FLAG_NUMBER
    312276                                   , UInt                            c1Idx,
    313277                                     UInt                            c2Idx
    314 #endif
    315278                                     ) const;
    316 #if MULTIBITS_DATA_HIDING
    317279__inline Int xGetICRate  ( UInt                            uiAbsLevel,
    318280                           UShort                          ui16CtxNumOne,
    319281                           UShort                          ui16CtxNumAbs,
    320282                           UShort                          ui16AbsGoRice
    321 #if RESTRICT_GR1GR2FLAG_NUMBER
    322283                         , UInt                            c1Idx,
    323284                           UInt                            c2Idx
    324 #endif
    325285                         ) const;
    326 #endif
    327286  __inline Double xGetRateLast     ( const UInt                      uiPosX,
    328287                                     const UInt                      uiPosY,
  • trunk/source/Lib/TLibCommon/TComWedgelet.cpp

    r189 r296  
    5252                                                            m_uhOri    ( 0 ),
    5353                                                            m_eWedgeRes( FULL_PEL )
    54 #if HHIQC_DMMFASTSEARCH_B0039
     54#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    5555                                                            , m_bIsCoarse( false )
    5656#endif
     
    6565                                                            m_uhOri    ( rcWedge.m_uhOri     ),
    6666                                                            m_eWedgeRes( rcWedge.m_eWedgeRes ),
    67 #if HHIQC_DMMFASTSEARCH_B0039
     67#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    6868                                                            m_bIsCoarse( rcWedge.m_bIsCoarse ),
    6969                                                            m_uiAng    ( rcWedge.m_uiAng     ),
     
    101101}
    102102
    103 #if HHIQC_DMMFASTSEARCH_B0039
     103#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    104104Void TComWedgelet::findClosetAngle()
    105105{
     
    142142  m_uhOri     = uhOri;
    143143  m_eWedgeRes = eWedgeRes;
    144 #if HHIQC_DMMFASTSEARCH_B0039
     144#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    145145  m_bIsCoarse = bIsCoarse;
    146146#endif
     
    687687  case( 2 ): { for( UInt iX = uiTempBlockSize-1; iX > uhXs;            iX-- ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } } break;
    688688  case( 3 ): { for( UInt iY = uiTempBlockSize-1; iY > uhYs;            iY-- ) { UInt iX = 0;                 while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break;
    689 #if HHIQC_DMMFASTSEARCH_B0039
     689#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    690690  case( 4 ):
    691691    {
     
    721721      case( 2 ): { uiOffX = 1; uiOffY = 1; } break;
    722722      case( 3 ): { uiOffX = 0; uiOffY = 1; } break;
    723 #if HHIQC_DMMFASTSEARCH_B0039
     723#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    724724      case( 4 ):
    725725        {
     
    805805}
    806806
    807 #if HHIQC_DMMFASTSEARCH_B0039
     807#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    808808TComWedgeNode::TComWedgeNode()
    809809{
  • trunk/source/Lib/TLibCommon/TComWedgelet.h

    r189 r296  
    5050};
    5151
    52 #if HHIQC_DMMFASTSEARCH_B0039
     52#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    5353#define NUM_WEDGE_REFINES 8
    5454#define NO_IDX MAX_UINT
     
    6767  UChar           m_uhOri;                      // orientation index
    6868  WedgeResolution m_eWedgeRes;                  // start/end pos resolution
    69 #if HHIQC_DMMFASTSEARCH_B0039
     69#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    7070  Bool            m_bIsCoarse;
    7171  UInt            m_uiAng;
     
    9999  UChar           getEndY    () { return m_uhYe; }
    100100  UChar           getOri     () { return m_uhOri; }
    101 #if HHIQC_DMMFASTSEARCH_B0039
     101#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    102102  Bool            getIsCoarse() { return m_bIsCoarse; }
    103103  UInt            getAng     () { return m_uiAng; }
     
    153153typedef std::vector<TComWedgeRef> WedgeRefList;
    154154
    155 #if HHIQC_DMMFASTSEARCH_B0039
     155#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    156156// ====================================================================================================================
    157157// Class definition TComWedgeNode
  • trunk/source/Lib/TLibCommon/TComYuv.cpp

    r189 r296  
    392392}
    393393
    394 #if LG_RESTRICTEDRESPRED_M24766
     394#if LG_RESTRICTEDRESPRED_M24766  && !MTK_MDIVRP_C0138
    395395Void
    396396TComYuv::add(Int *iPUResiPredShift, PartSize uhPartitionSize,  TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
     
    408408#endif
    409409
    410 #if LG_RESTRICTEDRESPRED_M24766
     410#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    411411Void
    412412TComYuv::getPUXYOffset(PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset)
     
    435435#endif
    436436
    437 #if LG_RESTRICTEDRESPRED_M24766
     437#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    438438Void
    439439TComYuv::addLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
     
    449449  Pel*  pDstSamples = getLumaAddr();
    450450
    451 #if LG_RESTRICTEDRESPRED_M24766
     451#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    452452  Int iXOffset, iYOffset;
    453453
     
    502502}
    503503
    504 #if LG_RESTRICTEDRESPRED_M24766
     504#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    505505Void
    506506TComYuv::addChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
     
    518518  Pel*  pDstSamplesCr = getCrAddr();
    519519
    520 #if LG_RESTRICTEDRESPRED_M24766
     520#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    521521  Int iXOffset, iYOffset;
    522522 
     
    676676}
    677677
    678 #if LG_RESTRICTEDRESPRED_M24766
     678#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    679679Void TComYuv::subtract(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
    680680{
     
    690690#endif
    691691
    692 #if LG_RESTRICTEDRESPRED_M24766
     692#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    693693Void TComYuv::subtractLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
    694694#else
     
    706706  Int  iDstStride  = getStride();
    707707
    708 #if LG_RESTRICTEDRESPRED_M24766
     708#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    709709  Int iXOffset, iYOffset;
    710710
     
    814814}
    815815
    816 #if LG_RESTRICTEDRESPRED_M24766
     816#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    817817Void TComYuv::subtractChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
    818818#else
     
    832832  Int  iSrc1Stride = pcYuvSrc1->getCStride();
    833833  Int  iDstStride  = getCStride();
    834 #if LG_RESTRICTEDRESPRED_M24766
     834#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    835835  Int iXOffset, iYOffset;
    836836 
  • trunk/source/Lib/TLibCommon/TComYuv.h

    r100 r296  
    146146  Void    addClipPartLuma   ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); //GT
    147147
    148 #if LG_RESTRICTEDRESPRED_M24766
     148#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    149149  //  pcYuvSrc0 - pcYuvSrc1 -> m_apiBuf
    150150  Void    subtract          (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
     
    166166  //   Remove High frequency
    167167  Void    removeHighFreq    ( TComYuv* pcYuvSrc, UInt uiPartIdx, UInt uiWidht, UInt uiHeight );
    168 #if LG_RESTRICTEDRESPRED_M24766
     168#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    169169  Void    getPUXYOffset     (PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset);
    170170  Void    add               (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract = false );
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r211 r296  
    4141//! \ingroup TLibCommon
    4242//! \{
     43
     44// MV-HEVC
     45#define QC_IV_AS_LT_B0046                 1   //JCT3V-B0046: inter-view reference pictures are treated as long-term pictures
     46#define QC_REM_IDV_B0046                  1   //JCT3V-B0046: removal of IDV NAL unit type
     47#define DV_V_RESTRICTION_B0037            1   //JCT3V-B0037: disparity vector vertical range restriction
     48#define QC_TMVP_IDX_MOD_B0046             1   //JCT3V-B0046: the reference index for temporal merging candidate is set to 0, as defined in HEVC
     49
     50// 3D-HEVC
    4351#define QC_MVHEVC_B0046                   0   //JCT3V-B0046: disable 3DHEVC tools
    44 #define QC_IV_AS_LT_B0046                 1   //JCT3V-B0046: inter-view reference pictures are treated as long-term pictures
    45 #define QC_TMVP_IDX_MOD_B0046             1   //JCT3V-B0046: the reference index for temporal merging candidate is set to 0, as defined in HEVC
    46 #define QC_REM_IDV_B0046                  1   //JCT3V-B0046: removal of IDV NAL unit type
    47 #define FIX_DEL_NULLPTR                   1
    48 #define FIX_MISUSE_REFINDEX               1
    49 #define FIX_FCO_COMP_WARNING              1
    50 #define DV_V_RESTRICTION_B0037            1   // JCT3V-B0037 disparity vector vertical range restriction
    5152
    5253#if !QC_MVHEVC_B0046
    53 ///// ***** FIXES *********
    54 // A
    55 #define FIX_POZNAN_CABAC_INIT_FLAG        1
    56 #define FIX_LG_RESTRICTEDRESPRED_M24766   1
    57 
    58 // B
    59 #define FIX_LGE_IVMP_PARALLEL_MERGE_B0136 1
    60 #define FIX_RDO_NEGDIST                   1
    61 #define FIX_DMM_NEG_DIST                  1
    62 #define FIX_LGE_DVMCP_B0133               1
    63 
    64 
    65 // FCO
    66 #define FLEX_CODING_ORDER_M23723          1
    67 #if FLEX_CODING_ORDER_M23723
    68   #define DISABLE_FCO_FOR_VSO             0 // Optional compile settings to disable VSO with FCO.
    69 #endif
    70 
    71 ///// ***** PATCHES *********
    72 #define TMVP_DEPTH_SWITCH                 1   // JCT3V-B0092 additional encoder option only
    73 
    74 ///// ***** DEPTH MODELING MODES *********
     54
     55///// ***** DMM *********
    7556#define HHI_DMM_WEDGE_INTRA               1   // depth model modes independent on texture (explicit and intra-predicted Wedgelet prediction)
    7657#define HHI_DMM_PRED_TEX                  1   // depth model modes dependent on texture (inter-component Wedgelet and Contour prediction )
     58                                              // HHIQC_DMMFASTSEARCH_B0039, fast Wedgelet search for DMM modes 1 and 3
     59
    7760#define LGE_EDGE_INTRA_A0070              1   // JCT3V-A0070
     61
     62#define HHI_DMM_DELTADC_Q1_C0034          1   // JCT3V-C0034: no quantization and fast encoder search for DMM delta DC values
     63#if ( HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA ) && HHI_DMM_PRED_TEX
     64#define LGE_DMM3_SIMP_C0044               1
     65#endif
     66#define FIX_DMM_CTX_INIT_C0034            1   // JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short)
     67
     68///// ***** SDC *********
    7869#define RWTH_SDC_DLT_B0036                1   // JCT3V-B0036: Simplified Depth Coding + Depth Lookup Table
    79 #define HHIQC_DMMFASTSEARCH_B0039         1   // JCT3V-B0039: fast Wedgelet search for DMM modes 1 and 3
    80 
    81 ///// ***** INTERVIEW MOTION VECTOR PREDICTION *********
    82 #define HHI_INTER_VIEW_MOTION_PRED        1   // inter-view motion parameter prediction
    83 #define SHARP_INTERVIEW_DECOUPLE_B0111    1   // JCT3V-B0111 decoupling inter-view candidate
    84 #define QC_MRG_CANS_B0048                 1   // JCT3V-B0048, B0086, B0069
    85 #if     QC_MRG_CANS_B0048
    86 #define OL_DISMV_POS_B0069                1   // different pos for disparity MV candidate, B0069
    87 #endif
    88 #define MTK_INTERVIEW_MERGE_A0049         1   // JCT3V-A0049 second part
    89 #if HHI_INTER_VIEW_MOTION_PRED         
    90 #define SAIT_IMPROV_MOTION_PRED_M24829    1   // improved inter-view motion vector prediction
    91 #else                                 
    92 #define SAIT_IMPROV_MOTION_PRED_M24829    0   
    93 #endif                                 
     70#if RWTH_SDC_DLT_B0036
     71#define SAIT_SDC_C0096                    1   // JCT3V-C0096: Improved Simple Depth Coding(removal of DMM2 among four SDC modes(DC, Planar, DMM1 and DMM2))
     72#endif
     73#define FIX_SDC_ENC_C0143                 1   // JCT3V-C0143 fix for unnecessary encoder checks in case of SDC
     74
     75///// ***** TMVP/AMVP *********
     76#define TMVP_DEPTH_SWITCH                 1   // JCT3V-B0092 additional encoder option only
     77#define QC_TMVP_MRG_REFIDX_C0047          1   // only enabled when QC_TMVP_IDX_MOD_B0046 is enabled.
     78#define INTER_VIEW_VECTOR_SCALING_C0115   1   // JCT3V-C0115 Inter-view vector scaling for TMVP & flag
     79#define INTER_VIEW_VECTOR_SCALING_C0116   1   // JCT3V-C0116 Inter-view vector scaling for AMVP
     80
     81///// ***** INTERVIEW MOTION PARAMETER PREDICTION *********
     82#define H3D_IVMP                          1   // Inter-view motion parameter prediction
     83                                              // HHI_INTER_VIEW_MOTION_PRED
     84                                              // SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction
     85                                              // SHARP_INTERVIEW_DECOUPLE_B0111, decoupling inter-view candidate
     86                                              // QC_MRG_CANS_B0048             , JCT3V-B0048, B0086, B0069
     87                                              // OL_DISMV_POS_B0069            , different pos for disparity MV candidate, B0069
     88                                              // MTK_INTERVIEW_MERGE_A0049     , second part
     89#define QC_AMVP_MRG_UNIFY_IVCAN_C0051     1
     90#define QC_C0051_FIXED_BY_MTK             1   // Bug fix for C0051 implementation
     91
    9492
    9593///// ***** INTERVIEW RESIDUAL PREDICTION *********
    96 #define HHI_INTER_VIEW_RESIDUAL_PRED      1   // inter-view residual prediction
    97 #if HHI_INTER_VIEW_RESIDUAL_PRED       
    98 #define LG_RESTRICTEDRESPRED_M24766       1   // restricted inter-view residual prediction
    99 #define QC_SIMPLIFIEDIVRP_M24938          1
     94#define H3D_IVRP                          1   // Inter-view residual prediction
     95                                              // HHI_INTER_VIEW_RESIDUAL_PRED
     96                                              // QC_SIMPLIFIEDIVRP_M24938
     97#if H3D_IVRP       
     98#define LG_RESTRICTEDRESPRED_M24766       1   // Restricted inter-view residual prediction
     99#define FIX_LG_RESTRICTEDRESPRED_M24766   1
    100100#else                                 
    101101#define LG_RESTRICTEDRESPRED_M24766       0
    102 #define QC_SIMPLIFIEDIVRP_M24938          0
    103 #endif
     102#endif
     103
     104#define MTK_MDIVRP_C0138                  1   // Mode-dependent inter-view residual prediction
     105#define MTK_C0138_FIXED                   1   // Fix for IBP coding structure in view direction (not CTC)
     106
    104107
    105108///// ***** DISPARITY VECTOR DERIVATION *********
    106 #define QC_MULTI_DIS_CAN_A0097            1   // JCT3V-A0097
    107 #define LGE_DVMCP_A0126                   1   // JCT3V-A0126     
    108 #define LGE_DVMCP_MEM_REDUCTION_B0135     1   // JCT3V-B0135     
    109 #define DV_DERIVATION_PARALLEL_B0096      1   // JCT3V-B0096, enable parallel derivation of disparity vector
    110 #define QC_SIMPLE_NBDV_B0047              1   // JCT3V-B0047
     109#define H3D_NBDV                          1   // Neighboring block disparity derivation
     110                                              // JCT3V-A0097
     111                                              // LGE_DVMCP_A0126
     112                                              // LGE_DVMCP_MEM_REDUCTION_B0135     
     113                                              // DV_DERIVATION_PARALLEL_B0096, enable parallel derivation of disparity vector
     114                                              // QC_SIMPLE_NBDV_B0047
     115                                              // FIX_LGE_DVMCP_B0133
     116                                              // LGE_IVMP_PARALLEL_MERGE_B0136, B0136 support of parallel merge/skip in disparity vector derivation
     117                                              // FIX_LGE_IVMP_PARALLEL_MERGE_B0136
     118
     119#define QC_NBDV_LDB_FIX_C0055             1   // JCT3V-C0055
     120#define MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097     1   // JCT3V-C0141/C0097
     121#define MTK_RELEASE_DV_CONSTRAINT_C0129   1   // JCT3V-C0129
     122#define MTK_SIMPLIFY_DVTC_C0135           1   // JCT3V-C0135
    111123
    112124///// ***** MOTION PARAMETER INHERITANCE  *********
    113 #define HHI_MPI                           1   // motion parameter inheritance from texture picture for depth map coding
     125#define MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137   1   // JCT3V-C0137
     126#define HHI_MPI                           0   // motion parameter inheritance from texture picture for depth map coding
    114127#if HHI_MPI
    115128#define FIX_MPI_B0065                     1   // JCT3V-B0065, fix the MPI bug when RQT is off
     
    133146#if LGE_ILLUCOMP_B0045
    134147#define LGE_ILLUCOMP_B0045_ENCSIMP        1
     148#define FIX_LGE_ILLUCOMP_B0045            1
     149#define LGE_ILLUCOMP_DEPTH_C0046          1   // JCT2-C0046 Apply illumination compensation to depth
     150#if LGE_ILLUCOMP_DEPTH_C0046
     151#define FIX_ILLUCOMP_DEPTH                1
     152#endif
    135153#endif
    136154
     
    140158///// ***** QUADTREE LIMITATION *********
    141159#define OL_QTLIMIT_PREDCODING_B0068       1    //JCT3V-B0068
     160#define HHI_QTLPC_RAU_OFF_C0160           1   // JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units
    142161
    143162///// ***** OTHERS *********
    144163#define LG_ZEROINTRADEPTHRESI_A0087       1   // JCT2-A0087
    145 #define SONY_COLPIC_AVAILABILITY          1
    146164#define HHI_FULL_PEL_DEPTH_MAP_MV_ACC     1   // full-pel mv accuracy for depth maps
    147 #define VIDYO_VPS_INTEGRATION             1
    148 
    149 
    150 
    151 ///// ***** DEFINED PARAMETERS *********
    152 #if QC_MULTI_DIS_CAN_A0097                   
     165#define VIDYO_VPS_INTEGRATION             1   // Integration of VPS
     166#define HHI_DEPTH_INTRA_SEARCH_RAU_C0160  1   // JCT3V-C0160 change 1: full Intra search in depth random access units
     167#define FIX_POZNAN_CABAC_INIT_FLAG        1
     168
     169///// ***** FCO  *********
     170#define FLEX_CODING_ORDER_M23723          1
     171#if FLEX_CODING_ORDER_M23723
     172#define DISABLE_FCO_FOR_VSO               0 // Optional compile settings to disable VSO with FCO.
     173#endif
     174
     175///// ***** VSP *********
     176#define MERL_VSP_C0152                    1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
     177#if MERL_VSP_C0152
     178
     179/*
     180 * Two macros are used to configure combinations of JCT3V-C0152 and JCT3V-C0131
     181 *
     182 *   a) (full) A full JCT3V-C0152 implementation, including JCT3V-C0131
     183 *      #define MERL_VSP_COMPENSATION_C0152          1
     184 *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
     185 *
     186 *   b) (mvp2off) For partial JCT3V-C0152 excluding overlaps from JCT3V-C0131
     187 *      #define MERL_VSP_COMPENSATION_C0152          1
     188 *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0
     189 *
     190 *   c) (nocand) For JCT3V-C0131 only
     191 *      #define MERL_VSP_COMPENSATION_C0152          0
     192 *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
     193 */
     194
     195#define MERL_VSP_COMPENSATION_C0152          1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add   (nocand).
     196#define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine  (mvp2off).
     197
     198#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
     199#define VSP_MERGE_POS                        5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5.
     200#define LGE_SIMP_DVP_REFINE_C0112            1 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block
     201
     202#else // !MERL_VSP_C0152
     203#define MERL_VSP_COMPENSATION_C0152          0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add
     204#define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine
     205#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
     206#define LGE_SIMP_DVP_REFINE_C0112            0 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block
     207#endif
     208
     209
     210///// ***** DERIVED PARAMETERS *********
     211#if H3D_NBDV                   
    153212#define DIS_CANS                          1
    154213#endif                                 
     
    172231
    173232
    174 #if LGE_DVMCP_A0126                           
     233#if H3D_NBDV                           
    175234#define DVFROM_LEFTBELOW                  1
    176235#define DVFROM_LEFT                       2
     
    182241
    183242
    184 #if HHIQC_DMMFASTSEARCH_B0039
     243#if HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA
    185244#define DMM3_SIMPLIFY_TR                  1
    186245#endif
     
    189248#if RWTH_SDC_DLT_B0036
    190249#define Log2( n ) ( log((double)n) / log(2.0) )
     250#define HS_REFERENCE_SUBSAMPLE_C0154      1
    191251#endif
    192252
    193253#define HHI_MPI_MERGE_POS                 0
    194254#endif
     255
     256
    195257///// ***** HM 6.1 *********
     258
     259//// REMOVED HM 6.1 Guard macros (corresponding to macros removed in HM 6.3.1)
     260/*
    196261#define SKIPFRAME_BUGFIX                  1 ///< bug fix to enable skipFrame at decoder
    197262#define START_DECODING_AT_CRA             1 ///< H0496, start decoding at clear random access point
    198263#define NO_COMBINED_PARALLEL              1 ///< Disallow any combined usage of parallel tools among Tile, EntropySlice and Wavefont
     264#define PARALLEL_MERGE                    1 ///< H0082 parallel merge/skip
     265#define MVP_AT_ENTROPYSLICE_BOUNDARY      1  //< H0362 enable motion prediction accross entropy slice boundary
     266#define FAST_DECISION_FOR_MRG_RD_COST     1  ////< H0178: Fast Decision for Merge 2Nx2N RDCost
     267#define PIC_CROPPING                      1  ///< Picture cropping and size constraints
     268#define NAL_REF_FLAG                      1  ///< Change nal_ref_idc to nal_ref_flag (JCTVC-F463)
     269#define REMOVE_DIV_OPERATION      1  ///< H0238: Simplified intra horizontal and vertical filtering
     270#define LOGI_INTRA_NAME_3MPM      1  ///< H0407: logical Intra mode naming (sequential angular mode numbering) and 3 MPM mode coding
     271#define LEVEL_CTX_LUMA_RED        1  ///<H0130: Luma level context reduction
     272#define REMOVE_INFER_SIGGRP       1  ///<H0131: Remove inferred significant_coeff_group_flag
     273#define SET_MERGE_TMVP_REFIDX     1  ///< H0278/H0199: Setting the merge TMVP refidx to 0 for the non-first partition
     274#define MULTILEVEL_SIGMAP_EXT     1  ///< H0526: multi-level significance map extended to smaller TUs
     275#define MULTIBITS_DATA_HIDING     1  ///< H0481: multiple sign bit hiding
     276#define DEQUANT_CLIPPING          1  ///< H0312/H0541: transformed coefficients clipping before de-quantization
     277#define REMOVE_NON_SCALED         1 ///< H0164/H0250: Removal of non-scaled merge candidate
     278#define MRG_IDX_CTX_RED           1 ///< H0251: Merge index context reduction
     279#define SIMP_MRG_PRUN             1 ///< H0252: simplification of merge pruning process
     280#define AMVP_PRUNING_SIMPLIFICATION         1     ///H0316: simplify the pruning process of AMVP by exempting the temporal candidate
     281#define AMVP_ZERO_CHECKING_REMOVAL          1     ///H0239/H0316: remove zero motion vector checking of AMVP
     282#define H0111_MVD_L1_ZERO         1  ///< H0111: modification of bi-prediction
     283#define CLIPSCALEDMVP               1  ///< H0216: Clipping scaled MV to 16 bit
     284#define UNIFIED_TRANSFORM_TREE      1   ///< H0123: unified tree structure for TU
     285#define SIGMAP_CTX_SUBBLOCK       1 ///< H0290: 4x4 sub-block based region for significant_flag context selection
     286#define LAST_CTX_REDUCTION        1  ///< H0537/H514: contexts reduction for last position coding
     287#define AMP_CTX                   1 ///<H0545: context reduction for asymmetric partition
     288#define RESTRICT_GR1GR2FLAG_NUMBER    1 ///< H0554: Throughput improvement of CABAC coefficients level coding
     289#define EIGHT_BITS_RICE_CODE        1 ///< H0498 : 8 bits rice codes
     290#define SAO_UNIT_INTERLEAVING      1   ///< H0273
     291#define ALF_SINGLE_FILTER_SHAPE    1     //< !!! H0068: Single filter type : 9x7 cross + 3x3 square
     292#define ALF_16_BA_GROUPS        1     ///< H0409 16 BA groups
     293#define LCU_SYNTAX_ALF          1     ///< H0274 LCU-syntax ALF
     294#define ALF_CHROMA_COEF_PRED_HARMONIZATION 1 ///< H0483: ALF chroma coeff pred harmonization
     295#define CABAC_LINEAR_INIT       1     ///< H0535 : linear CABAC initialization
     296#define UNIFIED_TRANSFORM       1     ///< H0492: unify square and non-square transform
     297#define G519_TU_AMP_NSQT_HARMONIZATION  1   ///< G519: Harmonization of implicit TU, AMP and NSQT
     298#define CHROMA_MODE_CODING                   1     //H0326/H0475 : 2-length fixed, bypass coding for chroma intra prediction mode
     299#define NSQT_LFFIX                           1     ///< Bug fix related to NSQT and deblocking filter
     300#define H0736_AVC_STYLE_QP_RANGE             1    ///< H0736: AVC style qp range and wrapping.
     301#define H0204_QP_PREDICTION                  1    ///< H0204: improved QP prediction
     302#define BURST_IPCM                        1           ///< H0051: Burst IPCM
     303#define H0137_0138_LIST_MODIFICATION      1           // Enabled reference picture lists combination (H0137) and reference picture list modification (H0138) updates
     304#define LTRP_MULT                       1           ///< enable/disable multiple long term reference pictures with same POC LSB
     305#define OL_FLUSH 1          // Set to 1 to enable Wavefront Flush.
     306#define FIXED_NUMBER_OF_TILES_SLICE_MODE                1
     307#define SCALING_LIST                  1 //JCTVC-H0230/H0461/H0237
     308#define DEFAULT_DC                    1 // JCTVC-H0242
     309#define RPS_IN_SPS                    1 // Adopted during discussion of JCTVC-H0423
     310#define H0412_REF_PIC_LIST_RESTRICTION 1
     311#define H0566_TLA                     1
     312#define H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1
     313#define DBL_H0473_PART_1          1   //Deblocking filtering simplification
     314#define DBL_CONTROL               1   //PPS deblocking_filter_control_present_flag (JCTVC-H0398); condition for inherit params flag in SH (JCTVC-H0424)
     315#define DBL_STRONG_FILTER_CLIP    1   //Introduction of strong filter clipping in deblocking filter (JCTVC-H0275)
     316#define H0388                       1 // JCTVC-H0388
     317#define TILES_WPP_ENTRY_POINT_SIGNALLING        1 // JCTVC-H0556. Assumes either Tiles is ON or WPP is ON (not both simultaneously).
     318#define REMOVE_TILE_DEPENDENCE                  1 // remove tile_boundary_independence_flag and dependent tiles
     319#define TILES_OR_ENTROPY_SYNC_IDC               1 // tiles_or_entropy_coding_sync_idc flag
     320#define COMPLETE_SLICES_IN_TILE     1 // Among the constraints between slices and tiles, all slices within a tile shall be complete (JCTVC-H0348/JCTVC-H0463) for SliceMode 1&2
     321#define WPP_SIMPLIFICATION          1 // JCTVC-H0349/JCTVC-0517
     322*/
     323
    199324
    200325#define LOSSLESS_CODING                   1 ///< H0530: lossless and lossy (mixed) coding
     
    203328#endif
    204329
    205 #define PARALLEL_MERGE  1                   //< H0082 parallel merge/skip
    206 #define LGE_IVMP_PARALLEL_MERGE_B0136     1 //< B0136 support of parallel merge/skip in disparity vector derivation
    207330#define LOG2_PARALLEL_MERGE_LEVEL_MINUS2  0 //< H0082 parallel merge level 0-> 4x4, 1-> 8x8, 2->16x16, 3->32x32, 4->64x64
    208331
    209 #if PARALLEL_MERGE && LOG2_PARALLEL_MERGE_LEVEL_MINUS2
     332#if LOG2_PARALLEL_MERGE_LEVEL_MINUS2
    210333#define CU_BASED_MRG_CAND_LIST            1  //< H0240: single merge candidate list for all PUs inside a 8x8 CU conditioned on LOG2_PARALLEL_MERGE_LEVEL_MINUS2 > 0
    211334#define FIX_CU_BASED_MRG_CAND_LIST_B0136  1  //< B0136 bug fix for CU_BASED_MRG_CAND_LIST
    212335#endif
    213336
    214 #define MVP_AT_ENTROPYSLICE_BOUNDARY      1  //< H0362 enable motion prediction accross entropy slice boundary
    215 
    216 #define FAST_DECISION_FOR_MRG_RD_COST     1  ////< H0178: Fast Decision for Merge 2Nx2N RDCost
    217 
    218 #define PIC_CROPPING              1  ///< Picture cropping and size constraints
    219 #define NAL_REF_FLAG              1  ///< Change nal_ref_idc to nal_ref_flag (JCTVC-F463)
    220 #define REMOVE_DIV_OPERATION      1  ///< H0238: Simplified intra horizontal and vertical filtering
    221 #define LOGI_INTRA_NAME_3MPM      1  ///< H0407: logical Intra mode naming (sequential angular mode numbering) and 3 MPM mode coding
    222 
    223 #define LEVEL_CTX_LUMA_RED        1  ///<H0130: Luma level context reduction
    224 #define REMOVE_INFER_SIGGRP       1  ///<H0131: Remove inferred significant_coeff_group_flag
    225 
    226 #define SET_MERGE_TMVP_REFIDX     1  ///< H0278/H0199: Setting the merge TMVP refidx to 0 for the non-first partition
    227 
    228 #define MULTILEVEL_SIGMAP_EXT     1  ///< H0526: multi-level significance map extended to smaller TUs
    229 #define MULTIBITS_DATA_HIDING     1  ///< H0481: multiple sign bit hiding
    230 
    231 #define DEQUANT_CLIPPING          1  ///< H0312/H0541: transformed coefficients clipping before de-quantization
    232 
    233 #define REMOVE_NON_SCALED         1 ///< H0164/H0250: Removal of non-scaled merge candidate
    234 #define MRG_IDX_CTX_RED           1 ///< H0251: Merge index context reduction
    235 #define SIMP_MRG_PRUN             1 ///< H0252: simplification of merge pruning process
    236 
    237 #define AMVP_PRUNING_SIMPLIFICATION         1     ///H0316: simplify the pruning process of AMVP by exempting the temporal candidate
    238 #define AMVP_ZERO_CHECKING_REMOVAL          1     ///H0239/H0316: remove zero motion vector checking of AMVP
    239 
    240 #define H0111_MVD_L1_ZERO         1  ///< H0111: modification of bi-prediction
    241337#define DISABLING_CLIP_FOR_BIPREDME         1  ///< Ticket #175
    242 
    243 #define CLIPSCALEDMVP               1  ///< H0216: Clipping scaled MV to 16 bit
    244 
    245 #define UNIFIED_TRANSFORM_TREE      1   ///< H0123: unified tree structure for TU
    246 
    247 #define SIGMAP_CTX_SUBBLOCK       1 ///< H0290: 4x4 sub-block based region for significant_flag context selection
    248 
    249338#define SIGMAP_CONST_AT_HIGH_FREQUENCY      1      ///< H0095 method2.1: const significance map at high freaquency
    250339
    251 #define LAST_CTX_REDUCTION        1  ///< H0537/H514: contexts reduction for last position coding
    252 
    253 #define AMP_CTX                   1 ///<H0545: context reduction for asymmetric partition
    254 
    255 #define RESTRICT_GR1GR2FLAG_NUMBER    1 ///< H0554: Throughput improvement of CABAC coefficients level coding
    256 #if RESTRICT_GR1GR2FLAG_NUMBER    //
    257340#define C1FLAG_NUMBER               8 // maximum number of largerThan1 flag coded in one chunk :  16 in HM5
    258341#define C2FLAG_NUMBER               1 // maximum number of largerThan2 flag coded in one chunk:  16 in HM5
    259 #endif
    260 
    261 #define EIGHT_BITS_RICE_CODE        1 ///< H0498 : 8 bits rice codes
    262 
    263 #define SAO_UNIT_INTERLEAVING      1   ///< H0273
     342
    264343#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_1 0  ///< disable the encoder constraint that does not test SAO/BO mode for chroma in interleaved mode
    265344#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_2 0  ///< disable the encoder constraint that reduce the range of SAO/EO for chroma in interleaved mode
    266345#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 0  ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode
    267 
    268 #define ALF_SINGLE_FILTER_SHAPE    1     //< !!! H0068: Single filter type : 9x7 cross + 3x3 square
    269 
    270 #define ALF_16_BA_GROUPS        1     ///< H0409 16 BA groups
    271 #define LCU_SYNTAX_ALF          1     ///< H0274 LCU-syntax ALF
    272 #define ALF_CHROMA_COEF_PRED_HARMONIZATION 1 ///< H0483: ALF chroma coeff pred harmonization
    273 
    274 #define CABAC_LINEAR_INIT       1     ///< H0535 : linear CABAC initialization
    275 
    276 #define COLLOCATED_REF_IDX      1     ///< H0442: signal collocated reference index
    277 
    278 #define UNIFIED_TRANSFORM       1     ///< H0492: unify square and non-square transform
     346#define COLLOCATED_REF_IDX      1           ///< H0442: signal collocated reference index
     347
    279348
    280349#define MAX_NUM_SPS                32
     
    293362#define FAST_BIT_EST                1   ///< G763: Table-based bit estimation for CABAC
    294363
    295 #define G519_TU_AMP_NSQT_HARMONIZATION  1   ///< G519: Harmonization of implicit TU, AMP and NSQT
    296364
    297365#define MLS_GRP_NUM                         64     ///< G644 : Max number of coefficient groups, max(16, 64)
     
    305373
    306374
    307 #define CHROMA_MODE_CODING                   1     //H0326/H0475 : 2-length fixed, bypass coding for chroma intra prediction mode
    308 
    309 #define NSQT_LFFIX                           1     ///< Bug fix related to NSQT and deblocking filter
    310375#define NS_HAD                               1
    311376
     
    313378#define APS_BITS_FOR_ALF_BYTE_LENGTH 8
    314379
    315 #define H0736_AVC_STYLE_QP_RANGE             1    ///< H0736: AVC style qp range and wrapping.
    316 #define H0204_QP_PREDICTION                  1    ///< H0204: improved QP prediction
     380
    317381
    318382#define HHI_RQT_INTRA_SPEEDUP             1           ///< tests one best mode with full rqt
    319383#define HHI_RQT_INTRA_SPEEDUP_MOD         0           ///< tests two best modes with full rqt
    320384
    321 #define BURST_IPCM                        1           ///< H0051: Burst IPCM
     385
    322386
    323387#if HHI_RQT_INTRA_SPEEDUP_MOD && !HHI_RQT_INTRA_SPEEDUP
     
    325389#endif
    326390
    327 #define H0137_0138_LIST_MODIFICATION      1           // Enabled reference picture lists combination (H0137) and reference picture list modification (H0138) updates
    328 #if !H0137_0138_LIST_MODIFICATION
    329 #error "H0137_0138_LIST_MODIFICATION must be enabled for multi-view coding."
    330 #endif
     391
    331392
    332393#define VERBOSE_RATE 0                               ///< Print additional rate information in encoder
     
    386447
    387448#if LGE_EDGE_INTRA_A0070
    388 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
     449#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    389450#define EDGE_INTRA_IDX  (NUM_INTRA_MODE+NUM_DMM_MODE)
    390 #endif // HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
     451#endif // HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    391452#if LGE_EDGE_INTRA_DELTA_DC
    392453#define EDGE_INTRA_DELTA_IDX          (EDGE_INTRA_IDX+1)
     
    402463                                                    // this should be done with encoder only decision
    403464                                                    // but because of the absence of reference frame management, the related code was hard coded currently
    404 #define LTRP_MULT                       1           ///< enable/disable multiple long term reference pictures with same POC LSB
    405 
    406 #define OL_FLUSH 1          // Set to 1 to enable Wavefront Flush.
    407465#define OL_FLUSH_ALIGN 0    // Align flush to byte boundary.  This preserves byte operations in CABAC (faster) but at the expense of an average
    408466                            // of 4 bits per flush.
     
    413471
    414472#define PLANAR_IDX             0
    415 #if LOGI_INTRA_NAME_3MPM
    416473#define VER_IDX                26                    // index for intra VERTICAL   mode
    417474#define HOR_IDX                10                    // index for intra HORIZONTAL mode
    418475#define DC_IDX                 1                     // index for intra DC mode
    419 #else
    420 #define DC_IDX                 3                     // index for intra DC mode
    421 #endif
    422476#define NUM_CHROMA_MODE        6                     // total number of chroma modes
    423477#define DM_CHROMA_IDX          36                    // chroma mode index for derived from luma intra mode
     
    430484#define FULL_NBIT 0 ///< When enabled, does not use g_uiBitIncrement anymore to support > 8 bit data
    431485
    432 #define FIXED_NUMBER_OF_TILES_SLICE_MODE                1
     486
    433487#define AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE      1          ///< OPTION IDENTIFIER. mode==1 -> Limit maximum number of largest coding tree blocks in a slice
    434488#define AD_HOC_SLICES_FIXED_NUMBER_OF_BYTES_IN_SLICE    2          ///< OPTION IDENTIFIER. mode==2 -> Limit maximum number of bins/bits in a slice
    435 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    436489#define AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE    3
    437 #endif
    438490
    439491// Entropy slice options
     
    459511
    460512#define SCALING_LIST_OUTPUT_RESULT    0 //JCTVC-G880/JCTVC-G1016 quantization matrices
    461 #define SCALING_LIST                  1 //JCTVC-H0230/H0461/H0237
    462 
    463 #define DEFAULT_DC                    1 // JCTVC-H0242
    464 
    465 #define RPS_IN_SPS                    1 // Adopted during discussion of JCTVC-H0423
    466 
    467 #define H0412_REF_PIC_LIST_RESTRICTION 1
    468 
    469 #define H0566_TLA                     1
    470 #if H0566_TLA
    471513#define H0566_TLA_SET_FOR_SWITCHING_POINTS 1
    472 #endif
    473 
    474 #define H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1
    475 
    476 #define DBL_H0473_PART_1          1   //Deblocking filtering simplification
    477 #define DBL_CONTROL               1   //PPS deblocking_filter_control_present_flag (JCTVC-H0398); condition for inherit params flag in SH (JCTVC-H0424)
    478 #define DBL_STRONG_FILTER_CLIP    1   //Introduction of strong filter clipping in deblocking filter (JCTVC-H0275)
     514
    479515
    480516#define CABAC_INIT_FLAG             1 // JCTVC-H0540
    481517#define CABAC_INIT_PRESENT_FLAG     1
    482518
    483 #define H0388                       1 // JCTVC-H0388
    484 
    485 #define TILES_WPP_ENTRY_POINT_SIGNALLING        1 // JCTVC-H0556. Assumes either Tiles is ON or WPP is ON (not both simultaneously).
    486 #define REMOVE_TILE_DEPENDENCE                  1 // remove tile_boundary_independence_flag and dependent tiles
    487 #define TILES_OR_ENTROPY_SYNC_IDC               1 // tiles_or_entropy_coding_sync_idc flag
    488 #define COMPLETE_SLICES_IN_TILE     1 // Among the constraints between slices and tiles, all slices within a tile shall be complete (JCTVC-H0348/JCTVC-H0463) for SliceMode 1&2
    489 #define WPP_SIMPLIFICATION          1 // JCTVC-H0349/JCTVC-0517
    490519
    491520// ====================================================================================================================
     
    568597{
    569598  SAO_EO_LEN    = 4,
    570 #if SAO_UNIT_INTERLEAVING
    571599  SAO_BO_LEN    = 4,
    572600  SAO_MAX_BO_CLASSES = 32
    573 #else
    574   SAO_BO_LEN    = 16
    575 #endif
    576601};
    577602
     
    582607  SAO_EO_2,
    583608  SAO_EO_3,
    584 #if SAO_UNIT_INTERLEAVING
    585609  SAO_BO,
    586 #else
    587   SAO_BO_0,
    588   SAO_BO_1,
    589 #endif
    590610  MAX_NUM_SAO_TYPE
    591611};
     
    593613typedef struct _SaoQTPart
    594614{
    595 #if !SAO_UNIT_INTERLEAVING
    596   Bool        bEnableFlag;
    597 #endif
    598615  Int         iBestType;
    599616  Int         iLength;
    600 #if SAO_UNIT_INTERLEAVING
    601617  Int         bandPosition ;
    602618  Int         iOffset[4];
    603 #else
    604   Int         iOffset[32];
    605 #endif
    606619  Int         StartCUX;
    607620  Int         StartCUY;
     
    627640} SAOQTPart;
    628641
    629 #if SAO_UNIT_INTERLEAVING
    630642typedef struct _SaoLcuParam
    631643{
     
    641653  Int        length;
    642654} SaoLcuParam;
    643 #endif
    644655
    645656struct SAOParam
     
    649660  Int        iMaxSplitLevel;
    650661  Int        iNumClass[MAX_NUM_SAO_TYPE];
    651 #if SAO_UNIT_INTERLEAVING
    652662  Bool         oneUnitFlag[3];
    653663  SaoLcuParam* saoLcuParam[3];
    654664  Int          numCuInHeight;
    655665  Int          numCuInWidth;
    656 #endif
    657666  ~SAOParam();
    658667};
     
    661670{
    662671  Int alf_flag;                           ///< indicates use of ALF
    663 #if !LCU_SYNTAX_ALF
    664   Int chroma_idc;                         ///< indicates use of ALF for chroma
    665 #endif
    666672  Int num_coeff;                          ///< number of filter coefficients
    667673  Int filter_shape;
    668 #if !LCU_SYNTAX_ALF
    669   Int filter_shape_chroma;
    670   Int num_coeff_chroma;                   ///< number of filter coefficients (chroma)
    671   Int *coeff_chroma;                      ///< filter coefficient array (chroma)
    672 #endif
    673674  Int *filterPattern;
    674675  Int startSecondFilter;
     
    678679  Int **coeffmulti;
    679680  Int minKStart;
    680 #if !LCU_SYNTAX_ALF
    681   Int maxScanVal;
    682   Int kMinTab[42];
    683 
    684   Int alf_pcr_region_flag;
    685   ~ALFParam();
    686 #endif
    687 #if LCU_SYNTAX_ALF
    688681  Int componentID;
    689682  Int* kMinTab;
     
    698691  Void destroy();
    699692  Void copy(const ALFParam& src);
    700 #endif
    701 };
    702 
    703 #if LCU_SYNTAX_ALF
     693};
     694
    704695struct AlfUnitParam
    705696{
     
    734725  Void destroy();
    735726};
    736 #endif
    737727
    738728
Note: See TracChangeset for help on using the changeset viewer.