Changeset 294 in 3DVCSoftware


Ignore:
Timestamp:
19 Feb 2013, 20:33:52 (12 years ago)
Author:
tech
Message:

Removed HM-6.1 related guard macros.

Location:
branches/HTM-5.1-dev0/source
Files:
77 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-5.1-dev0/source/App/TAppDecoder/TAppDecTop.cpp

    r289 r294  
    369369      if(newPicture[viewDepthId])
    370370      {
    371 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    372371        xWriteOutput( pcListPic[viewDepthId], viewDepthId, nalu.m_temporalId );
    373 #else
    374         xWriteOutput( pcListPic[viewDepthId], viewDepthId );
    375 #endif
    376372      }
    377373    }
     
    440436}
    441437
    442 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    443438Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId )
    444 #else
    445 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId )
    446 #endif
    447439{
    448440  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
     
    463455  {
    464456    TComPic* pcPic = *(iterPic);
    465 #if PIC_CROPPING
    466457    TComSPS *sps = pcPic->getSlice(0)->getSPS();
    467 #endif
    468458   
    469 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    470459    if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getSlice(0)->getSPS()->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[viewDepthId]))
    471 #else
    472     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getSlice(0)->getSPS()->getNumReorderFrames() && pcPic->getPOC() > m_pocLastDisplay[viewDepthId]))
    473 #endif
    474460    {
    475461      // write to file
     
    477463      if ( m_pchReconFile )
    478464      {
    479 #if PIC_CROPPING
    480465        m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
    481 #else
    482         m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
    483 #endif
    484466      }
    485467     
     
    526508  {
    527509    TComPic* pcPic = *(iterPic);
    528 #if PIC_CROPPING
    529510    TComSPS *sps = pcPic->getSlice(0)->getSPS();
    530 #endif
    531511
    532512    if ( pcPic->getOutputMark() )
     
    535515      if ( m_pchReconFile )
    536516      {
    537 #if PIC_CROPPING
    538517        m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
    539 #else
    540         m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
    541 #endif
    542518      }
    543519     
  • branches/HTM-5.1-dev0/source/App/TAppDecoder/TAppDecTop.h

    r231 r294  
    121121//  Void  xInitDecLib       (); ///< initialize decoder class
    122122 
    123 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    124123  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId); ///< write YUV to file
    125 #else
    126   Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< write YUV to file
    127 #endif
    128124  Void  xFlushOutput      ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< flush all remaining decoded pictures to file
    129125
  • branches/HTM-5.1-dev0/source/App/TAppEncoder/TAppEncCfg.cpp

    r292 r294  
    233233  ("SourceWidth,-wdt",        m_iSourceWidth,           0,                            "Source picture width")
    234234  ("SourceHeight,-hgt",       m_iSourceHeight,          0,                            "Source picture height")
    235 #if PIC_CROPPING
    236235  ("CroppingMode",            m_croppingMode,           0,                            "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    237236  ("CropLeft",                m_cropLeft,               0,                            "Left cropping/padding for cropping mode 3")
     
    241240  ("HorizontalPadding,-pdx",  m_aiPad[0],               0,                            "horizontal source padding for cropping mode 2")
    242241  ("VerticalPadding,-pdy",    m_aiPad[1],               0,                            "vertical source padding for cropping mode 2")
    243 #endif
    244242  ("InputBitDepth",         m_uiInputBitDepth, 8u, "bit-depth of input file")
    245243  ("BitDepth",              m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth")
    246244  ("OutputBitDepth",        m_uiOutputBitDepth, 0u, "bit-depth of output file")
    247245  ("InternalBitDepth",      m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)")
    248 #if !PIC_CROPPING
    249   ("HorizontalPadding,-pdx",m_aiPad[0],      0, "horizontal source padding size")
    250   ("VerticalPadding,-pdy",  m_aiPad[1],      0, "vertical source padding size")
    251   ("PAD",                   m_bUsePAD,   false, "automatic source padding of multiple of 16" )
    252 #endif
    253246  ("FrameRate,-fr",         m_iFrameRate,        0, "Frame rate")
    254247  ("FrameSkip,-fs",         m_FrameSkip,         0u, "Number of frames to skip at start of input YUV")
     
    279272  ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CRA 2:IDR)")
    280273  ("GOPSize,g",      m_iGOPSize,      1, "GOP size of temporal structure")
    281 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    282   ("MaxNumberOfReorderPictures",   m_numReorderFrames,               -1, "Max. number of reorder pictures: -1: encoder determines value, >=0: set explicitly")
    283   ("MaxNumberOfReferencePictures", m_maxNumberOfReferencePictures, 6, "Max. number of reference pictures")
    284 #endif
    285274  ("ListCombination,-lc", m_bUseLComb, true, "combined reference list flag for uni-prediction in B-slices")
    286275  ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation")
     
    321310  ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], MAX_QP + 1, "QP offset of temporal layer 3")
    322311 
    323 #if !H0566_TLA
    324   ("TLayeringBasedOnCodingStruct,-tl", m_bTLayering, false, "Temporal ID is set based on the hierarchical coding structure")
    325  
    326   ("TLayerSwitchingFlag_L0,-ts0", m_abTLayerSwitchingFlag[0], false, "Switching flag for temporal layer 0")
    327   ("TLayerSwitchingFlag_L1,-ts1", m_abTLayerSwitchingFlag[1], false, "Switching flag for temporal layer 1")
    328   ("TLayerSwitchingFlag_L2,-ts2", m_abTLayerSwitchingFlag[2], false, "Switching flag for temporal layer 2")
    329   ("TLayerSwitchingFlag_L3,-ts3", m_abTLayerSwitchingFlag[3], false, "Switching flag for temporal layer 3")
    330 #endif
    331312
    332313  /* Entropy coding parameters */
     
    349330  ("IVSEnable",                       m_bUseIVS                 , true         , "Use inter-view vector scaling" )
    350331#endif
    351 #if DBL_CONTROL
    352332  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, true)
    353 #endif
    354333
    355334  /* Camera Paremetes */
     
    412391  ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF")
    413392  ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO")
    414 #if SAO_UNIT_INTERLEAVING
    415393  ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "2048: default")   
    416394  ("SAOInterleaving", m_saoInterleavingFlag, false, "0: SAO Picture Mode, 1: SAO Interleaving ")   
    417 #endif
    418395
    419396  ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding")
    420397
    421398  ("ALFMaxNumFilter,-ALFMNF", m_iALFMaxNumberFilters, 16, "16: No Constrained, 1-15: Constrained max number of filter")
    422 #if LCU_SYNTAX_ALF
    423399  ("ALFParamInSlice", m_bALFParamInSlice, false, "ALF parameters in 0: APS, 1: slice header")
    424400  ("ALFPicBasedEncode", m_bALFPicBasedEncode, true, "ALF picture-based encoding 0: false, 1: true")
    425 #endif
    426401
    427402    ("SliceMode",            m_iSliceMode,           0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes")
     
    446421    ("TileInfoPresentFlag",         m_iColumnRowInfoPresent,         1,          "0: tiles parameters are NOT present in the PPS. 1: tiles parameters are present in the PPS")
    447422    ("UniformSpacingIdc",           m_iUniformSpacingIdr,            0,          "Indicates if the column and row boundaries are distributed uniformly")
    448 #if !REMOVE_TILE_DEPENDENCE
    449     ("TileBoundaryIndependenceIdc", m_iTileBoundaryIndependenceIdr,  1,          "Indicates if the column and row boundaries break the prediction")
    450 #endif
    451423    ("NumTileColumnsMinus1",        m_iNumColumnsMinus1,             0,          "Number of columns in a picture minus 1")
    452424    ("ColumnWidthArray",            cfg_ColumnWidth,                 string(""), "Array containing ColumnWidth values in units of LCU")
     
    463435    ("ScalingList",                 m_useScalingListId,              0,          "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile")
    464436    ("ScalingListFile",             cfg_ScalingListFile,             string(""), "Scaling list file name")
    465 #if MULTIBITS_DATA_HIDING
    466437    ("SignHideFlag,-SBH",                m_signHideFlag, 1)
    467438    ("SignHideThreshold,-TSIG",          m_signHidingThreshold,         4)
    468 #endif
    469439#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    470440  ("DMM",                         m_bUseDMM,                       false,      "depth model modes flag")
     
    484454  ("FEN", m_bUseFastEnc, false, "fast encoder setting")
    485455  ("ECU", m_bUseEarlyCU, false, "Early CU setting")
    486 #if FAST_DECISION_FOR_MRG_RD_COST
    487456  ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost")
    488 #endif
    489457  ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
    490458#if HHI_INTERVIEW_SKIP
     
    624592  }
    625593
    626 #if PIC_CROPPING
    627594  switch (m_croppingMode)
    628595  {
     
    674641    }
    675642  }
    676 #else
    677 
    678   // compute source padding size
    679   if ( m_bUsePAD )
    680   {
    681     if ( m_iSourceWidth%MAX_PAD_SIZE )
    682     {
    683       m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth;
    684     }
    685    
    686     if ( m_iSourceHeight%MAX_PAD_SIZE )
    687     {
    688       m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight;
    689     }
    690   }
    691   m_iSourceWidth  += m_aiPad[0];
    692   m_iSourceHeight += m_aiPad[1];
    693 #endif
    694643 
    695644  // allocate slice-based dQP values
     
    897846  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
    898847  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
    899 #if H0736_AVC_STYLE_QP_RANGE
    900848  xConfirmPara( m_aiQP[0] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[0] > 51,         "QP exceeds supported range (-QpBDOffsety to 51)" );
    901849  if ( m_aiQP.size() >= 2 )
     
    903851    xConfirmPara( m_aiQP[1] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[1] > 51,       "QP depth exceeds supported range (-QpBDOffsety to 51)" );
    904852  }
    905 #else
    906   xConfirmPara( m_aiQP[0] < 0 || m_aiQP[0] > 51,                                             "QP exceeds supported range (0 to 51)" );
    907   if ( m_aiQP.size() >= 2 )
    908   {
    909     xConfirmPara( m_aiQP[1] < 0 || m_aiQP[1] > 51,                                           "QP Depth exceeds supported range (0 to 51)" );
    910   }
    911 #endif
    912853  xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2,             "ALFEncodePassReduction must be equal to 0, 1 or 2");
    913 #if LCU_SYNTAX_ALF
    914854  xConfirmPara( m_iALFMaxNumberFilters < 1,                                                 "ALFMaxNumFilter should be larger than 1"); 
    915 #else
    916   xConfirmPara( m_iALFMaxNumberFilters < 1 || m_iALFMaxNumberFilters > 16,                  "ALFMaxNumFilter exceeds supported range (1 to 16)"); 
    917 #endif
    918855  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13,          "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)");
    919856  xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13,              "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)");
     
    941878  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    942879  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
    943 #if PIC_CROPPING
    944880  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
    945881  xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame height must be a multiple of the minimum CU size");
    946 #else
    947   xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Frame width should be multiple of minimum CU size");
    948   xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0,             "Frame height should be multiple of minimum CU size");
    949 #endif
    950882 
    951883  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
     
    1005937  }
    1006938#if ADAPTIVE_QP_SELECTION
    1007 #if H0736_AVC_STYLE_QP_RANGE
    1008939  xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[0] < 0,                                              "AdaptiveQpSelection must be disabled when QP < 0.");
    1009940  xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[1] < 0,                                              "AdaptiveQpSelection must be disabled when QP < 0.");
    1010941  xConfirmPara( m_bUseAdaptQpSelect == true && (m_iChromaQpOffset !=0 || m_iChromaQpOffset2nd != 0 ),  "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0.");
    1011 #endif
    1012942#endif
    1013943
     
    1020950  }
    1021951
    1022 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    1023952  xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" );
    1024 #endif
    1025953  if (m_iSliceMode!=0)
    1026954  {
    1027955    xConfirmPara( m_iSliceArgument < 1 ,         "SliceArgument should be larger than or equal to 1" );
    1028956  }
    1029 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    1030957  if (m_iSliceMode==3)
    1031958  {
    1032959    xConfirmPara( m_iSliceGranularity > 0 ,      "When SliceMode == 3 is chosen, the SliceGranularity must be 0" );
    1033960  }
    1034 #endif
    1035961  xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" );
    1036962  if (m_iEntropySliceMode!=0)
     
    1042968  xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" );
    1043969
    1044 #if NO_COMBINED_PARALLEL
    1045970  bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 );
    1046971  xConfirmPara( tileFlag && m_iEntropySliceMode,            "Tile and Entropy Slice can not be applied together");
    1047972  xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
    1048973  xConfirmPara( m_iWaveFrontSynchro && m_iEntropySliceMode, "Wavefront and Entropy Slice can not be applied together"); 
    1049 #endif
    1050974
    1051975  // max CU width and height should be power of 2
     
    12391163      for( Int i = 0; i < MAX_GOP; i++ ) { isOK[i] = false; }
    12401164      Int numOK = 0;
    1241 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1242       Int numReorderFramesRequired=0;
    1243       m_maxNumberOfReferencePictures=0;
    1244       Int lastDisp = -1;
    1245 #endif
    12461165      m_extraRPSs[viewId] = 0;
    12471166      //start looping through frames in coding order until we can verify that the GOP structure is correct.
     
    14271346            }
    14281347          }
    1429 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1430           if(m_maxNumberOfReferencePictures<numRefs)
    1431           {
    1432             m_maxNumberOfReferencePictures=numRefs;
    1433           }
    1434 #endif
    14351348          refList[numRefs] = curPOC;
    14361349          numRefs++;
    1437 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1438           Int nonDisplayed=0;
    1439           for(Int i=0; i<numRefs; i++)
    1440           {
    1441             if(refList[i]==lastDisp+1)
    1442             {
    1443               lastDisp=refList[i];
    1444               i=0;
    1445             }
    1446           }
    1447           for(Int i=0; i<numRefs; i++)
    1448           {
    1449             if(refList[i]>lastDisp)
    1450             {
    1451               nonDisplayed++;
    1452             }
    1453           }
    1454           if(nonDisplayed>numReorderFramesRequired)
    1455           {
    1456             numReorderFramesRequired=nonDisplayed;
    1457           }
    1458 #endif
    14591350        }
    14601351        checkGOP++;
    14611352      }
    1462 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1463       if (m_numReorderFrames == -1)
    1464       {
    1465         m_numReorderFrames = numReorderFramesRequired;
    1466       }
    1467 #endif
    14681353      xConfirmPara( errorGOP, "Invalid GOP structure given" );
    1469 #if H0566_TLA
    14701354      m_maxTempLayer[viewId] = 1;
    1471 #endif
    14721355      for( Int i = 0; i < m_iGOPSize; i++ )
    14731356      {
    1474 #if H0566_TLA
    14751357        if( m_GOPListsMvc[viewId][i].m_temporalId >= m_maxTempLayer[viewId] )
    14761358        {
    14771359          m_maxTempLayer[viewId] = m_GOPListsMvc[viewId][i].m_temporalId + 1;
    14781360        }
    1479 #endif
    14801361        xConfirmPara( m_GOPListsMvc[viewId][i].m_sliceType != 'B' && m_GOPListsMvc[viewId][i].m_sliceType != 'P', "Slice type must be equal to B or P" );
    14811362      }
    14821363
    1483 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    14841364      for( Int i = 0; i < MAX_TLAYER; i++ )
    14851365      {
     
    15381418        m_maxDecPicBuffering[viewId][MAX_TLAYER-1] = m_numReorderPics[viewId][MAX_TLAYER-1];
    15391419      }
    1540 #endif
    1541 
    1542 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
     1420
    15431421      xConfirmPara( m_bUseLComb == false && m_numReorderPics[viewId][MAX_TLAYER-1] != 0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" );  // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.
    1544 #else
    1545       xConfirmPara( m_bUseLComb==false && m_numReorderFrames!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" );  // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.
    1546       xConfirmPara( m_numReorderFrames < numReorderFramesRequired, "For the used GOP the encoder requires more pictures for reordering than specified in MaxNumberOfReorderPictures" );
    1547 #endif
    15481422    }
    15491423  }
     
    16551529    }
    16561530  }
    1657 #if PIC_CROPPING
    16581531  printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate );
    1659 #else
    1660   printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate );
    1661 #endif
    16621532  printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    16631533  printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded );
     
    17271597 
    17281598  printf("TOOL CFG General: "); 
    1729 #if LCU_SYNTAX_ALF
    17301599  printf("ALFMNF:%d ", m_iALFMaxNumberFilters);
    17311600  printf("ALFInSlice:%d ", m_bALFParamInSlice);
    17321601  printf("ALFPicEnc:%d ", m_bALFPicBasedEncode);
    1733 #endif
    17341602  printf("IBD:%d ", !!g_uiBitIncrement);
    17351603  printf("HAD:%d ", m_bUseHADME           );
     
    17371605  printf("SQP:%d ", m_uiDeltaQpRD         );
    17381606  printf("ASR:%d ", m_bUseASR             );
    1739 #if !PIC_CROPPING
    1740   printf("PAD:%d ", m_bUsePAD             );
    1741 #endif
    17421607  printf("LComb:%d ", m_bUseLComb         );
    17431608  printf("LCMod:%d ", m_bLCMod         );
    17441609  printf("FEN:%d ", m_bUseFastEnc         );
    17451610  printf("ECU:%d ", m_bUseEarlyCU         );
    1746 #if FAST_DECISION_FOR_MRG_RD_COST
    17471611  printf("FDM:%d ", m_useFastDecisionForMerge );
    1748 #endif
    17491612  printf("CFM:%d ", m_bUseCbfFastMode         );
    17501613  printf("RQT:%d ", 1     );
     
    17611624  }
    17621625  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    1763 #if BURST_IPCM
    17641626  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    1765 #else
    1766   printf("PCM:%d ", ((1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    1767 #endif
    1768 #if SAO_UNIT_INTERLEAVING
    17691627  printf("SAOInterleaving:%d ", (m_saoInterleavingFlag)?(1):(0));
    1770 #endif
    17711628#if LOSSLESS_CODING
    17721629  printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 );
     
    17741631  printf("WPP:%d ", (Int)m_bUseWeightPred);
    17751632  printf("WPB:%d ", m_uiBiPredIdc);
    1776 #if !REMOVE_TILE_DEPENDENCE
    1777   printf("TileBoundaryIndependence:%d ", m_iTileBoundaryIndependenceIdr );
    1778 #endif
    17791633  printf("TileLocationInSliceHdr:%d ", m_iTileLocationInSliceHeaderFlag);
    17801634  printf("TileMarker:%d", m_iTileMarkerFlag);
     
    17991653#endif
    18001654
    1801 #if MULTIBITS_DATA_HIDING
    18021655  printf(" SignBitHidingFlag:%d SignBitHidingThreshold:%d", m_signHideFlag, m_signHidingThreshold);
    1803 #endif
    18041656  printf("\n");
    18051657  printf("TOOL CFG VIDEO  : ");
  • branches/HTM-5.1-dev0/source/App/TAppEncoder/TAppEncCfg.h

    r292 r294  
    7373  Int       m_iSourceWidth;                                   ///< source width in pixel
    7474  Int       m_iSourceHeight;                                  ///< source height in pixel
    75 #if PIC_CROPPING
    7675  Int       m_croppingMode;
    7776  Int       m_cropLeft;
     
    7978  Int       m_cropTop;
    8079  Int       m_cropBottom;
    81 #endif
    8280  Int       m_iFrameToBeEncoded;                              ///< number of encoded frames
    83 #if !PIC_CROPPING
    84   Bool      m_bUsePAD;                                        ///< flag for using source padding
    85 #endif
    8681  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    8782 
     
    10095  Int       m_extraRPSs[MAX_VIEW_NUM];
    10196  GOPEntryMvc m_GOPListsMvc[MAX_VIEW_NUM][MAX_GOP+1];
    102 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    10397  Int       m_numReorderPics[MAX_VIEW_NUM][MAX_TLAYER];       ///< total number of reorder pictures
    10498  Int       m_maxDecPicBuffering[MAX_VIEW_NUM][MAX_TLAYER];   ///< total number of reference pictures needed for decoding
    105 #else
    106   Int       m_numReorderFrames;                               ///< total number of reorder pictures
    107   Int       m_maxNumberOfReferencePictures;                   ///< total number of reference pictures needed for decoding
    108 #endif
    10999  Bool      m_bUseLComb;                                      ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)
    110100  Bool      m_bLCMod;                                         ///< flag for specifying whether the combined reference list for uni-prediction in B-slices is uploaded explicitly
     
    136126  Int       m_iQPAdaptationRange;                             ///< dQP range by QP adaptation
    137127 
    138 #if H0566_TLA
    139128  Int       m_maxTempLayer[MAX_VIEW_NUM];                     ///< Max temporal layer
    140 #else
    141   Bool      m_bTLayering;                                     ///< indicates whether temporal IDs are set based on the hierarchical coding structure
    142   Bool      m_abTLayerSwitchingFlag[MAX_TLAYER];              ///< temporal layer switching flags corresponding to each temporal layer
    143 #endif
    144129
    145130  // coding unit (CU) definition
     
    179164  Bool      m_bUseIVS;                                        ///< flag for using inter-view vector scaling
    180165#endif
    181 #if SAO_UNIT_INTERLEAVING
    182166  Int       m_maxNumOffsetsPerPic;                            ///< SAO maximun number of offset per picture
    183167  Bool      m_saoInterleavingFlag;                            ///< SAO interleaving flag
    184 #endif
    185168  // coding tools (loop filter)
    186169  vector<Bool> m_abUseALF;                                    ///< flag for using adaptive loop filter [0] - video, [1] - depth
     
    188171 
    189172  Int       m_iALFMaxNumberFilters;                           ///< ALF Max Number Filters in one picture
    190 #if LCU_SYNTAX_ALF
    191173  Bool      m_bALFParamInSlice;
    192174  Bool      m_bALFPicBasedEncode;
    193 #endif
    194175
    195176  vector<Bool> m_abLoopFilterDisable;                         ///< flag for using deblocking filter filter [0] - video, [1] - depth
     
    197178  Int       m_loopFilterBetaOffsetDiv2;                     ///< beta offset for deblocking filter
    198179  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
    199 #if DBL_CONTROL
    200180  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
    201 #endif
    202181 
    203182  Bool      m_bUseLMChroma;                                  ///< JL: Chroma intra prediction based on luma signal
     
    242221#endif
    243222
    244 #if FAST_DECISION_FOR_MRG_RD_COST
    245223  Bool      m_useFastDecisionForMerge;         ///< flag for using Fast Decision Merge RD-Cost
    246 #endif
    247224  Bool      m_bUseCbfFastMode;                 ///< flag for using Cbf Fast PU Mode Decision
    248225  Int       m_iSliceMode;                      ///< 0: Disable all Recon slice limits, 1 : Maximum number of largest coding units per slice, 2: Maximum number of bytes in a slice
     
    257234  Int       m_iColumnRowInfoPresent;
    258235  Int       m_iUniformSpacingIdr;
    259 #if !REMOVE_TILE_DEPENDENCE
    260   Int       m_iTileBoundaryIndependenceIdr;
    261 #endif
    262236  Int       m_iNumColumnsMinus1;
    263237  char*     m_pchColumnWidth;
     
    287261#endif
    288262
    289 #if MULTIBITS_DATA_HIDING
    290263  Int       m_signHideFlag;
    291264  Int       m_signHidingThreshold;
    292 #endif
    293265#if HHI_MPI
    294266  Bool      m_bUseMVI;  ///< flag for using Motion Vector Inheritance for depth map coding
  • branches/HTM-5.1-dev0/source/App/TAppEncoder/TAppEncTop.cpp

    r292 r294  
    9797    m_acTEncTopList[iViewIdx]->setSourceWidth                  ( m_iSourceWidth );
    9898    m_acTEncTopList[iViewIdx]->setSourceHeight                 ( m_iSourceHeight );
    99 #if PIC_CROPPING
    10099    m_acTEncTopList[iViewIdx]->setCroppingMode                 ( m_croppingMode );
    101100    m_acTEncTopList[iViewIdx]->setCropLeft                     ( m_cropLeft );
     
    103102    m_acTEncTopList[iViewIdx]->setCropTop                      ( m_cropTop );
    104103    m_acTEncTopList[iViewIdx]->setCropBottom                   ( m_cropBottom );
    105 #endif
    106104    m_acTEncTopList[iViewIdx]->setFrameToBeEncoded             ( m_iFrameToBeEncoded );
    107105    m_acTEncTopList[iViewIdx]->setViewId                       ( iViewIdx );
     
    138136    m_acTEncTopList[iViewIdx]->setGopList                      ( m_GOPListsMvc[iViewIdx] );
    139137    m_acTEncTopList[iViewIdx]->setExtraRPSs                    ( m_extraRPSs[iViewIdx] );
    140 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    141138    for(Int i = 0; i < MAX_TLAYER; i++)
    142139    {
     
    144141      m_acTEncTopList[iViewIdx]->setMaxDecPicBuffering         ( m_maxDecPicBuffering[iViewIdx][i], i );
    145142    }
    146 #else
    147     m_acTEncTopList[iViewIdx]->setNumReorderFrames             ( m_numReorderFrames );
    148     m_acTEncTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures );
    149 #endif
    150143    for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    151144    {
     
    157150    m_acTEncTopList[iViewIdx]->setPad                          ( m_aiPad );
    158151   
    159 #if H0566_TLA
    160152    m_acTEncTopList[iViewIdx]->setMaxTempLayer                 ( m_maxTempLayer[iViewIdx] );
    161 #else
    162     m_acTEncTopList[iViewIdx]->setTLayering                    ( m_bTLayering );
    163     m_acTEncTopList[iViewIdx]->setTLayerSwitchingFlag          ( m_abTLayerSwitchingFlag );
    164 #endif
    165153
    166154    m_acTEncTopList[iViewIdx]->setDisInter4x4                  ( m_bDisInter4x4);
     
    176164    m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    177165    m_acTEncTopList[iViewIdx]->setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    178 #if DBL_CONTROL
    179166    m_acTEncTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    180 #endif
    181167
    182168  //====== Motion search ========
     
    201187#if LOSSLESS_CODING
    202188    Int lowestQP;
    203 #if H0736_AVC_STYLE_QP_RANGE
    204189    lowestQP =  - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) );
    205 #else
    206     lowestQP = 0;
    207 #endif
    208190    if ((m_iMaxDeltaQP == 0 ) && (m_aiQP[0] == lowestQP) && (m_useLossless == true))
    209191    {
     
    260242    m_acTEncTopList[iViewIdx]->setdQPs                         ( m_aidQP        );
    261243    m_acTEncTopList[iViewIdx]->setUseRDOQ                      ( m_abUseRDOQ[0] );
    262 #if !PIC_CROPPING
    263     m_acTEncTopList[iViewIdx]->setUsePAD                       ( m_bUsePAD      );
    264 #endif
    265244    m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    266245    m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
     
    269248    m_acTEncTopList[iViewIdx]->setUseFastEnc                   ( m_bUseFastEnc  );
    270249    m_acTEncTopList[iViewIdx]->setUseEarlyCU                   ( m_bUseEarlyCU  );
    271 #if FAST_DECISION_FOR_MRG_RD_COST
    272250    m_acTEncTopList[iViewIdx]->setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    273 #endif
    274251    m_acTEncTopList[iViewIdx]->setUseCbfFastMode               ( m_bUseCbfFastMode  );
    275252#if HHI_INTERVIEW_SKIP
     
    304281      m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) );
    305282    }
    306 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    307283    if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE)
    308284    {
    309285      m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument );
    310286    }
    311 #endif
    312287    m_acTEncTopList[iViewIdx]->setSliceGranularity        ( m_iSliceGranularity         );
    313288    if(m_iSliceMode == 0 )
     
    327302    m_acTEncTopList[iViewIdx]->setUseIVS               ( m_bUseIVS          );
    328303#endif
    329 #if SAO_UNIT_INTERLEAVING
    330304    m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    331305    m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag);
    332 #endif
    333306    m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    334307    m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
     
    338311    m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent       ( m_iColumnRowInfoPresent );
    339312    m_acTEncTopList[iViewIdx]->setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    340 #if !REMOVE_TILE_DEPENDENCE
    341     m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );
    342 #endif
    343313    m_acTEncTopList[iViewIdx]->setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
    344314    m_acTEncTopList[iViewIdx]->setNumRowsMinus1              ( m_iNumRowsMinus1 );
     
    357327    m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset         ( m_dMaxTileMarkerOffset );
    358328    m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag );
    359 #if !REMOVE_TILE_DEPENDENCE
    360     if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1)
    361 #else
    362329    if(uiTilesCount == 1)
    363 #endif
    364330    {
    365331      m_bLFCrossTileBoundaryFlag = true;
     
    376342    m_acTEncTopList[iViewIdx]->setUseScalingListId           ( m_useScalingListId  );
    377343    m_acTEncTopList[iViewIdx]->setScalingListFile            ( m_scalingListFile   );
    378 #if MULTIBITS_DATA_HIDING
    379344    m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag);
    380345    m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold);
    381 #endif
    382 
    383 #if LCU_SYNTAX_ALF
     346
    384347    if(uiTilesCount > 1)
    385348    {
     
    389352    m_acTEncTopList[iViewIdx]->setALFParamInSlice              ( m_bALFParamInSlice);
    390353    m_acTEncTopList[iViewIdx]->setALFPicBasedEncode            ( m_bALFPicBasedEncode);
    391 #endif
    392354
    393355    //====== Depth tools ========
     
    445407      m_acTEncDepthTopList[iViewIdx]->setSourceWidth                  ( m_iSourceWidth );
    446408      m_acTEncDepthTopList[iViewIdx]->setSourceHeight                 ( m_iSourceHeight );
    447 #if PIC_CROPPING
    448409      m_acTEncDepthTopList[iViewIdx]->setCroppingMode                 ( m_croppingMode );
    449410      m_acTEncDepthTopList[iViewIdx]->setCropLeft                     ( m_cropLeft );
     
    451412      m_acTEncDepthTopList[iViewIdx]->setCropTop                      ( m_cropTop );
    452413      m_acTEncDepthTopList[iViewIdx]->setCropBottom                   ( m_cropBottom );
    453 #endif
    454414      m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded             ( m_iFrameToBeEncoded );
    455415      m_acTEncDepthTopList[iViewIdx]->setViewId                       ( iViewIdx );
     
    480440      m_acTEncDepthTopList[iViewIdx]->setGopList                      ( m_GOPListsMvc[iViewIdx] );
    481441      m_acTEncDepthTopList[iViewIdx]->setExtraRPSs                    ( m_extraRPSs[iViewIdx] );
    482 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    483442      for(Int i = 0; i < MAX_TLAYER; i++)
    484443      {
     
    486445        m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering         ( m_maxDecPicBuffering[iViewIdx][i], i );
    487446      }
    488 #else
    489       m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames             ( m_numReorderFrames );
    490       m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures );
    491 #endif
    492447      for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    493448      {
     
    499454      m_acTEncDepthTopList[iViewIdx]->setPad                          ( m_aiPad );
    500455
    501 #if H0566_TLA
    502456      m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer                 ( m_maxTempLayer[iViewIdx] );
    503 #else
    504       m_acTEncDepthTopList[iViewIdx]->setTLayering                    ( m_bTLayering );
    505       m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag          ( m_abTLayerSwitchingFlag );
    506 #endif
    507457
    508458      m_acTEncDepthTopList[iViewIdx]->setDisInter4x4                  ( m_bDisInter4x4);
     
    518468      m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    519469      m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    520 #if DBL_CONTROL
    521470      m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    522 #endif
    523471
    524472      //====== Motion search ========
     
    560508      m_acTEncDepthTopList[iViewIdx]->setdQPs                         ( m_aidQPdepth   );
    561509      m_acTEncDepthTopList[iViewIdx]->setUseRDOQ                      ( m_abUseRDOQ[1] );
    562 #if !PIC_CROPPING
    563       m_acTEncDepthTopList[iViewIdx]->setUsePAD                       ( m_bUsePAD      );
    564 #endif
    565510      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    566511      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
     
    569514      m_acTEncDepthTopList[iViewIdx]->setUseFastEnc                   ( m_bUseFastEnc  );
    570515      m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU                   ( m_bUseEarlyCU  );
    571 #if FAST_DECISION_FOR_MRG_RD_COST
    572516      m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    573 #endif
    574517      m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode               ( m_bUseCbfFastMode  );
    575518#if HHI_INTERVIEW_SKIP
     
    633576        m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) );
    634577      }
    635 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    636578      if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE)
    637579      {
    638580        m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument );
    639581      }
    640 #endif
    641582      m_acTEncDepthTopList[iViewIdx]->setSliceGranularity        ( m_iSliceGranularity         );
    642583      if(m_iSliceMode == 0 )
     
    652593     m_acTEncDepthTopList[iViewIdx]->setUseIVS                ( m_bUseIVS );
    653594#endif
    654 #if SAO_UNIT_INTERLEAVING
    655595      m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    656596      m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag);
    657 #endif
    658597      m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    659598      m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
     
    663602      m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent       ( m_iColumnRowInfoPresent );
    664603      m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    665 #if !REMOVE_TILE_DEPENDENCE
    666       m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );
    667 #endif
    668604      m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
    669605      m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1              ( m_iNumRowsMinus1 );
     
    682618      m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset         ( m_dMaxTileMarkerOffset );
    683619      m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag );
    684 #if !REMOVE_TILE_DEPENDENCE
    685       if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1)
    686 #else
    687620      if(uiTilesCount == 1)
    688 #endif
    689621      {
    690622        m_bLFCrossTileBoundaryFlag = true;
     
    701633      m_acTEncDepthTopList[iViewIdx]->setUseScalingListId           ( m_useScalingListId  );
    702634      m_acTEncDepthTopList[iViewIdx]->setScalingListFile            ( m_scalingListFile   );
    703 #if MULTIBITS_DATA_HIDING
    704635      m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag);
    705636      m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold);
    706 #endif
    707 
    708 #if LCU_SYNTAX_ALF
     637
    709638      if(uiTilesCount > 1)
    710639      {
     
    714643      m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice              ( m_bALFParamInSlice);
    715644      m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode            ( m_bALFPicBasedEncode);
    716 #endif
    717645
    718646  //====== Depth tools ========
     
    13251253        if (m_pchReconFileList[iViewIdx])
    13261254        {
    1327 #if PIC_CROPPING
    13281255          m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom );
    1329 #else
    1330           m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad );
    1331 #endif
    13321256        }
    13331257      }
     
    13361260        if (m_pchDepthReconFileList[iViewIdx])
    13371261        {
    1338 #if PIC_CROPPING
    13391262          m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom );
    1340 #else
    1341           m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad );
    1342 #endif
    13431263        }
    13441264      }
     
    13931313    {
    13941314    case NAL_UNIT_CODED_SLICE:
    1395 #if H0566_TLA
    13961315#if !QC_REM_IDV_B0046
    13971316    case NAL_UNIT_CODED_SLICE_IDV:
     
    13991318    case NAL_UNIT_CODED_SLICE_TLA:
    14001319    case NAL_UNIT_CODED_SLICE_CRA:
    1401 #else
    1402     case NAL_UNIT_CODED_SLICE_DATAPART_A:
    1403     case NAL_UNIT_CODED_SLICE_DATAPART_B:
    1404     case NAL_UNIT_CODED_SLICE_CDR:
    1405 #endif
    14061320    case NAL_UNIT_CODED_SLICE_IDR:
    14071321    case NAL_UNIT_SPS:
  • branches/HTM-5.1-dev0/source/App/TAppRenderer/TAppRendererTop.cpp

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

    r292 r294  
    437437
    438438// Explicit temporal layer QP offset
    439 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    440439#define MAX_TLAYER                  8           ///< max number of temporal layer
    441 #else
    442 #define MAX_TLAYER                  4           ///< max number of temporal layer
    443 #endif
    444440#define HB_LAMBDA_FOR_LDC           1           ///< use of B-style lambda for non-key pictures in low-delay mode
    445441
     
    466462#define MAX_NUM_REF_PICS 16
    467463
    468 #if !NAL_REF_FLAG
    469 enum NalRefIdc
    470 {
    471   NAL_REF_IDC_PRIORITY_LOWEST = 0,
    472   NAL_REF_IDC_PRIORITY_LOW,
    473   NAL_REF_IDC_PRIORITY_HIGH,
    474   NAL_REF_IDC_PRIORITY_HIGHEST
    475 };
    476 #endif
    477464
    478465enum NalUnitType
     
    480467  NAL_UNIT_UNSPECIFIED_0 = 0,
    481468  NAL_UNIT_CODED_SLICE,
    482 #if H0566_TLA
    483469#if QC_REM_IDV_B0046
    484470  NAL_UNIT_RESERVED,
     
    488474  NAL_UNIT_CODED_SLICE_TLA,
    489475  NAL_UNIT_CODED_SLICE_CRA,
    490 #else
    491   NAL_UNIT_CODED_SLICE_DATAPART_A,
    492   NAL_UNIT_CODED_SLICE_DATAPART_B,
    493   NAL_UNIT_CODED_SLICE_CDR,
    494 #endif
    495476  NAL_UNIT_CODED_SLICE_IDR,
    496477  NAL_UNIT_SEI,
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/ContextModel.cpp

    r56 r294  
    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//! \}
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/ContextModel.h

    r56 r294  
    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;
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/ContextTables.h

    r287 r294  
    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
    6460
    6561#if HHI_INTER_VIEW_RESIDUAL_PRED
     
    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
     
    181141
    182142// initial probability for split flag
    183 #if CABAC_LINEAR_INIT
    184143static const UChar
    185144INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] = 
     
    227186INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] = 
    228187{
    229 #if MRG_IDX_CTX_RED
    230188  { CNU, },
    231189  { 122, },
    232190  { 137, },
    233 #else
    234   { CNU,  CNU,  CNU,  CNU, },
    235   { 122,  138,  153,  182, },
    236   { 137,  139,  154,  139, },
    237 #endif
    238191};
    239192
     
    256209};
    257210
    258 #if AMP_CTX
    259211static const UChar
    260212INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] = 
     
    264216  { 154, },
    265217};
    266 #else
    267 static const UChar
    268 INIT_CU_X_POS[3][NUM_CU_X_POS_CTX] = 
    269 {
    270   { CNU,  CNU, },
    271   { 154,  139, },
    272   { 154,  139, },
    273 };
    274 
    275 static const UChar
    276 INIT_CU_Y_POS[3][NUM_CU_Y_POS_CTX] = 
    277 {
    278   { CNU,  CNU, },
    279   { 154,  154, },
    280   { 154,  139, },
    281 };
    282 #endif
    283218
    284219static const UChar
     
    358293};
    359294
    360 #if LAST_CTX_REDUCTION
    361295static const UChar
    362296INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] = 
     
    372306  },
    373307};
    374 #else
    375 static const UChar
    376 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] = 
    377 {
    378   { 110,  110,  124,  110,  140,  111,  124,  125,  111,  127,  111,  138,  111,  156,  127,  127,  111,   94,
    379     108,  123,   63,   63,  139,  124,   93,  108,  125,  111,  110,   63,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU,
    380   },
    381   { 125,  110,  124,  110,  125,  110,  153,  125,  111,  111,  110,  153,  139,  111,  111,  111,  125,  139,
    382     108,  123,  108,  152,  124,   94,  123,  137,  139,  110,  110,  154,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU,
    383   },
    384   { 125,  110,  124,  110,  125,  110,  153,  125,  111,  111,  110,  153,  139,  111,  111,  111,  125,  139, 
    385     108,  123,   93,  152,  124,   94,  123,  152,  139,  110,  110,  154,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU,
    386   },
    387 };
    388 #endif
    389308
    390309static const UChar
     
    410329};
    411330
    412 #if LEVEL_CTX_LUMA_RED
    413331static const UChar
    414332INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
     
    419337};
    420338
    421 #if RESTRICT_GR1GR2FLAG_NUMBER
    422339static const UChar
    423340INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
     
    427344  { 107,  167,   91,  107,  107,  167, },
    428345};
    429 #else
    430 static const UChar
    431 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
    432 {
    433   { 138,  139,  111,  153,  139,  111,  136,  167,  139,  167,  153,  139,  152,  139,  140,  152,  184,  141, },
    434   { 107,  153,  125,  167,  153,  140,   91,  137,  153,  122,  167,  139,  107,  153,  140,  167,  183,  140, },
    435   { 107,  153,  125,  167,  153,  140,   91,  137,  153,  107,  167,  139,  107,  153,  140,  167,  183,  140, },
    436 };
    437 #endif
    438 #else
    439 static const UChar
    440 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
    441 {
    442   { 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, },
    443   { 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, },
    444   { 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, },
    445 };
    446 
    447 #if RESTRICT_GR1GR2FLAG_NUMBER
    448 static const UChar
    449 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
    450 {
    451   { 138,  153,  139,  136,  167,  153,  152,  152, },
    452   { 107,  167,  139,   91,  122,  152,  107,  167, },
    453   { 107,  167,  139,   91,  107,   93,  107,  167, },
    454 };
    455 #else
    456 static const UChar
    457 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] = 
    458 {
    459   { 138,  139,  111,  153,  139,  111,  139,  125,  111,  136,  167,  139,  167,  153,  139,  153,  139,  110,  152,  139,  140,  152,  184,  141, },
    460   { 107,  153,  125,  167,  153,  140,  139,  154,  155,   91,  137,  153,  122,  167,  139,  152,  138,  139,  107,  153,  140,  167,  183,  140, },
    461   { 107,  153,  125,  167,  153,  140,  139,  154,  155,   91,  137,  153,  107,  167,  139,   93,  138,  139,  107,  153,  140,  167,  183,  140, },
    462 };
    463 #endif
    464 #endif
    465346
    466347static const UChar
     
    520401};
    521402
    522 #if SAO_UNIT_INTERLEAVING
    523403static const UChar
    524404INIT_SAO_MERGE_LEFT_FLAG[3][NUM_SAO_MERGE_LEFT_FLAG_CTX] =
     
    544424  { 200,  140, },
    545425};
    546 #endif
    547426
    548427static const UChar
     
    553432{ CNU,  153,  138,  138,  CNU,  CNU,  CNU,  CNU,  CNU,  CNU, },
    554433};
    555 #else
    556 static const UChar
    557 INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] =
    558 {
    559   {
    560      87,  74, 107,
    561    
    562   },
    563   {
    564      84, 103, 105,
    565    
    566   },
    567   {
    568      84, 103, 105,
    569    
    570   },
    571 };
    572 
    573 // initial probability for skip flag
    574 static const UChar
    575 INIT_SKIP_FLAG[3][NUM_SKIP_FLAG_CTX] =
    576 {
    577   {
    578     CNU, CNU, CNU,
    579    
    580   },
    581   {
    582     165, 168, 154,
    583    
    584   },
    585   {
    586     165, 168, 154,
    587    
    588   },
    589 };
    590 
    591 // initial probability for skip flag
    592 static const UChar
    593 INIT_ALF_CTRL_FLAG[3][NUM_ALF_CTRL_FLAG_CTX] =
    594 {
    595   {
    596     153,
    597    
    598   },
    599   {
    600      87,
    601    
    602   },
    603   {
    604     135,
    605    
    606   },
    607 };
    608 
    609 // initial probability for merge flag
    610 static const UChar
    611 INIT_MERGE_FLAG_EXT[3][NUM_MERGE_FLAG_EXT_CTX] =
    612 {
    613   {
    614     CNU,
    615    
    616   },
    617   {
    618     72,
    619    
    620   },
    621   {
    622     119,
    623    
    624   },
    625 };
    626 
    627 static const UChar
    628 INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] =
    629 {
    630 #if MRG_IDX_CTX_RED
    631   {
    632     CNU,
    633    
    634   },
    635   {
    636     100,
    637    
    638   },
    639   {
    640     116,
    641   },
    642 #else
    643   {
    644     CNU, CNU, CNU, CNU,
    645    
    646   },
    647   {
    648     100,  86, 102, 133,
    649    
    650   },
    651   {
    652     116,  87, 119, 103,
    653    
    654   },
    655 #endif
    656 };
    657 
    658 // initial probability for PU size
    659 static const UChar
    660 INIT_PART_SIZE[3][NUM_PART_SIZE_CTX] =
    661 {
    662   {
    663     167, CNU, CNU, CNU,
    664    
    665   },
    666   {
    667     119,  87, CNU, CNU,
    668    
    669   },
    670   {
    671     119,  87, CNU, CNU,
    672    
    673   },
    674 };
    675 #if AMP_CTX
    676 static const UChar
    677 INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] =
    678 {
    679   {
    680     CNU,
    681   },
    682   {
    683     119,
    684   },
    685   {
    686     119,
    687   },
    688 };
    689 #else
    690 // initial probability for AMP split position (X)
    691 static const UChar
    692 INIT_CU_X_POS[3][NUM_CU_X_POS_CTX] =
    693 {
    694   {
    695     CNU, CNU,
    696    
    697   },
    698   {
    699     119, 103,
    700    
    701   },
    702   {
    703     119, 103,
    704    
    705   },
    706 };
    707 
    708 // initial probability for AMP split position (Y)
    709 static const UChar
    710 INIT_CU_Y_POS[3][NUM_CU_Y_POS_CTX] =
    711 {
    712   {
    713     CNU, CNU,
    714    
    715   },
    716   {
    717     119, 119,
    718    
    719   },
    720   {
    721     119, 103,
    722    
    723   },
    724 };
    725 #endif
    726 // initial probability for prediction mode
    727 static const UChar
    728 INIT_PRED_MODE[3][NUM_PRED_MODE_CTX] =
    729 {
    730   {
    731     CNU,
    732    
    733   },
    734   {
    735     114,
    736    
    737   },
    738   {
    739     98,
    740    
    741   },
    742 };
    743 
    744 // initial probability for intra direction of luma
    745 static const UChar
    746 INIT_INTRA_PRED_MODE[3][NUM_ADI_CTX] =
    747 {
    748   {
    749     167,
    750    
    751   },
    752   {
    753     119,
    754    
    755   },
    756   {
    757     150,
    758    
    759   },
    760 };
    761 
    762 // initial probability for intra direction of chroma
    763 static const UChar
    764 INIT_CHROMA_PRED_MODE[3][NUM_CHROMA_PRED_CTX] =
    765 {
    766   {
    767     53, 103,
    768    
    769   },
    770   {
    771     85,  87,
    772    
    773   },
    774   {
    775     101,  87,
    776    
    777   },
    778 };
    779 
    780 // initial probability for temporal direction
    781 static const UChar
    782 INIT_INTER_DIR[3][NUM_INTER_DIR_CTX] =
    783 {
    784   {
    785     CNU, CNU, CNU, CNU,
    786    
    787   },
    788   {
    789     CNU, CNU, CNU, CNU,
    790    
    791   },
    792   {
    793     41,  39,  38,  36,
    794    
    795   },
    796 };
    797 
    798 // initial probability for motion vector difference
    799 static const UChar
    800 INIT_MVD[3][NUM_MV_RES_CTX] =
    801 {
    802   {
    803     CNU, CNU,
    804    
    805   },
    806   {
    807     120, 166,
    808    
    809   },
    810   {
    811     135, 166,
    812    
    813   },
    814 };
    815 
    816 // initial probability for reference frame index
    817 static const UChar
    818 INIT_REF_PIC[3][NUM_REF_NO_CTX] =
    819 {
    820   {
    821     CNU, CNU, CNU, CNU,
    822    
    823   },
    824   {
    825     102, 118, 103, CNU,
    826    
    827   },
    828   {
    829     118, 118, 134, CNU,
    830    
    831   },
    832 };
    833 
    834 // initial probability for dQP
    835 static const UChar
    836 INIT_DQP[3][NUM_DELTA_QP_CTX] =
    837 {
    838   {
    839     CNU, CNU, CNU,
    840    
    841   },
    842   {
    843     CNU, CNU, CNU,
    844    
    845   },
    846   {
    847     CNU, CNU, CNU,
    848    
    849   },
    850 };
    851 
    852 static const UChar
    853 INIT_QT_CBF[3][2*NUM_QT_CBF_CTX] =
    854 {
    855   {
    856      73,  74, CNU, CNU, CNU,
    857      55,  86, 133, CNU, CNU,
    858    
    859   },
    860   {
    861     102,  89, CNU, CNU, CNU,
    862     114,  84, 117, CNU, CNU,
    863    
    864   },
    865   {
    866     102,  89, CNU, CNU, CNU,
    867     114,  68, 117, CNU, CNU,
    868    
    869   },
    870 };
    871 
    872 static const UChar
    873 INIT_QT_ROOT_CBF[3][NUM_QT_ROOT_CBF_CTX] =
    874 {
    875   {
    876     CNU,
    877    
    878   },
    879   {
    880     39,
    881    
    882   },
    883   {
    884     39,
    885    
    886   },
    887 };
    888 
    889 #if LAST_CTX_REDUCTION
    890 static const UChar
    891 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] =
    892 {
    893   {
    894     72,  72,  71,  72, 104,  89,  88,  89,  59,  73,  89, 106,  60,  59,  43,   
    895     54,  70,  53,  CNU, CNU, CNU,  CNU, CNU, CNU,  CNU, CNU, CNU, CNU, CNU, CNU,
    896   },
    897   {
    898     57,  72,  55,  72,  57,  72,   88,  73,  73,  72,  103,  73,  89,  73,  57, 
    899     54,  70,  54,  CNU, CNU, CNU,  CNU, CNU, CNU,  CNU, CNU, CNU, CNU, CNU, CNU,
    900   },
    901   {
    902     88,  72,  71,  72,  57,  72,  88,  73,  73,  72,   103,  73,  89,  73,  57,   
    903     54,  70,  69,   CNU, CNU, CNU,  CNU, CNU, CNU,  CNU, CNU, CNU, CNU, CNU, CNU,
    904   },
    905 };
    906 #else
    907 static const UChar
    908 INIT_LAST[3][2*NUM_CTX_LAST_FLAG_XY] =
    909 {
    910   {
    911     72,  72,  71,  72, 104,  89,  71,  88,  89,  59,  73,  86,  89, 106,  60,  59,  43,  55,
    912     54,  70,  53,  53,  87,  71,  69,  54,  88,  73,  72,  53, CNU, CNU, CNU, CNU, CNU, CNU,
    913    
    914   },
    915   {
    916     57,  72,  71,  72,  57,  72, 102,  88,  73,  73,  72, 102, 103,  73,  89,  73,  57,  87,
    917     54,  70,  54, 101,  71,  55,  70, 116, 103,  72,  72, 119, CNU, CNU, CNU, CNU, CNU, CNU,
    918    
    919   },
    920   {
    921     88,  72,  71,  72,  57,  72, 102,  88,  73,  73,  72, 118, 103,  73,  89,  73,  57,  87,
    922     54,  70,  69,  85,  71,  55,  70,  85, 103,  72,  72, 119, CNU, CNU, CNU, CNU, CNU, CNU,
    923    
    924   },
    925 };
    926 #endif
    927 
    928 static const UChar
    929 INIT_SIG_CG_FLAG[3][2 * NUM_SIG_CG_FLAG_CTX] =
    930 {
    931   {
    932     83, 122,
    933     98, 121,
    934    
    935   },
    936   {
    937     99, 120,
    938     67, 119,
    939    
    940   },
    941   {
    942     99, 120,
    943     67, 119,
    944    
    945   },
    946 };
    947 
    948 static const UChar
    949 INIT_SIG_FLAG[3][NUM_SIG_FLAG_CTX] =
    950 {
    951   {
    952     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,
    953     120,  87, 149,  70,  52, 118, 133, 116, 114, 129, 132, 162, 115,  51, 115,  66, 120,  74, 115,  87,  89,
    954   },
    955   {
    956     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,
    957     136, 102,  70,  53,  67, 117, 102, 117, 115, 114,  84, 115,  99, 100,  83, 114, 152, 168, 131, 150, 120,
    958   },
    959   {
    960     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,
    961     136, 102,  86,  84,  67, 117, 102, 117, 115,  99, 100, 115,  99, 100,  83, 114, 152, 152, 131, 150, 120,
    962   },
    963 };
    964 
    965 #if LEVEL_CTX_LUMA_RED
    966 static const UChar
    967 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
    968 {
    969   {
    970     104,  68, 116,  86, 104, 132,  86,  87, 102,  66, 114,  68,  87,  84, 100, 101,
    971       104, 130, 147, 149, 104, 196, 100, 165,
    972   },
    973   {
    974     119, 179, 179, 164, 119,  85, 117, 149, 133,  98, 114, 115, 118,  99, 115, 116,
    975       135, 146, 147, 164, 119, 148, 116, 133,
    976   },
    977   {
    978     119, 179, 148, 164, 119,  85, 117, 149, 133,  98, 114, 115, 118,  99, 115, 100,
    979       135, 177, 147, 164, 119, 132, 148, 149,
    980   },
    981 };
    982 
    983 #if RESTRICT_GR1GR2FLAG_NUMBER
    984 static const UChar
    985 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    986 {
    987   {
    988     86, 102, 115, 117, 101, 101,
    989   },
    990   {
    991     84, 117, 83, 100, 84, 117,
    992   },
    993   {
    994     84, 117, 83,  84, 84, 117,
    995   },
    996 };
    997 #else
    998 static const UChar
    999 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    1000 {
    1001   {
    1002     86, 103,  73, 102, 103,  73, 115, 117, 103, 117, 118, 103,
    1003       101, 103, 104, 101, 167, 121,
    1004   },
    1005   {
    1006     84, 102,  88, 117, 118, 104, 83, 116, 118, 100, 117,  87,
    1007       84, 118, 120, 117, 150, 120,
    1008     },
    1009     {
    1010       84, 102,  88, 117, 118, 104, 83, 116, 118,  84, 117,  87,
    1011         84, 118, 120, 117, 150, 120,
    1012     },
    1013 };
    1014 #endif
    1015 #else
    1016 static const UChar
    1017 INIT_ONE_FLAG[3][NUM_ONE_FLAG_CTX] =
    1018 {
    1019   {
    1020     104,  68, 116,  86, 104, 132,  86,  87, 105, 134,  87, 103, 102,  66, 114,  68,  87,  84, 100, 101,  72,  69, 101,  86,
    1021     104, 130, 147, 149, 104, 196, 100, 165,
    1022   },
    1023   {
    1024     119, 179, 179, 164, 119,  85, 117, 149, 136, 103, 103, 103, 133,  98, 114, 115, 118,  99, 115, 116,  87, 100,  85, 117,
    1025     135, 146, 147, 164, 119, 148, 116, 133,
    1026   },
    1027   {
    1028     119, 179, 148, 164, 119,  85, 117, 149, 136,  87, 103, 103, 133,  98, 114, 115, 118,  99, 115, 100,  87,  84,  85,  85,
    1029     135, 177, 147, 164, 119, 132, 148, 149,
    1030   },
    1031 };
    1032 
    1033 #if RESTRICT_GR1GR2FLAG_NUMBER
    1034 static const UChar
    1035 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    1036 {
    1037   {
    1038     86, 102, 103, 115, 117, 102, 101, 101,
    1039   },
    1040   {
    1041     84, 117, 103, 83, 100, 85, 84, 117,
    1042   },
    1043   {
    1044     84, 117, 87, 83, 84, 69, 84, 117,
    1045   },
    1046 };
    1047 #else
    1048 static const UChar
    1049 INIT_ABS_FLAG[3][NUM_ABS_FLAG_CTX] =
    1050 {
    1051   {
    1052     86, 103,  73, 102, 103,  73, 103,  88,  89, 115, 117, 103, 117, 118, 103, 102, 103,  72,
    1053     101, 103, 104, 101, 167, 121,
    1054   },
    1055   {
    1056     84, 102,  88, 117, 118, 104, 103, 119, 136,  83, 116, 118, 100, 117,  87,  85,  86, 103,
    1057     84, 118, 120, 117, 150, 120,
    1058   },
    1059   {
    1060     84, 102,  88, 117, 118, 104,  87, 119, 136,  83, 116, 118,  84, 117,  87,  69,  86,  87,
    1061     84, 118, 120, 117, 150, 120,
    1062   },
    1063 };
    1064 #endif
    1065 #endif
    1066 // initial probability for motion vector predictor index
    1067 static const UChar
    1068 INIT_MVP_IDX[3][NUM_MVP_IDX_CTX] =
    1069 {
    1070   {
    1071     CNU, CNU,
    1072    
    1073   },
    1074   {
    1075     134, CNU,
    1076    
    1077   },
    1078   {
    1079     134, CNU,
    1080    
    1081   },
    1082 };
    1083 
    1084 // initial probability for ALF flag
    1085 static const UChar
    1086 INIT_ALF_FLAG[3][NUM_ALF_FLAG_CTX] =
    1087 {
    1088   {
    1089     118,
    1090    
    1091   },
    1092   {
    1093     102,
    1094    
    1095   },
    1096   {
    1097     102,
    1098    
    1099   },
    1100 };
    1101 
    1102 // initial probability for ALF side information (unsigned)
    1103 static const UChar
    1104 INIT_ALF_UVLC[3][NUM_ALF_UVLC_CTX] =
    1105 {
    1106   {
    1107     120, 119,
    1108    
    1109   },
    1110   {
    1111     119, 119,
    1112    
    1113   },
    1114   {
    1115     119, 119,
    1116    
    1117   },
    1118 };
    1119 
    1120 // initial probability for ALF side information (signed)
    1121 static const UChar
    1122 INIT_ALF_SVLC[3][NUM_ALF_SVLC_CTX] =
    1123 {
    1124   {
    1125     139, 119, 124,
    1126    
    1127   },
    1128   {
    1129      90, 119, 140,
    1130    
    1131   },
    1132   {
    1133      90, 119, 124,
    1134    
    1135   },
    1136 };
    1137 
    1138 // initial probability for SAO flag
    1139 static const UChar
    1140 INIT_SAO_FLAG[3][NUM_SAO_FLAG_CTX] =
    1141 {
    1142   {
    1143     119,
    1144    
    1145   },
    1146   {
    1147     102,
    1148    
    1149   },
    1150   {
    1151     102,
    1152    
    1153   },
    1154 };
    1155 
    1156 // initial probability for SAO side information (unsigned)
    1157 static const UChar
    1158 INIT_SAO_UVLC[3][NUM_SAO_UVLC_CTX] =
    1159 {
    1160   {
    1161      61, 104,
    1162    
    1163   },
    1164   {
    1165     168, 120,
    1166    
    1167   },
    1168   {
    1169     184, 120,
    1170    
    1171   },
    1172 };
    1173 
    1174 // initial probability for SAO side information (signed)
    1175 static const UChar
    1176 INIT_SAO_SVLC[3][NUM_SAO_SVLC_CTX] =
    1177 {
    1178   {
    1179     171, 119, 199,
    1180    
    1181   },
    1182   {
    1183     169, 119, 151,
    1184    
    1185   },
    1186   {
    1187     169, 119, 151,
    1188    
    1189   },
    1190 };
    1191 
    1192 #if SAO_UNIT_INTERLEAVING
    1193 static const UChar
    1194 INIT_SAO_MERGE_LEFT_FLAG[3][NUM_SAO_MERGE_LEFT_FLAG_CTX] =
    1195 {
    1196   {
    1197     118, 118, 118,
    1198   },
    1199   {
    1200     102, 102, 102,
    1201     },
    1202     {
    1203       102, 102, 102,
    1204     },
    1205 };
    1206 
    1207 static const UChar
    1208 INIT_SAO_MERGE_UP_FLAG[3][NUM_SAO_MERGE_UP_FLAG_CTX] =
    1209 {
    1210   {
    1211     109,
    1212   },
    1213   {
    1214     102,
    1215   },
    1216   {
    1217     102,
    1218   },
    1219 };
    1220 static const UChar
    1221 INIT_SAO_TYPE_IDX[3][NUM_SAO_TYPE_IDX_CTX] =
    1222 {
    1223   {
    1224     64, 104
    1225   },
    1226   {
    1227   168, 120
    1228   },
    1229   {
    1230     184, 120
    1231   },
    1232 };
    1233 static const Short
    1234 INIT_SAO_RUN[3][NUM_SAO_RUN_CTX][2] =
    1235 {
    1236   {
    1237     {   11,   57 }, {   -1,   62 }, {    0,   64 }
    1238   },
    1239   {
    1240     {    6,   66 }, {   -1,   64 }, {    0,   64 }
    1241   },
    1242   {
    1243     {    1,   73 }, {    2,   61 }, {    0,   64 }
    1244   }
    1245 };
    1246 #endif
    1247 
    1248 static const UChar
    1249 INIT_TRANS_SUBDIV_FLAG[3][NUM_TRANS_SUBDIV_FLAG_CTX] =
    1250 {
    1251   {
    1252     CNU, 162, 148, 100, CNU, CNU, CNU, CNU, CNU, CNU,
    1253    
    1254   },
    1255   {
    1256     CNU,  71,  86,  55, CNU, CNU, CNU, CNU, CNU, CNU,
    1257    
    1258   },
    1259   {
    1260     CNU, 102,  86,  86, CNU, CNU, CNU, CNU, CNU, CNU,
    1261    
    1262   },
    1263 };
    1264 #endif
    1265434
    1266435#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/NAL.h

    r210 r294  
    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  }
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComAdaptiveLoopFilter.cpp

    r56 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComAdaptiveLoopFilter.h

    r56 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComBitStream.cpp

    r56 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComBitStream.h

    r56 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.cpp

    r293 r294  
    105105          }
    106106          iVSPIndexTrue[idx] = iCount;
    107 #if SIMP_MRG_PRUN
    108107          if ( mrgCandIdx == iCount )
    109108          {
    110109            return false;
    111110          }
    112 #endif
    113111          iCount ++;
    114112        }
     
    257255  if ( !bDecSubCu )
    258256  {
    259 #if H0736_AVC_STYLE_QP_RANGE
    260257    m_phQP               = (Char*     )xMalloc(Char,     uiNumPartition);
    261 #else
    262     m_phQP               = (UChar*    )xMalloc(UChar,    uiNumPartition);
    263 #endif
    264258    m_puhDepth           = (UChar*    )xMalloc(UChar,    uiNumPartition);
    265259#if HHI_MPI
     
    550544  this->height = src.height;
    551545  ::memcpy(this->isBorderAvailable, src.isBorderAvailable, sizeof(Bool)*((Int)NUM_SGU_BORDER));
    552 #if LCU_SYNTAX_ALF
    553546  this->allBordersAvailable = src.allBordersAvailable;
    554 #endif
    555547
    556548  return *this;
     
    587579  m_uiTotalBins        = 0;
    588580  m_uiNumPartition     = pcPic->getNumPartInCU();
    589 #if BURST_IPCM
    590581  m_numSucIPCM       = 0;
    591582  m_lastCUSucIPCMFlag   = false;
    592 #endif
    593583
    594584  for(int i=0; i<pcPic->getNumPartInCU(); i++)
     
    816806}
    817807
    818 #if H0736_AVC_STYLE_QP_RANGE
    819808/** initialize prediction data with enabling sub-LCU-level delta QP
    820809*\param  uiDepth  depth of the current CU
     
    825814*/
    826815Void TComDataCU::initEstData( UInt uiDepth, Int qp )
    827 #else
    828 /** initialize prediction data with enabling sub-LCU-level delta QP
    829 *\param  uiDepth  depth of the current CU
    830 *\param  uiQP     QP for the current CU
    831 *- set CU width and CU height according to depth
    832 *- set QP value according to input QP
    833 *- set last-coded QP value according to input last-coded QP
    834 */
    835 Void TComDataCU::initEstData( UInt uiDepth, UInt uiQP )
    836 #endif
    837816{
    838817  m_dTotalCost         = MAX_DOUBLE;
     
    866845      m_pePredMode[ui] = MODE_NONE;
    867846      m_pbIPCMFlag[ui] = 0;
    868 #if H0736_AVC_STYLE_QP_RANGE
    869847      m_phQP[ui] = qp;
    870 #else
    871       m_phQP[ui] = uiQP;
    872 #endif
    873848      m_puiAlfCtrlFlag[ui]= false;
    874849      m_pbMergeFlag[ui] = 0;
     
    947922
    948923// initialize Sub partition
    949 #if H0736_AVC_STYLE_QP_RANGE
    950924Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp )
    951 #else
    952 Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP )
    953 #endif
    954925{
    955926  assert( uiPartUnitIdx<4 );
     
    971942  m_uiNumPartition     = pcCU->getTotalNumPart() >> 2;
    972943
    973 #if BURST_IPCM
    974944  m_numSucIPCM       = 0;
    975945  m_lastCUSucIPCMFlag   = false;
    976 #endif
    977946
    978947  Int iSizeInUchar = sizeof( UChar  ) * m_uiNumPartition;
     
    982951#endif
    983952
    984 #if H0736_AVC_STYLE_QP_RANGE
    985953  Int sizeInChar = sizeof( Char  ) * m_uiNumPartition;
    986954  memset( m_phQP,              qp,  sizeInChar );
    987 #else
    988   memset( m_phQP,              uiQP, iSizeInUchar );
    989 #endif
    990955
    991956  memset( m_puiAlfCtrlFlag,     0, iSizeInBool );
     
    14181383#endif
    14191384 
    1420 #if H0736_AVC_STYLE_QP_RANGE
    14211385  Int sizeInChar  = sizeof( Char ) * uiNumPartition;
    14221386  memcpy( m_phQP       + uiOffset, pcCU->getQP(),             sizeInChar                        );
    1423 #else
    1424   memcpy( m_phQP       + uiOffset, pcCU->getQP(),             iSizeInUchar                        );
    1425 #endif
    14261387  memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(),  sizeof( *m_pePartSize ) * uiNumPartition );
    14271388  memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition );
     
    15581519#endif
    15591520 
    1560 #if H0736_AVC_STYLE_QP_RANGE
    15611521  Int sizeInChar  = sizeof( Char ) * m_uiNumPartition;
    15621522  memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar  );
    1563 #else
    1564   memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, iSizeInUchar );
    1565 #endif
    15661523
    15671524  memcpy( rpcCU->getPartitionSize()  + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition );
     
    16951652#endif
    16961653 
    1697 #if H0736_AVC_STYLE_QP_RANGE
    16981654  Int sizeInChar  = sizeof( Char ) * uiQNumPart;
    16991655  memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar );
    1700 #else
    1701   memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, iSizeInUchar );
    1702 #endif 
    17031656  memcpy( rpcCU->getPartitionSize()  + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart );
    17041657#if HHI_INTERVIEW_SKIP
     
    18571810       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    18581811      ||
    1859 #if !REMOVE_TILE_DEPENDENCE
    1860        (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))  )  )
    1861 #else
    18621812       (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))  )  )
    1863 #endif
    18641813      )
    18651814  {
     
    19191868       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    19201869      ||
    1921 #if !REMOVE_TILE_DEPENDENCE
    1922        (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
    1923 #else
    19241870       (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
    1925 #endif
    19261871      )
    19271872  {
     
    19701915  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19711916       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1972 #if !REMOVE_TILE_DEPENDENCE
    1973        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1974 #else
    19751917       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1976 #endif
    19771918       ))||
    19781919       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19791920       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1980 #if !REMOVE_TILE_DEPENDENCE
    1981        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1982 #else
    19831921       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1984 #endif
    19851922       ))
    19861923     )
     
    19961933  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    19971934       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1998 #if !REMOVE_TILE_DEPENDENCE
    1999        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2000 #else
    20011935       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2002 #endif
    20031936       ))||
    20041937       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    20051938       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2006 #if !REMOVE_TILE_DEPENDENCE
    2007        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2008 #else
    20091939       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2010 #endif
    20111940       ))
    20121941     )
     
    20241953  if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    20251954       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2026 #if !REMOVE_TILE_DEPENDENCE
    2027        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2028 #else
    20291955       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2030 #endif
    20311956       ))||
    20321957       (bEnforceEntropySliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    20331958       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2034 #if !REMOVE_TILE_DEPENDENCE
    2035        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2036 #else
    20371959       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2038 #endif
    20391960       ))
    20401961     )
     
    20962017  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    20972018       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2098 #if !REMOVE_TILE_DEPENDENCE
    2099        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2100 #else
    21012019       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2102 #endif
    21032020       ))||
    21042021       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    21052022       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2106 #if !REMOVE_TILE_DEPENDENCE
    2107        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2108 #else
    21092023       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2110 #endif
    21112024       ))
    21122025     )
     
    21312044       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    21322045       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2133 #if !REMOVE_TILE_DEPENDENCE
    2134        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2135 #else
    21362046       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2137 #endif
    21382047       ))||
    21392048       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    21402049       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    21412050       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2142 #if !REMOVE_TILE_DEPENDENCE
    2143        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2144 #else
    21452051       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2146 #endif
    21472052       ))
    21482053     )
     
    21992104  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22002105       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2201 #if !REMOVE_TILE_DEPENDENCE
    2202        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2203 #else
    22042106       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2205 #endif
    22062107       ))||
    22072108       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22082109       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2209 #if !REMOVE_TILE_DEPENDENCE
    2210        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2211 #else
    22122110       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2213 #endif
    22142111       ))
    22152112     )
     
    22702167  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22712168       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2272 #if !REMOVE_TILE_DEPENDENCE
    2273        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2274 #else
    22752169       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2276 #endif
    22772170       ))||
    22782171       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22792172       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2280 #if !REMOVE_TILE_DEPENDENCE
    2281        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2282 #else
    22832173       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2284 #endif
    22852174       ))
    22862175     )
     
    23422231  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23432232       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2344 #if !REMOVE_TILE_DEPENDENCE
    2345        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2346 #else
    23472233       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2348 #endif
    23492234       ))||
    23502235       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23512236       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2352 #if !REMOVE_TILE_DEPENDENCE
    2353        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2354 #else
    23552237       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2356 #endif
    23572238       ))
    23582239     )
     
    23732254       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    23742255       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2375 #if !REMOVE_TILE_DEPENDENCE
    2376        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2377 #else
    23782256       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2379 #endif
    23802257       ))||
    23812258       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    23822259       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    23832260       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2384 #if !REMOVE_TILE_DEPENDENCE
    2385        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2386 #else
    23872261       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2388 #endif
    23892262       ))
    23902263     )
     
    24332306  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    24342307       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiAbsZorderQpMinCUIdx)||
    2435 #if !REMOVE_TILE_DEPENDENCE
    2436        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2437 #else
    24382308       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2439 #endif
    24402309       ))||
    24412310       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    24422311       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)||
    2443 #if !REMOVE_TILE_DEPENDENCE
    2444        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2445 #else
    24462312       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2447 #endif
    24482313       ))
    24492314     )
     
    24522317  }
    24532318
    2454 #if H0204_QP_PREDICTION
    24552319  if ( m_pcCULeft && m_pcCULeft->getAddr() != getAddr() )
    24562320  {
    24572321    return NULL;
    24582322  }
    2459 #endif
    24602323
    24612324  return m_pcCULeft;
    24622325}
    24632326
    2464 #if H0204_QP_PREDICTION
    24652327/** Get Above QpMinCu
    24662328*\param   aPartUnitIdx
     
    25002362  if ( (enforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    25012363       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(absZorderQpMinCUIdx)||
    2502 #if !REMOVE_TILE_DEPENDENCE
    2503        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2504 #else
    25052364       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2506 #endif
    25072365       ))||
    25082366       (enforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    25092367       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)||
    2510 #if !REMOVE_TILE_DEPENDENCE
    2511        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2512 #else
    25132368       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2514 #endif
    25152369       ))
    25162370     )
     
    25262380  return m_pcCUAbove;
    25272381}
    2528 #endif
    2529 
    2530 #if H0736_AVC_STYLE_QP_RANGE
     2382
    25312383/** Get reference QP from left QpMinCu or latest coded QP
    25322384*\param   uiCurrAbsIdxInLCU
     
    25342386*/
    25352387Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU )
    2536 #else
    2537 /** Get reference QP from left QpMinCu or latest coded QP
    2538 *\param   uiCurrAbsIdxInLCU
    2539 *\returns UChar   reference QP value
    2540 */
    2541 UChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU )
    2542 #endif
    2543 {
    2544 #if H0204_QP_PREDICTION
     2388{
    25452389  UInt        lPartIdx, aPartIdx;
    25462390  lPartIdx = 0;
     
    25492393  TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    25502394  return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1);
    2551 #else
    2552   // Left CU
    2553   TComDataCU* pcCULeft;
    2554   UInt        uiLPartIdx;
    2555   pcCULeft = getQpMinCuLeft( uiLPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    2556   if ( pcCULeft )
    2557   {
    2558     return pcCULeft->getQP(uiLPartIdx);
    2559   }
    2560   // Last QP
    2561   return getLastCodedQP( uiCurrAbsIdxInLCU );
    2562 #endif
    25632395}
    25642396
     
    25752407}
    25762408
    2577 #if H0736_AVC_STYLE_QP_RANGE
    25782409Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )
    2579 #else
    2580 UChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )
    2581 #endif
    25822410{
    25832411  UInt uiQUPartIdxMask = ~((1<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))-1);
     
    26162444Bool TComDataCU::isLosslessCoded(UInt absPartIdx)
    26172445{
    2618 #if H0736_AVC_STYLE_QP_RANGE
    26192446  return ( getSlice()->getSPS()->getUseLossless() && ((getQP(absPartIdx) + getSlice()->getSPS()->getQpBDOffsetY()) == 0) );
    2620 #else
    2621   return ( getSlice()->getSPS()->getUseLossless() && (getQP(absPartPIdx)  == 0) );
    2622 #endif
    26232447}
    26242448#endif
     
    26332457{
    26342458  uiModeList[0] = PLANAR_IDX;
    2635 #if LOGI_INTRA_NAME_3MPM
    26362459  uiModeList[1] = VER_IDX;
    26372460  uiModeList[2] = HOR_IDX;
    2638 #else
    2639   uiModeList[1] = 1;
    2640   uiModeList[2] = 2;
    2641 #endif
    26422461  uiModeList[3] = DC_IDX;
    26432462  uiModeList[4] = LM_CHROMA_IDX;
     
    26532472    if( uiLumaMode == uiModeList[i] )
    26542473    {
    2655 #if LOGI_INTRA_NAME_3MPM
    26562474      uiModeList[i] = 34; // VER+8 mode
    2657 #else
    2658       uiModeList[i] = 7; // VER+8 mode
    2659 #endif
    26602475      break;
    26612476    }
     
    26792494  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
    26802495 
    2681 #if DEFAULT_DC
    26822496  iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2683 #else
    2684   iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;
    2685 #endif
    26862497#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    26872498  mapDMMtoIntraMode( iLeftIntraDir );
     
    26942505  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true, false, true );
    26952506 
    2696 #if DEFAULT_DC
    26972507  iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2698 #else
    2699   iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;
    2700 #endif
    27012508#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    27022509  mapDMMtoIntraMode( iAboveIntraDir );
     
    27062513#endif
    27072514 
    2708 #if LOGI_INTRA_NAME_3MPM
    27092515  uiPredNum = 3;
    27102516  if(iLeftIntraDir == iAboveIntraDir)
     
    27462552    }
    27472553  }
    2748 #else
    2749   Int iIdx  = getIntraSizeIdx(uiAbsPartIdx);
    2750  
    2751  
    2752   if ( iLeftIntraDir >= g_aucIntraModeNumAng[iIdx] )
    2753   {
    2754     iLeftIntraDir = PLANAR_IDX;
    2755   }
    2756  
    2757  
    2758   if ( iAboveIntraDir >= g_aucIntraModeNumAng[iIdx] )
    2759   {
    2760     iAboveIntraDir = PLANAR_IDX;
    2761   }
    2762  
    2763   if(iLeftIntraDir == iAboveIntraDir)
    2764   {
    2765     uiPredNum = 2;
    2766    
    2767     if( piMode )
    2768     {
    2769       *piMode = iLeftIntraDir;
    2770     }
    2771    
    2772     iAboveIntraDir = iLeftIntraDir == PLANAR_IDX ? DC_IDX : PLANAR_IDX; // DC or Planar
    2773    
    2774     assert( iLeftIntraDir != iAboveIntraDir );
    2775    
    2776     uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);
    2777     uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);
    2778   }
    2779   else
    2780   {
    2781     uiPredNum = 2;
    2782     uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);
    2783     uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);
    2784   }
    2785 #endif
    27862554 
    27872555  return uiPredNum;
     
    28332601  UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter();
    28342602  Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0;
    2835 #if G519_TU_AMP_NSQT_HARMONIZATION
    28362603  Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) );
    2837 #else
    2838   Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize == SIZE_Nx2N || partSize == SIZE_2NxN) );
    2839 #endif
    28402604 
    28412605  UInt log2MinTUSizeInCU = 0;
     
    30062770}
    30072771
    3008 #if H0736_AVC_STYLE_QP_RANGE
    30092772Void TComDataCU::setQPSubParts( Int qp, UInt uiAbsPartIdx, UInt uiDepth )
    3010 #else
    3011 Void TComDataCU::setQPSubParts( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth )
    3012 #endif
    30132773{
    30142774  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     
    30192779    if( m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiSCUIdx+getZorderIdxInCU()) == pcSlice->getEntropySliceCurStartCUAddr() )
    30202780    {
    3021 #if H0736_AVC_STYLE_QP_RANGE
    30222781      m_phQP[uiSCUIdx] = qp;
    3023 #else
    3024       m_phQP[uiSCUIdx] = uiQP;
    3025 #endif
    30262782    }
    30272783  }
     
    38323588 * \param numValidMergeCand
    38333589 */
    3834 #if SIMP_MRG_PRUN
    38353590#if MERL_VSP_C0152
    38363591Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx )
    38373592#else
    38383593Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
    3839 #endif
    3840 #else
    3841 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand )
    38423594#endif
    38433595{
     
    38633615  }
    38643616  // compute the location of the current PU
    3865 #if PARALLEL_MERGE
    38663617  Int xP, yP, nPSW, nPSH;
    38673618  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    3868 #endif
    38693619
    38703620#if MERL_VSP_C0152
     
    39153665      xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    39163666#endif
    3917 #if SIMP_MRG_PRUN
    39183667      if ( mrgCandIdx == iCount )
    39193668      {
    39203669        return;
    39213670      }
    3922 #endif
    39233671      iCount ++;
    39243672    }
     
    40023750      xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    40033751#endif
    4004 #if SIMP_MRG_PRUN
    40053752      if ( mrgCandIdx == iCount )
    40063753      {
    40073754        return;
    40083755      }
    4009 #endif
    40103756      iCount ++;
    40113757    }
     
    40593805    }
    40603806#endif
    4061 #if SIMP_MRG_PRUN
    40623807    if ( mrgCandIdx == iCount )
    40633808    {
    40643809      return;
    40653810    }
    4066 #endif
    40673811    iCount ++;
    40683812  }
     
    40873831      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    40883832#endif
    4089 #if SIMP_MRG_PRUN
    40903833      if ( mrgCandIdx == iCount )
    40913834          return;
    4092 #endif
    40933835      iCount ++;
    40943836    }   
     
    41063848  UInt uiLeftPartIdx = 0;
    41073849  TComDataCU* pcCULeft = 0;
    4108 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    41093850  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB, true, false );
    4110 #else
    4111   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    4112 #endif
    4113 #if PARALLEL_MERGE
    41143851  if (pcCULeft)
    41153852  {
     
    41193856    }
    41203857  }
    4121 #endif
    41223858  PartSize partSize = getPartitionSize( uiAbsPartIdx );
    41233859  if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N)))
     
    41753911        xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    41763912#endif
    4177 #if SIMP_MRG_PRUN
    41783913        if ( mrgCandIdx == iCount )
    41793914        {
    41803915          return;
    41813916        }
    4182 #endif
    41833917        iCount ++;
    41843918#if H3D_IVMP
     
    42133947    }
    42143948#endif
    4215 #if SIMP_MRG_PRUN
    42163949    if ( mrgCandIdx == iCount )
    42173950    {
    42183951      return;
    42193952    }
    4220 #endif
    42213953    iCount ++;
    42223954  }
     
    42313963
    42323964  // above
    4233 #if !SIMP_MRG_PRUN
    4234   partSize = getPartitionSize( uiAbsPartIdx );
    4235   if (!(uiPUIdx == 1 && (partSize == SIZE_2NxN || partSize == SIZE_2NxnU || partSize == SIZE_2NxnD)))
    4236   {
    4237 #endif
    42383965  UInt uiAbovePartIdx = 0;
    42393966  TComDataCU* pcCUAbove = 0;
    4240 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    42413967  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true );
    4242 #else
    4243   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, true, true );
    4244 #endif
    4245 #if PARALLEL_MERGE
    42463968    if (pcCUAbove)
    42473969    {
     
    42513973      }
    42523974    }
    4253 #endif
    4254 #if SIMP_MRG_PRUN
    42553975  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
    42563976#if MERL_VSP_C0152
     
    42593979    && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD))
    42603980    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    4261 #else
    4262   if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) )
    4263 #endif
    42643981  {
    42653982    abCandIsInter[iCount] = true;
     
    43074024     xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    43084025#endif
    4309 #if SIMP_MRG_PRUN
    43104026    if ( mrgCandIdx == iCount )
    43114027    {
    43124028      return;
    43134029    }
    4314 #endif
    43154030    iCount ++;
    43164031#if H3D_IVMP
     
    43184033#endif
    43194034  }
    4320 #if !SIMP_MRG_PRUN
    4321   }
    4322 #endif
    43234035
    43244036#if H3D_IVMP
     
    43474059    }
    43484060#endif
    4349 #if SIMP_MRG_PRUN
    43504061    if ( mrgCandIdx == iCount )
    43514062    {
    43524063      return;
    43534064    }
    4354 #endif
    43554065    iCount ++;
    43564066  }
     
    43674077  UInt uiAboveRightPartIdx = 0;
    43684078  TComDataCU* pcCUAboveRight = 0;
    4369 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    43704079  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, false, true );
    4371 #else
    4372   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, true, true);
    4373 #endif
    4374 #if PARALLEL_MERGE
    43754080  if (pcCUAboveRight)
    43764081  {
     
    43804085    }
    43814086  }
    4382 #endif
    4383 #if SIMP_MRG_PRUN
    43844087  if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx )
    43854088#if MERL_VSP_C0152
     
    43874090#endif
    43884091    && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    4389 #else
    4390   if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) )
    4391 #endif
    43924092  {
    43934093    abCandIsInter[iCount] = true;
     
    44134113    xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    44144114#endif
    4415 #if SIMP_MRG_PRUN
    44164115    if ( mrgCandIdx == iCount )
    44174116    {
    44184117      return;
    44194118    }
    4420 #endif
    44214119    iCount ++;
    44224120  }
     
    44474145    }
    44484146#endif
    4449 #if SIMP_MRG_PRUN
    44504147    if ( mrgCandIdx == iCount )
    44514148    {
    44524149      return;
    44534150    }
    4454 #endif
    44554151    iCount ++;
    44564152  }
     
    44954191        pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    44964192#endif
    4497 #if SIMP_MRG_PRUN
    44984193        if ( mrgCandIdx == iCount )
    44994194          return;
    4500 #endif
    45014195        iCount ++;
    45024196      }
     
    45264220  UInt uiLeftBottomPartIdx = 0;
    45274221  TComDataCU* pcCULeftBottom = 0;
    4528 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    45294222  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB, true, false );
    4530 #else
    4531   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    4532 #endif
    4533 #if PARALLEL_MERGE
    45344223  if (pcCULeftBottom)
    45354224  {
     
    45394228    }
    45404229  }
    4541 #endif
    4542 #if SIMP_MRG_PRUN
    45434230  if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx )
    45444231#if MERL_VSP_C0152
     
    45464233#endif
    45474234    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    4548 #else
    4549   if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) )
    4550 #endif
    45514235  {
    45524236    abCandIsInter[iCount] = true;
     
    45724256     xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    45734257#endif
    4574 #if SIMP_MRG_PRUN
    45754258    if ( mrgCandIdx == iCount )
    45764259    {
    45774260      return;
    45784261    }
    4579 #endif
    45804262    iCount ++;
    45814263  }
     
    46114293    }
    46124294#endif
    4613 #if SIMP_MRG_PRUN
    46144295    if ( mrgCandIdx == iCount )
    46154296    {
    46164297      return;
    46174298    }
    4618 #endif
    46194299    iCount ++;
    46204300  }
     
    46374317    UInt uiAboveLeftPartIdx = 0;
    46384318    TComDataCU* pcCUAboveLeft = 0;
    4639 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    46404319    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, false, true );
    4641 #else
    4642     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, true, true );
    4643 #endif
    4644 #if PARALLEL_MERGE
    46454320    if (pcCUAboveLeft)
    46464321    {
     
    46504325      }
    46514326    }
    4652 #endif
    4653 #if SIMP_MRG_PRUN
    46544327    if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx )
    46554328#if MERL_VSP_C0152
     
    46594332     && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    46604333     )
    4661 #else
    4662     if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) )
    4663 #endif
    46644334    {
    46654335      abCandIsInter[iCount] = true;
     
    46854355     xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    46864356#endif
    4687 #if SIMP_MRG_PRUN
    46884357      if ( mrgCandIdx == iCount )
    46894358      {
    46904359        return;
    46914360      }
    4692 #endif
    46934361      iCount ++;
    46944362    }
     
    47144382    {
    47154383      RefPicList  eRefPicList = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    4716 #if SET_MERGE_TMVP_REFIDX
    47174384      Int iRefIdxTmp;
    47184385      if ( uiPUIdx != 0 )
     
    47244391        iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1;
    47254392      }
    4726 #else     
    4727       Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1;
    4728 #endif
    47294393      iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
    47304394    }
     
    48584522      pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv().m_bDvMcp = false;
    48594523#endif
    4860 #if SIMP_MRG_PRUN
    48614524      if ( mrgCandIdx == iCount )
    48624525      {
     
    48644527      }
    48654528      iCount++;
    4866 #endif
    48674529    }
    48684530    uiIdx++;
     
    48704532  }
    48714533
    4872 #if SIMP_MRG_PRUN
    48734534  UInt uiArrayAddr = iCount;
    4874 #else
    4875 #if H3D_IVMP
    4876   for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS_MEM; uiOuter++ )
    4877 #else
    4878   for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ )
    4879 #endif
    4880   {
    4881     if( abCandIsInter[ uiOuter ] )
    4882     {
    4883 #if H3D_IVMP
    4884       for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS_MEM; uiIter++ )
    4885 #else
    4886       for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ )
    4887 #endif
    4888       {
    4889         UInt uiMvFieldNeighIdxCurr = uiOuter << 1;
    4890         UInt uiMvFieldNeighIdxComp = uiIter << 1;
    4891         if( getSlice()->isInterB() )
    4892         {
    4893           if( puhInterDirNeighbours[ uiOuter ] == 3 )
    4894           {
    4895             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&
    4896               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&
    4897               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4898             {
    4899               abCandIsInter[ uiIter ] = false;
    4900             }
    4901           }
    4902           else if( puhInterDirNeighbours[ uiOuter ] == 2 )
    4903           {
    4904             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&
    4905               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&
    4906               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4907             {
    4908               abCandIsInter[ uiIter ] = false;
    4909             }
    4910           }
    4911           else
    4912           {
    4913             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&
    4914               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() &&
    4915               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4916             {
    4917               abCandIsInter[ uiIter ] = false;
    4918             }
    4919           }
    4920         }
    4921         else
    4922         {
    4923           if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&
    4924               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() )
    4925           {
    4926             assert( puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] );
    4927             abCandIsInter[ uiIter ] = false;
    4928           }
    4929         }
    4930       }
    4931     }
    4932   }
    4933 
    4934 #if H3D_IVMP
    4935   bool abCandIsInterFlag[MRG_MAX_NUM_CANDS_MEM];
    4936   for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4937 #else
    4938   bool abCandIsInterFlag[MRG_MAX_NUM_CANDS];
    4939   for (int i=0; i<MRG_MAX_NUM_CANDS; i++)
    4940 #endif
    4941   {
    4942     abCandIsInterFlag[i] = abCandIsInter[ i ];
    4943     abCandIsInter[ i ] = false;
    4944   }
    4945 
    4946   UInt uiArrayAddr = 0;
    4947    
    4948 #if H3D_IVMP
    4949   for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4950 #else
    4951   for (int i=0; i<MRG_MAX_NUM_CANDS; i++)
    4952 #endif
    4953   {
    4954     if (abCandIsInterFlag[i])
    4955     {
    4956       abCandIsInter[uiArrayAddr] = true;
    4957       puhInterDirNeighbours[uiArrayAddr] = puhInterDirNeighbours[i];
    4958       pcMvFieldNeighbours[uiArrayAddr<<1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
    4959       pcMvFieldNeighbours[(uiArrayAddr<<1)+1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    4960       ++uiArrayAddr;
    4961     }
    4962   }
    4963 
    4964 #if H3D_IVMP
    4965   for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4966 #else
    4967   for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS; i++)
    4968 #endif
    4969   {
    4970     puhInterDirNeighbours[i] = (getSlice()->isInterB()) ? 3 : 1;
    4971     abCandIsInter[i] = false;
    4972     TComMv tmpMv;
    4973     tmpMv.set(0,0);
    4974     pcMvFieldNeighbours[i<<1].setMvField(tmpMv, 0);
    4975     if ( getSlice()->isInterB() )
    4976     {
    4977       pcMvFieldNeighbours[(i<<1)+1].setMvField(tmpMv, 0);
    4978     }
    4979   }
    4980 #endif
    49814535  UInt uiCutoff = uiArrayAddr;
    49824536   
     
    50334587      }
    50344588    }
    5035 #if !REMOVE_NON_SCALED 
    5036     Int iScaledCount = 0;
    5037 #if H3D_IVMP
    5038     for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; i++)
    5039 #else
    5040     for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; i++)
    5041 #endif
    5042     {
    5043 #if H3D_IVMP
    5044       for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; j++)
    5045 #else
    5046       for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; j++)
    5047 #endif
    5048       {
    5049         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))
    5050         {
    5051           Int iCurrPOC = m_pcSlice->getPOC();
    5052           Int iCurrRefPOC1 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );
    5053           Int iCurrRefPOC2 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_0:REF_PIC_LIST_1, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );
    5054 
    5055           if (iCurrRefPOC1 != iCurrRefPOC2 && abs(iCurrPOC-iCurrRefPOC1) == abs(iCurrPOC-iCurrRefPOC2))
    5056           {
    5057             abCandIsInter[uiArrayAddr] = true;
    5058             puhInterDirNeighbours[uiArrayAddr] = 3;
    5059            
    5060             TComMv cMvPred = pcMvFieldNeighbours[(i<<1)+j].getMv();
    5061             TComMv rcMv;
    5062 
    5063             rcMv.set(-1*cMvPred.getHor(), -1*cMvPred.getVer());
    5064 
    5065             if (j==0)
    5066             {
    5067               pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[(i<<1)].getMv(), pcMvFieldNeighbours[(i<<1)].getRefIdx());
    5068               pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)].getRefIdx());
    5069             }
    5070             else
    5071             {
    5072               pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    5073               pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    5074             }
    5075 
    5076             uiArrayAddr++;
    5077             iScaledCount++;
    5078           }
    5079         }
    5080       }
    5081     }
    5082 #endif
    50834589  }
    50844590
     
    52584764  }
    52594765}
    5260 #if PARALLEL_MERGE
    52614766/** Check whether the current PU and a spatial neighboring PU are in a same ME region.
    52624767 * \param xN, xN   location of the upper-left corner pixel of a neighboring PU
     
    53454850}
    53464851
    5347 #endif
    53484852AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx)
    53494853{
     
    53674871
    53684872  UInt uiIdx = 0;
    5369 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    53704873    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    5371 #else
    5372     pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    5373 #endif
    53744874  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    53754875#if MERL_VSP_C0152
     
    53954895    }
    53964896  }
    5397 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    53984897      pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    5399 #else
    5400     pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
    5401 #endif
    54024898
    54034899  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     
    54254921  }
    54264922
    5427 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    54284923      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    5429 #else
    5430       pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
    5431 #endif
    54324924  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    54334925#if MERL_VSP_C0152
     
    54534945    }
    54544946  }
    5455 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    54564947      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    5457 #else
    5458       pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
    5459 #endif
    54604948  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    54614949#if MERL_VSP_C0152
     
    54834971
    54844972  // Above predictor search
    5485 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    54864973      pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    54874974    assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5488 #else
    5489       pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
    5490 #endif
    54914975  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    54924976#if MERL_VSP_C0152
     
    59935477#endif
    59945478  UInt uiIdx = 0;
    5995 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    59965479  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    5997 #else
    5998   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    5999 #endif
    60005480  if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
    60015481  {
     
    60785558  }
    60795559
    6080 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    60815560  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    6082 #else
    6083   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
    6084 #endif
    60855561  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
    60865562  {
     
    61645640  }
    61655641
    6166 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    61675642  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    6168 #else
    6169   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
    6170 #endif
    61715643
    61725644  if (pcTmpCU && bParMerge)
     
    62465718  }
    62475719
    6248 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    62495720  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    6250 #else
    6251   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
    6252 #endif
    62535721
    62545722  if (pcTmpCU && bParMerge)
     
    63285796
    63295797  // Above predictor search
    6330 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63315798  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    63325799  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    6333 #else
    6334   pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
    6335 #endif
    63365800
    63375801  if (pcTmpCU && bParMerge)
     
    67416205  TComDataCU* tmpCU = NULL;
    67426206  UInt idx;
    6743 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    67446207  tmpCU = getPUBelowLeft(idx, uiPartIdxLB, true, false);
    6745 #else
    6746   tmpCU = getPUBelowLeft(idx, uiPartIdxLB);
    6747 #endif
    67486208  bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
    67496209
    67506210  if (!bAddedSmvp)
    67516211  {
    6752 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    67536212    tmpCU = getPULeft(idx, uiPartIdxLB, true, false);
    6754 #else
    6755     tmpCU = getPULeft(idx, uiPartIdxLB);
    6756 #endif
    67576213    bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
    67586214  }
     
    68116267
    68126268
    6813 #if AMVP_PRUNING_SIMPLIFICATION
    68146269  if ( pInfo->iN == 2 )
    68156270  {
     
    68226277    }
    68236278  }
    6824 #endif
    68256279
    68266280  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     
    68946348  }
    68956349
    6896 #if !AMVP_PRUNING_SIMPLIFICATION
    6897   // Check No MV Candidate
    6898   xUniqueMVPCand( pInfo );
    6899 #endif
    69006350
    69016351  if (pInfo->iN > AMVP_MAX_NUM_CANDS)
     
    69056355  else if (pInfo->iN < AMVP_MAX_NUM_CANDS)
    69066356  {
    6907 #if !AMVP_ZERO_CHECKING_REMOVAL
    6908     int j;
    6909     for (j=0; j<pInfo->iN; j++)
    6910     {
    6911       if (pInfo->m_acMvCand[j].getHor() == 0 && pInfo->m_acMvCand[j].getVer() == 0)
    6912       {
    6913         break;
    6914       }
    6915     }
    6916     if (j == pInfo->iN)
    6917     {
    6918 #endif
    69196357      pInfo->m_acMvCand[pInfo->iN].set(0,0);
    69206358      pInfo->iN++;
    6921 #if !AMVP_ZERO_CHECKING_REMOVAL
    6922     }
    6923 #endif
    69246359  }
    69256360  return ;
     
    70116446    case MD_LEFT:
    70126447    {
    7013 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    70146448      pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false);
    7015 #else
    7016       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
    7017 #endif
    70186449      break;
    70196450    }
    70206451    case MD_ABOVE:
    70216452    {
    7022 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    70236453      pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true);
    7024 #else
    7025       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);
    7026 #endif
    70276454      break;
    70286455    }
    70296456    case MD_ABOVE_RIGHT:
    70306457    {
    7031 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    70326458      pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true);
    7033 #else
    7034       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);
    7035 #endif
    70366459      break;
    70376460    }
    70386461    case MD_BELOW_LEFT:
    70396462    {
    7040 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    70416463      pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false);
    7042 #else
    7043       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
    7044 #endif
    70456464      break;
    70466465    }
    70476466    case MD_ABOVE_LEFT:
    70486467    {
    7049 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    70506468      pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true);
    7051 #else
    7052       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);
    7053 #endif
    70546469      break;
    70556470    }
     
    71246539}
    71256540
    7126 #if !AMVP_PRUNING_SIMPLIFICATION
    7127 /**
    7128  * Reduce list of motion vector predictors to a set of unique predictors
    7129  * \param pInfo list of motion vector predictors
    7130  */
    7131 Void TComDataCU::xUniqueMVPCand(AMVPInfo* pInfo)
    7132 {
    7133   Int n = 1;
    7134   if ( pInfo->iN == 0 )
    7135   {
    7136 #if AMVP_ZERO_CHECKING_REMOVAL
    7137     return;
    7138 #else
    7139     // Add a zero candidate is none is available
    7140     pInfo->m_acMvCand[ 0 ].setZero();
    7141 #endif
    7142   }
    7143   else
    7144   {
    7145     for (Int i = 1; i < pInfo->iN; i++)
    7146     {
    7147       Int j;
    7148       for (j = n - 1; j >= 0; j--)
    7149       {
    7150         if ( pInfo->m_acMvCand[ i ] == pInfo->m_acMvCand[ j ] )
    7151         {
    7152           break;
    7153         }
    7154       }
    7155       if ( j < 0 )
    7156       {
    7157         pInfo->m_acMvCand[ n++ ] = pInfo->m_acMvCand[ i ];
    7158       }
    7159     }
    7160   }
    7161   pInfo->iN = n;
    7162 }
    7163 #endif
    71646541
    71656542/**
     
    71806557  case MD_LEFT:
    71816558    {
    7182 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    71836559      pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false);
    7184 #else
    7185       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
    7186 #endif
    71876560      break;
    71886561    }
    71896562  case MD_ABOVE:
    71906563    {
    7191 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    71926564      pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true);
    7193 #else
    7194       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);
    7195 #endif
    71966565      break;
    71976566    }
    71986567  case MD_ABOVE_RIGHT:
    71996568    {
    7200 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    72016569      pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true);
    7202 #else
    7203       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);
    7204 #endif
    72056570      break;
    72066571    }
    72076572  case MD_BELOW_LEFT:
    72086573    {
    7209 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    72106574      pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false);
    7211 #else
    7212       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
    7213 #endif
    72146575      break;
    72156576    }
    72166577  case MD_ABOVE_LEFT:
    72176578    {
    7218 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    72196579      pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true);
    7220 #else
    7221       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);
    7222 #endif
    72236580      break;
    72246581    }
     
    77817138UInt TComDataCU::getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra)
    77827139{
    7783 #if !LOGI_INTRA_NAME_3MPM 
    7784   static const UChar aucIntraDirToScanIdx[MAX_CU_DEPTH][NUM_INTRA_MODE] =
    7785   {
    7786     {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
    7787     },
    7788     {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
    7789     },
    7790     {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
    7791     },
    7792     {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
    7793     },
    7794     {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
    7795     },
    7796     {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
    7797     },
    7798     {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
    7799     },
    7800   };
    7801 #endif
    78027140 
    78037141  UInt uiCTXIdx;
     
    78297167#endif
    78307168
    7831 #if LOGI_INTRA_NAME_3MPM
    78327169    uiScanIdx = SCAN_ZIGZAG;
    78337170    if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for PU size
     
    78357172      uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0);
    78367173    }
    7837 #else
    7838     uiScanIdx = aucIntraDirToScanIdx[uiCTXIdx][uiDirMode];
    7839 #endif
    78407174  }
    78417175  else
     
    78547188#endif
    78557189    }
    7856 #if LOGI_INTRA_NAME_3MPM
    78577190    uiScanIdx = SCAN_ZIGZAG;
    78587191    if (uiCTXIdx >4 && uiCTXIdx < 7) //if multiple scans supported for PU size
     
    78607193      uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0);
    78617194    }
    7862 #else
    7863     uiScanIdx = aucIntraDirToScanIdx[max<Int>(uiCTXIdx-1,0)][uiDirMode];
    7864 #endif
    78657195  }
    78667196
     
    83547684      }
    83557685    }
    8356 #if LCU_SYNTAX_ALF
    83577686    rSGU.allBordersAvailable = true;
    83587687    for(Int b=0; b< NUM_SGU_BORDER; b++)
     
    83647693      }
    83657694    }
    8366 #endif
    83677695
    83687696  }
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.h

    r293 r294  
    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
     
    214208  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
    215209
    216 #if BURST_IPCM
    217210  Int           m_numSucIPCM;         ///< the number of succesive IPCM blocks associated with the current log2CUSize
    218211  Bool          m_lastCUSucIPCMFlag;  ///< True indicates that the last CU is IPCM and shares the same root as the current CU. 
    219 #endif
    220212#if HHI_INTER_VIEW_RESIDUAL_PRED
    221213  Bool*         m_pbResPredAvailable; ///< array of residual prediction available flags
     
    298290#endif
    299291 
    300 #if !AMVP_PRUNING_SIMPLIFICATION
    301   /// remove redundant candidates
    302   Void          xUniqueMVPCand        ( AMVPInfo* pInfo );
    303 #endif
    304292
    305293  Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand );
     
    316304  Void xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr);
    317305
    318 #if !BURST_IPCM
    319   Int           getLastValidPartIdx   ( Int iAbsPartIdx );
    320 #endif
    321306
    322307public:
     
    336321 
    337322  Void          initCU                ( TComPic* pcPic, UInt uiCUAddr );
    338 #if H0736_AVC_STYLE_QP_RANGE
    339323  Void          initEstData           ( UInt uiDepth, Int qp );
    340324  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
    341 #else
    342   Void          initEstData           ( UInt uiDepth, UInt uiQP );
    343   Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP );
    344 #endif
    345325  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
    346326
     
    410390  Void          setSizeSubParts       ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth );
    411391 
    412 #if H0736_AVC_STYLE_QP_RANGE
    413392  Char*         getQP                 ()                        { return m_phQP;              }
    414393  Char          getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
    415394  Void          setQP                 ( UInt uiIdx, Char value ){ m_phQP[uiIdx] =  value;     }
    416395  Void          setQPSubParts         ( Int qp,   UInt uiAbsPartIdx, UInt uiDepth );
    417 #if BURST_IPCM
    418396  Int           getLastValidPartIdx   ( Int iAbsPartIdx );
    419 #endif
    420397  Char          getLastCodedQP        ( UInt uiAbsPartIdx );
    421 #else
    422   UChar*        getQP                 ()                        { return m_phQP;              }
    423   UChar         getQP                 ( UInt uiIdx )            { return m_phQP[uiIdx];       }
    424   Void          setQP                 ( UInt uiIdx, UChar  uh ) { m_phQP[uiIdx] = uh;         }
    425   Void          setQPSubParts         ( UInt uiQP,   UInt uiAbsPartIdx, UInt uiDepth );
    426 #if BURST_IPCM
    427   Int           getLastValidPartIdx   ( Int iAbsPartIdx );
    428 #endif
    429   UChar         getLastCodedQP        ( UInt uiAbsPartIdx );
    430 #endif
    431398
    432399#if LOSSLESS_CODING
     
    541508  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
    542509
    543 #if BURST_IPCM
    544510  Int           getNumSucIPCM         ()                        { return m_numSucIPCM;             }
    545511  Void          setNumSucIPCM         ( Int num )               { m_numSucIPCM = num;              }
    546512  Bool          getLastCUSucIPCMFlag  ()                        { return m_lastCUSucIPCMFlag;        }
    547513  Void          setLastCUSucIPCMFlag  ( Bool flg )              { m_lastCUSucIPCMFlag = flg;         }
    548 #endif
    549514
    550515  /// get slice ID for SU
     
    637602  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1);
    638603#endif
    639 #if PARALLEL_MERGE
    640604  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
    641605  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
    642 #endif
    643606  Void          setMVPIdx             ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx)  { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx;  }
    644607  Int           getMVPIdx             ( RefPicList eRefPicList, UInt uiIdx)               { return m_apiMVPIdx[eRefPicList][uiIdx];     }
     
    684647
    685648  TComDataCU*   getQpMinCuLeft              ( UInt&  uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
    686 #if H0204_QP_PREDICTION
    687649  TComDataCU*   getQpMinCuAbove             ( UInt&  aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceEntropySliceRestriction=true );
    688 #endif
    689 #if H0736_AVC_STYLE_QP_RANGE
    690650  Char          getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
    691 #else
    692   UChar         getRefQP                    ( UInt   uiCurrAbsIdxInLCU                       );
    693 #endif
    694651
    695652  TComDataCU*   getPUAboveRightAdi          ( UInt&  uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true );
     
    703660 
    704661  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    705 #if SIMP_MRG_PRUN
    706662#if MERL_VSP_C0152
    707663  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 );
    708664#else
    709665  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
    710 #endif
    711 #else
    712   Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand );
    713666#endif
    714667  Void          deriveLeftRightTopIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComLoopFilter.cpp

    r231 r294  
    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
     
    455443  )
    456444  {
    457 #if NSQT_LFFIX
    458445    UInt nsPartQ = uiPartQ;
    459446    UInt nsPartP = uiPartP;
     
    468455
    469456    if ( m_aapucBS[iDir][uiAbsPartIdx] && (pcCUQ->getCbf( nsPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(nsPartQ)) != 0 || pcCUP->getCbf( nsPartP, TEXT_LUMA, pcCUP->getTransformIdx(nsPartP) ) != 0) )
    470 #else
    471     if ( m_aapucBS[iDir][uiAbsPartIdx] && (pcCUQ->getCbf( uiPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(uiPartQ)) != 0 || pcCUP->getCbf( uiPartP, TEXT_LUMA, pcCUP->getTransformIdx(uiPartP) ) != 0) )
    472 #endif
    473457    {
    474458      uiBs = 1;
     
    574558 
    575559  UInt  uiPelsInPart = g_uiMaxCUWidth >> g_uiMaxCUDepth;
    576 #if !DBL_H0473_PART_1
    577   UInt  PartIdxIncr = DEBLOCK_SMALLEST_BLOCK / uiPelsInPart ? DEBLOCK_SMALLEST_BLOCK / uiPelsInPart : 1;
    578   UInt  uiBlocksInPart = uiPelsInPart / DEBLOCK_SMALLEST_BLOCK ? uiPelsInPart / DEBLOCK_SMALLEST_BLOCK : 1;
    579 #endif
    580560  UInt  uiBsAbsIdx = 0, uiBs = 0;
    581561  Int   iOffset, iSrcStep;
     
    602582  }
    603583 
    604 #if !DBL_H0473_PART_1
    605   for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx+=PartIdxIncr )
    606   {
    607     uiBs = 0;
    608     for (UInt iIdxInside = 0; iIdxInside<PartIdxIncr; iIdxInside++)
    609     {
    610       uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx+iIdxInside);
    611       if (uiBs < m_aapucBS[iDir][uiBsAbsIdx])
    612       {
    613         uiBs = m_aapucBS[iDir][uiBsAbsIdx];
    614       }
    615     }
    616    
    617 #else
    618584  for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
    619585  {
    620586    uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx);
    621587    uiBs = m_aapucBS[iDir][uiBsAbsIdx];
    622 #endif
    623588    if ( uiBs )
    624589    {
     
    658623     
    659624     
    660 #if !DBL_H0473_PART_1     
    661       for (UInt iBlkIdx = 0; iBlkIdx< uiBlocksInPart; iBlkIdx ++)
    662       {
    663         Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0), iOffset);
    664         Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0), iOffset);
    665         Int dp3 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3), iOffset);
    666         Int dq3 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3), iOffset);
    667         Int d0 = dp0 + dq0;
    668         Int d3 = dp3 + dq3;
    669        
    670         Int dp4 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4), iOffset);
    671         Int dq4 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4), iOffset);
    672         Int dp7 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7), iOffset);
    673         Int dq7 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7), iOffset);
    674         Int d4 = dp4 + dq4;
    675         Int d7 = dp7 + dq7;
    676 #else
    677625        Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0), iOffset);
    678626        Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0), iOffset);
     
    685633        Int dq = dq0 + dq3;
    686634        Int d =  d0 + d3;
    687 #endif
    688635       
    689636        if (bPCMFilter)
     
    698645        bPartQNoFilter = bPartQNoFilter || (pcCU->isLosslessCoded(uiAbsZorderIdx) );
    699646#endif
    700 #if !DBL_H0473_PART_1         
    701         if (d0+d3 < iBeta)
    702         {
    703           Bool bFilterP = (dp0+dp3 < iSideThreshold);
    704           Bool bFilterQ = (dq0+dq3 < iSideThreshold);
    705          
    706           Bool sw =  xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+0))
    707           && xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+3));
    708          
    709 #else
    710647        if (d < iBeta)
    711648        {
     
    715652          Bool sw =  xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+0))
    716653                  && xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+3));
    717 #endif
    718654
    719655          for ( Int i = 0; i < DEBLOCK_SMALLEST_BLOCK/2; i++)
    720656          {
    721 #if !DBL_H0473_PART_1         
    722             xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+i), iOffset, d0+d3, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
    723 #else
    724657            xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+i), iOffset, d, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
    725 #endif
    726658
    727659          }
    728660        }
    729 #if !DBL_H0473_PART_1             
    730         if (d4+d7 < iBeta)
    731         {
    732           Bool bFilterP = (dp4+dp7 < iSideThreshold);
    733           Bool bFilterQ = (dq4+dq7 < iSideThreshold);
    734          
    735           Bool sw =  xUseStrongFiltering( iOffset, 2*d4, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+4))
    736           && xUseStrongFiltering( iOffset, 2*d7, iBeta, iTc , piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+7));
    737           for ( Int i = DEBLOCK_SMALLEST_BLOCK/2; i < DEBLOCK_SMALLEST_BLOCK; i++)
    738           {
    739             xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+i), iOffset, d4+d7, iBeta, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
    740           }
    741         }
    742       }
    743 #endif
    744661    }
    745662  }
     
    893810  if (sw)
    894811  {
    895 #if DBL_STRONG_FILTER_CLIP
    896812    piSrc[-iOffset]   = Clip3(m3-2*tc, m3+2*tc, ((m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3));
    897813    piSrc[0]          = Clip3(m4-2*tc, m4+2*tc, ((m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3));
     
    900816    piSrc[-iOffset*3] = Clip3(m1-2*tc, m1+2*tc, ((2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3));
    901817    piSrc[ iOffset*2] = Clip3(m6-2*tc, m6+2*tc, ((m3 + m4 + m5 + 3*m6 + 2*m7 +4 )>>3));
    902 #else
    903     piSrc[-iOffset] = ( m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3;
    904     piSrc[0] = ( m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3;
    905    
    906     piSrc[-iOffset*2] = ( m1 + m2 + m3 + m4 + 2)>>2;
    907     piSrc[ iOffset] = ( m3 + m4 + m5 + m6 + 2)>>2;
    908    
    909     piSrc[-iOffset*3] = ( 2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3;
    910     piSrc[ iOffset*2] = ( m3 + m4 + m5 + 3*m6 + 2*m7 +4 )>>3;
    911 #endif
    912818  }
    913819  else
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComLoopFilter.h

    r56 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComMv.h

    r289 r294  
    167167  const TComMv scaleMv( Int iScale ) const
    168168  {
    169 #if CLIPSCALEDMVP
    170169    Int mvx = Clip3( -32768, 32767, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8 );
    171170    Int mvy = Clip3( -32768, 32767, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8 );
    172171    return TComMv( mvx, mvy );
    173 #else
    174     return TComMv( (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8);
    175 #endif
    176172  }
    177173};// END CLASS DEFINITION TComMV
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPattern.cpp

    r189 r294  
    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 );
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPattern.h

    r189 r294  
    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:
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPic.cpp

    r292 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPicSym.h

    r56 r294  
    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; } 
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPrediction.cpp

    r290 r294  
    203203
    204204  // Map the mode index to main prediction direction and angle
    205 #if LOGI_INTRA_NAME_3MPM
    206205  assert( dirMode > 0 ); //no planar
    207206  Bool modeDC        = dirMode < 2;
     
    209208  Bool modeVer       = !modeDC && !modeHor;
    210209  Int intraPredAngle = modeVer ? (Int)dirMode - VER_IDX : modeHor ? -((Int)dirMode - HOR_IDX) : 0;
    211 #else
    212   Bool modeDC        = dirMode == 0;
    213   Bool modeVer       = !modeDC && (dirMode < 18);
    214   Bool modeHor       = !modeDC && !modeVer;
    215   Int intraPredAngle = modeVer ? dirMode - 9 : modeHor ? dirMode - 25 : 0;
    216 #endif
    217210  Int absAng         = abs(intraPredAngle);
    218211  Int signAng        = intraPredAngle < 0 ? -1 : 1;
     
    297290        for (k=0;k<blkSize;k++)
    298291        {
    299 #if REMOVE_DIV_OPERATION
    300292          pDst[k*dstStride] = Clip ( pDst[k*dstStride] + (( refSide[k+1] - refSide[0] ) >> 1) );
    301 #else
    302           pDst[k*dstStride] = Clip ( pDst[k*dstStride] + ( refSide[k+1] - refSide[0] ) / 2 );
    303 #endif
    304293        }
    305294      }
     
    376365  else
    377366  {
    378 #if LOGI_INTRA_NAME_3MPM
    379367    xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, true );
    380 #else
    381     xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, true );
    382 #endif
    383368
    384369    if( (uiDirMode == DC_IDX ) && bAbove && bLeft )
     
    405390  {
    406391    // Create the prediction
    407 #if LOGI_INTRA_NAME_3MPM
    408392    xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode, bAbove, bLeft, false );
    409 #else
    410     xPredIntraAng( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, g_aucAngIntraModeOrder[ uiDirMode ], bAbove, bLeft, false );
    411 #endif
    412393  }
    413394}
     
    33903371
    33913372  // 2nd step: derive wedge direction
    3392 #if LOGI_INTRA_NAME_3MPM
    33933373  Int uiPreds[3] = {-1, -1, -1};
    3394 #else
    3395   Int uiPreds[2] = {-1, -1};
    3396 #endif
    33973374  Int iMode = -1;
    33983375  Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 
    33993376
    34003377  UInt uiDirMode = 0;
    3401 #if LOGI_INTRA_NAME_3MPM
    34023378  if( iMode >= 0 ) { iPredNum = iMode; }
    34033379  if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; }
     
    34093385  Bool modeVer       = !modeHor;
    34103386  Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0;
    3411 #else
    3412   if( iPredNum == 1 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[0]]; }
    3413   if( iPredNum == 2 ) { uiDirMode = g_aucAngIntraModeOrder[uiPreds[1]]; }
    3414 
    3415   if( uiDirMode == 0 ) {  return false; } // no DC
    3416 
    3417   Bool modeVer       = (uiDirMode < 18);
    3418   Bool modeHor       = !modeVer;
    3419   Int intraPredAngle = modeVer ? uiDirMode - 9 : modeHor ? uiDirMode - 25 : 0;
    3420 #endif
    34213387  Int absAng         = abs(intraPredAngle);
    34223388  Int signAng        = intraPredAngle < 0 ? -1 : 1;
     
    37373703  Int*  ptrSrc  = pcTComPattern->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt );
    37383704  Int   sw      = ( iWidth<<1 ) + 1;
    3739 #if !LOGI_INTRA_NAME_3MPM
    3740   uiDirMode     = g_aucAngIntraModeOrder[ uiDirMode ];
    3741 #endif
    37423705  xPredIntraAngDepth( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, uiDirMode );
    37433706}
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r290 r294  
    415415#endif
    416416  pcCU->convertTransIdx             ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode );
    417 #if H0736_AVC_STYLE_QP_RANGE
    418417    m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    419 #else
    420     m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    421 #endif
    422418  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    423419  // chroma Cb
     
    426422  piCoeff     = pcCU->getCoeffCb();
    427423  pRes        = pcCUResidual->getCbAddr();
    428 #if H0736_AVC_STYLE_QP_RANGE
    429424    m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    430 #else
    431     m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC() );
    432 #endif
    433425  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    434426  // chroma Cr
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComRom.cpp

    r287 r294  
    417417};
    418418
    419 #if !LOGI_INTRA_NAME_3MPM
    420 // Mapping each Unified Directional Intra prediction direction to DCT/DST transform
    421 // 0 implies use DCT, 1 implies DST
    422 
    423 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    424 const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE+NUM_DMM_MODE] =
    425 #else
    426 const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE] =
    427 #endif
    428 { //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
    429   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
    430 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
    431   , 0, 0, 0, 0, 0, 0, 0, 0
    432 #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    433   , 0, 0, 0, 0
    434 #endif
    435 };
    436 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    437 const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE+NUM_DMM_MODE] =
    438 #else
    439 const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE] =
    440 #endif
    441 { //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
    442   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
    443 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
    444   , 0, 0, 0, 0, 0, 0, 0, 0
    445 #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    446   , 0, 0, 0, 0
    447 #endif
    448 };
    449 #endif
    450419
    451420
     
    482451const UChar g_aucConvertTxtTypeToIdx[4] = { 0, 1, 1, 2 };
    483452
    484 #if !LOGI_INTRA_NAME_3MPM
    485 // ====================================================================================================================
    486 // Angular Intra prediction
    487 // ====================================================================================================================
    488 
    489 // g_aucAngIntraModeOrder
    490 //   Indexing this array with the mode indicated in the bitstream
    491 //   gives a logical index used in the prediction functions.
    492 const UChar g_aucAngIntraModeOrder[NUM_INTRA_MODE] =
    493 {     //  ModeOrder LogicalOrderInPredFunctions
    494   34, //  PLANAR_IDX PLANAR PLANAR
    495   9,  //  0 VER     DC
    496   25, //  1 HOR     VER-8 (diagonal from top-left to bottom-right = HOR-8)
    497   0,  //  2 DC      VER-7
    498   1,  //  4 VER-8   VER-6
    499   5,  //  5 VER-4   VER-5
    500   13, //  6 VER+4   VER-4
    501   17, //  7 VER+8   VER-3
    502   21, //  8 HOR-4   VER-2
    503   29, //  9 HOR+4   VER-1
    504   33, // 10 HOR+8   VER
    505   3,  // 11 VER-6   VER+1
    506   7,  // 12 VER-2   VER+2
    507   11, // 13 VER+2   VER+3
    508   15, // 14 VER+6   VER+4
    509   19, // 15 HOR-6   VER+5
    510   23, // 16 HOR-2   VER+6
    511   27, // 17 HOR+2   VER+7
    512   31, // 18 HOR+6   VER+8
    513   2,  // 19 VER-7   HOR-7
    514   4,  // 20 VER-5   HOR-6
    515   6,  // 21 VER-3   HOR-5
    516   8,  // 22 VER-1   HOR-4
    517   10, // 23 VER+1   HOR-3
    518   12, // 24 VER+3   HOR-2
    519   14, // 25 VER+5   HOR-1
    520   16, // 26 VER+7   HOR
    521   18, // 27 HOR-7   HOR+1
    522   20, // 28 HOR-5   HOR+2
    523   22, // 29 HOR-3   HOR+3
    524   24, // 30 HOR-1   HOR+4
    525   26, // 31 HOR+1   HOR+5
    526   28, // 32 HOR+3   HOR+6
    527   30, // 33 HOR+5   HOR+7
    528   32, // 34 HOR+7   HOR+8
    529   0, // LM_CHROMA_IDX
    530 };
    531 
    532 const UChar g_aucIntraModeNumAng[7] =
    533 {
    534   4,  //   2x2
    535   18,  //   4x4
    536   35,  //   8x8
    537   35,  //  16x16
    538   35,  //  32x32
    539   35,  //  64x64
    540   6   // 128x128
    541 };
    542 
    543 const UChar g_aucIntraModeBitsAng[7] =
    544 {
    545   2,  //   2x2     3   1+1
    546   5,  //   4x4    17   4+1
    547   6,  //   8x8    34   5+esc
    548   6,  //  16x16   34   5+esc
    549   6,  //  32x32   34   5+esc
    550   6,  //  64x64   34   5+esc
    551   3   // 128x128   5   2+1
    552 };
    553 #endif
    554453
    555454// ====================================================================================================================
     
    647546};
    648547
    649 #if MULTILEVEL_SIGMAP_EXT
    650548const UInt g_sigLastScan8x8[ 4 ][ 4 ] =
    651549{
     
    656554};
    657555UInt g_sigLastScanCG32x32[ 64 ];
    658 #endif
    659556
    660557UInt* g_auiNonSquareSigLastScan[ 4 ];
     
    662559const UInt g_uiMinInGroup[ 10 ] = {0,1,2,3,4,6,8,12,16,24};
    663560const 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};
    664 #if LAST_CTX_REDUCTION
    665561const UInt g_uiLastCtx[ 28 ]    =
    666562{
     
    670566  10, 11, 12, 12, 13, 13, 14, 14, 2, 2    // 32x32  10
    671567};
    672 #else
    673 const UInt g_uiLastCtx[ 28 ]    =
    674 {
    675   0,   1,  2,  2,                         // 4x4    4
    676   3,   4,  5,  5, 6,  6,                  // 8x8    6 
    677   7,   8,  9,  9, 10, 10, 11, 11,         // 16x16  8
    678   12, 13, 14, 14, 15, 15, 16, 16, 17, 17  // 32x32  10
    679 };
    680 #endif
    681568
    682569// Rice parameters for absolute transform levels
    683 #if EIGHT_BITS_RICE_CODE
    684570const UInt g_auiGoRiceRange[5] =
    685571{
     
    691577  8, 7, 6, 5, 4
    692578};
    693 #else
    694 const UInt g_auiGoRiceRange[4] =
    695 {
    696   7, 20, 42, 70
    697 };
    698 
    699 const UInt g_auiGoRicePrefixLen[4] =
    700 {
    701   8, 10, 10, 8
    702 };
    703 #endif
    704 
    705 #if EIGHT_BITS_RICE_CODE
     579
    706580const UInt g_aauiGoRiceUpdate[5][24] =
    707581{
    708 #if RESTRICT_GR1GR2FLAG_NUMBER
    709582  {
    710583    0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
     
    722595    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
    723596  }
    724 #else
    725   {
    726     0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    727   },
    728   {
    729     1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    730   },
    731   {
    732     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    733   },
    734   {
    735     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
    736   },
    737   {
    738     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
    739   }
    740 #endif
    741 };
    742 #else
    743 const UInt g_aauiGoRiceUpdate[4][16] =
    744 {
    745 #if RESTRICT_GR1GR2FLAG_NUMBER
    746   {
    747     0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
    748   },
    749   {
    750     1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
    751   },
    752   {
    753     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
    754   },
    755   {
    756     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    757   }
    758 #else 
    759   {
    760     0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3
    761   },
    762   {
    763     1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3
    764   },
    765   {
    766     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3
    767   },
    768   {
    769     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
    770   }
    771 #endif
    772 };
    773 #endif
     597};
    774598
    775599// initialize g_auiFrameScanXY
     
    825649  if( iWidth < 16 )
    826650  {
    827 #if MULTILEVEL_SIGMAP_EXT
    828651  UInt* pBuffTemp = pBuffD;
    829652  if( iWidth == 8 )
     
    831654    pBuffTemp = g_sigLastScanCG32x32;
    832655  }
    833 #endif
    834656  for( UInt uiScanLine = 0; uiNextScanPos < uiNumScanPos; uiScanLine++ )
    835657  {
     
    843665    while( iPrimDim >= 0 && iScndDim < iWidth )
    844666    {
    845 #if MULTILEVEL_SIGMAP_EXT
    846667      pBuffTemp[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ;
    847 #else
    848       pBuffD[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ;
    849 #endif
    850668      uiNextScanPos++;
    851669      iScndDim++;
     
    854672  }
    855673  }
    856 #if MULTILEVEL_SIGMAP_EXT
    857674  if( iWidth > 4 )
    858 #else
    859   else
    860 #endif
    861675  {
    862676    UInt uiNumBlkSide = iWidth >> 2;
     
    868682      uiNextScanPos   = 0;
    869683      UInt initBlkPos = g_auiSigLastScan[ SCAN_DIAG ][ log2Blk ][ uiBlk ];
    870 #if MULTILEVEL_SIGMAP_EXT
    871684      if( iWidth == 32 )
    872685      {
    873686        initBlkPos = g_sigLastScanCG32x32[ uiBlk ];
    874687      }
    875 #endif
    876688      UInt offsetY    = initBlkPos / uiNumBlkSide;
    877689      UInt offsetX    = initBlkPos - offsetY * uiNumBlkSide;
     
    1000812}
    1001813
    1002 #if SCALING_LIST
    1003814Int g_quantIntraDefault4x4[16] =
    1004815{
     
    1039850  24,25,28,33,41,54,71,91
    1040851};
    1041 #else
    1042 Int g_quantIntraDefault4x4[16] =
    1043 {
    1044    6,13,20,28,
    1045   13,20,28,32,
    1046   20,28,32,37,
    1047   28,32,37,42
    1048 };
    1049 Int g_quantInterDefault4x4[16] =
    1050 {
    1051   10,14,20,24,
    1052   14,20,24,27,
    1053   20,24,27,30,
    1054   24,27,30,34
    1055 };
    1056 
    1057 Int g_quantIntraDefault8x8[64] =
    1058 {
    1059    6,10,13,16,18,23,25,27,
    1060   10,11,16,18,23,25,27,29,
    1061   13,16,18,23,25,27,29,31,
    1062   16,18,23,25,27,29,31,33,
    1063   18,23,25,27,29,31,33,36,
    1064   23,25,27,29,31,33,36,38,
    1065   25,27,29,31,33,36,38,40,
    1066   27,29,31,33,36,38,40,42
    1067 };
    1068 
    1069 Int g_quantInterDefault8x8[64] =
    1070 {
    1071    9,13,15,17,19,21,22,24,
    1072   13,13,17,19,21,22,24,25,
    1073   15,17,19,21,22,24,25,27,
    1074   17,19,21,22,24,25,27,28,
    1075   19,21,22,24,25,27,28,30,
    1076   21,22,24,25,27,28,30,32,
    1077   22,24,25,27,28,30,32,33,
    1078   24,25,27,28,30,32,33,35
    1079 };
    1080 
    1081 Int g_quantIntraDefault16x16[256] =
    1082 {
    1083   16,16,16,16,16,16,16,16,17,17,18,19,21,22,24,27,
    1084   16,16,16,16,16,16,16,16,17,18,18,20,21,23,25,27,
    1085   16,16,16,16,16,16,16,17,17,18,19,20,22,23,25,28,
    1086   16,16,16,16,16,16,17,17,18,19,20,21,23,25,27,29,
    1087   16,16,16,16,17,17,18,19,20,21,22,23,25,27,29,31,
    1088   16,16,16,16,17,18,19,20,22,23,24,26,27,29,32,34,
    1089   16,16,16,17,18,19,21,23,24,25,27,29,31,33,36,39,
    1090   16,16,17,17,19,20,23,25,27,29,31,33,35,38,41,44,
    1091   17,17,17,18,20,22,24,27,30,32,35,38,41,44,47,51,
    1092   17,18,18,19,21,23,25,29,32,36,40,43,47,51,55,60,
    1093   18,18,19,20,22,24,27,31,35,40,44,49,54,59,65,70,
    1094   19,20,20,21,23,26,29,33,38,43,49,56,62,69,75,82,
    1095   21,21,22,23,25,27,31,35,41,47,54,62,70,79,88,97,
    1096   22,23,23,25,27,29,33,38,44,51,59,69,79,90,101,113,
    1097   24,25,25,27,29,32,36,41,47,55,65,75,88,101,115,130,
    1098   27,27,28,29,31,34,39,44,51,60,70,82,97,113,130,149
    1099 };
    1100 
    1101 Int g_quantInterDefault16x16[256] =
    1102 {
    1103   16,16,16,16,16,16,16,16,17,17,18,19,20,21,22,27,
    1104   16,16,16,16,16,16,16,17,17,18,19,20,21,22,27,27,
    1105   16,16,16,16,16,16,17,17,18,19,20,21,22,27,27,28,
    1106   16,16,16,16,16,17,17,18,19,20,21,22,27,27,28,29,
    1107   16,16,16,16,17,17,18,19,20,21,22,27,27,28,29,30,
    1108   16,16,16,17,17,18,19,20,21,22,27,27,28,29,30,32,
    1109   16,16,17,17,18,19,20,21,22,27,27,28,29,30,32,36,
    1110   16,17,17,18,19,20,21,22,27,27,28,29,30,32,36,40,
    1111   17,17,18,19,20,21,22,27,27,28,29,30,32,36,40,45,
    1112   17,18,19,20,21,22,27,27,28,29,30,32,36,40,45,52,
    1113   18,19,20,21,22,27,27,28,29,30,32,36,40,45,52,59,
    1114   19,20,21,22,27,27,28,29,30,32,36,40,45,52,59,68,
    1115   20,21,22,27,27,28,29,30,32,36,40,45,52,59,68,79,
    1116   21,22,27,27,28,29,30,32,36,40,45,52,59,68,79,91,
    1117   22,27,27,28,29,30,32,36,40,45,52,59,68,79,91,103,
    1118   27,27,28,29,30,32,36,40,45,52,59,68,79,91,103,117
    1119 };
    1120 
    1121 Int g_quantIntraDefault32x32[1024] =
    1122 {
    1123   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,
    1124   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,
    1125   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,
    1126   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,
    1127   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,
    1128   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,
    1129   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,
    1130   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,
    1131   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,
    1132   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,
    1133   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,
    1134   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,
    1135   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,
    1136   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,
    1137   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,
    1138   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,
    1139   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,
    1140   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,
    1141   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,
    1142   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,
    1143   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,
    1144   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,
    1145   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,
    1146   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,
    1147   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,
    1148   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,
    1149   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,
    1150   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,
    1151   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,
    1152   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,
    1153   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,
    1154   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
    1155 };
    1156 
    1157 Int g_quantInterDefault32x32[1024] =
    1158 {
    1159   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,
    1160   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,
    1161   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,
    1162   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,
    1163   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,
    1164   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,
    1165   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,
    1166   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,
    1167   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,
    1168   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,
    1169   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,
    1170   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,
    1171   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,
    1172   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,
    1173   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,
    1174   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,
    1175   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,
    1176   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,
    1177   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,
    1178   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,
    1179   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,
    1180   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,
    1181   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,
    1182   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,
    1183   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,
    1184   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,
    1185   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,
    1186   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,
    1187   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,
    1188   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,
    1189   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,
    1190   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
    1191 };
    1192 #endif
    1193852UInt g_scalingListSize   [4] = {16,64,256,1024};
    1194853UInt g_scalingListSizeX  [4] = { 4, 8, 16,  32};
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComRom.h

    r287 r294  
    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// ====================================================================================================================
     
    214206Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList );
    215207
    216 #if DEFAULT_DC
    217208__inline Void mapDMMtoIntraMode(  UInt& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? DC_IDX : dirMode; }
    218209__inline Void mapDMMtoIntraMode(   Int& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? DC_IDX : dirMode; }
    219 #else
    220 __inline Void mapDMMtoIntraMode(  UInt& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? PLANAR_IDX : dirMode; }
    221 __inline Void mapDMMtoIntraMode(   Int& dirMode ) { dirMode = (dirMode >= NUM_INTRA_MODE) ? PLANAR_IDX : dirMode; }
    222 #endif
    223210#endif
    224211
     
    287274#define MAX_MATRIX_COEF_NUM 64     ///< max coefficient number for quantization matrix
    288275#define MAX_MATRIX_SIZE_NUM 8      ///< max size number for quantization matrix
    289 #if SCALING_LIST
    290276#define SCALING_LIST_DC 16         ///< default DC value
    291 #endif
    292277enum ScalingListDIR
    293278{
     
    336321  },
    337322};
    338 #if SCALING_LIST
    339323static const char MatrixType_DC[4][12][22] =
    340324{
     
    356340  },
    357341};
    358 #endif
    359342extern Int g_quantIntraDefault4x4[16];
    360343extern Int g_quantIntraDefault8x8[64];
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r56 r294  
    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//! \}
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r56 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComSlice.cpp

    r292 r294  
    110110, m_cabacInitIdc                 ( -1 )
    111111#endif
    112 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    113112, m_numEntryPointOffsets          ( 0 )
    114 #endif
    115113#if LGE_ILLUCOMP_B0045
    116114, m_bApplyIC                      ( false )
     
    197195  m_cabacInitFlag        = false;
    198196#endif
    199 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    200197  m_numEntryPointOffsets = 0;
    201 #endif
    202198#if QC_TMVP_MRG_REFIDX_C0047
    203199  m_aiNewRefIdx[0]                  = -1;
     
    646642    }
    647643  }
    648 #if H0566_TLA
    649644  if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
    650 #else
    651   if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found
    652 #endif
    653645  {
    654646    pocCRA = getPOC();
     
    703695      bRefreshPending = false;
    704696    }
    705 #if H0566_TLA
    706697    if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
    707 #else
    708     if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found
    709 #endif
    710698    {
    711699      bRefreshPending = true;
     
    830818
    831819  m_saoEnabledFlag = pSrc->m_saoEnabledFlag;
    832 #if SAO_UNIT_INTERLEAVING
    833820  m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag;
    834821  m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb;
    835822  m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr;
    836 #endif
    837823#if CABAC_INIT_FLAG
    838824  m_cabacInitFlag                = pSrc->m_cabacInitFlag;
    839825#endif
    840 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    841826  m_numEntryPointOffsets  = pSrc->m_numEntryPointOffsets;
    842 #endif
    843 
    844 #if H0111_MVD_L1_ZERO
     827
    845828  m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero;
    846 #endif
    847829}
    848830
     
    856838Void TComSlice::setTLayerInfo( UInt uiTLayer )
    857839{
    858 #if !H0566_TLA
    859   // 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
    860   if ( m_pcSPS->getTemporalIdNestingFlag() )
    861   {
    862     m_pcPPS->setNumTLayerSwitchingFlags( 0 );
    863     for ( UInt i = 0; i < MAX_TLAYER; i++ )
    864     {
    865       m_pcPPS->setTLayerSwitchingFlag( i, true );
    866     }
    867   }
    868   else
    869   {
    870     for ( UInt i = m_pcPPS->getNumTLayerSwitchingFlags(); i < MAX_TLAYER; i++ )
    871     {
    872       m_pcPPS->setTLayerSwitchingFlag( i, false );
    873     }
    874   }
    875 #endif
    876840
    877841  m_uiTLayer = uiTLayer;
    878 #if !H0566_TLA
    879   m_bTLayerSwitchingFlag = m_pcPPS->getTLayerSwitchingFlag( uiTLayer );
    880 #endif
    881 }
    882 
    883 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS
     842}
     843
     844#if H0566_TLA_SET_FOR_SWITCHING_POINTS
    884845/** Function for checking if this is a switching-point
    885846*/
     
    959920/** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet.
    960921*/
    961 #if START_DECODING_AT_CRA
    962922Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess)
    963 #else
    964 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag)
    965 #endif
    966923{
    967924  TComPic* rpcPic;
     
    1009966    if(isAvailable == 0)   
    1010967    {           
    1011 #if START_DECODING_AT_CRA
    1012968      if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess)
    1013969      {
    1014 #endif
    1015970        if(!pReferencePictureSet->getUsed(i) )
    1016971        {
     
    1026981          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
    1027982        }
    1028 #if START_DECODING_AT_CRA
    1029       }
    1030 #endif
     983      }
    1031984    }
    1032985  } 
     
    10531006    if(isAvailable == 0)   
    10541007    {           
    1055 #if START_DECODING_AT_CRA
    10561008      if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess)
    10571009      {
    1058 #endif
    10591010        if(!pReferencePictureSet->getUsed(i) )
    10601011        {
     
    10701021          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
    10711022        }
    1072 #if START_DECODING_AT_CRA
    1073       }
    1074 #endif
     1023      }
    10751024    }
    10761025  }   
     
    11381087    Int rIdx =  this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1;
    11391088    Int deltaRPS = pReferencePictureSet->getDeltaRPS();
    1140 #if RPS_IN_SPS
    11411089    TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx);
    1142 #else
    1143     TComReferencePictureSet* pcRefRPS = this->getPPS()->getRPSList()->getReferencePictureSet(rIdx);
    1144 #endif
    11451090    Int iRefPics = pcRefRPS->getNumberOfPictures();
    11461091    Int iNewIdc=0;
     
    11691114    pcRPS->setNumRefIdc(iNewIdc);
    11701115    pcRPS->setDeltaRPS(deltaRPS);
    1171 #if RPS_IN_SPS
    11721116    pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());
    1173 #else
    1174     pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getPPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());
    1175 #endif
    11761117  }
    11771118
     
    15391480, m_picWidthInLumaSamples     (352)
    15401481, m_picHeightInLumaSamples    (288)
    1541 #if PIC_CROPPING
    15421482, m_picCroppingFlag           (false)
    15431483, m_picCropLeftOffset         (  0)
     
    15451485, m_picCropTopOffset          (  0)
    15461486, m_picCropBottomOffset       (  0)
    1547 #endif
    15481487, m_uiMaxCUWidth              ( 32)
    15491488, m_uiMaxCUHeight             ( 32)
     
    15511490, m_uiMinTrDepth              (  0)
    15521491, m_uiMaxTrDepth              (  1)
    1553 #if RPS_IN_SPS
    15541492, m_bLongTermRefsPresent      (false)
    1555 #endif
    1556 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1557 , m_numReorderFrames          (  0)
    1558 #endif
    15591493, m_iNumberOfUsableInterViewRefs( 0 )
    15601494, m_uiQuadtreeTULog2MaxSize   (  0)
     
    15681502, m_bDisInter4x4              (  1)
    15691503, m_bUseALF                   (false)
    1570 #if LCU_SYNTAX_ALF
    15711504, m_bALFCoefInSlice           (false)
    1572 #endif
    1573 #if !PIC_CROPPING
    1574 , m_bUsePAD                   (false)
    1575 #endif
    15761505, m_bUseLMChroma              (false)
    15771506, m_bUseLComb                 (false)
    15781507, m_bLCMod                    (false)
    1579 #if H0412_REF_PIC_LIST_RESTRICTION
    15801508#if QC_MVHEVC_B0046
    15811509, m_restrictedRefPicListsFlag   (  0)
     
    15841512#endif
    15851513, m_listsModificationPresentFlag(  0)
    1586 #endif
    15871514, m_uiBitDepth                (  8)
    15881515, m_uiBitIncrement            (  0)
    1589 #if H0736_AVC_STYLE_QP_RANGE
    15901516, m_qpBDOffsetY               (  0)
    15911517, m_qpBDOffsetC               (  0)
    1592 #endif
    15931518#if LOSSLESS_CODING
    15941519, m_useLossless               (false)
     
    16131538, m_bTemporalIdNestingFlag    (false)
    16141539, m_scalingListEnabledFlag    (false)
    1615 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    1616 , m_uiMaxDecFrameBuffering    (  0)
    1617 , m_uiMaxLatencyIncrease      (  0)
    1618 #endif
    1619 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    16201540,  m_tilesOrEntropyCodingSyncIdc( 0 )
    16211541,  m_numSubstreams              ( 0 )
    1622 #endif
    16231542#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    16241543, m_bUseDMM                   (false)
     
    16331552  // AMVP parameter
    16341553  ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) );
    1635 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    16361554  for ( Int i = 0; i < MAX_TLAYER; i++ )
    16371555  {
     
    16401558    m_numReorderPics[i]       = 0;
    16411559  }
    1642 #endif
    16431560
    16441561  m_uiViewId              = 0;
     
    17781695, m_iChromaQpOffset             (0)
    17791696, m_iChromaQpOffset2nd          (0)
    1780 #if !RPS_IN_SPS
    1781 , m_bLongTermRefsPresent        (false)
    1782 #endif
    1783 #if !H0566_TLA
    1784 , m_uiNumTlayerSwitchingFlags   (0)
    1785 #endif
    17861697, m_iSliceGranularity           (0)
    17871698, m_iTileBehaviorControlPresentFlag (0)
     
    17891700, m_iColumnRowInfoPresent        (0)
    17901701, m_iUniformSpacingIdr           (0)
    1791 #if !REMOVE_TILE_DEPENDENCE
    1792 , m_iTileBoundaryIndependenceIdr (0)
    1793 #endif
    17941702, m_iNumColumnsMinus1            (0)
    17951703, m_puiColumnWidth               (NULL)
    17961704, m_iNumRowsMinus1               (0)
    17971705, m_puiRowHeight                 (NULL)
    1798 #if !WPP_SIMPLIFICATION
    1799 ,  m_iEntropyCodingSynchro      (0)
    1800 ,  m_bCabacIstateReset          (false)
    1801 #endif
    18021706,  m_iNumSubstreams             (1)
    1803 #if MULTIBITS_DATA_HIDING
    18041707, m_signHideFlag(0)
    18051708, m_signHidingThreshold(0)
    1806 #endif
    18071709#if CABAC_INIT_FLAG
    18081710, m_cabacInitPresentFlag        (false)
     
    18131715#endif
    18141716{
    1815 #if !H0566_TLA
    1816   for ( UInt i = 0; i < MAX_TLAYER; i++ )
    1817   {
    1818     m_abTLayerSwitchingFlag[i] = false;
    1819   }
    1820 #endif
    18211717}
    18221718
     
    20861982: m_bRefPicListModificationFlagL0 (false)
    20871983, m_bRefPicListModificationFlagL1 (false)
    2088 #if !H0137_0138_LIST_MODIFICATION
    2089 , m_uiNumberOfRefPicListModificationsL0 (0)
    2090 , m_uiNumberOfRefPicListModificationsL1 (0)
    2091 #endif
    2092 {
    2093 #if !H0137_0138_LIST_MODIFICATION
    2094   ::memset( m_ListIdcL0, 0, sizeof(m_ListIdcL0) );
    2095 #endif
     1984{
    20961985  ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) );
    2097 #if !H0137_0138_LIST_MODIFICATION
    2098   ::memset( m_ListIdcL1, 0, sizeof(m_ListIdcL1) );
    2099 #endif
    21001986  ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) );
    21011987}
     
    21111997  m_bSaoEnabled = false;
    21121998  m_pSaoParam = NULL;
    2113 #if LCU_SYNTAX_ALF
    21141999  m_alfParamSet = NULL;
    2115 #else
    2116   m_pAlfParam = NULL;
    2117 #endif
    21182000  m_scalingList = NULL;
    21192001  m_scalingListEnabled = false;
     
    21352017  m_bSaoEnabled = src.m_bSaoEnabled;
    21362018  m_pSaoParam   = src.m_pSaoParam;
    2137 #if LCU_SYNTAX_ALF
    21382019  m_alfParamSet    = src.m_alfParamSet;
    2139 #else
    2140   m_pAlfParam   = src.m_pAlfParam;
    2141 #endif
    21422020  m_scalingList = src.m_scalingList;
    21432021  m_scalingListEnabled = src.m_scalingListEnabled;
    2144 #if SAO_UNIT_INTERLEAVING
    21452022  m_saoInterleavingFlag = src.m_saoInterleavingFlag;
    2146 #endif
    21472023
    21482024  return *this;
     
    21652041Void TComAPS::createAlfParam()
    21662042{
    2167 #if LCU_SYNTAX_ALF
    21682043  m_alfParamSet = new AlfParamSet;
    2169 #else
    2170   m_pAlfParam = new ALFParam;
    2171 #endif
    21722044}
    21732045Void TComAPS::destroyAlfParam()
    21742046{
    2175 #if LCU_SYNTAX_ALF
    21762047  if(m_alfParamSet != NULL)
    21772048  {
     
    21792050    m_alfParamSet = NULL;
    21802051  }
    2181 #else
    2182   if(m_pAlfParam != NULL)
    2183   {
    2184     delete m_pAlfParam;
    2185     m_pAlfParam = NULL;
    2186   }
    2187 #endif
    21882052}
    21892053
     
    22212085 * \returns true if use default quantization matrix in all size
    22222086*/
    2223 #if SCALING_LIST
    22242087Bool TComSlice::checkDefaultScalingList()
    22252088{
     
    22382101  return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32
    22392102}
    2240 #else
    2241 Bool TComSlice::checkDefaultScalingList()
    2242 {
    2243   UInt i;
    2244   Int *dst=0;
    2245   Int *src=0;
    2246   UInt defaultCounter=0;
    2247 
    2248   //4x4
    2249   for(i=0;i<SCALING_LIST_NUM;i++)
    2250   {
    2251     src = (i<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4;
    2252     dst = getScalingList()->getScalingListAddress(SCALING_LIST_4x4,i);
    2253     if(::memcmp(dst,src,sizeof(UInt)*16) == 0) defaultCounter++;
    2254   }
    2255 
    2256   //8x8
    2257   for(i=0;i<SCALING_LIST_NUM;i++)
    2258   {
    2259     src = (i<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
    2260     dst = getScalingList()->getScalingListAddress(SCALING_LIST_8x8,i);
    2261     if(::memcmp(dst,src,sizeof(UInt)*64) == 0) defaultCounter++;
    2262   }
    2263   //16x16
    2264   for(i=0;i<SCALING_LIST_NUM;i++)
    2265   {
    2266     src = (i<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16;
    2267     dst = getScalingList()->getScalingListAddress(SCALING_LIST_16x16,i);
    2268     if(::memcmp(dst,src,sizeof(UInt)*256) == 0) defaultCounter++;
    2269   }
    2270   //32x32
    2271   for(i=0;i<SCALING_LIST_NUM_32x32;i++)
    2272   {
    2273     src = (i<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32;
    2274     dst = getScalingList()->getScalingListAddress(SCALING_LIST_32x32,i*3);
    2275     if(::memcmp(dst,src,sizeof(UInt)*1024) == 0) defaultCounter++;
    2276   }
    2277   return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32
    2278 }
    2279 #endif
    22802103/** get scaling matrix from RefMatrixID
    22812104 * \param sizeId size index
     
    22852108Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId )
    22862109{
    2287 #if SCALING_LIST
    22882110  ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    2289 #else
    2290   ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*g_scalingListSize[sizeId]);
    2291 #endif
    22922111}
    22932112/** parse syntax infomation
     
    23132132  for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++)
    23142133  {
    2315 #if SCALING_LIST
    23162134    size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]);
    2317 #else
    2318     size = g_scalingListSize[sizeIdc];
    2319 #endif
    23202135    for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++)
    23212136    {
     
    23432158        src[i] = data;
    23442159      }
    2345 #if SCALING_LIST
    23462160      //set DC value for default matrix check
    23472161      setScalingListDC(sizeIdc,listIdc,src[0]);
     
    23692183          setScalingListDC(sizeIdc,listIdc,data);
    23702184      }
    2371 #endif
    23722185    }
    23732186  }
     
    23842197    for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++)
    23852198    {
    2386 #if SCALING_LIST
    23872199      m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])];
    2388 #else
    2389       m_scalingListCoef[sizeId][listId] = new Int [g_scalingListSize[sizeId]];
    2390 #endif
    23912200    }
    23922201  }
     
    24212230      src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
    24222231      break;
    2423 #if SCALING_LIST
    24242232    case SCALING_LIST_16x16:
    24252233      src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
     
    24282236      src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;
    24292237      break;
    2430 #else
    2431     case SCALING_LIST_16x16:
    2432       src = (listId<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16;
    2433       break;
    2434     case SCALING_LIST_32x32:
    2435       src = (listId<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32;
    2436       break;
    2437 #endif
    24382238    default:
    24392239      assert(0);
     
    24492249Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId)
    24502250{
    2451 #if SCALING_LIST
    24522251  ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    24532252  setUseDefaultScalingMatrixFlag(sizeId,listId,true);
    24542253  setScalingListDC(sizeId,listId,SCALING_LIST_DC);
    2455 #else
    2456   ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*(Int)g_scalingListSize[sizeId]);
    2457 #endif
    2458 }
    2459 #if SCALING_LIST
     2254}
    24602255/** check DC value of matrix for default matrix signaling
    24612256 */
     
    24752270  }
    24762271}
    2477 #endif
    24782272
    24792273ParameterSetManager::ParameterSetManager()
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComSlice.h

    r292 r294  
    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
     
    276274  UInt        m_picWidthInLumaSamples;
    277275  UInt        m_picHeightInLumaSamples;
    278 #if PIC_CROPPING
    279276  Bool        m_picCroppingFlag;
    280277  Int         m_picCropLeftOffset;
     
    282279  Int         m_picCropTopOffset;
    283280  Int         m_picCropBottomOffset;
    284 #else
    285   Int         m_aiPad[2];
    286 #endif
    287281  UInt        m_uiMaxCUWidth;
    288282  UInt        m_uiMaxCUHeight;
     
    290284  UInt        m_uiMinTrDepth;
    291285  UInt        m_uiMaxTrDepth;
    292 #if RPS_IN_SPS
    293286  TComRPSList* m_RPSList;
    294287  Bool        m_bLongTermRefsPresent;
    295 #endif
    296 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    297288  Int         m_numReorderPics[MAX_TLAYER];
    298 #else
    299   Int         m_maxNumberOfReferencePictures;
    300   Int         m_numReorderFrames;
    301 #endif
    302289 
    303290  Int         m_iNumberOfUsableInterViewRefs;
     
    315302  Bool        m_useAMP;
    316303  Bool        m_bUseALF;
    317 #if LCU_SYNTAX_ALF
    318304  Bool        m_bALFCoefInSlice;
    319 #endif
    320 #if !PIC_CROPPING
    321   Bool        m_bUsePAD;
    322 #endif
    323305  Bool        m_bUseLMChroma; // JL:
    324306
     
    327309  Bool        m_useNSQT;
    328310 
    329 #if H0412_REF_PIC_LIST_RESTRICTION
    330311  Bool        m_restrictedRefPicListsFlag;
    331312  Bool        m_listsModificationPresentFlag;
    332 #endif
    333313
    334314  // Parameter
     
    336316  UInt        m_uiBitDepth;
    337317  UInt        m_uiBitIncrement;
    338 #if H0736_AVC_STYLE_QP_RANGE
    339318  Int         m_qpBDOffsetY;
    340319  Int         m_qpBDOffsetC;
    341 #endif
    342320
    343321#if LOSSLESS_CODING
     
    381359
    382360  Bool        m_scalingListEnabledFlag;
    383 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    384361  UInt        m_uiMaxDecPicBuffering[MAX_TLAYER];
    385362  UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];
    386 #else
    387   UInt        m_uiMaxDecFrameBuffering;
    388   UInt        m_uiMaxLatencyIncrease;
    389 #endif
    390363
    391364  Bool        m_useDF;
    392365
    393 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    394366  UInt        m_tilesOrEntropyCodingSyncIdc;
    395367  Int         m_numSubstreams;
    396 #endif
    397368
    398369#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    452423  UInt getPicHeightInLumaSamples      ()         { return  m_picHeightInLumaSamples;   }
    453424
    454 #if PIC_CROPPING
    455425  Bool getPicCroppingFlag() const          { return m_picCroppingFlag; }
    456426  Void setPicCroppingFlag(Bool val)        { m_picCroppingFlag = val; }
     
    463433  Int  getPicCropBottomOffset() const      { return m_picCropBottomOffset; }
    464434  Void setPicCropBottomOffset(Int val)     { m_picCropBottomOffset = val; }
    465 #endif
    466435
    467436  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
     
    495464  UInt getQuadtreeTUMaxDepthInter()         { return m_uiQuadtreeTUMaxDepthInter; }
    496465  UInt getQuadtreeTUMaxDepthIntra()         { return m_uiQuadtreeTUMaxDepthIntra; }
    497 #if !PIC_CROPPING
    498   Void setPad         (Int iPad[2]) { m_aiPad[0] = iPad[0]; m_aiPad[1] = iPad[1]; }
    499 #endif
    500 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    501466  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
    502467  Int  getNumReorderPics(UInt tlayer)                     { return m_numReorderPics[tlayer]; }
    503 #else
    504   Void setMaxNumberOfReferencePictures( Int u )  { m_maxNumberOfReferencePictures = u;    }
    505   Int  getMaxNumberOfReferencePictures()         { return m_maxNumberOfReferencePictures; }
    506   Void setNumReorderFrames( Int i )              { m_numReorderFrames = i;    }
    507   Int  getNumReorderFrames()                     { return m_numReorderFrames; }
    508 #endif
    509 #if RPS_IN_SPS
    510468  Void      setRPSList( TComRPSList* RPSList )   { m_RPSList = RPSList;       }
    511469  TComRPSList* getRPSList()                      { return m_RPSList;          }
    512470  Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
    513471  Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
    514 #endif
    515472
    516473  Void setNumberOfUsableInterViewRefs( Int number )      { m_iNumberOfUsableInterViewRefs = number;    }
     
    519476  Int  getUsableInterViewRef( Int pos )                  { return m_aiUsableInterViewRefs[pos];        }
    520477
    521 #if !PIC_CROPPING
    522   Void setPadX        ( Int  u ) { m_aiPad[0] = u; }
    523   Void setPadY        ( Int  u ) { m_aiPad[1] = u; }
    524   Int  getPad         ( Int  u ) { assert(u < 2); return m_aiPad[u];}
    525   Int* getPad         ( )        { return m_aiPad; }
    526 #endif
    527478 
    528479  // physical transform
     
    532483  // Tool list
    533484  Bool getUseALF      ()         { return m_bUseALF;        }
    534 #if LCU_SYNTAX_ALF
    535485  Void setUseALFCoefInSlice(Bool b) {m_bALFCoefInSlice = b;}
    536486  Bool getUseALFCoefInSlice()    {return m_bALFCoefInSlice;}
    537 #endif
    538 
    539 #if !PIC_CROPPING
    540   Bool getUsePAD      ()         { return m_bUsePAD;        }
    541   Void setUsePAD      ( Bool b ) { m_bUsePAD   = b;         }
    542 #endif
     487
    543488  Void setUseALF      ( Bool b ) { m_bUseALF  = b;          }
    544489  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
     
    557502  Void setUseNSQT( Bool b ) { m_useNSQT = b; }
    558503 
    559 #if H0412_REF_PIC_LIST_RESTRICTION
    560504  Bool getRestrictedRefPicListsFlag    ()          { return m_restrictedRefPicListsFlag;   }
    561505  Void setRestrictedRefPicListsFlag    ( Bool b )  { m_restrictedRefPicListsFlag = b;      }
    562506  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
    563507  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
    564 #endif
    565508
    566509  // AMVP mode (for each depth)
     
    577520  UInt      getBitIncrement ()         { return m_uiBitIncrement; }
    578521  Void      setBitIncrement ( UInt u ) { m_uiBitIncrement = u;    }
    579 #if H0736_AVC_STYLE_QP_RANGE
    580522  Int       getQpBDOffsetY  ()             { return m_qpBDOffsetY;   }
    581523  Void      setQpBDOffsetY  ( Int value  ) { m_qpBDOffsetY = value;  }
    582524  Int       getQpBDOffsetC  ()             { return m_qpBDOffsetC;   }
    583525  Void      setQpBDOffsetC  ( Int value  ) { m_qpBDOffsetC = value;  }
    584 #endif
    585526
    586527  Void      setLFCrossSliceBoundaryFlag     ( Bool   bValue  )    { m_bLFCrossSliceBoundaryFlag = bValue; }
     
    625566  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
    626567  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
    627 #if !REMOVE_TILE_DEPENDENCE
    628   Void     setTileBoundaryIndependenceIdr   ( Int i )           { m_iTileBoundaryIndependenceIdr = i; }
    629   Int      getTileBoundaryIndependenceIdr   ()                  { return m_iTileBoundaryIndependenceIdr; }
    630 #endif
    631568  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
    632569  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
     
    661598  Bool getScalingListFlag       ()         { return m_scalingListEnabledFlag;     }
    662599  Void setScalingListFlag       ( Bool b ) { m_scalingListEnabledFlag  = b;       }
    663 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    664600  UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
    665601  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
    666602  UInt getMaxLatencyIncrease  (UInt tlayer)            { return m_uiMaxLatencyIncrease[tlayer];   }
    667603  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
    668 #else
    669   UInt getMaxDecFrameBuffering  ()            { return m_uiMaxDecFrameBuffering; }
    670   Void setMaxDecFrameBuffering  ( UInt ui )   { m_uiMaxDecFrameBuffering = ui;   }
    671   UInt getMaxLatencyIncrease    ()            { return m_uiMaxLatencyIncrease;   }
    672   Void setMaxLatencyIncrease    ( UInt ui )   { m_uiMaxLatencyIncrease= ui;      }
    673 #endif
    674 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    675604  UInt getTilesOrEntropyCodingSyncIdc ()                    { return m_tilesOrEntropyCodingSyncIdc;   }
    676605  Void setTilesOrEntropyCodingSyncIdc ( UInt val )          { m_tilesOrEntropyCodingSyncIdc = val;    }
    677606  Int  getNumSubstreams               ()                    { return m_numSubstreams;                 }
    678607  Void setNumSubstreams               ( Int numSubstreams ) { m_numSubstreams = numSubstreams;        }
    679 #endif
    680608
    681609#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    739667};
    740668
    741 #if !RPS_IN_SPS
    742 /// Reference Picture Set class
    743 class TComReferencePictureSet
    744 {
    745 private:
    746   Int m_numberOfPictures;
    747   Int m_numberOfNegativePictures;
    748   Int m_numberOfPositivePictures;
    749   Int m_numberOfLongtermPictures;
    750   Int  m_deltaPOC[MAX_NUM_REF_PICS];
    751   Int  m_POC[MAX_NUM_REF_PICS];
    752   Bool m_used[MAX_NUM_REF_PICS];
    753   Bool m_interRPSPrediction;
    754   Int  m_deltaRIdxMinus1;   
    755   Int  m_deltaRPS;
    756   Int  m_numRefIdc;
    757   Int  m_refIdc[MAX_NUM_REF_PICS+1];
    758 
    759 public:
    760   TComReferencePictureSet();
    761   virtual ~TComReferencePictureSet();
    762 
    763   Void setUsed(Int bufferNum, Bool used);
    764   Void setDeltaPOC(Int bufferNum, Int deltaPOC);
    765   Void setPOC(Int bufferNum, Int deltaPOC);
    766   Void setNumberOfPictures(Int numberOfPictures);
    767 
    768   Int  getUsed(Int bufferNum);
    769   Int  getDeltaPOC(Int bufferNum);
    770   Int  getPOC(Int bufferNum);
    771   Int  getNumberOfPictures();
    772 
    773   Void setNumberOfNegativePictures(Int number)  { m_numberOfNegativePictures = number; }
    774   Int  getNumberOfNegativePictures()            { return m_numberOfNegativePictures; }
    775   Void setNumberOfPositivePictures(Int number)  { m_numberOfPositivePictures = number; }
    776   Int  getNumberOfPositivePictures()            { return m_numberOfPositivePictures; }
    777   Void setNumberOfLongtermPictures(Int number)  { m_numberOfLongtermPictures = number; }
    778   Int  getNumberOfLongtermPictures()            { return m_numberOfLongtermPictures; }
    779 
    780   Void setInterRPSPrediction(Bool flag)         { m_interRPSPrediction = flag; }
    781   Bool getInterRPSPrediction()                  { return m_interRPSPrediction; }
    782   Void setDeltaRIdxMinus1(Int x)                { m_deltaRIdxMinus1 = x; }
    783   Int  getDeltaRIdxMinus1()                     { return m_deltaRIdxMinus1; }
    784   Void setDeltaRPS(Int x)                       { m_deltaRPS = x; }
    785   Int  getDeltaRPS()                            { return m_deltaRPS; }
    786   Void setNumRefIdc(Int x)                      { m_numRefIdc = x; }
    787   Int  getNumRefIdc()                           { return m_numRefIdc; }
    788 
    789   Void setRefIdc(Int bufferNum, Int refIdc);
    790   Int  getRefIdc(Int bufferNum);
    791 
    792   Void sortDeltaPOC();
    793   Void printDeltaPOC();
    794 };
    795 
    796 /// Reference Picture Set set class
    797 class TComRPSList
    798 {
    799 private:
    800   Int  m_numberOfReferencePictureSets;
    801   TComReferencePictureSet* m_referencePictureSets;
    802  
    803 public:
    804   TComRPSList();
    805   virtual ~TComRPSList();
    806  
    807   Void  create  (Int numberOfEntries);
    808   Void  destroy ();
    809 
    810 
    811   TComReferencePictureSet* getReferencePictureSet(Int referencePictureSetNum);
    812   Int getNumberOfReferencePictureSets();
    813   Void setNumberOfReferencePictureSets(Int numberOfReferencePictureSets);
    814 };
    815 #endif
    816669
    817670/// Reference Picture Lists class
     
    821674  UInt      m_bRefPicListModificationFlagL0; 
    822675  UInt      m_bRefPicListModificationFlagL1; 
    823 #if !H0137_0138_LIST_MODIFICATION
    824   UInt      m_uiNumberOfRefPicListModificationsL0;
    825   UInt      m_uiNumberOfRefPicListModificationsL1;
    826   UInt      m_ListIdcL0[32];
    827 #endif
    828676  UInt      m_RefPicSetIdxL0[32];
    829 #if !H0137_0138_LIST_MODIFICATION
    830   UInt      m_ListIdcL1[32];
    831 #endif
    832677  UInt      m_RefPicSetIdxL1[32];
    833678   
     
    843688  Bool       getRefPicListModificationFlagL1() { return m_bRefPicListModificationFlagL1; }
    844689  Void       setRefPicListModificationFlagL1(Bool flag) { m_bRefPicListModificationFlagL1 = flag; }
    845 #if !H0137_0138_LIST_MODIFICATION
    846   UInt       getNumberOfRefPicListModificationsL0() { return m_uiNumberOfRefPicListModificationsL0; }
    847   Void       setNumberOfRefPicListModificationsL0(UInt nr) { m_uiNumberOfRefPicListModificationsL0 = nr; }
    848   UInt       getNumberOfRefPicListModificationsL1() { return m_uiNumberOfRefPicListModificationsL1; }
    849   Void       setNumberOfRefPicListModificationsL1(UInt nr) { m_uiNumberOfRefPicListModificationsL1 = nr; }
    850   Void       setListIdcL0(UInt idx, UInt idc) { m_ListIdcL0[idx] = idc; }
    851   UInt       getListIdcL0(UInt idx) { return m_ListIdcL0[idx]; }
    852 #endif
    853690  Void       setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL0[idx] = refPicSetIdx; }
    854691  UInt       getRefPicSetIdxL0(UInt idx) { return m_RefPicSetIdxL0[idx]; }
    855 #if !H0137_0138_LIST_MODIFICATION
    856   Void       setListIdcL1(UInt idx, UInt idc) { m_ListIdcL1[idx] = idc; }
    857   UInt       getListIdcL1(UInt idx) { return m_ListIdcL1[idx]; }
    858 #endif
    859692  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
    860693  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
     
    873706  // access channel
    874707  TComSPS*    m_pcSPS;
    875 #if !RPS_IN_SPS
    876   TComRPSList* m_RPSList;
    877 #endif
    878708  UInt        m_uiMaxCuDQPDepth;
    879709  UInt        m_uiMinCuDQPSize;
     
    882712  Int        m_iChromaQpOffset2nd;
    883713
    884 #if !RPS_IN_SPS
    885   Bool        m_bLongTermRefsPresent;
    886 #endif
    887 
    888 #if !H0566_TLA
    889   UInt        m_uiNumTlayerSwitchingFlags;            // num_temporal_layer_switching_point_flags
    890   Bool        m_abTLayerSwitchingFlag[ MAX_TLAYER ];  // temporal_layer_switching_point_flag
    891 #endif
     714
    892715
    893716  Int         m_iSliceGranularity;
     
    896719  UInt        m_uiBiPredIdc;              // Use of Weighting Bi-Prediction (B_SLICE)
    897720
    898 #if H0388
    899721  Bool        m_OutputFlagPresentFlag;   // Indicates the presence of output_flag in slice header
    900 #endif
    901722
    902723  Int      m_iTileBehaviorControlPresentFlag;
     
    904725  Int      m_iColumnRowInfoPresent;
    905726  Int      m_iUniformSpacingIdr;
    906 #if !REMOVE_TILE_DEPENDENCE
    907   Int      m_iTileBoundaryIndependenceIdr;
    908 #endif
    909727  Int      m_iNumColumnsMinus1;
    910728  UInt*    m_puiColumnWidth;
     
    913731 
    914732  Int      m_iEntropyCodingMode; // !!! in PPS now, but also remains in slice header!
    915 #if !WPP_SIMPLIFICATION 
    916   Int      m_iEntropyCodingSynchro;
    917   Bool     m_bCabacIstateReset;
    918 #endif
    919733  Int      m_iNumSubstreams;
    920734
    921735  Bool     m_enableTMVPFlag;
    922736
    923 #if MULTIBITS_DATA_HIDING
    924737  Int      m_signHideFlag;
    925738  Int      m_signHidingThreshold;
    926 #endif
    927739
    928740#if CABAC_INIT_FLAG
     
    933745#endif
    934746#endif
    935 #if DBL_CONTROL
    936747  Bool     m_DeblockingFilterControlPresent;
    937 #endif
    938 #if PARALLEL_MERGE
    939748  UInt m_log2ParallelMergeLevelMinus2;
    940 #endif
    941749public:
    942750  TComPPS();
     
    957765  Void      setConstrainedIntraPred ( Bool b ) { m_bConstrainedIntraPred = b;     }
    958766
    959 #if !H0566_TLA
    960   UInt      getNumTLayerSwitchingFlags()                                  { return m_uiNumTlayerSwitchingFlags; }
    961   Void      setNumTLayerSwitchingFlags( UInt uiNumTlayerSwitchingFlags )  { assert( uiNumTlayerSwitchingFlags < MAX_TLAYER ); m_uiNumTlayerSwitchingFlags = uiNumTlayerSwitchingFlags; }
    962 
    963   Bool      getTLayerSwitchingFlag( UInt uiTLayer )                       { assert( uiTLayer < MAX_TLAYER ); return m_abTLayerSwitchingFlag[ uiTLayer ]; }
    964   Void      setTLayerSwitchingFlag( UInt uiTLayer, Bool bValue )          { m_abTLayerSwitchingFlag[ uiTLayer ] = bValue; }
    965 #endif
    966 
    967 #if !RPS_IN_SPS
    968   Bool      getLongTermRefsPresent()         { return m_bLongTermRefsPresent; }
    969   Void      setLongTermRefsPresent(Bool b)   { m_bLongTermRefsPresent=b;      }
    970 #endif
     767
    971768  Void      setSPS              ( TComSPS* pcSPS ) { m_pcSPS = pcSPS; }
    972769  TComSPS*  getSPS              ()         { return m_pcSPS;          }
    973 #if !RPS_IN_SPS
    974   Void      setRPSList          ( TComRPSList* RPSList ) { m_RPSList = RPSList; }
    975   TComRPSList* getRPSList       ()         { return m_RPSList;        }
    976 #endif
    977770  Void      setMaxCuDQPDepth    ( UInt u ) { m_uiMaxCuDQPDepth = u;   }
    978771  UInt      getMaxCuDQPDepth    ()         { return m_uiMaxCuDQPDepth;}
     
    991784  Void setWPBiPredIdc               ( UInt u )  { m_uiBiPredIdc = u;        }
    992785
    993 #if H0388
    994786  Void      setOutputFlagPresentFlag( Bool b )  { m_OutputFlagPresentFlag = b;    }
    995787  Bool      getOutputFlagPresentFlag()          { return m_OutputFlagPresentFlag; }
    996 #endif
    997788
    998789  Void    setTileBehaviorControlPresentFlag        ( Int i )             { m_iTileBehaviorControlPresentFlag = i;    }
     
    1004795  Void     setUniformSpacingIdr             ( Int i )           { m_iUniformSpacingIdr = i; }
    1005796  Int      getUniformSpacingIdr             ()                  { return m_iUniformSpacingIdr; }
    1006 #if !REMOVE_TILE_DEPENDENCE
    1007   Void     setTileBoundaryIndependenceIdr   ( Int i )           { m_iTileBoundaryIndependenceIdr = i; }
    1008   Int      getTileBoundaryIndependenceIdr   ()                  { return m_iTileBoundaryIndependenceIdr; }
    1009 #endif
    1010797  Void     setNumColumnsMinus1              ( Int i )           { m_iNumColumnsMinus1 = i; }
    1011798  Int      getNumColumnsMinus1              ()                  { return m_iNumColumnsMinus1; }
     
    1040827  Void     setEntropyCodingMode(Int iEntropyCodingMode)       { m_iEntropyCodingMode = iEntropyCodingMode; }
    1041828  Int      getEntropyCodingMode()                             { return m_iEntropyCodingMode; }
    1042 #if !WPP_SIMPLIFICATION
    1043   Void     setEntropyCodingSynchro(Int iEntropyCodingSynchro) { m_iEntropyCodingSynchro = iEntropyCodingSynchro; }
    1044   Int      getEntropyCodingSynchro()                          { return m_iEntropyCodingSynchro; }
    1045   Void     setCabacIstateReset(Bool bCabacIstateReset)        { m_bCabacIstateReset = bCabacIstateReset; }
    1046   Bool     getCabacIstateReset()                              { return m_bCabacIstateReset; }
    1047 #endif
    1048829  Void     setNumSubstreams(Int iNumSubstreams)               { m_iNumSubstreams = iNumSubstreams; }
    1049830  Int      getNumSubstreams()                                 { return m_iNumSubstreams; }
    1050831
    1051 #if MULTIBITS_DATA_HIDING
    1052832  Void      setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; }
    1053833  Void      setTSIG( Int tsig )                 { m_signHidingThreshold = tsig; }
    1054834  Int       getSignHideFlag()                    { return m_signHideFlag; }
    1055835  Int       getTSIG()                            { return m_signHidingThreshold; }
    1056 #endif
    1057836
    1058837  Void     setEnableTMVPFlag( Bool b )  { m_enableTMVPFlag = b;    }
     
    1069848#endif
    1070849#endif
    1071 #if DBL_CONTROL
    1072850  Void setDeblockingFilterControlPresent    ( Bool bValue )       { m_DeblockingFilterControlPresent = bValue; }
    1073851  Bool getDeblockingFilterControlPresent    ()                    { return m_DeblockingFilterControlPresent; }
    1074 #endif
    1075 #if PARALLEL_MERGE
    1076852  UInt getLog2ParallelMergeLevelMinus2      ()                    { return m_log2ParallelMergeLevelMinus2; }
    1077853  Void setLog2ParallelMergeLevelMinus2      (UInt mrgLevel)       { m_log2ParallelMergeLevelMinus2 = mrgLevel; }
    1078 #endif
    1079854};
    1080855
     
    1093868  Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
    1094869  Void     processDefaultMarix            (UInt sizeId, UInt listId);
    1095 #if SCALING_LIST
    1096870  Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
    1097871  Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
     
    1099873  Void     setUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId, Bool b)   { m_useDefaultScalingMatrixFlag[sizeId][listId] = b;    } //!< set default matrix enabled/disabled in each matrix
    1100874  Bool     getUseDefaultScalingMatrixFlag (UInt sizeId, UInt listId)           { return m_useDefaultScalingMatrixFlag[sizeId][listId]; } //!< get default matrix enabled/disabled in each matrix
    1101 #endif
    1102875  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
    1103876  Bool     xParseScalingList              (char* pchFile);
     
    1106879  Void     init                    ();
    1107880  Void     destroy                 ();
    1108 #if SCALING_LIST
    1109881  Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
    1110882  Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
    1111 #endif
    1112883  UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
    1113884  Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
     
    1130901  Bool      getAlfEnabled ()          {return m_bAlfEnabled;     }  //!< get ALF enabled/disabled in APS
    1131902
    1132 #if LCU_SYNTAX_ALF
    1133903  AlfParamSet* getAlfParam   ()          {return m_alfParamSet;}
    1134 #else
    1135   ALFParam* getAlfParam   ()          {return m_pAlfParam;       }  //!< get ALF parameters in APS
    1136 #endif
    1137904  SAOParam* getSaoParam   ()          {return m_pSaoParam;       }  //!< get SAO parameters in APS
    1138905
     
    1157924  Bool      getScalingListEnabled ()          { return m_scalingListEnabled; }  //!< get ScalingList enabled/disabled in APS
    1158925  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in APS
    1159 #if SAO_UNIT_INTERLEAVING
    1160926  Bool     getSaoInterleavingFlag() {return m_saoInterleavingFlag;}             //!< get SAO interleaving flag in APS
    1161927  Void     setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;}    //!< set SAO interleaving flag in APS
    1162 #endif
    1163928
    1164929private:
     
    1167932  Bool        m_bAlfEnabled;  //!< ALF enabled/disabled in APS (true for enabled)
    1168933  SAOParam*   m_pSaoParam;    //!< SAO parameter object pointer
    1169 #if LCU_SYNTAX_ALF
    1170934  AlfParamSet*   m_alfParamSet;
    1171 #else
    1172   ALFParam*   m_pAlfParam;    //!< ALF parameter object pointer
    1173 #endif
    1174935  Bool        m_loopFilterOffsetInAPS;       //< offset for deblocking filter in 0 = slice header, 1 = APS
    1175936  Bool        m_loopFilterDisable;           //< Deblocking filter enabled/disabled in APS
     
    1178939  Bool        m_scalingListEnabled;     //!< ScalingList enabled/disabled in APS (true for enabled)
    1179940  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
    1180 #if SAO_UNIT_INTERLEAVING
    1181941  Bool        m_saoInterleavingFlag;    //!< SAO interleaving flag
    1182 #endif
    1183942
    1184943public:
     
    1212971  bool       m_alfEnabledFlag;
    1213972  bool       m_saoEnabledFlag;
    1214 #if SAO_UNIT_INTERLEAVING
    1215973  bool       m_saoInterleavingFlag;   ///< SAO interleaving flag
    1216974  bool       m_saoEnabledFlagCb;      ///< SAO Cb enabled flag
    1217975  bool       m_saoEnabledFlagCr;      ///< SAO Cr enabled flag
    1218 #endif
    1219976  Int         m_iPPSId;               ///< picture parameter set ID
    1220 #if H0388
    1221977  Bool        m_PicOutputFlag;        ///< pic_output_flag
    1222 #endif
    1223978  Int         m_iPOC;
    1224979  Int         m_iLastIDR;
     
    13371092#endif
    13381093
    1339 #if H0111_MVD_L1_ZERO
    13401094  Bool       m_bLMvdL1Zero;
    1341 #endif
    1342 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    13431095  Int         m_numEntryPointOffsets;
    1344 #endif
    13451096
    13461097  Int        m_viewId;
     
    13971148  Void      setAPSId        ( Int Id)          { m_iAPSId =Id;    } //!< set APS ID
    13981149  Int       getAPSId        ()                 { return m_iAPSId; } //!< get APS ID
    1399 #if H0388
    14001150  Void      setPicOutputFlag( Bool b )         { m_PicOutputFlag = b;    }
    14011151  Bool      getPicOutputFlag()                 { return m_PicOutputFlag; }
    1402 #endif
    14031152  Void      setAlfEnabledFlag(Bool s) {m_alfEnabledFlag =s; }
    14041153  Bool      getAlfEnabledFlag() { return m_alfEnabledFlag; }
    14051154  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
    14061155  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
    1407 #if SAO_UNIT_INTERLEAVING
    14081156  Void      setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag
    14091157  Bool      getSaoInterleavingFlag() { return m_saoInterleavingFlag;  } //!< get SAO interleaving flag
     
    14121160  Void      setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; }       //!< set SAO Cr enabled flag
    14131161  Bool      getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; }        //!< get SAO Cr enabled flag
    1414 #endif
    14151162  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
    14161163  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
     
    14541201#endif
    14551202  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
    1456 #if H0111_MVD_L1_ZERO
    14571203  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    1458 #endif
    14591204  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
    14601205  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
     
    15101255#endif
    15111256  Void      setCheckLDC         ( Bool b )                      { m_bCheckLDC = b; }
    1512 #if H0111_MVD_L1_ZERO
    15131257  Void      setMvdL1ZeroFlag     ( Bool b)                       { m_bLMvdL1Zero = b; }
    1514 #endif 
    15151258
    15161259  Bool      isIntra         ()                          { return  m_eSliceType == I_SLICE;  }
     
    15501293  Void setTLayer             ( UInt uiTLayer )             { m_uiTLayer = uiTLayer;                  }
    15511294
    1552 #if !H0566_TLA
    1553   Bool getTLayerSwitchingFlag()                            { return m_bTLayerSwitchingFlag;          }
    1554   Void setTLayerSwitchingFlag( Bool bValue )               { m_bTLayerSwitchingFlag = bValue;        }
    1555 #endif
    15561295
    15571296  Void setTLayerInfo( UInt uiTLayer );
    15581297  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum );
    15591298  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
    1560 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS
     1299#if H0566_TLA_SET_FOR_SWITCHING_POINTS
    15611300  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
    15621301#endif
    1563 #if START_DECODING_AT_CRA
    15641302  Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess = 0);
    1565 #else
    1566   Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag);
    1567 #endif
    15681303  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
    15691304
     
    16391374  Int       getCABACinitIDC()         {return m_cabacInitIdc;    }  //!< get CABAC initial IDC number
    16401375#endif
    1641 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    16421376  Void      setNumEntryPointOffsets(Int val)  { m_numEntryPointOffsets = val;     }
    16431377  Int       getNumEntryPointOffsets()         { return m_numEntryPointOffsets;    }
    1644 #endif
    16451378
    16461379  Void setViewId( Int viewId )       { m_viewId = viewId;   }
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComTrQuant.cpp

    r56 r294  
    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
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComTrQuant.h

    r56 r294  
    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,
  • branches/HTM-5.1-dev0/source/Lib/TLibCommon/TypeDef.h

    r293 r294  
    257257///// ***** HM 6.1 *********
    258258
    259 // REMOVED HM 6.1 Macros
     259//// REMOVED HM 6.1 Guard macros
     260/*
    260261#define SKIPFRAME_BUGFIX                  1 ///< bug fix to enable skipFrame at decoder
    261262#define START_DECODING_AT_CRA             1 ///< H0496, start decoding at clear random access point
     
    319320#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
    320321#define WPP_SIMPLIFICATION          1 // JCTVC-H0349/JCTVC-0517
    321 
     322*/
    322323
    323324
     
    329330#define LOG2_PARALLEL_MERGE_LEVEL_MINUS2  0 //< H0082 parallel merge level 0-> 4x4, 1-> 8x8, 2->16x16, 3->32x32, 4->64x64
    330331
    331 #if PARALLEL_MERGE && LOG2_PARALLEL_MERGE_LEVEL_MINUS2
     332#if LOG2_PARALLEL_MERGE_LEVEL_MINUS2
    332333#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
    333334#define FIX_CU_BASED_MRG_CAND_LIST_B0136  1  //< B0136 bug fix for CU_BASED_MRG_CAND_LIST
     
    337338#define SIGMAP_CONST_AT_HIGH_FREQUENCY      1      ///< H0095 method2.1: const significance map at high freaquency
    338339
    339 #if RESTRICT_GR1GR2FLAG_NUMBER    //
    340340#define C1FLAG_NUMBER               8 // maximum number of largerThan1 flag coded in one chunk :  16 in HM5
    341341#define C2FLAG_NUMBER               1 // maximum number of largerThan2 flag coded in one chunk:  16 in HM5
    342 #endif
    343342
    344343#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_1 0  ///< disable the encoder constraint that does not test SAO/BO mode for chroma in interleaved mode
     
    391390
    392391
    393 #if !H0137_0138_LIST_MODIFICATION
    394 #error "H0137_0138_LIST_MODIFICATION must be enabled for multi-view coding."
    395 #endif
    396392
    397393#define VERBOSE_RATE 0                               ///< Print additional rate information in encoder
     
    475471
    476472#define PLANAR_IDX             0
    477 #if LOGI_INTRA_NAME_3MPM
    478473#define VER_IDX                26                    // index for intra VERTICAL   mode
    479474#define HOR_IDX                10                    // index for intra HORIZONTAL mode
    480475#define DC_IDX                 1                     // index for intra DC mode
    481 #else
    482 #define DC_IDX                 3                     // index for intra DC mode
    483 #endif
    484476#define NUM_CHROMA_MODE        6                     // total number of chroma modes
    485477#define DM_CHROMA_IDX          36                    // chroma mode index for derived from luma intra mode
     
    495487#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
    496488#define AD_HOC_SLICES_FIXED_NUMBER_OF_BYTES_IN_SLICE    2          ///< OPTION IDENTIFIER. mode==2 -> Limit maximum number of bins/bits in a slice
    497 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    498489#define AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE    3
    499 #endif
    500490
    501491// Entropy slice options
     
    521511
    522512#define SCALING_LIST_OUTPUT_RESULT    0 //JCTVC-G880/JCTVC-G1016 quantization matrices
    523 #if H0566_TLA
    524513#define H0566_TLA_SET_FOR_SWITCHING_POINTS 1
    525 #endif
    526514
    527515
     
    609597{
    610598  SAO_EO_LEN    = 4,
    611 #if SAO_UNIT_INTERLEAVING
    612599  SAO_BO_LEN    = 4,
    613600  SAO_MAX_BO_CLASSES = 32
    614 #else
    615   SAO_BO_LEN    = 16
    616 #endif
    617601};
    618602
     
    623607  SAO_EO_2,
    624608  SAO_EO_3,
    625 #if SAO_UNIT_INTERLEAVING
    626609  SAO_BO,
    627 #else
    628   SAO_BO_0,
    629   SAO_BO_1,
    630 #endif
    631610  MAX_NUM_SAO_TYPE
    632611};
     
    634613typedef struct _SaoQTPart
    635614{
    636 #if !SAO_UNIT_INTERLEAVING
    637   Bool        bEnableFlag;
    638 #endif
    639615  Int         iBestType;
    640616  Int         iLength;
    641 #if SAO_UNIT_INTERLEAVING
    642617  Int         bandPosition ;
    643618  Int         iOffset[4];
    644 #else
    645   Int         iOffset[32];
    646 #endif
    647619  Int         StartCUX;
    648620  Int         StartCUY;
     
    668640} SAOQTPart;
    669641
    670 #if SAO_UNIT_INTERLEAVING
    671642typedef struct _SaoLcuParam
    672643{
     
    682653  Int        length;
    683654} SaoLcuParam;
    684 #endif
    685655
    686656struct SAOParam
     
    690660  Int        iMaxSplitLevel;
    691661  Int        iNumClass[MAX_NUM_SAO_TYPE];
    692 #if SAO_UNIT_INTERLEAVING
    693662  Bool         oneUnitFlag[3];
    694663  SaoLcuParam* saoLcuParam[3];
    695664  Int          numCuInHeight;
    696665  Int          numCuInWidth;
    697 #endif
    698666  ~SAOParam();
    699667};
     
    702670{
    703671  Int alf_flag;                           ///< indicates use of ALF
    704 #if !LCU_SYNTAX_ALF
    705   Int chroma_idc;                         ///< indicates use of ALF for chroma
    706 #endif
    707672  Int num_coeff;                          ///< number of filter coefficients
    708673  Int filter_shape;
    709 #if !LCU_SYNTAX_ALF
    710   Int filter_shape_chroma;
    711   Int num_coeff_chroma;                   ///< number of filter coefficients (chroma)
    712   Int *coeff_chroma;                      ///< filter coefficient array (chroma)
    713 #endif
    714674  Int *filterPattern;
    715675  Int startSecondFilter;
     
    719679  Int **coeffmulti;
    720680  Int minKStart;
    721 #if !LCU_SYNTAX_ALF
    722   Int maxScanVal;
    723   Int kMinTab[42];
    724 
    725   Int alf_pcr_region_flag;
    726   ~ALFParam();
    727 #endif
    728 #if LCU_SYNTAX_ALF
    729681  Int componentID;
    730682  Int* kMinTab;
     
    739691  Void destroy();
    740692  Void copy(const ALFParam& src);
    741 #endif
    742 };
    743 
    744 #if LCU_SYNTAX_ALF
     693};
     694
    745695struct AlfUnitParam
    746696{
     
    775725  Void destroy();
    776726};
    777 #endif
    778727
    779728
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/NALread.cpp

    r210 r294  
    124124  assert(forbidden_zero_bit == 0);
    125125
    126 #if NAL_REF_FLAG
    127126  nalu.m_nalRefFlag  = (bs.read(1) != 0 );
    128127  nalu.m_nalUnitType = (NalUnitType) bs.read(6);
    129 #else
    130   nalu.m_nalRefIDC   = (NalRefIdc) bs.read(2);
    131   nalu.m_nalUnitType = (NalUnitType) bs.read(5);
    132 #endif
    133128
    134129#if QC_MVHEVC_B0046
     
    137132  nalu.m_temporalId = bs.read(3) - 1;
    138133#else
    139 #if H0388
    140134  nalu.m_temporalId = bs.read(3);
    141135 //  unsigned reserved_one_5bits = bs.read(5);
     
    147141  nalu.m_isDepth  = bs.read(1);
    148142#endif
    149 #if H0566_TLA
    150143  if ( nalu.m_temporalId )
    151144  {
     
    157150  }
    158151#endif
    159 #else
    160   switch (nalu.m_nalUnitType)
    161   {
    162   case NAL_UNIT_CODED_SLICE:
    163   case NAL_UNIT_CODED_SLICE_IDR:
    164 #if H0566_TLA
    165 #if !QC_REM_IDV_B0046
    166   case NAL_UNIT_CODED_SLICE_IDV:
    167 #endif
    168   case NAL_UNIT_CODED_SLICE_CRA:
    169   case NAL_UNIT_CODED_SLICE_TLA:
    170 #else
    171   case NAL_UNIT_CODED_SLICE_CDR:
    172 #endif
    173     {
    174       nalu.m_temporalId = bs.read(3);
    175 #if VIDYO_VPS_INTEGRATION
    176       nalu.m_layerId    = bs.read(5) - 1;
    177 #else
    178       nalu.m_OutputFlag = bs.read(1);
    179   //    unsigned reserved_one_4bits = bs.read(4);
    180   //    assert(reserved_one_4bits == 1);
    181       nalu.m_viewId   = bs.read(3)-1;
    182       nalu.m_isDepth  = bs.read(1);
    183 #endif
    184 
    185 #if H0566_TLA
    186       if (nalu.m_temporalId == 0)
    187       {
    188 #if QC_REM_IDV_B0046
    189         assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR);
    190 #else
    191         assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV );
    192 #endif
    193       }
    194       else
    195       {
    196         assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA);
    197       }
    198 #endif
    199     }
    200     break;
    201   default:
    202     nalu.m_temporalId = 0;
    203     nalu.m_OutputFlag = true;
    204     break;
    205   }
    206 #endif
    207 #endif
    208152}
    209153//! \}
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoder.h

    r56 r294  
    5454  virtual Void  start             ()                                          = 0;
    5555  virtual Void  finish            ()                                          = 0;
    56 #if OL_FLUSH
    5756  virtual Void  flush            ()                                           = 0;
    58 #endif
    5957
    6058  virtual Void  decodeBin         ( UInt& ruiBin, ContextModel& rcCtxModel )  = 0;
     
    6462 
    6563  virtual Void  resetBac          ()                                          = 0;
    66 #if BURST_IPCM
    6764  virtual Void  decodeNumSubseqIPCM( Int& numSubseqIPCM )                  = 0;
    68 #endif
    6965  virtual Void  decodePCMAlignBits()                                          = 0;
    7066  virtual Void  xReadPCMCode      ( UInt uiLength, UInt& ruiCode)              = 0;
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp

    r56 r294  
    6565TDecBinCABAC::start()
    6666{
    67 #if !OL_FLUSH || OL_FLUSH_ALIGN
     67#if OL_FLUSH_ALIGN
    6868  assert( m_pcTComBitstream->getNumBitsUntilByteAligned() == 0 );
    6969#endif
     
    7272  m_bitsNeeded = -8;
    7373  m_uiValue    = m_pcTComBitstream->readByte() << 8;
    74 #if OL_FLUSH && !OL_FLUSH_ALIGN
     74#if !OL_FLUSH_ALIGN
    7575  m_uiLastByte = m_pcTComBitstream->readByte();
    7676  m_uiValue   |= m_uiLastByte;
     
    8585}
    8686
    87 #if OL_FLUSH
    8887Void
    8988TDecBinCABAC::flush()
     
    108107#endif // OL_FLUSH_ALIGN
    109108}
    110 #endif // OL_FLUSH
    111109
    112110/**
     
    122120  m_uiValue   = pcTDecBinCABAC->m_uiValue;
    123121  m_bitsNeeded= pcTDecBinCABAC->m_bitsNeeded;
    124 #if OL_FLUSH && !OL_FLUSH_ALIGN
     122#if !OL_FLUSH_ALIGN
    125123  m_uiLastByte= pcTDecBinCABAC->m_uiLastByte;
    126124#endif
     
    152150    {
    153151      m_bitsNeeded = -8;
    154 #if OL_FLUSH && !OL_FLUSH_ALIGN
     152#if !OL_FLUSH_ALIGN
    155153      m_uiLastByte = m_pcTComBitstream->readByte();
    156154      m_uiValue += m_uiLastByte;   
     
    173171    if ( m_bitsNeeded >= 0 )
    174172    {
    175 #if OL_FLUSH && !OL_FLUSH_ALIGN
     173#if !OL_FLUSH_ALIGN
    176174      m_uiLastByte = m_pcTComBitstream->readByte();
    177175      m_uiValue += m_uiLastByte << m_bitsNeeded;
     
    192190  {
    193191    m_bitsNeeded = -8;
    194 #if OL_FLUSH && !OL_FLUSH_ALIGN
     192#if !OL_FLUSH_ALIGN
    195193    m_uiLastByte = m_pcTComBitstream->readByte();
    196194    m_uiValue += m_uiLastByte;
     
    215213  while ( numBins > 8 )
    216214  {
    217 #if OL_FLUSH && !OL_FLUSH_ALIGN
     215#if !OL_FLUSH_ALIGN
    218216    m_uiLastByte = m_pcTComBitstream->readByte();
    219217    m_uiValue = ( m_uiValue << 8 ) + ( m_uiLastByte << ( 8 + m_bitsNeeded ) );
     
    241239  if ( m_bitsNeeded >= 0 )
    242240  {
    243 #if OL_FLUSH && !OL_FLUSH_ALIGN
     241#if !OL_FLUSH_ALIGN
    244242    m_uiLastByte = m_pcTComBitstream->readByte();
    245243    m_uiValue += m_uiLastByte << m_bitsNeeded;
     
    285283      {
    286284        m_bitsNeeded = -8;
    287 #if OL_FLUSH && !OL_FLUSH_ALIGN
     285#if !OL_FLUSH_ALIGN
    288286        m_uiLastByte = m_pcTComBitstream->readByte();
    289287        m_uiValue += m_uiLastByte;   
     
    306304}
    307305
    308 #if BURST_IPCM
    309306/** Decode subsequent_pcm_num.
    310307 * \param numSubseqIPCM
     
    323320    {
    324321      m_bitsNeeded = -8;
    325 #if OL_FLUSH && !OL_FLUSH_ALIGN
     322#if !OL_FLUSH_ALIGN
    326323      m_uiLastByte = m_pcTComBitstream->readByte();
    327324      m_uiValue += m_uiLastByte;
     
    342339  numSubseqIPCM --;
    343340}
    344 #endif
    345341
    346342/** Decode PCM alignment zero bits.
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h

    r56 r294  
    5656  Void  start             ();
    5757  Void  finish            ();
    58 #if OL_FLUSH
    5958  Void  flush             ();
    60 #endif
    6159 
    6260  Void  decodeBin         ( UInt& ruiBin, ContextModel& rcCtxModel );
     
    6664 
    6765  Void  resetBac          ();
    68 #if BURST_IPCM
    6966  Void  decodeNumSubseqIPCM( Int& numSubseqIPCM ) ;
    70 #endif
    7167  Void  decodePCMAlignBits();
    7268  Void  xReadPCMCode      ( UInt uiLength, UInt& ruiCode );
     
    8278  UInt                m_uiRange;
    8379  UInt                m_uiValue;
    84 #if OL_FLUSH && !OL_FLUSH_ALIGN
     80#if !OL_FLUSH_ALIGN
    8581  UInt                m_uiLastByte;
    8682#endif
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r292 r294  
    169169  assert(m_pcBitstream->getNumBitsLeft() == 8); /* rsbp_trailing_bits */
    170170}
    171 #if RPS_IN_SPS
    172171void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx )
    173 #else
    174 void TDecCavlc::parseShortTermRefPicSet( TComPPS* pcPPS, TComReferencePictureSet* rps, Int idx )
    175 #endif
    176172{
    177173  UInt code;
     
    184180    Int rIdx =  idx - 1 - code;
    185181    assert (rIdx <= idx && rIdx >= 0);
    186 #if RPS_IN_SPS
    187182    TComReferencePictureSet*   rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx);
    188 #else
    189     TComReferencePictureSet*   rpsRef = pcPPS->getRPSList()->getReferencePictureSet(rIdx);
    190 #endif
    191183    Int k = 0, k0 = 0, k1 = 0;
    192184    READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign
     
    265257  READ_FLAG(uiCode, "aps_scaling_list_data_present_flag"); aps->setScalingListEnabled( (uiCode==1)?true:false );
    266258  READ_FLAG(uiCode, "aps_deblocking_filter_flag");         aps->setLoopFilterOffsetInAPS( (uiCode==1)?true:false );
    267 #if !SAO_UNIT_INTERLEAVING
    268   READ_FLAG(uiCode, "aps_sample_adaptive_offset_flag");    aps->setSaoEnabled( (uiCode==1)?true:false );
    269 #endif
    270 #if !LCU_SYNTAX_ALF
    271   READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag");      aps->setAlfEnabled( (uiCode==1)?true:false );
    272 #endif
    273259  if(aps->getScalingListEnabled())
    274260  {
    275261    parseScalingList( aps->getScalingList() );
    276262  }
    277 #if DBL_CONTROL
    278263  if(aps->getLoopFilterOffsetInAPS())
    279264  {
    280265    xParseDblParam( aps );   
    281266  }
    282 #endif
    283 #if SAO_UNIT_INTERLEAVING
    284267  READ_FLAG(uiCode, "aps_sao_interleaving_flag");      aps->setSaoInterleavingFlag( (uiCode==1)?true:false );
    285268  if(!aps->getSaoInterleavingFlag())
    286269  {
    287270    READ_FLAG(uiCode, "aps_sample_adaptive_offset_flag");      aps->setSaoEnabled( (uiCode==1)?true:false );
    288 #endif
    289271  if(aps->getSaoEnabled())
    290272  {
     
    292274    xParseSaoParam( aps->getSaoParam() );
    293275  }
    294 #if SAO_UNIT_INTERLEAVING
    295   }
    296 #endif
    297 #if LCU_SYNTAX_ALF
     276  }
    298277  READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag");      aps->setAlfEnabled( (uiCode==1)?true:false );
    299 #endif
    300278  if(aps->getAlfEnabled())
    301279  {
    302 #if !LCU_SYNTAX_ALF
    303     aps->getAlfParam()->alf_flag = 1;
    304 #endif
    305280    xParseAlfParam( aps->getAlfParam());
    306281  }
     
    316291}
    317292
    318 #if DBL_CONTROL
    319293Void  TDecCavlc::xParseDblParam       ( TComAPS* aps )
    320294{
     
    333307  }
    334308}
    335 #endif
    336309/** parse SAO parameters
    337310 * \param pSaoParam
     
    341314  UInt uiSymbol;
    342315
    343 #if SAO_UNIT_INTERLEAVING
    344316  int i,j, compIdx;
    345317  int numCuInWidth;
     
    393365    }
    394366  }
    395 #else
    396   if (pSaoParam->bSaoFlag[0])
    397   {
    398     xParseSaoSplitParam (pSaoParam, 0, 0);
    399     xParseSaoOffsetParam(pSaoParam, 0, 0);
    400     READ_FLAG (uiSymbol, "sao_flag_cb");
    401     pSaoParam->bSaoFlag[1] = uiSymbol? true:false;
    402     if (pSaoParam->bSaoFlag[1])
    403     {
    404       xParseSaoSplitParam (pSaoParam, 0, 1);
    405       xParseSaoOffsetParam(pSaoParam, 0, 1);
    406     }
    407 
    408     READ_FLAG (uiSymbol, "sao_flag_cr");
    409     pSaoParam->bSaoFlag[2] = uiSymbol? true:false;
    410     if (pSaoParam->bSaoFlag[2])
    411     {
    412       xParseSaoSplitParam (pSaoParam, 0, 2);
    413       xParseSaoOffsetParam(pSaoParam, 0, 2);
    414     }
    415   }
    416 #endif
    417 }
    418 #if SAO_UNIT_INTERLEAVING
     367}
    419368/** copy SAO parameter
    420369 * \param dst 
     
    584533}
    585534
    586 #else
    587 /** Decode quadtree split flag
    588  * \param  pSaoParam, iPartIdx
    589  */
    590 Void TDecCavlc::xParseSaoSplitParam(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
    591 {
    592   UInt uiSymbol;
    593   SAOQTPart*  pSaoPart = NULL;
    594   pSaoPart= &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
    595 
    596   if(pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel)
    597   {
    598     READ_FLAG (uiSymbol, "sao_split_flag");
    599     pSaoPart->bSplit = uiSymbol? true:false;
    600     if(pSaoPart->bSplit)
    601     {
    602       for (Int i=0;i<NUM_DOWN_PART;i++)
    603       {
    604         xParseSaoSplitParam(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr);
    605       }
    606     }
    607   }
    608   else
    609   {
    610     pSaoPart->bSplit = false;
    611   }
    612 }
    613 
    614 /** Decode SAO for one partition
    615  * \param  pSaoParam, iPartIdx
    616  */
    617 Void TDecCavlc::xParseSaoOffsetParam(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
    618 {
    619   UInt uiSymbol;
    620   Int iSymbol; 
    621   SAOQTPart*  pSaoPart = NULL;
    622   pSaoPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
    623 
    624   static Int iTypeLength[MAX_NUM_SAO_TYPE] = {
    625     SAO_EO_LEN,
    626     SAO_EO_LEN,
    627     SAO_EO_LEN,
    628     SAO_EO_LEN,
    629     SAO_BO_LEN,
    630     SAO_BO_LEN
    631   }; 
    632   if(!pSaoPart->bSplit)
    633   {
    634     READ_UVLC (uiSymbol, "sao_type_idx");
    635     if (uiSymbol)
    636     {
    637       pSaoPart->iBestType = uiSymbol-1;
    638       pSaoPart->bEnableFlag = true;
    639     }
    640     else
    641     {
    642       pSaoPart->iBestType = -1;
    643       pSaoPart->bEnableFlag = false;
    644     }
    645 
    646     if (pSaoPart->bEnableFlag)
    647     {
    648       pSaoPart->iLength = iTypeLength[pSaoPart->iBestType];
    649       for(Int i=0; i< pSaoPart->iLength; i++)
    650       {
    651         READ_SVLC (iSymbol, "sao_offset");
    652         pSaoPart->iOffset[i] = iSymbol;
    653       }
    654     }
    655     return;
    656   }
    657 
    658   //split
    659   if (pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel)
    660   {
    661     for(Int i=0;i<NUM_DOWN_PART;i++)
    662     {
    663       xParseSaoOffsetParam(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr);
    664     }
    665   }
    666 }
    667 #endif
    668 
    669 #if LCU_SYNTAX_ALF
     535
    670536Void TDecCavlc::xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS, Int firstLCUAddr, Bool acrossSlice, Int numLCUInWidth, Int numLCUInHeight)
    671537{
     
    931797}
    932798
    933 #endif
    934799
    935800Void TDecCavlc::xParseAlfParam(ALFParam* pAlfParam)
     
    937802  UInt uiSymbol;
    938803  Int iSymbol;
    939 #if ALF_SINGLE_FILTER_SHAPE
    940804  Int sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE] = {ALF_FILTER_LEN};
    941 #else
    942   Int sqrFiltLengthTab[2] = { 9, 9};
    943 #endif
    944 
    945 #if LCU_SYNTAX_ALF
     805
    946806  switch(pAlfParam->componentID)
    947807  {
     
    961821  case ALF_Y:
    962822    {
    963 #endif
    964823  pAlfParam->filters_per_group = 0;
    965824  memset (pAlfParam->filterPattern, 0 , sizeof(Int)*NO_VAR_BINS);
    966 #if !LCU_SYNTAX_ALF
    967   READ_FLAG (uiSymbol, "alf_region_adaptation_flag");
    968   pAlfParam->alf_pcr_region_flag = uiSymbol; 
    969 #endif
    970 #if ALF_SINGLE_FILTER_SHAPE 
    971825  pAlfParam->filter_shape = 0;
    972 #else
    973   READ_UVLC (uiSymbol, "alf_length_luma_minus_5_div2");
    974   pAlfParam->filter_shape = uiSymbol;
    975 #endif
    976826  pAlfParam->num_coeff = sqrFiltLengthTab[pAlfParam->filter_shape];
    977827
     
    989839  {
    990840    pAlfParam->filters_per_group = 1;
    991 #if LCU_SYNTAX_ALF
    992 #if ALF_16_BA_GROUPS
    993841    Int numMergeFlags = 16;
    994 #else
    995     Int numMergeFlags = 15;
    996 #endif
    997 #else
    998 #if ALF_16_BA_GROUPS
    999     Int numMergeFlags = 16;
    1000 #else
    1001     Int numMergeFlags = pAlfParam->alf_pcr_region_flag ? 16 : 15;
    1002 #endif
    1003 #endif
    1004842    for (Int i=1; i<numMergeFlags; i++)
    1005843    {
     
    1021859  }
    1022860
    1023 #if ALF_SINGLE_FILTER_SHAPE
    1024861  Int minScanVal = MIN_SCAN_POS_CROSS;
    1025 #else
    1026   Int minScanVal = (pAlfParam->filter_shape == ALF_STAR5x5) ? 0: MIN_SCAN_POS_CROSS;
    1027 #endif
    1028862
    1029863  // Determine maxScanVal
     
    1036870
    1037871  // Golomb parameters
    1038 #if LCU_SYNTAX_ALF
    1039872  if( pAlfParam->filters_per_group > 1 )
    1040873  {
    1041 #endif
    1042874  READ_UVLC (uiSymbol, "alf_min_kstart_minus1");
    1043875  pAlfParam->minKStart = 1 + uiSymbol;
     
    1051883    kMin = pAlfParam->kMinTab[scanPos];
    1052884  }
    1053 #if LCU_SYNTAX_ALF
    1054   }
    1055 #endif
     885  }
    1056886
    1057887  Int scanPos;
     
    1061891    {
    1062892      scanPos = pDepthInt[i] - 1;
    1063 #if LCU_SYNTAX_ALF
    1064893      Int k = (pAlfParam->filters_per_group == 1) ? kTableTabShapes[ALF_CROSS9x7_SQUARE3x3][i] : pAlfParam->kMinTab[scanPos];
    1065894      pAlfParam->coeffmulti[idx][i] = xGolombDecode(k);
    1066 #else
    1067       pAlfParam->coeffmulti[idx][i] = xGolombDecode(pAlfParam->kMinTab[scanPos]);
    1068 #endif
    1069     }
    1070   }
    1071 #if LCU_SYNTAX_ALF
     895    }
     896  }
    1072897    }
    1073898    break;
     
    1079904    }
    1080905  }
    1081 #else
    1082   // filter parameters for chroma
    1083   READ_UVLC (uiSymbol, "alf_chroma_idc");
    1084   pAlfParam->chroma_idc = uiSymbol;
    1085 
    1086   if(pAlfParam->chroma_idc)
    1087   {
    1088 
    1089 #if ALF_SINGLE_FILTER_SHAPE
    1090     pAlfParam->filter_shape_chroma  = 0;
    1091 #else
    1092     READ_UVLC (uiSymbol, "alf_length_chroma_minus_5_div2");
    1093 
    1094     pAlfParam->filter_shape_chroma = uiSymbol;
    1095 #endif
    1096     pAlfParam->num_coeff_chroma = sqrFiltLengthTab[pAlfParam->filter_shape_chroma];
    1097     // filter coefficients for chroma
    1098     for(Int pos=0; pos<pAlfParam->num_coeff_chroma; pos++)
    1099     {
    1100       READ_SVLC (iSymbol, "alf_coeff_chroma");
    1101       pAlfParam->coeff_chroma[pos] = iSymbol;
    1102     }
    1103   }
    1104 #endif
    1105906}
    1106907
     
    1137938}
    1138939
    1139 #if TILES_OR_ENTROPY_SYNC_IDC
    1140940Void TDecCavlc::parsePPS(TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet)
    1141 #else
    1142 Void TDecCavlc::parsePPS(TComPPS* pcPPS)
    1143 #endif
    1144941{
    1145942#if ENC_DEC_TRACE 
     
    1150947  Int   iCode;
    1151948
    1152 #if !RPS_IN_SPS
    1153   TComRPSList* rpsList = pcPPS->getRPSList();
    1154 #endif
    1155949  READ_UVLC( uiCode, "pic_parameter_set_id");                      pcPPS->setPPSId (uiCode);
    1156950  READ_UVLC( uiCode, "seq_parameter_set_id");                      pcPPS->setSPSId (uiCode);
    1157951
    1158 #if MULTIBITS_DATA_HIDING
    1159952  READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode );
    1160953  if( pcPPS->getSignHideFlag() )
     
    1162955    READ_CODE( 4, uiCode, "sign_hiding_threshold"); pcPPS->setTSIG(uiCode);
    1163956  }
    1164 #endif
    1165957
    1166958#if CABAC_INIT_FLAG
    1167959  READ_FLAG( uiCode,   "cabac_init_present_flag" );            pcPPS->setCabacInitPresentFlag( uiCode ? true : false );
    1168 #endif
    1169 #if !RPS_IN_SPS
    1170   // RPS is put before entropy_coding_mode_flag
    1171   // since entropy_coding_mode_flag will probably be removed from the WD
    1172   TComReferencePictureSet*      pcRPS;
    1173 
    1174   READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );
    1175   rpsList->create(uiCode);
    1176 
    1177   for(Int i=0; i< rpsList->getNumberOfReferencePictureSets(); i++)
    1178   {
    1179     pcRPS = rpsList->getReferencePictureSet(i);
    1180     parseShortTermRefPicSet(pcPPS,pcRPS,i);
    1181   }
    1182   READ_FLAG( uiCode, "long_term_ref_pics_present_flag" );          pcPPS->setLongTermRefsPresent(uiCode);
    1183960#endif
    1184961  // entropy_coding_mode_flag
     
    1187964  if (pcPPS->getEntropyCodingMode())
    1188965  {
    1189 #if !WPP_SIMPLIFICATION
    1190     READ_UVLC( uiCode, "entropy_coding_synchro" );                 pcPPS->setEntropyCodingSynchro( uiCode );
    1191     READ_FLAG( uiCode, "cabac_istate_reset" );                     pcPPS->setCabacIstateReset( uiCode ? true : false );
    1192 #endif
    1193 #if !TILES_OR_ENTROPY_SYNC_IDC
    1194 #if !WPP_SIMPLIFICATION
    1195     if ( pcPPS->getEntropyCodingSynchro() )
    1196 #endif
    1197     {
    1198       READ_UVLC( uiCode, "num_substreams_minus1" );                pcPPS->setNumSubstreams(uiCode+1);
    1199     }
    1200 #endif
    1201   }
    1202 #if !H0566_TLA
    1203   READ_UVLC( uiCode, "num_temporal_layer_switching_point_flags" ); pcPPS->setNumTLayerSwitchingFlags( uiCode );
    1204   for ( UInt i = 0; i < pcPPS->getNumTLayerSwitchingFlags(); i++ )
    1205   {
    1206     READ_FLAG( uiCode, "temporal_layer_switching_point_flag" );    pcPPS->setTLayerSwitchingFlag( i, uiCode > 0 ? true : false );
    1207   }
    1208 #endif
     966  }
    1209967 
    1210968  // num_ref_idx_l0_default_active_minus1
     
    1241999//printf("TDecCavlc::parsePPS():\tm_bUseWeightPred=%d\tm_uiBiPredIdc=%d\n", pcPPS->getUseWP(), pcPPS->getWPBiPredIdc());
    12421000
    1243 #if H0388
    12441001  READ_FLAG( uiCode, "output_flag_present_flag" );
    12451002  pcPPS->setOutputFlagPresentFlag( uiCode==1 );
    1246 #endif
    1247 
    1248 #if TILES_OR_ENTROPY_SYNC_IDC
     1003
    12491004  if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==1)
    12501005  {
    1251 #endif
    12521006    READ_FLAG ( uiCode, "tile_info_present_flag" );
    12531007    pcPPS->setColumnRowInfoPresent(uiCode);
     
    12901044      Int iNumColTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumColumnsMinus1());
    12911045      Int iNumRowTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumRowsMinus1());
    1292 #if !REMOVE_TILE_DEPENDENCE
    1293       pcPPS->setTileBoundaryIndependenceIdr( 1 ); //default
    1294 #endif
    12951046      pcPPS->setLFCrossTileBoundaryFlag(true); //default
    12961047
    12971048      if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0)
    12981049      {
    1299 #if !REMOVE_TILE_DEPENDENCE
    1300         READ_FLAG ( uiCode, "tile_boundary_independence_flag" ); 
    1301         pcPPS->setTileBoundaryIndependenceIdr( uiCode );
    1302 
    1303         if(pcPPS->getTileBoundaryIndependenceIdr() == 1)
    1304         {
    1305 #endif
    13061050          READ_FLAG ( uiCode, "loop_filter_across_tile_flag" ); 
    13071051          pcPPS->setLFCrossTileBoundaryFlag( (uiCode == 1)?true:false );
    1308 #if !REMOVE_TILE_DEPENDENCE
    1309         }
    1310 #endif
    1311       }
    1312     }
    1313 #if TILES_OR_ENTROPY_SYNC_IDC
     1052      }
     1053    }
    13141054  }
    13151055  else if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==2)
     
    13171057    READ_UVLC( uiCode, "num_substreams_minus1" );                pcPPS->setNumSubstreams(uiCode+1);
    13181058  }
    1319 #endif
    1320 
    1321 #if DBL_CONTROL
     1059
    13221060  READ_FLAG( uiCode, "deblocking_filter_control_present_flag" );
    13231061  pcPPS->setDeblockingFilterControlPresent( uiCode ? true : false);
    1324 #endif
    1325 #if PARALLEL_MERGE
    13261062  READ_UVLC( uiCode, "log2_parallel_merge_level_minus2");
    13271063  assert(uiCode == LOG2_PARALLEL_MERGE_LEVEL_MINUS2);
    13281064  pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode);
    1329 #endif
    13301065
    13311066  READ_FLAG( uiCode, "pps_extension_flag");
     
    14961231  READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
    14971232  READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
    1498 #if PIC_CROPPING
    14991233  READ_FLAG(     uiCode, "pic_cropping_flag");                   pcSPS->setPicCroppingFlag ( uiCode ? true : false );
    15001234  if (uiCode != 0)
     
    15051239    READ_UVLC(   uiCode, "pic_crop_bottom_offset" );             pcSPS->setPicCropBottomOffset( uiCode );
    15061240  }
    1507 #endif
    15081241
    15091242#if FULL_NBIT
     
    15251258#endif
    15261259
    1527 #if H0736_AVC_STYLE_QP_RANGE
    15281260  pcSPS->setQpBDOffsetY( (Int) (6*uiCode) );
    1529 #endif
    15301261
    15311262  g_uiBASE_MAX  = ((1<<(g_uiBitDepth))-1);
     
    15371268#endif
    15381269  READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
    1539 #if H0736_AVC_STYLE_QP_RANGE
    15401270  pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
    1541 #endif
    15421271
    15431272  READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false );
     
    15541283
    15551284  READ_UVLC( uiCode,    "log2_max_pic_order_cnt_lsb_minus4" );   pcSPS->setBitsForPOC( 4 + uiCode );
    1556 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    15571285  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    15581286  {
     
    15641292    pcSPS->setMaxLatencyIncrease( uiCode, i );
    15651293  }
    1566 #else
    1567   READ_UVLC( uiCode,    "max_num_ref_pics" );                    pcSPS->setMaxNumberOfReferencePictures(uiCode);
    1568   READ_UVLC( uiCode,    "num_reorder_frames" );                  pcSPS->setNumReorderFrames(uiCode);
    1569   READ_UVLC ( uiCode, "max_dec_frame_buffering");
    1570   pcSPS->setMaxDecFrameBuffering( uiCode );
    1571   READ_UVLC ( uiCode, "max_latency_increase");
    1572   pcSPS->setMaxLatencyIncrease( uiCode );
    1573 #endif
    1574 
    1575 #if H0412_REF_PIC_LIST_RESTRICTION
     1294
    15761295  READ_FLAG( uiCode, "restricted_ref_pic_lists_flag" );
    15771296  pcSPS->setRestrictedRefPicListsFlag( uiCode );
     
    15851304    pcSPS->setListsModificationPresentFlag(true);
    15861305  }
    1587 #endif
    15881306  READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" );
    15891307  UInt log2MinCUSize = uiCode + 3;
     
    16281346  READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" );       pcSPS->setUseSAO ( uiCode ? true : false ); 
    16291347  READ_FLAG( uiCode, "adaptive_loop_filter_enabled_flag" );         pcSPS->setUseALF ( uiCode ? true : false );
    1630 #if LCU_SYNTAX_ALF
    16311348  if(pcSPS->getUseALF())
    16321349  {
    16331350    READ_FLAG( uiCode, "alf_coef_in_slice_flag" );      pcSPS->setUseALFCoefInSlice ( uiCode ? true : false );
    16341351  }
    1635 #endif
    16361352  if( pcSPS->getUsePCM() )
    16371353  {
     
    16421358
    16431359
    1644 #if RPS_IN_SPS
    16451360  TComRPSList* rpsList = pcSPS->getRPSList();
    16461361  TComReferencePictureSet* rps;
     
    16551370  }
    16561371  READ_FLAG( uiCode, "long_term_ref_pics_present_flag" );          pcSPS->setLongTermRefsPresent(uiCode);
    1657 #endif
    1658 #if !PIC_CROPPING
    1659   //!!!KS: Syntax not in WD !!!
    1660 
    1661   xReadUvlc ( uiCode ); pcSPS->setPadX        ( uiCode    );
    1662   xReadUvlc ( uiCode ); pcSPS->setPadY        ( uiCode    );
    1663 #endif
    16641372 
    16651373  // AMVP mode for each depth (AM_NONE or AM_EXPL)
     
    16701378  }
    16711379
    1672 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    16731380  READ_CODE(2, uiCode, "tiles_or_entropy_coding_sync_idc");         pcSPS->setTilesOrEntropyCodingSyncIdc(uiCode);
    1674 #endif
    1675 
    1676 #if TILES_OR_ENTROPY_SYNC_IDC
     1381
    16771382  if(pcSPS->getTilesOrEntropyCodingSyncIdc() == 1)
    16781383  {
    1679 #endif
    16801384    READ_UVLC ( uiCode, "num_tile_columns_minus1" );
    16811385    pcSPS->setNumColumnsMinus1( uiCode ); 
     
    17041408      free(rowHeight); 
    17051409    }
    1706 #if !REMOVE_TILE_DEPENDENCE
    1707     pcSPS->setTileBoundaryIndependenceIdr( 1 ); //default
    1708 #endif
    17091410    pcSPS->setLFCrossTileBoundaryFlag(true); //default
    17101411
    17111412    if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0)
    17121413    {
    1713 #if !REMOVE_TILE_DEPENDENCE
    1714       READ_FLAG ( uiCode, "tile_boundary_independence_flag" ); 
    1715       pcSPS->setTileBoundaryIndependenceIdr( uiCode );
    1716       if(pcSPS->getTileBoundaryIndependenceIdr() == 1)
    1717       {
    1718 #endif
    17191414        READ_FLAG ( uiCode, "loop_filter_across_tile_flag" ); 
    17201415        pcSPS->setLFCrossTileBoundaryFlag( (uiCode==1)?true:false);
    1721 #if !REMOVE_TILE_DEPENDENCE
    1722       }
    1723 #endif
    1724     }
    1725 #if TILES_OR_ENTROPY_SYNC_IDC
    1726   }
    1727 #endif
     1416    }
     1417  }
    17281418  READ_FLAG( uiCode, "sps_extension_flag");
    17291419#if !QC_MVHEVC_B0046
     
    18941584}
    18951585
    1896 #if LCU_SYNTAX_ALF
    18971586#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
    18981587Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth)
    18991588#else
    19001589Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet)
    1901 #endif
    1902 #else
    1903 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl)
    19041590#endif
    19051591{
     
    19881674    rpcSlice->setSPS(sps);
    19891675    rpcSlice->setPPS(pps);
    1990 #if H0388
    19911676    if( pps->getOutputFlagPresentFlag() )
    19921677    {
     
    19981683      rpcSlice->setPicOutputFlag( true );
    19991684    }
    2000 #endif
    20011685#if QC_REM_IDV_B0046
    20021686#if !QC_MVHEVC_B0046
     
    20651749        {
    20661750          rps = rpcSlice->getLocalRPS();
    2067 #if RPS_IN_SPS
    20681751          parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets());
    2069 #else
    2070           parseShortTermRefPicSet(pps,rps, pps->getRPSList()->getNumberOfReferencePictureSets());
    2071 #endif
    20721752          rpcSlice->setRPS(rps);
    20731753        }
    20741754        else // use reference to short-term reference picture set in PPS
    20751755        {
    2076 #if RPS_IN_SPS
    20771756          READ_UVLC( uiCode, "short_term_ref_pic_set_idx"); rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode));
    2078 #else
    2079           READ_UVLC( uiCode, "short_term_ref_pic_set_idx"); rpcSlice->setRPS(pps->getRPSList()->getReferencePictureSet(uiCode));
    2080 #endif
    20811757          rps = rpcSlice->getRPS();
    20821758        }
    2083 #if RPS_IN_SPS
    20841759        if(sps->getLongTermRefsPresent())
    2085 #else
    2086         if(pps->getLongTermRefsPresent())
    2087 #endif
    20881760        {
    20891761          Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures();
    20901762          READ_UVLC( uiCode, "num_long_term_pics");             rps->setNumberOfLongtermPictures(uiCode);
    20911763          Int prev = 0;
    2092 #if LTRP_MULT
    20931764          Int prevMsb=0;
    20941765          Int prevDeltaPocLt=0;
    2095 #endif
    20961766          for(Int j=rps->getNumberOfLongtermPictures()+offset-1 ; j > offset-1; j--)
    20971767          {
     
    20991769            prev += uiCode;
    21001770
    2101 #if LTRP_MULT
    21021771            READ_FLAG(uiCode,"delta_poc_msb_present_flag");
    21031772            Int decDeltaPOCMsbPresent=uiCode;
     
    21201789            else
    21211790            {
    2122 #endif
    21231791              rps->setPOC(j,rpcSlice->getPOC()-prev);         
    21241792              rps->setDeltaPOC(j,-(Int)prev);
    2125 #if LTRP_MULT
    21261793            }
    21271794            prevDeltaPocLt=prev;
    2128 #endif
    21291795            READ_FLAG( uiCode, "used_by_curr_pic_lt_flag");     rps->setUsed(j,uiCode);
    21301796          }
     
    21451811      if (sps->getUseSAO())
    21461812      {
    2147 #if SAO_UNIT_INTERLEAVING
    21481813        READ_FLAG(uiCode, "slice_sao_interleaving_flag");        rpcSlice->setSaoInterleavingFlag(uiCode);
    2149 #endif
    21501814        READ_FLAG(uiCode, "slice_sample_adaptive_offset_flag");  rpcSlice->setSaoEnabledFlag((Bool)uiCode);
    2151 #if SAO_UNIT_INTERLEAVING
    21521815        if (rpcSlice->getSaoEnabledFlag() && rpcSlice->getSaoInterleavingFlag())
    21531816        {
     
    21601823          rpcSlice->setSaoEnabledFlagCr(0);
    21611824        }
    2162 #endif
    21631825      }
    21641826      READ_UVLC (    uiCode, "aps_id" );  rpcSlice->setAPSId(uiCode);
     
    21881850    if( !rpcSlice->isIntra() )
    21891851    {
    2190 #if H0412_REF_PIC_LIST_RESTRICTION
    21911852#if QC_MVHEVC_B0046
    21921853    if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() )
     
    21991860      else
    22001861      {
    2201 #endif
    22021862        READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 );
    2203 #if H0412_REF_PIC_LIST_RESTRICTION
    2204       }
    2205 #endif
     1863      }
    22061864     
    22071865      if(refPicListModification->getRefPicListModificationFlagL0())
     
    22091867        uiCode = 0;
    22101868        Int i = 0;
    2211 #if H0137_0138_LIST_MODIFICATION
    22121869        Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc();
    22131870        if ( NumPocTotalCurr > 1 )
     
    22321889          }
    22331890        }
    2234 #else
    2235         Int list_modification_idc = 0;
    2236         while(list_modification_idc != 3) 
    2237         {
    2238           READ_UVLC( uiCode, "list_modification_idc" ); refPicListModification->setListIdcL0(i, uiCode );
    2239           list_modification_idc = uiCode;
    2240           if(uiCode != 3)
    2241           {
    2242             READ_UVLC( uiCode, "ref_pic_set_idx" ); refPicListModification->setRefPicSetIdxL0(i, uiCode );
    2243           }
    2244           i++;
    2245         }
    2246         refPicListModification->setNumberOfRefPicListModificationsL0(i-1);
    2247 #endif
    2248       }
    2249 #if !H0137_0138_LIST_MODIFICATION
    2250       else
    2251       {
    2252         refPicListModification->setNumberOfRefPicListModificationsL0(0);
    2253       }
    2254 #endif
     1891      }
    22551892    }
    22561893    else
    22571894    {
    22581895      refPicListModification->setRefPicListModificationFlagL0(0);
    2259 #if !H0137_0138_LIST_MODIFICATION
    2260       refPicListModification->setNumberOfRefPicListModificationsL0(0);
    2261 #endif
    22621896    }
    22631897    if(rpcSlice->isInterB())
    22641898    {
    2265 #if H0412_REF_PIC_LIST_RESTRICTION
    22661899#if QC_MVHEVC_B0046
    22671900    if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() )
     
    22741907      else
    22751908      {
    2276 #endif
    22771909        READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 );
    2278 #if H0412_REF_PIC_LIST_RESTRICTION
    2279       }
    2280 #endif
     1910      }
    22811911      if(refPicListModification->getRefPicListModificationFlagL1())
    22821912      {
    22831913        uiCode = 0;
    22841914        Int i = 0;
    2285 #if H0137_0138_LIST_MODIFICATION
    22861915        Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc();
    22871916        if ( NumPocTotalCurr > 1 )
     
    23061935          }
    23071936        }
    2308 #else
    2309         Int list_modification_idc = 0;
    2310         while(list_modification_idc != 3) 
    2311         {
    2312           READ_UVLC( uiCode, "list_modification_idc" ); refPicListModification->setListIdcL1(i, uiCode );
    2313           list_modification_idc = uiCode;
    2314           if(uiCode != 3)
    2315           {
    2316             READ_UVLC( uiCode, "ref_pic_set_idx" ); refPicListModification->setRefPicSetIdxL1(i, uiCode );
    2317           }
    2318           i++;
    2319         }
    2320         refPicListModification->setNumberOfRefPicListModificationsL1(i-1);
    2321 #endif
    2322       }
    2323 #if !H0137_0138_LIST_MODIFICATION
    2324       else
    2325       {
    2326         refPicListModification->setNumberOfRefPicListModificationsL1(0);
    2327       }
    2328 #endif
     1937      }
    23291938    } 
    23301939    else
    23311940    {
    23321941      refPicListModification->setRefPicListModificationFlagL1(0);
    2333 #if !H0137_0138_LIST_MODIFICATION
    2334       refPicListModification->setNumberOfRefPicListModificationsL1(0);
    2335 #endif
    23361942    }
    23371943  }
     
    23511957      READ_UVLC( uiCode, "num_ref_idx_lc_active_minus1" );      rpcSlice->setNumRefIdx( REF_PIC_LIST_C, uiCode + 1 );
    23521958     
    2353 #if H0412_REF_PIC_LIST_RESTRICTION
    23541959#if QC_MVHEVC_B0046
    23551960    if( rpcSlice->getViewId() && rpcSlice->getSPS()->getListsModificationPresentFlag() )
     
    23581963#endif
    23591964      {
    2360 #endif
    23611965        READ_FLAG( uiCode, "ref_pic_list_modification_flag_lc" ); rpcSlice->setRefPicListModificationFlagLC( uiCode ? 1 : 0 );
    23621966        if(uiCode)
     
    23661970            READ_FLAG( uiCode, "pic_from_list_0_flag" );
    23671971            rpcSlice->setListIdFromIdxOfLC(i, uiCode);
    2368 #if H0137_0138_LIST_MODIFICATION
    23691972          if (((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_0) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_0 ) == 1)) || ((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_1) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_1 ) == 1)) )
    23701973          {
     
    23751978            READ_UVLC( uiCode, "ref_idx_list_curr" );
    23761979          }
    2377 #else
    2378             READ_UVLC( uiCode, "ref_idx_list_curr" );
    2379 #endif
    23801980            rpcSlice->setRefIdxFromIdxOfLC(i, uiCode);
    23811981            rpcSlice->setRefIdxOfLC((RefPicList)rpcSlice->getListIdFromIdxOfLC(i), rpcSlice->getRefIdxFromIdxOfLC(i), i);
    23821982          }
    23831983        }
    2384 #if H0412_REF_PIC_LIST_RESTRICTION
    23851984      }
    23861985      else
     
    23881987        rpcSlice->setRefPicListModificationFlagLC(false);
    23891988      }
    2390 #endif
    23911989    }
    23921990    else
     
    24011999  }
    24022000 
    2403 #if H0111_MVD_L1_ZERO
    24042001  if (rpcSlice->isInterB())
    24052002  {
    24062003    READ_FLAG( uiCode, "mvd_l1_zero_flag" );       rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) );
    24072004  }
    2408 #endif
    24092005
    24102006#if CABAC_INIT_FLAG
     
    24322028    rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode);
    24332029
    2434 #if H0736_AVC_STYLE_QP_RANGE
    24352030    assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() );
    24362031    assert( rpcSlice->getSliceQp() <=  51 );
    2437 #endif
    2438 
    2439 #if DBL_CONTROL
     2032
    24402033    if (rpcSlice->getPPS()->getDeblockingFilterControlPresent())
    24412034    {
     
    24472040        rpcSlice->setInheritDblParamFromAPS(0);
    24482041      }
    2449 #else
    2450     READ_FLAG ( uiCode, "inherit_dbl_param_from_APS_flag" ); rpcSlice->setInheritDblParamFromAPS(uiCode ? 1 : 0);
    2451 #endif
    24522042      if(!rpcSlice->getInheritDblParamFromAPS())
    24532043      {
     
    24592049        }
    24602050      }
    2461 #if DBL_CONTROL
    24622051   }
    2463 #endif
    24642052    if ( rpcSlice->getSliceType() == B_SLICE )
    24652053    {
     
    25312119
    25322120      Int uiNumCUsInFrame = uiNumLCUsInWidth* uiNumLCUsInHeight;
    2533 #if LCU_SYNTAX_ALF
    25342121      if(sps->getUseALFCoefInSlice())
    25352122      {
     
    25442131      if(!sps->getUseALFCoefInSlice())
    25452132      {
    2546 #endif
    25472133      xParseAlfCuControlParam(alfCUCtrl, uiNumCUsInFrame);
    2548 #if LCU_SYNTAX_ALF
    2549       }
    2550 #endif
     2134      }
    25512135
    25522136    }
     
    25572141  if (!bEntropySlice)
    25582142  {
    2559 #if !REMOVE_TILE_DEPENDENCE
    2560     if (sps->getTileBoundaryIndependenceIdr())
    2561     {   
    2562 #endif
    25632143    xReadCode(1, uiCode); // read flag indicating if tile markers transmitted
    25642144    rpcSlice->setTileMarkerFlag( uiCode );
    2565 #if !REMOVE_TILE_DEPENDENCE
    2566     }
    2567 #endif
    2568   }
    2569 
    2570 #if TILES_WPP_ENTRY_POINT_SIGNALLING
     2145  }
     2146
    25712147  Int tilesOrEntropyCodingSyncIdc = rpcSlice->getSPS()->getTilesOrEntropyCodingSyncIdc();
    25722148  UInt *entryPointOffset          = NULL;
     
    26292205    delete [] entryPointOffset;
    26302206  }
    2631 #else
    2632 #if WPP_SIMPLIFICATION
    2633   if (pps->getNumSubstreams() > 1)
    2634 #else
    2635   if (pps->getEntropyCodingSynchro())
    2636 #endif
    2637   {
    2638     UInt uiNumSubstreams = pps->getNumSubstreams();
    2639     rpcSlice->allocSubstreamSizes(uiNumSubstreams);
    2640     UInt *puiSubstreamSizes = rpcSlice->getSubstreamSizes();
    2641 
    2642     for (UInt ui = 0; ui+1 < uiNumSubstreams; ui++)
    2643     {
    2644       xReadCode(2, uiCode);
    2645      
    2646       switch ( uiCode )
    2647       {
    2648       case 0:
    2649         xReadCode(8,  uiCode);
    2650         break;
    2651       case 1:
    2652         xReadCode(16, uiCode);
    2653         break;
    2654       case 2:
    2655         xReadCode(24, uiCode);
    2656         break;
    2657       case 3:
    2658         xReadCode(32, uiCode);
    2659         break;
    2660       default:
    2661         printf("Error in parseSliceHeader\n");
    2662         exit(-1);
    2663         break;
    2664       }
    2665       puiSubstreamSizes[ui] = uiCode;
    2666     }
    2667   }
    2668 #endif
    26692207
    26702208  if (!bEntropySlice)
    26712209  {
    26722210    // Reading location information
    2673 #if !REMOVE_TILE_DEPENDENCE
    2674     if (sps->getTileBoundaryIndependenceIdr())
    2675     {   
    2676 #endif
    2677 #if !TILES_WPP_ENTRY_POINT_SIGNALLING
    2678       xReadCode(1, uiCode); // read flag indicating if location information signaled in slice header
    2679       Bool bTileLocationInformationInSliceHeaderFlag = (uiCode)? true : false;
    2680 
    2681       if (bTileLocationInformationInSliceHeaderFlag)
    2682       {
    2683         // location count
    2684         xReadCode(5, uiCode); // number of tiles for which location information signaled
    2685         rpcSlice->setTileLocationCount ( uiCode + 1 );
    2686 
    2687         xReadCode(5, uiCode); // number of bits used by diff
    2688         Int iBitsUsedByDiff = uiCode + 1;
    2689 
    2690         // read out tile start location
    2691         Int iLastSize = 0;
    2692         for (UInt uiIdx=0; uiIdx<rpcSlice->getTileLocationCount(); uiIdx++)
    2693         {
    2694           Int iAbsDiff, iCurSize, iCurDiff;
    2695           if (uiIdx==0)
    2696           {
    2697             xReadCode(iBitsUsedByDiff-1, uiCode); iAbsDiff  = uiCode;
    2698             rpcSlice->setTileLocation( uiIdx, iAbsDiff );
    2699             iCurDiff  = iAbsDiff;
    2700             iLastSize = iAbsDiff;
    2701           }
    2702           else
    2703           {
    2704             xReadCode(1, uiCode); // read sign
    2705             Int iSign = (uiCode) ? -1 : +1;
    2706 
    2707             xReadCode(iBitsUsedByDiff-1, uiCode); iAbsDiff  = uiCode;
    2708             iCurDiff  = (iSign) * iAbsDiff;
    2709             iCurSize  = iLastSize + iCurDiff;
    2710             iLastSize = iCurSize;
    2711             rpcSlice->setTileLocation( uiIdx, rpcSlice->getTileLocation( uiIdx-1 ) + iCurSize ); // calculate byte location
    2712           }
    2713         }
    2714       }
    2715 #endif
    27162211
    27172212      // read out trailing bits
    27182213    m_pcBitstream->readOutTrailingBits();
    2719 #if !REMOVE_TILE_DEPENDENCE
    2720     }
    2721 #endif
    27222214  }
    27232215  return;
     
    28142306Void TDecCavlc::parseIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    28152307{
    2816 #if BURST_IPCM
    28172308  assert(0);
    2818 #else
    2819   UInt uiSymbol;
    2820 
    2821   xReadFlag( uiSymbol );
    2822 
    2823   if ( uiSymbol )
    2824   {
    2825     Bool bIpcmFlag   = true;
    2826 
    2827     xReadPCMAlignZero();
    2828 
    2829     pcCU->setPartSizeSubParts  ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    2830     pcCU->setSizeSubParts      ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
    2831     pcCU->setIPCMFlagSubParts  ( bIpcmFlag, uiAbsPartIdx, uiDepth );
    2832 
    2833     UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
    2834     UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    2835     UInt uiChromaOffset = uiLumaOffset>>2;
    2836 
    2837     Pel* piPCMSample;
    2838     UInt uiWidth;
    2839     UInt uiHeight;
    2840     UInt uiSampleBits;
    2841     UInt uiX, uiY;
    2842 
    2843     piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset;
    2844     uiWidth = pcCU->getWidth(uiAbsPartIdx);
    2845     uiHeight = pcCU->getHeight(uiAbsPartIdx);
    2846     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
    2847 
    2848     for(uiY = 0; uiY < uiHeight; uiY++)
    2849     {
    2850       for(uiX = 0; uiX < uiWidth; uiX++)
    2851       {
    2852         UInt uiSample;
    2853         xReadCode(uiSampleBits, uiSample);
    2854 
    2855         piPCMSample[uiX] = uiSample;
    2856       }
    2857       piPCMSample += uiWidth;
    2858     }
    2859 
    2860     piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
    2861     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    2862     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    2863     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    2864 
    2865     for(uiY = 0; uiY < uiHeight; uiY++)
    2866     {
    2867       for(uiX = 0; uiX < uiWidth; uiX++)
    2868       {
    2869         UInt uiSample;
    2870         xReadCode(uiSampleBits, uiSample);
    2871         piPCMSample[uiX] = uiSample;
    2872       }
    2873       piPCMSample += uiWidth;
    2874     }
    2875 
    2876     piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;
    2877     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    2878     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    2879     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    2880 
    2881     for(uiY = 0; uiY < uiHeight; uiY++)
    2882     {
    2883       for(uiX = 0; uiX < uiWidth; uiX++)
    2884       {
    2885         UInt uiSample;
    2886         xReadCode(uiSampleBits, uiSample);
    2887         piPCMSample[uiX] = uiSample;
    2888       }
    2889       piPCMSample += uiWidth;
    2890     }
    2891   }
    2892 #endif
    28932309}
    28942310
     
    29202336Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    29212337{
    2922 #if H0736_AVC_STYLE_QP_RANGE
    29232338  Int qp;
    2924 #else
    2925   UInt uiQp;
    2926 #endif
    29272339  Int  iDQp;
    29282340 
    29292341  xReadSvlc( iDQp );
    29302342
    2931 #if H0736_AVC_STYLE_QP_RANGE
    29322343  Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY();
    29332344  qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) -  qpBdOffsetY;
    2934 #else
    2935   uiQp = pcCU->getRefQP( uiAbsPartIdx ) + iDQp;
    2936 #endif
    29372345
    29382346  UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ;
    29392347  UInt uiQpCUDepth =   min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ;
    29402348
    2941 #if H0736_AVC_STYLE_QP_RANGE
    29422349  pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth );
    2943 #else
    2944   pcCU->setQPSubParts( uiQp, uiAbsQpCUPartIdx, uiQpCUDepth );
    2945 #endif
    29462350}
    29472351
     
    34072811          READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
    34082812          scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code+1)));
    3409 #if SCALING_LIST
    34102813          if( sizeId > SCALING_LIST_8x8 )
    34112814          {
    34122815            scalingList->setScalingListDC(sizeId,listId,scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)));
    34132816          }
    3414 #endif
    34152817          scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
    34162818         
     
    34332835Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId)
    34342836{
    3435 #if SCALING_LIST
    34362837  Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
    34372838  Int data;
     
    34732874    }
    34742875  }
    3475 #else
    3476   Int i,coefNum = g_scalingListSize[sizeId];
    3477   Int data;
    3478   Int nextCoef = SCALING_LIST_START_VALUE;
    3479   UInt* scan  = g_auiFrameScanXY [ sizeId + 1 ];
    3480   Int *dst = scalingList->getScalingListAddress(sizeId, listId);
    3481 
    3482   for(i = 0; i < coefNum; i++)
    3483   {
    3484     READ_SVLC( data, "scaling_list_delta_coef");
    3485     nextCoef = (nextCoef + data + 256 ) % 256;
    3486     dst[scan[i]] = nextCoef;
    3487   }
    3488 #endif
    34892876}
    34902877
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h

    r292 r294  
    8282  UInt  xGetBit             ();
    8383 
    84 #if RPS_IN_SPS
    8584  void  parseShortTermRefPicSet            (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx);
    86 #else
    87   void  parseShortTermRefPicSet            (TComPPS* pcPPS, TComReferencePictureSet* pcRPS, Int idx);
    88 #endif
    8985private:
    9086  TComInputBitstream*   m_pcBitstream;
     
    123119  Void  parseSPS            ( TComSPS* pcSPS );
    124120#endif
    125 #if TILES_OR_ENTROPY_SYNC_IDC
    126121  Void  parsePPS            ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet);
    127 #else
    128   Void  parsePPS            ( TComPPS* pcPPS);
    129 #endif
    130122  Void  parseSEI(SEImessages&);
    131123  Void  parseAPS            ( TComAPS* pAPS );
    132 #if LCU_SYNTAX_ALF
    133124#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
    134125  Void  parseSliceHeader    ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth);
    135126#else
    136127  Void  parseSliceHeader    ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet);
    137 #endif
    138 #else
    139   Void  parseSliceHeader    ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl );
    140128#endif
    141129  Void  parseTerminatingBit ( UInt& ruiBit );
     
    175163  Void readTileMarker     ( UInt& uiTileIdx, UInt uiBitsUsed );
    176164  Void updateContextTables  ( SliceType eSliceType, Int iQp ) { return; }
    177 #if OL_FLUSH
    178165  Void decodeFlush() {};
    179 #endif
    180166
    181167  Void xParsePredWeightTable ( TComSlice* pcSlice );
     
    190176#endif
    191177protected:
    192 #if DBL_CONTROL
    193178  Void  xParseDblParam       ( TComAPS* aps );
    194 #endif
    195179  Void  xParseSaoParam       ( SAOParam* pSaoParam );
    196 #if SAO_UNIT_INTERLEAVING
    197180  Void  xParseSaoOffset      (SaoLcuParam* saoLcuParam);
    198181  Void  xParseSaoUnit        (Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool& repeatedRow );
    199 #else
    200   Void  xParseSaoSplitParam  ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr );
    201   Void  xParseSaoOffsetParam ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr );
    202 #endif
    203 #if LCU_SYNTAX_ALF
    204182  Void  xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS = true, Int firstLCUAddr = 0, Bool acrossSlice = true, Int numLCUInWidth= -1, Int numLCUInHeight= -1);
    205183  Void  parseAlfParamSet(AlfParamSet* pAlfParamSet, Int firstLCUAddr, Bool alfAcrossSlice);
    206184  Void  parseAlfFixedLengthRun(UInt& idx, UInt rx, UInt numLCUInWidth);
    207185  Void  parseAlfStoredFilterIdx(UInt& idx, UInt numFilterSetsInBuffer);
    208 #endif
    209186  Void  xParseAlfParam       ( ALFParam* pAlfParam );
    210187  Void  xParseAlfCuControlParam(AlfCUCtrlInfo& cAlfParam, Int iNumCUsInPic);
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp

    r292 r294  
    148148  }
    149149
    150 #if BURST_IPCM
    151150  pcCU->setNumSucIPCM(0);
    152 #endif
    153151
    154152  // start from the top level CU
     
    240238  if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    241239  {
    242 #if BURST_IPCM
    243240    if(pcCU->getNumSucIPCM() == 0)
    244241    {
     
    252249      pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx );
    253250    }
    254 #else
    255 #if HHI_MPI
    256     if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )
    257 #endif
    258     m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
    259 #endif
    260251  }
    261252  else
     
    323314
    324315  // decode CU mode and the partition size
    325 #if BURST_IPCM
    326316  if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 )
    327 #else
    328   if( !pcCU->getSlice()->isIntra() )
    329 #endif
    330317#if HHI_MPI
    331318  if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
     
    382369    {
    383370#endif
    384 #if SIMP_MRG_PRUN     
    385371    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    386372#if MERL_VSP_C0152
     
    404390    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    405391#endif
    406 #else
    407     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    408     UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    409 #endif
    410392    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    411393
     
    438420  {
    439421#endif
    440 #if BURST_IPCM
    441422  if( pcCU->getNumSucIPCM() == 0 )
    442423  {
     
    451432    pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
    452433  }
    453 #else
    454   m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
    455   m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    456 #endif
    457434
    458435  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
     
    592569  }
    593570
    594 #if BURST_IPCM
    595571  if( pcCU->getNumSucIPCM() > 0 )
    596572  {
     
    598574    return;
    599575  }
    600 #endif
    601576
    602577  ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth);
     
    820795 
    821796  //===== inverse transform =====
    822 #if H0736_AVC_STYLE_QP_RANGE
    823797  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    824 #else
    825   m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    826 #endif
    827798
    828799  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
     
    940911  if(eText == TEXT_CHROMA_U)
    941912  {
    942 #if H0736_AVC_STYLE_QP_RANGE
    943913    m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    944 #else
    945     m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    946 #endif
    947914  }
    948915  else
    949916  {
    950 #if H0736_AVC_STYLE_QP_RANGE
    951917    m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    952 #else
    953     m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    954 #endif
    955918  }
    956919
     
    12521215  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
    12531216
    1254 #if H0736_AVC_STYLE_QP_RANGE
    12551217  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    1256 #else
    1257   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    1258 #endif
    12591218
    12601219  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    12611220 
    12621221  // Cb and Cr
    1263 #if H0736_AVC_STYLE_QP_RANGE
    12641222  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    1265 #else
    1266   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    1267 #endif
    12681223
    12691224  uiWidth  >>= 1;
     
    12721227  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    12731228
    1274 #if H0736_AVC_STYLE_QP_RANGE
    12751229  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    1276 #else
    1277   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    1278 #endif
    12791230
    12801231  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp

    r292 r294  
    330330      else
    331331      {
    332 #if SIMP_MRG_PRUN
    333332        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    334333        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    335 #else     
    336         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    337         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    338 #endif
    339334      }
    340335#else
    341 #if SIMP_MRG_PRUN       
    342336      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    343337#if MERL_VSP_C0152
     
    375369#else
    376370      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    377 #endif
    378 #else     
    379       pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    380       UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    381371#endif
    382372#endif
     
    547537}
    548538
    549 #if UNIFIED_TRANSFORM_TREE
    550539Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP )
    551 #else
    552 Void TDecEntropy::xDecodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )
    553 #endif
    554540{
    555541  UInt uiSubdiv;
    556542  const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth;
    557543
    558 #if UNIFIED_TRANSFORM_TREE
    559544  if(uiTrIdx==0)
    560545  {
     
    570555    }
    571556  }
    572 #endif // UNIFIED_TRANSFORM_TREE
    573557  if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) )
    574558  {
    575559    uiSubdiv = 1;
    576560  }
    577 #if G519_TU_AMP_NSQT_HARMONIZATION
    578561  else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
    579 #else
    580   else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
    581 #endif
    582562  {
    583563    uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx));
     
    656636  if( uiSubdiv )
    657637  {
    658 #if UNIFIED_TRANSFORM_TREE
    659638    UInt size;
    660639    width  >>= 1;
     
    662641    size = width*height;
    663642    uiTrIdx++;
    664 #endif
    665643    ++uiDepth;
    666644    const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     
    678656    for( Int i = 0; i < 4; i++ )
    679657    {
    680 #if UNIFIED_TRANSFORM_TREE
    681658      UInt nsAddr = 0;
    682659      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
    683660      xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP );
    684 #else
    685       UInt nsAddr = 0;
    686       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
    687       xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    688 #endif
    689661      uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode );
    690662      uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiChromaTrMode );
    691663      uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiChromaTrMode );
    692664      uiAbsPartIdx += uiQPartNum;
    693 #if UNIFIED_TRANSFORM_TREE
    694665      offsetLuma += size;  offsetChroma += (size>>2);
    695 #endif
    696666    }
    697667   
     
    751721      }
    752722    }
    753 #if UNIFIED_TRANSFORM_TREE
    754723    // transform_unit begin
    755724    UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA    , uiTrIdx );
     
    817786    }
    818787    // transform_unit end
    819 #endif // UNIFIED_TRANSFORM_TREE
    820   }
    821 }
    822 
    823 #if !UNIFIED_TRANSFORM_TREE
    824 Void TDecEntropy::decodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    825 {
    826   DTRACE_CABAC_VL( g_nSymbolCounter++ )
    827   DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
    828   DTRACE_CABAC_V( uiDepth )
    829   DTRACE_CABAC_T( "\n" )
    830   UInt temp = 0;
    831   UInt temp1 = 0;
    832   UInt temp2 = 0;
    833   xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
    834 }
    835 #endif // UNIFIED_TRANSFORM_TREE
    836 
    837 #if UNIFIED_TRANSFORM_TREE
     788  }
     789}
     790
     791
    838792Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    839793{
     
    843797  }
    844798}
    845 #else
    846 Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    847 {
    848   if ( pcCU->getSlice()->getPPS()->getUseDQP() )
    849   {
    850     m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, uiDepth );
    851   }
    852 }
    853 #endif
    854 
    855 #if !UNIFIED_TRANSFORM_TREE
    856 Void TDecEntropy::xDecodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP )
    857 {
    858   UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2;
    859   UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx );
    860   UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    861   UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    862   if( uiLog2TrSize == 2 )
    863   {
    864     UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    865     if( ( uiAbsPartIdx % uiQPDiv ) == 0 )
    866     {
    867       m_uiBakAbsPartIdx   = uiAbsPartIdx;
    868       m_uiBakChromaOffset = uiChromaOffset;
    869     }
    870     else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    871     {
    872       uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    873       uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    874     }
    875   }
    876 
    877   if ( uiCbfY || uiCbfU || uiCbfV )
    878   {
    879     // dQP: only for LCU
    880     if ( pcCU->getSlice()->getPPS()->getUseDQP() )
    881     {
    882       if ( bCodeDQP )
    883       {
    884         decodeQP( pcCU, uiAbsPartIdx, uiDepth);
    885         bCodeDQP = false;
    886       }
    887     }   
    888     UInt uiLumaTrMode, uiChromaTrMode;
    889     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );
    890     const UInt uiStopTrMode = uiLumaTrMode;
    891    
    892     if( uiTrIdx == uiStopTrMode )
    893     {
    894       if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) )
    895       {
    896         Int trWidth = uiWidth;
    897         Int trHeight = uiHeight;
    898         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    899         m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
    900       }
    901      
    902       uiWidth  >>= 1;
    903       uiHeight >>= 1;
    904 
    905       if( uiLog2TrSize == 2 )
    906       {
    907         UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    908         if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    909         {
    910           uiWidth  <<= 1;
    911           uiHeight <<= 1;
    912           Int trWidth = uiWidth;
    913           Int trHeight = uiHeight;
    914           pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight );
    915           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    916           {
    917             m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    918           }
    919           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    920           {
    921             m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    922           }
    923         }
    924       }
    925       else
    926       {
    927         Int trWidth = uiWidth;
    928         Int trHeight = uiHeight;
    929         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    930         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    931         {
    932           m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    933         }
    934         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    935         {
    936           m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    937         }
    938       }
    939     }
    940     else
    941     {
    942       {
    943         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    944         DTRACE_CABAC_T( "\tgoing down\tdepth=" );
    945         DTRACE_CABAC_V( uiDepth );
    946         DTRACE_CABAC_T( "\ttridx=" );
    947         DTRACE_CABAC_V( uiTrIdx );
    948         DTRACE_CABAC_T( "\n" );
    949       }
    950       if( uiCurrTrIdx <= uiTrIdx )
    951       {
    952         assert(1);
    953       }
    954       UInt uiSize;
    955       uiWidth  >>= 1;
    956       uiHeight >>= 1;
    957       uiSize = uiWidth*uiHeight;
    958       uiDepth++;
    959       uiTrIdx++;
    960      
    961       UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    962       UInt uiIdx      = uiAbsPartIdx;
    963      
    964       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    965       uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    966      
    967       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    968       uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    969      
    970       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    971       uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    972      
    973       xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    974       {
    975         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    976         DTRACE_CABAC_T( "\tgoing up\n" );
    977       }
    978     }
    979   }
    980 }
    981 #endif // !UNIFIED_TRANSFORM_TREE
     799
    982800
    983801/** decode coefficients
     
    994812  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    995813  UInt uiChromaOffset = uiLumaOffset>>2;
    996 #if UNIFIED_TRANSFORM_TREE
    997814  UInt temp  = 0;
    998815  UInt temp1 = 0;
    999816  UInt temp2 = 0;
    1000 #else
    1001   UInt uiLumaTrMode, uiChromaTrMode;
    1002 #endif
    1003817 
    1004818#if RWTH_SDC_DLT_B0036
     
    1018832  if( pcCU->isIntra(uiAbsPartIdx) )
    1019833  {
    1020 #if !UNIFIED_TRANSFORM_TREE
    1021     decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
    1022    
    1023     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
    1024    
    1025 #endif // !UNIFIED_TRANSFORM_TREE
    1026834  }
    1027835  else
     
    1045853    }
    1046854   
    1047 #if !UNIFIED_TRANSFORM_TREE
    1048     decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
    1049    
    1050     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
    1051 #endif // !UNIFIED_TRANSFORM_TREE
    1052855  }
    1053856
     
    1068871#endif
    1069872
    1070 #if UNIFIED_TRANSFORM_TREE
    1071873  xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP );
    1072 #else // UNIFIED_TRANSFORM_TREE
    1073   xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );
    1074 #endif // UNIFIED_TRANSFORM_TREE
    1075874
    1076875#if FIX_MPI_B0065
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.h

    r292 r294  
    6767  virtual Void  setBitstream          ( TComInputBitstream* p )  = 0;
    6868
    69 #if OL_FLUSH
    7069  virtual Void  decodeFlush()                                                                      = 0;
    71 #endif
    7270
    7371#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
     
    7977  virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
    8078#endif
    81 #if TILES_OR_ENTROPY_SYNC_IDC 
    8279  virtual Void  parsePPS                  ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet )                                      = 0;
    83 #else
    84   virtual Void  parsePPS                  ( TComPPS* pcPPS )                                      = 0;
    85 #endif
    8680  virtual Void  parseAPS                  ( TComAPS* pAPS  )                                      = 0;
    8781  virtual void parseSEI(SEImessages&) = 0;
    8882
    89 #if LCU_SYNTAX_ALF
    9083#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
    9184  virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth)       = 0;
    9285#else
    9386  virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet)       = 0;
    94 #endif
    95 #else
    96   virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl )                                = 0;
    9787#endif
    9888
     
    163153  UInt    m_uiBakAbsPartIdx;
    164154  UInt    m_uiBakChromaOffset;
    165 #if UNIFIED_TRANSFORM_TREE
    166155  UInt    m_bakAbsPartIdxCU;
    167 #endif
    168156 
    169157public:
     
    188176  Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
    189177#endif
    190 #if TILES_OR_ENTROPY_SYNC_IDC
    191178  Void    decodePPS                   ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet    )    { m_pcEntropyDecoderIf->parsePPS(pcPPS, parameterSet);                    }
    192 #else
    193   Void    decodePPS                   ( TComPPS* pcPPS     )    { m_pcEntropyDecoderIf->parsePPS(pcPPS);                    }
    194 #endif
    195179  Void    decodeAPS                   ( TComAPS* pAPS      )    { m_pcEntropyDecoderIf->parseAPS(pAPS);}
    196180  void decodeSEI(SEImessages& seis) { m_pcEntropyDecoderIf->parseSEI(seis); }
    197181
    198 #if LCU_SYNTAX_ALF
    199182#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
    200183  Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet, isDepth);         }
    201184#else
    202185  Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet);         }
    203 #endif
    204 #else
    205   Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl )  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl);         }
    206186#endif
    207187
     
    231211  Void decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    232212 
    233 #if !UNIFIED_TRANSFORM_TREE
    234   Void decodeTransformIdx      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    235 #endif
    236 #if UNIFIED_TRANSFORM_TREE
    237213  Void decodeQP                ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    238 #else
    239   Void decodeQP                ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    240 #endif
    241214 
    242215  Void readTileMarker         ( UInt& uiTileIdx, UInt uiBitsUsed )  {  m_pcEntropyDecoderIf->readTileMarker( uiTileIdx, uiBitsUsed ); }
     
    245218 
    246219private:
    247 #if UNIFIED_TRANSFORM_TREE
    248220  Void xDecodeTransform        ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP );
    249 #else
    250   Void xDecodeTransformSubdiv  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 );
    251  
    252   Void xDecodeCoeff            ( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP );
    253 #endif //UNIFIED_TRANSFORM_TREE
    254221
    255222public:
     
    261228  Void setSliceGranularity (Int iSliceGranularity) {m_pcEntropyDecoderIf->setSliceGranularity(iSliceGranularity);}
    262229
    263 #if SAO_UNIT_INTERLEAVING
    264230  Void decodeSaoParam         (SAOParam* saoParam);
    265231  void decodeSaoLcu(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool &repeatedRow );
    266232  Void decodeSaoOneLcu(SaoLcuParam* saoLcuParam);
    267 #endif
    268 
    269 #if OL_FLUSH
     233
    270234  Void decodeFlush() { m_pcEntropyDecoderIf->decodeFlush(); }
    271 #endif
    272235 
    273236#if RWTH_SDC_DLT_B0036
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.cpp

    r289 r294  
    7979Void TDecGop::destroy()
    8080{
    81 #if LCU_SYNTAX_ALF
    8281  m_alfParamSetPilot.releaseALFParam();
    83 #endif
    8482}
    8583
     
    120118// Private member functions
    121119// ====================================================================================================================
    122 #if LCU_SYNTAX_ALF
    123120Void TDecGop::patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr)
    124121{
     
    195192}
    196193
    197 #endif
    198194// ====================================================================================================================
    199195// Public member functions
     
    279275        if(pcSlice->getAlfEnabledFlag())
    280276        {
    281 #if LCU_SYNTAX_ALF
    282277          if(pcSlice->getSPS()->getUseALFCoefInSlice())
    283278          {
     
    289284          if( !pcSlice->getSPS()->getUseALFCoefInSlice())
    290285          {
    291 #endif
    292286          m_vAlfCUCtrlSlices.push_back(m_cAlfCUCtrlOneSlice);
    293 #if LCU_SYNTAX_ALF
    294287          }
    295 #endif
    296288        }
    297289      }
     
    323315    m_pcSliceDecoder->decompressSlice( pcBitstream, ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders);
    324316    m_pcEntropyDecoder->setBitstream(  ppcSubstreams[uiNumSubstreams-1] );
    325 #if WPP_SIMPLIFICATION
    326317    if ( uiNumSubstreams > 1 )
    327 #else
    328     if ( pcSlice->getPPS()->getEntropyCodingSynchro() )
    329 #endif
    330318    {
    331319      // deallocate all created substreams, including internal buffers.
     
    356344    Bool bLFCrossTileBoundary = (pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)?
    357345                                (pcSlice->getPPS()->getLFCrossTileBoundaryFlag()):(pcSlice->getPPS()->getSPS()->getLFCrossTileBoundaryFlag());
    358 #if DBL_CONTROL
    359346    if (pcSlice->getPPS()->getDeblockingFilterControlPresent())
    360347    {
    361 #endif
    362348      if(pcSlice->getSPS()->getUseDF())
    363349      {
     
    372358        }
    373359      }
    374 #if DBL_CONTROL
    375360    }
    376361    m_pcLoopFilter->setCfg(pcSlice->getPPS()->getDeblockingFilterControlPresent(), pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary);
    377 #else
    378     m_pcLoopFilter->setCfg(pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary);
    379 #endif
    380362    m_pcLoopFilter->loopFilterPic( rpcPic );
    381363
     
    392374      if(pcSlice->getSaoEnabledFlag())
    393375      {
    394 #if SAO_UNIT_INTERLEAVING
    395376        if (pcSlice->getSaoInterleavingFlag())
    396377        {
     
    402383        }
    403384        m_pcSAO->setSaoInterleavingFlag(pcSlice->getAPS()->getSaoInterleavingFlag());
    404 #endif
    405385        m_pcSAO->createPicSaoInfo(rpcPic, m_uiILSliceCount);
    406386        m_pcSAO->SAOProcess(rpcPic, pcSlice->getAPS()->getSaoParam()); 
     
    413393    if( pcSlice->getSPS()->getUseALF() )
    414394    {
    415 #if LCU_SYNTAX_ALF
    416395      if( (pcSlice->getSPS()->getUseALFCoefInSlice())?(true):(pcSlice->getAlfEnabledFlag()))
    417 #else
    418       if(pcSlice->getAlfEnabledFlag())
    419 #endif
    420       {
    421 
    422 #if LCU_SYNTAX_ALF
     396      {
     397
    423398        if(!pcSlice->getSPS()->getUseALFCoefInSlice())
    424399        {
     
    427402        m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount, pcSlice->getSliceQp());
    428403        m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, m_vAlfCUCtrlSlices, pcSlice->getSPS()->getUseALFCoefInSlice());
    429 #else
    430         m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount);
    431       m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, pcSlice->getAPS()->getAlfParam(), m_vAlfCUCtrlSlices);
    432 #endif
    433404      m_pcAdaptiveLoopFilter->PCMLFDisableProcess(rpcPic);
    434405      m_pcAdaptiveLoopFilter->destroyPicAlfInfo();
    435406      }
    436 #if LCU_SYNTAX_ALF
    437407      m_pcAdaptiveLoopFilter->resetLCUAlfInfo(); //reset all LCU ALFParam->alf_flag = 0
    438 #endif   
    439408    }
    440409   
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.h

    r56 r294  
    101101  bool m_pictureDigestEnabled; ///< if true, handle picture_digest SEI messages
    102102  AlfCUCtrlInfo       m_cAlfCUCtrlOneSlice;
    103 #if LCU_SYNTAX_ALF
    104103  AlfParamSet           m_alfParamSetPilot;
    105 #endif
    106104
    107105public:
     
    131129  void setPictureDigestEnabled(bool enabled) { m_pictureDigestEnabled = enabled; }
    132130  AlfCUCtrlInfo& getAlfCuCtrlParam() { return m_cAlfCUCtrlOneSlice; }
    133 #if LCU_SYNTAX_ALF
    134131  AlfParamSet& getAlfParamSet() {return m_alfParamSetPilot;}
    135 #endif
    136132
    137133private:
    138 #if LCU_SYNTAX_ALF
    139134  Void patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr = 0);
    140 #endif
    141135
    142136
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp

    r292 r294  
    8787, m_cALFUvlcSCModel           ( 1,             1,               NUM_ALF_UVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    8888, m_cALFSvlcSCModel           ( 1,             1,               NUM_ALF_SVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    89 #if AMP_CTX
    9089, m_cCUAMPSCModel             ( 1,             1,               NUM_CU_AMP_CTX                , m_contextModels + m_numContextModels, m_numContextModels)
    91 #else
    92 , m_cCUXPosiSCModel           ( 1,             1,               NUM_CU_X_POS_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    93 , m_cCUYPosiSCModel           ( 1,             1,               NUM_CU_Y_POS_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    94 #endif
    9590, m_cSaoFlagSCModel           ( 1,             1,               NUM_SAO_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    9691, m_cSaoUvlcSCModel           ( 1,             1,               NUM_SAO_UVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    9792, m_cSaoSvlcSCModel           ( 1,             1,               NUM_SAO_SVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    98 #if SAO_UNIT_INTERLEAVING
    9993, m_cSaoMergeLeftSCModel      ( 1,             1,               NUM_SAO_MERGE_LEFT_FLAG_CTX   , m_contextModels + m_numContextModels, m_numContextModels)
    10094, m_cSaoMergeUpSCModel        ( 1,             1,               NUM_SAO_MERGE_UP_FLAG_CTX     , m_contextModels + m_numContextModels, m_numContextModels)
    10195, m_cSaoTypeIdxSCModel        ( 1,             1,               NUM_SAO_TYPE_IDX_CTX          , m_contextModels + m_numContextModels, m_numContextModels)
    102 #endif
    10396#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    10497, m_cDmmFlagSCModel           ( 1,             1,               NUM_DMM_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     
    171164  m_cCUAlfCtrlFlagSCModel.initBuffer     ( sliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG );
    172165  m_cCUPartSizeSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_PART_SIZE );
    173 #if AMP_CTX
    174166  m_cCUAMPSCModel.initBuffer             ( sliceType, qp, (UChar*)INIT_CU_AMP_POS );
    175 #else
    176   m_cCUXPosiSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_CU_X_POS );
    177   m_cCUYPosiSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_CU_Y_POS );
    178 #endif
    179167  m_cCUPredModeSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_PRED_MODE );
    180168  m_cCUIntraPredSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE );
     
    199187  m_cSaoUvlcSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_SAO_UVLC );
    200188  m_cSaoSvlcSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_SAO_SVLC );
    201 #if SAO_UNIT_INTERLEAVING
    202189  m_cSaoMergeLeftSCModel.initBuffer      ( sliceType, qp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
    203190  m_cSaoMergeUpSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
    204191  m_cSaoTypeIdxSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX );
    205 #endif
    206192
    207193  m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
     
    265251  m_cCUAlfCtrlFlagSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG );
    266252  m_cCUPartSizeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PART_SIZE );
    267 #if AMP_CTX
    268253  m_cCUAMPSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS );
    269 #else
    270   m_cCUXPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_X_POS );
    271   m_cCUYPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_Y_POS );
    272 #endif
    273254  m_cCUPredModeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PRED_MODE );
    274255  m_cCUIntraPredSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE );
     
    293274  m_cSaoUvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC );
    294275  m_cSaoSvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC );
    295 #if SAO_UNIT_INTERLEAVING
    296276  m_cSaoMergeLeftSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
    297277  m_cSaoMergeUpSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
    298278  m_cSaoTypeIdxSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX );
    299 #endif
    300279  m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
    301280#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    449428  }
    450429
    451 #if EIGHT_BITS_RICE_CODE
    452430  ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 23 ) ];
    453 #else
    454   ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 15 ) ];
    455 #endif
    456431
    457432  return;
     
    470445{
    471446  UInt uiSymbol;
    472 #if BURST_IPCM
    473447  Int numSubseqIPCM = 0;
    474448  Bool readPCMSampleFlag = false;
     
    490464    }
    491465  }
    492 #else
    493   m_pcTDecBinIf->decodeBinTrm(uiSymbol);
    494 #endif
    495 
    496 #if BURST_IPCM
     466
    497467  if (readPCMSampleFlag == true)
    498 #else
    499   if (uiSymbol)
    500 #endif
    501468  {
    502469    Bool bIpcmFlag = true;
    503470
    504 #if !BURST_IPCM
    505     m_pcTDecBinIf->decodePCMAlignBits();
    506 #endif
    507471
    508472    pcCU->setPartSizeSubParts  ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
     
    568532    }
    569533
    570 #if BURST_IPCM
    571534    pcCU->setNumSucIPCM( pcCU->getNumSucIPCM() - 1);
    572535    if(pcCU->getNumSucIPCM() == 0)
     
    574537      m_pcTDecBinIf->resetBac();
    575538    }
    576 #else
    577     m_pcTDecBinIf->resetBac();
    578 #endif
    579539  }
    580540}
     
    664624{
    665625  UInt uiNumCand = MRG_MAX_NUM_CANDS;
    666 #if !MRG_IDX_CTX_RED 
    667   UInt auiCtx[4] = { 0, 1, 2, 3 };
    668 #endif
    669626  UInt uiUnaryIdx = 0;
    670627  uiNumCand = pcCU->getSlice()->getMaxNumMergeCand();
     
    678635    {
    679636      UInt uiSymbol = 0;
    680 #if MRG_IDX_CTX_RED
    681637      if ( uiUnaryIdx==0 )
    682638      {
     
    687643        m_pcTDecBinIf->decodeBinEP( uiSymbol );
    688644      }
    689 #else
    690       m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, auiCtx[uiUnaryIdx] ) );
    691 #endif
    692645      if( uiSymbol == 0 )
    693646      {
     
    879832        if (eMode == SIZE_2NxN)
    880833        {
    881 #if AMP_CTX
    882834            m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 ));
    883 #else
    884           m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUYPosiSCModel.get( 0, 0, 0 ));
    885 #endif
    886835          if (uiSymbol == 0)
    887836          {
    888 #if AMP_CTX
    889837            m_pcTDecBinIf->decodeBinEP(uiSymbol);
    890 #else
    891             m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUYPosiSCModel.get( 0, 0, 1 ));
    892 #endif
    893838            eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
    894839          }
     
    896841        else if (eMode == SIZE_Nx2N)
    897842        {
    898 #if AMP_CTX
    899843          m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 ));
    900 #else
    901           m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUXPosiSCModel.get( 0, 0, 0 ));
    902 #endif
    903844          if (uiSymbol == 0)
    904845          {
    905 #if AMP_CTX
    906846            m_pcTDecBinIf->decodeBinEP(uiSymbol);
    907 #else
    908             m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUXPosiSCModel.get( 0, 0, 1 ));
    909 #endif
    910847            eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
    911848          }
     
    989926  {
    990927#endif
    991 #if !LOGI_INTRA_NAME_3MPM
    992     Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx);
    993 #endif
    994928
    995929#if LGE_EDGE_INTRA_A0070
     
    1003937#endif
    1004938
    1005 #if LOGI_INTRA_NAME_3MPM
    1006939    Int uiPreds[3] = {-1, -1, -1};
    1007 #else
    1008     Int uiPreds[2] = {-1, -1};
    1009 #endif
    1010940    Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); 
    1011941#if LGE_EDGE_INTRA_A0070
     
    1018948    {
    1019949      m_pcTDecBinIf->decodeBinEP( uiSymbol );
    1020 #if LOGI_INTRA_NAME_3MPM
    1021950      if (uiSymbol)
    1022951      {
     
    1024953        uiSymbol++;
    1025954      }
    1026 #endif
    1027955      intraPredMode = uiPreds[uiSymbol];
    1028956    }
     
    1031959      intraPredMode = 0;
    1032960
    1033 #if LOGI_INTRA_NAME_3MPM
    1034961
    1035962      m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 );
     
    1060987        std::swap(uiPreds[1], uiPreds[2]);
    1061988      }
    1062 #else
    1063       m_pcTDecBinIf->decodeBinsEP( uiSymbol, g_aucIntraModeBitsAng[iIntraIdx] - 1 );
    1064       intraPredMode = uiSymbol;
    1065 
    1066       if ( intraPredMode == 31 )
    1067       {
    1068         m_pcTDecBinIf->decodeBinEP( uiSymbol );
    1069         intraPredMode += uiSymbol;     
    1070       }
    1071 #endif
    1072989#if LGE_EDGE_INTRA_A0070
    1073990      if ( intraPredMode != EDGE_INTRA_IDX)
     
    11581075    {
    11591076      UInt uiIPredMode;
    1160 #if CHROMA_MODE_CODING
    11611077      m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 );
    1162 #else
    1163       xReadUnaryMaxSymbol( uiIPredMode, m_cCUChromaPredSCModel.get( 0, 0 ) + 1, 0, 3 );
    1164 #endif
    11651078      UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ];
    11661079      pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir );
     
    12301143  ContextModel *pCtx = m_cCUMvdSCModel.get( 0 );
    12311144
    1232 #if H0111_MVD_L1_ZERO
    12331145  if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3)
    12341146  {
     
    12381150  else
    12391151  {
    1240 #endif
    12411152
    12421153    m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx );
     
    12811192    }
    12821193
    1283 #if H0111_MVD_L1_ZERO
    1284   }
    1285 #endif
     1194  }
    12861195
    12871196  const TComMv cMv( uiHorSign ? -Int( uiHorAbs ): uiHorAbs, uiVerSign ? -Int( uiVerAbs ) : uiVerAbs );
     
    13231232Void TDecSbac::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    13241233{
    1325 #if H0736_AVC_STYLE_QP_RANGE
    13261234  Int qp;
    1327 #endif
    13281235  UInt uiDQp;
    13291236  Int  iDQp;
     
    13331240  if ( uiDQp == 0 )
    13341241  {
    1335 #if H0736_AVC_STYLE_QP_RANGE
    13361242    qp = pcCU->getRefQP(uiAbsPartIdx);
    1337 #else
    1338     uiDQp = pcCU->getRefQP(uiAbsPartIdx);
    1339 #endif
    13401243  }
    13411244  else
    13421245  {
    13431246    UInt uiSign;
    1344 #if H0736_AVC_STYLE_QP_RANGE
    13451247    Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY();
    1346 #else
    1347     UInt uiQpBdOffsetY = 6*(g_uiBitIncrement + g_uiBitDepth - 8);
    1348 #endif
    13491248    m_pcTDecBinIf->decodeBinEP(uiSign);
    13501249
    1351 #if H0736_AVC_STYLE_QP_RANGE
    13521250    UInt uiMaxAbsDQpMinus1 = 24 + (qpBdOffsetY/2) + (uiSign);
    1353 #else
    1354     UInt uiMaxAbsDQpMinus1 = 24 + (uiQpBdOffsetY/2) + (uiSign);
    1355 #endif
    13561251    UInt uiAbsDQpMinus1;
    13571252    xReadUnaryMaxSymbol (uiAbsDQpMinus1,  &m_cCUDeltaQpSCModel.get( 0, 0, 1 ), 1, uiMaxAbsDQpMinus1);
     
    13641259    }
    13651260
    1366 #if H0736_AVC_STYLE_QP_RANGE
    13671261    qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY;
    1368 #else
    1369 #if LOSSLESS_CODING
    1370     uiDQp = (pcCU->getRefQP(uiAbsPartIdx) + iDQp + 52) % 52;
    1371 #else
    1372     uiDQp = pcCU->getRefQP(uiAbsPartIdx) + iDQp;
    1373 #endif
    1374 #endif
    13751262  }
    13761263 
    13771264  UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ;
    13781265  UInt uiQpCUDepth =   min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ;
    1379 #if H0736_AVC_STYLE_QP_RANGE
    13801266  pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth );
    1381 #else
    1382   pcCU->setQPSubParts( uiDQp, uiAbsQpCUPartIdx, uiQpCUDepth );
    1383 #endif
    13841267}
    13851268
     
    14221305
    14231306  // posX
    1424 #if LAST_CTX_REDUCTION
    14251307  Int widthCtx = eTType ? 4 : width;
    14261308  const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ widthCtx ] * ( g_aucConvertToBit[ widthCtx ] + 3 ) );
    1427 #else
    1428   const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ width ] * ( g_aucConvertToBit[ width ] + 3 ) );
    1429 #endif
    14301309  for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ )
    14311310  {
    1432 #if LAST_CTX_REDUCTION
    14331311    if ( eTType  )
    14341312    {
     
    14371315    else
    14381316    {
    1439 #endif
    14401317      m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + puiCtxIdxX[ uiPosLastX ] ) );
    1441 #if LAST_CTX_REDUCTION
    1442     }
    1443 #endif
     1318    }
    14441319    if( !uiLast )
    14451320    {
     
    14491324
    14501325  // posY
    1451 #if LAST_CTX_REDUCTION
    14521326  Int heightCtx = eTType? 4 : height;
    14531327  const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ heightCtx ] * ( g_aucConvertToBit[ heightCtx ] + 3 ) );
    1454 #else
    1455   const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ height ] * ( g_aucConvertToBit[ height ] + 3 ) );
    1456 #endif
    14571328  for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ )
    14581329  {
    1459 #if LAST_CTX_REDUCTION
    14601330    if (eTType)
    14611331    {
     
    14641334    else
    14651335    {
    1466 #endif
    14671336      m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + puiCtxIdxY[ uiPosLastY ] ) );
    1468 #if LAST_CTX_REDUCTION
    1469     }
    1470 #endif
     1337    }
    14711338    if( !uiLast )
    14721339    {
     
    15881455  UInt uiGoRiceParam           = 0;
    15891456
    1590 #if MULTIBITS_DATA_HIDING
    15911457  UInt const tsig = pcCU->getSlice()->getPPS()->getTSIG();
    15921458#if LOSSLESS_CODING
     
    16041470#endif
    16051471  UInt absSum = 0;
    1606 #endif  // MULTIBITS_DATA_HIDING
    16071472
    16081473  UInt uiSigCoeffGroupFlag[ MLS_GRP_NUM ];
     
    16131478  {
    16141479    scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0  ];   
    1615 #if MULTILEVEL_SIGMAP_EXT
    16161480    if( uiLog2BlockSize == 3 )
    16171481    {
     
    16221486      scanCG = g_sigLastScanCG32x32;
    16231487    }
    1624 #endif
    16251488  }
    16261489  else
     
    16351498    Int numNonZero = 0;
    16361499   
    1637 #if MULTIBITS_DATA_HIDING
    16381500    Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE;
    1639 #endif
    16401501
    16411502    Int pos[SCAN_SET_SIZE];
    16421503    if( iScanPosSig == (Int) uiScanPosLast )
    16431504    {
    1644 #if MULTIBITS_DATA_HIDING
    16451505      lastNZPosInCG  = iScanPosSig;
    16461506      firstNZPosInCG = iScanPosSig;
    1647 #endif
    16481507      iScanPosSig--;
    16491508      pos[ numNonZero ] = uiBlkPosLast;
     
    16511510    }
    16521511
    1653 #if !MULTILEVEL_SIGMAP_EXT
    1654     if( blockType > 3 )
    1655     {
    1656 #endif
    16571512      // decode significant_coeffgroup_flag
    16581513      Int iCGBlkPos = scanCG[ iSubSet ];
    16591514      Int iCGPosY   = iCGBlkPos / uiNumBlkSide;
    16601515      Int iCGPosX   = iCGBlkPos - (iCGPosY * uiNumBlkSide);
    1661 #if MULTILEVEL_SIGMAP_EXT
    16621516      if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) )
    16631517      {
     
    16651519        iCGPosX = (uiScanIdx == SCAN_VER ? iCGBlkPos : 0);
    16661520      }
    1667 #endif
    1668 #if !REMOVE_INFER_SIGGRP
    1669       Bool bInferredCGFlag = false;
    1670 #endif
    1671 #if REMOVE_INFER_SIGGRP
    16721521      if( iSubSet == iLastScanSet || iSubSet == 0)
    1673 #else
    1674       if( iSubSet == iLastScanSet )
    1675 #endif
    16761522      {
    16771523        uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;
     
    16791525      else
    16801526      {
    1681 #if !REMOVE_INFER_SIGGRP
    1682 #if MULTILEVEL_SIGMAP_EXT
    1683         if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight) && ( iSubSet ) )
    1684 #else
    1685         if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight) && ( iSubSet ) )
    1686 #endif
    1687         {
    1688 #endif
    16891527          UInt uiSigCoeffGroup;
    1690 #if MULTILEVEL_SIGMAP_EXT
    16911528          UInt uiCtxSig  = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight );
    1692 #else
    1693           UInt uiCtxSig  = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight );
    1694 #endif
    16951529          m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] );
    16961530          uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup;
    1697 #if !REMOVE_INFER_SIGGRP
    1698         }
    1699         else
    1700         {
    1701           uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;
    1702           bInferredCGFlag = true;
    1703         }
    1704 #endif
    17051531      }
    17061532
     
    17161542        if( uiSigCoeffGroupFlag[ iCGBlkPos ] )
    17171543        {
    1718 #if REMOVE_INFER_SIGGRP
    17191544          if( iScanPosSig > iSubPos || iSubSet == 0  || numNonZero )
    1720 #else
    1721           if( iScanPosSig > iSubPos || bInferredCGFlag || numNonZero )
    1722 #endif
    17231545          {
    17241546            uiCtxSig  = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
     
    17351557          pos[ numNonZero ] = uiBlkPos;
    17361558          numNonZero ++;
    1737 #if MULTIBITS_DATA_HIDING
    17381559          if( lastNZPosInCG == -1 )
    17391560          {
     
    17411562          }
    17421563          firstNZPosInCG = iScanPosSig;
    1743 #endif
    17441564        }
    17451565      }
    1746 #if !MULTILEVEL_SIGMAP_EXT
    1747     }
    1748     else
    1749     {
    1750       for( ; iScanPosSig >= iSubPos; iScanPosSig-- )
    1751       {
    1752         UInt uiBlkPos   = scan[ iScanPosSig ];
    1753         UInt  uiPosY    = uiBlkPos >> uiLog2BlockSize;
    1754         UInt  uiPosX    = uiBlkPos - ( uiPosY << uiLog2BlockSize );
    1755         UInt  uiSig     = 0;
    1756         UInt  uiCtxSig  = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
    1757         m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] );
    1758         pcCoef[ uiBlkPos ] = uiSig;
    1759         if( uiSig )
    1760         {
    1761           pos[ numNonZero ] = uiBlkPos;
    1762           numNonZero ++;
    1763 #if MULTIBITS_DATA_HIDING
    1764           if( lastNZPosInCG == -1 )
    1765           {
    1766             lastNZPosInCG = iScanPosSig;
    1767           }
    1768           firstNZPosInCG = iScanPosSig;
    1769 #endif
    1770         }
    1771       }
    1772     }
    1773 #endif
    17741566
    17751567   
    17761568    if( numNonZero )
    17771569    {
    1778 #if MULTIBITS_DATA_HIDING
    17791570      Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= (Int)tsig );
    17801571      absSum = 0;
    1781 #endif  // MULTIBITS_DATA_HIDING
    17821572
    17831573      UInt c1 = 1;
    1784 #if !RESTRICT_GR1GR2FLAG_NUMBER
    1785       UInt c2 = 0;
    1786 #endif
    1787 #if LEVEL_CTX_LUMA_RED
    17881574      UInt uiCtxSet    = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0;
    1789 #else
    1790       UInt uiCtxSet    = (iSubSet > 0 && eTType==TEXT_LUMA) ? 3 : 0;
    1791 #endif
    17921575      UInt uiBin;
    17931576     
     
    17951578      {
    17961579        uiCtxSet++;
    1797 #if !LEVEL_CTX_LUMA_RED
    1798         if(eTType==TEXT_LUMA && uiNumOne > 3)
    1799         {
    1800           uiCtxSet++;
    1801         }
    1802 #endif
    18031580      }
    18041581     
     
    18071584      Int absCoeff[SCAN_SET_SIZE];
    18081585
    1809 #if RESTRICT_GR1GR2FLAG_NUMBER
    18101586      for ( Int i = 0; i < numNonZero; i++) absCoeff[i] = 1;   
    18111587      Int numC1Flag = min(numNonZero, C1FLAG_NUMBER);
     
    18131589
    18141590      for( Int idx = 0; idx < numC1Flag; idx++ )
    1815 #else
    1816       for( Int idx = 0; idx < numNonZero; idx++ )
    1817 #endif
    18181591      {
    18191592        m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c1] );
     
    18211594        {
    18221595          c1 = 0;
    1823 #if RESTRICT_GR1GR2FLAG_NUMBER
    18241596          if (firstC2FlagIdx == -1)
    18251597          {
    18261598            firstC2FlagIdx = idx;
    18271599          }
    1828 #endif
    18291600        }
    18301601        else if( (c1 < 3) && (c1 > 0) )
     
    18371608      if (c1 == 0)
    18381609      {
    1839 #if RESTRICT_GR1GR2FLAG_NUMBER
    18401610        baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet;
    18411611        if ( firstC2FlagIdx != -1)
     
    18441614          absCoeff[ firstC2FlagIdx ] = uiBin + 2;
    18451615        }
    1846 #else   
    1847         baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + 3 * uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + 3 * uiCtxSet;
     1616      }
     1617
     1618      UInt coeffSigns;
     1619      if ( signHidden && beValid )
     1620      {
     1621        m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 );
     1622        coeffSigns <<= 32 - (numNonZero-1);
     1623      }
     1624      else
     1625      {
     1626        m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );
     1627        coeffSigns <<= 32 - numNonZero;
     1628      }
     1629     
     1630      Int iFirstCoeff2 = 1;   
     1631      if (c1 == 0 || numNonZero > C1FLAG_NUMBER)
     1632      {
    18481633        for( Int idx = 0; idx < numNonZero; idx++ )
    18491634        {
    1850           if( absCoeff[ idx ] == 2 )
    1851           {
    1852             m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c2] );
    1853             absCoeff[ idx ] = uiBin + 2;
    1854             c2 += (c2 < 2);
    1855             uiNumOne++;
    1856           }
    1857         }
    1858 #endif
    1859       }
    1860 
    1861 #if MULTIBITS_DATA_HIDING
    1862       UInt coeffSigns;
    1863       if ( signHidden && beValid )
    1864       {
    1865         m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 );
    1866         coeffSigns <<= 32 - (numNonZero-1);
    1867       }
    1868       else
    1869       {
    1870         m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );
    1871         coeffSigns <<= 32 - numNonZero;
    1872       }
    1873 #else
    1874       UInt coeffSigns;
    1875       m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );
    1876       coeffSigns <<= 32 - numNonZero;
    1877 #endif
    1878      
    1879 #if RESTRICT_GR1GR2FLAG_NUMBER
    1880       Int iFirstCoeff2 = 1;   
    1881       if (c1 == 0 || numNonZero > C1FLAG_NUMBER)
    1882 #else
    1883       if (c1 == 0)
    1884 #endif
    1885       {
    1886         for( Int idx = 0; idx < numNonZero; idx++ )
    1887         {
    1888 #if RESTRICT_GR1GR2FLAG_NUMBER   
    18891635          UInt baseLevel  = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2) : 1;
    18901636
     
    19011647            uiNumOne++;
    19021648          }
    1903 #else
    1904           if( absCoeff[ idx ] == 3 )
    1905           {
    1906             UInt uiLevel;
    1907             xReadGoRiceExGolomb( uiLevel, uiGoRiceParam );
    1908             absCoeff[ idx ] = uiLevel + 3;
    1909           }
    1910 #endif
    19111649        }
    19121650      }
     
    19151653      {
    19161654        Int blkPos = pos[ idx ];
    1917 #if MULTIBITS_DATA_HIDING
    19181655        // Signs applied later.
    19191656        pcCoef[ blkPos ] = absCoeff[ idx ];
     
    19321669          coeffSigns <<= 1;
    19331670        }
    1934 #else
    1935         Int sign = static_cast<Int>( coeffSigns ) >> 31;
    1936         pcCoef[ blkPos ] = ( absCoeff[ idx ] ^ sign ) - sign;
    1937         coeffSigns <<= 1;
    1938 #endif
    19391671      }
    19401672    }
     
    19491681
    19501682
    1951 #if SAO_UNIT_INTERLEAVING
    19521683Void TDecSbac::parseSaoUvlc (UInt& ruiVal)
    19531684{
     
    21861917  }
    21871918}
    2188 #endif
    21891919
    21901920/**
     
    22171947}
    22181948
    2219 #if OL_FLUSH
    22201949Void TDecSbac::decodeFlush ( )
    22211950{
     
    22251954
    22261955}
    2227 #endif
    22281956
    22291957#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX || (LGE_EDGE_INTRA_A0070 && LGE_EDGE_INTRA_DELTA_DC)
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.h

    r292 r294  
    7474  Void xCopyFrom           ( TDecSbac* pSrc );
    7575  Void xCopyContextsFrom       ( TDecSbac* pSrc );
    76 #if OL_FLUSH
    7776  Void decodeFlush();
    78 #endif
    7977
    8078#if CABAC_INIT_FLAG
     
    9593  Void  parseSPS                  ( TComSPS* pcSPS         ) {}
    9694#endif
    97 #if TILES_OR_ENTROPY_SYNC_IDC 
    9895  Void  parsePPS                  ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet         ) {}
    99 #else
    100   Void  parsePPS                  ( TComPPS* pcPPS         ) {}
    101 #endif
    10296  Void  parseAPS                  ( TComAPS* pAPS          ) {}
    10397  void parseSEI(SEImessages&) {}
    10498
    105 #if LCU_SYNTAX_ALF
    10699#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
    107100  Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) {}
    108101#else
    109102  Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) {}
    110 #endif
    111 #else
    112   Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl ) {}
    113103#endif
    114104
     
    120110#endif
    121111 
    122 #if SAO_UNIT_INTERLEAVING
    123112  Void  parseSaoUvlc              ( UInt& ruiVal           );
    124113  Void  parseSaoSvlc              ( Int&  riVal            );
     
    129118  Void  parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag);
    130119  Void  parseSaoOffset            (SaoLcuParam* psSaoLcuParam);
    131 #endif
    132120 
    133121#if RWTH_SDC_DLT_B0036
     
    256244  ContextModel3DBuffer m_cALFUvlcSCModel;
    257245  ContextModel3DBuffer m_cALFSvlcSCModel;
    258 #if AMP_CTX
    259246  ContextModel3DBuffer m_cCUAMPSCModel;
    260 #else
    261   ContextModel3DBuffer m_cCUXPosiSCModel;
    262   ContextModel3DBuffer m_cCUYPosiSCModel;
    263 #endif
    264247  ContextModel3DBuffer m_cSaoFlagSCModel;
    265248  ContextModel3DBuffer m_cSaoUvlcSCModel;
    266249  ContextModel3DBuffer m_cSaoSvlcSCModel;
    267 #if SAO_UNIT_INTERLEAVING
    268250  ContextModel3DBuffer m_cSaoMergeLeftSCModel;
    269251  ContextModel3DBuffer m_cSaoMergeUpSCModel;
    270252  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
    271 #endif
    272253
    273254#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSlice.cpp

    r210 r294  
    148148  UInt uiCol=0, uiLin=0, uiSubStrm=0;
    149149
    150 #if !REMOVE_TILE_DEPENDENCE
    151   Int iBreakDep;
    152 #endif
    153150  UInt uiTileCol;
    154151  UInt uiTileStartLCU;
     
    163160    pcCU = rpcPic->getCU( iCUAddr );
    164161    pcCU->initCU( rpcPic, iCUAddr );
    165 #if !REMOVE_TILE_DEPENDENCE
    166     iBreakDep = rpcPic->getPicSym()->getTileBoundaryIndependenceIdr();
    167 #endif
    168162    uiTileCol = rpcPic->getPicSym()->getTileIdxMap(iCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // what column of tiles are we in?
    169163    uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr();
     
    175169    uiLin     = iCUAddr / uiWidthInLCUs;
    176170    // inherit from TR if necessary, select substream to use.
    177 #if WPP_SIMPLIFICATION
    178171    if( iSymbolMode && pcSlice->getPPS()->getNumSubstreams() > 1 )
    179 #else
    180     if( iSymbolMode && pcSlice->getPPS()->getEntropyCodingSynchro() )
    181 #endif
    182     {
    183 #if !REMOVE_TILE_DEPENDENCE
    184 #if WPP_SIMPLIFICATION
    185       if (iBreakDep && pcSlice->getPPS()->getNumSubstreams() > 1)
    186 #else
    187       if (iBreakDep && pcSlice->getPPS()->getEntropyCodingSynchro())
    188 #endif
    189 #else
    190 #if WPP_SIMPLIFICATION
     172    {
    191173      if (pcSlice->getPPS()->getNumSubstreams() > 1)
    192 #else
    193       if (pcSlice->getPPS()->getEntropyCodingSynchro())
    194 #endif
    195 #endif
    196174      {
    197175        // independent tiles => substreams are "per tile".  iNumSubstreams has already been multiplied.
     
    207185      m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] );
    208186      // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line.
    209 #if WPP_SIMPLIFICATION
    210187      if (pcSlice->getPPS()->getNumSubstreams() > 1 && uiCol == uiTileLCUX)
    211 #else
    212       if (pcSlice->getPPS()->getEntropyCodingSynchro() && uiCol == uiTileLCUX)
    213 #endif
    214188      {
    215189        // We'll sync if the TR is available.
     
    217191        UInt uiWidthInCU = rpcPic->getFrameWidthInCU();
    218192        TComDataCU *pcCUTR = NULL;
    219 #if WPP_SIMPLIFICATION
    220193        if ( pcCUUp && ((iCUAddr%uiWidthInCU+1) < uiWidthInCU)  )
    221194        {
    222195          pcCUTR = rpcPic->getCU( iCUAddr - uiWidthInCU + 1 );
    223196        }
    224 #else
    225         if ( pcCUUp && ((iCUAddr%uiWidthInCU+pcSlice->getPPS()->getEntropyCodingSynchro()) < uiWidthInCU)  )
    226         {
    227           pcCUTR = rpcPic->getCU( iCUAddr - uiWidthInCU + pcSlice->getPPS()->getEntropyCodingSynchro() );
    228         }
    229 #endif
    230197        UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
    231198
     
    233200             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    234201             ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr()) ||
    235 #if !REMOVE_TILE_DEPENDENCE
    236              (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
    237 #else
    238202             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
    239 #endif
    240203             ))||
    241204             (true/*bEnforceEntropySliceRestriction*/ &&
    242205             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    243206             ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr()) ||
    244 #if !REMOVE_TILE_DEPENDENCE
    245              (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
    246 #else
    247207             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
    248 #endif
    249208             ))
    250209           )
     
    260219      pcSbacDecoder->load(&pcSbacDecoders[uiSubStrm]);  //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders)
    261220    }
    262 #if WPP_SIMPLIFICATION
    263221    else if ( iSymbolMode && pcSlice->getPPS()->getNumSubstreams() <= 1 )
    264 #else
    265     else if ( iSymbolMode && !pcSlice->getPPS()->getEntropyCodingSynchro() )
    266 #endif
    267222    {
    268223      // Set variables to appropriate values to avoid later code change.
     
    273228         (iCUAddr!=0) && (iCUAddr!=rpcPic->getPicSym()->getPicSCUAddr(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceCurStartCUAddr())/rpcPic->getNumPartInCU())) // !1st in frame && !1st in slice
    274229    {
    275 #if WPP_SIMPLIFICATION
    276230      if (pcSlice->getPPS()->getNumSubstreams() > 1)
    277 #else
    278       if (pcSlice->getPPS()->getEntropyCodingSynchro())
    279 #endif
    280231      {
    281232        // We're crossing into another tile, tiles are independent.
     
    330281    }
    331282
    332 #if !REMOVE_TILE_DEPENDENCE
    333     if ( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
    334     {   
    335       // Synchronize cabac probabilities with LCU among Tiles
    336       if( (uiTileLCUX != 0) &&
    337           (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) )
    338       {       
    339         TComDataCU *pcCULeft = pcCU->getCULeft();
    340         UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
    341 
    342         if ( (true/*bEnforceSliceRestriction*/ &&
    343               ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||
    344                ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr())
    345               )
    346              )||
    347              (true/*bEnforceEntropySliceRestriction*/ &&
    348               ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||
    349                ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr())
    350               )
    351              )
    352            )
    353         {
    354           // Left not available.
    355         }
    356         else
    357         {
    358           // Left is available, we use it.
    359           pcSbacDecoders[uiSubStrm].loadContexts( &m_pcBufferLowLatSbacDecoders[uiTileCol-1] );
    360           pcSbacDecoder->loadContexts(&pcSbacDecoders[uiSubStrm]);  //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders)
    361         }
    362       }
    363     }
    364 #endif
    365283
    366284
     
    368286    g_bJustDoIt = g_bEncDecTraceEnable;
    369287#endif
    370 #if SAO_UNIT_INTERLEAVING
    371288    if ( pcSlice->getSPS()->getUseSAO() && pcSlice->getSaoInterleavingFlag() && pcSlice->getSaoEnabledFlag() )
    372289    {
     
    384301      pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, pcSlice->getAPS()->getSaoParam(),pcCU, cuAddrInSlice, cuAddrUpInSlice, pcSlice->getSPS()->getLFCrossSliceBoundaryFlag() );
    385302    }
    386 #endif
    387303
    388304    m_pcCuDecoder->decodeCU     ( pcCU, uiIsLast );
     
    394310    if( iSymbolMode )
    395311    {
    396 #if OL_FLUSH
    397312      /*If at the end of a LCU line but not at the end of a substream, perform CABAC flush*/
    398 #if WPP_SIMPLIFICATION
    399313      if (!uiIsLast && pcSlice->getPPS()->getNumSubstreams() > 1)
    400 #else
    401       if (!uiIsLast && pcSlice->getPPS()->getCabacIstateReset())
    402 #endif
    403       {
    404 #if !REMOVE_TILE_DEPENDENCE
    405         if ((iBreakDep && (uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))
    406             || (!iBreakDep && (uiCol == uiWidthInLCUs-1) && (uiLin+iNumSubstreams < pcCU->getPic()->getFrameHeightInCU())))
    407 #else
     314      {
    408315        if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))
    409 #endif
    410316        {
    411317          m_pcEntropyDecoder->decodeFlush();
    412318        }
    413319      }
    414 #endif
    415320      pcSbacDecoders[uiSubStrm].load(pcSbacDecoder);
    416321
    417322      //Store probabilities of second LCU in line into buffer
    418 #if WPP_SIMPLIFICATION
    419323      if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiCol == uiTileLCUX+1))
    420 #else
    421       if (pcSlice->getPPS()->getEntropyCodingSynchro() && (uiCol == uiTileLCUX+pcSlice->getPPS()->getEntropyCodingSynchro()))
    422 #endif
    423324      {
    424325        m_pcBufferSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] );
     
    426327
    427328    }
    428 #if !REMOVE_TILE_DEPENDENCE
    429     if ( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
    430     {
    431       pcSbacDecoders[uiSubStrm].load(pcSbacDecoder);
    432        //Store probabilties for next tile
    433       if( (uiLin == (rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr() / uiWidthInLCUs )) &&
    434           (uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU()) )
    435       {
    436         m_pcBufferLowLatSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] );
    437       }
    438     }
    439 #endif
    440329  }
    441330
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.cpp

    r280 r294  
    525525  xUpdateGopSize(pcSlice);
    526526 
    527 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    528527  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded
    529 #else
    530   m_iMaxRefPicNum = pcSlice->getSPS()->getMaxNumberOfReferencePictures()+pcSlice->getSPS()->getNumReorderFrames() + 1; // +1 to have space for the picture currently being decoded
    531 #endif
    532528
    533529#if DEPTH_MAP_GENERATION
     
    716712  }
    717713
    718 #if !LCU_SYNTAX_ALF
    719   // create ALF temporary buffer
    720   m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
    721 #endif
    722714  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
    723715  m_cLoopFilter.        create( g_uiMaxCUDepth );
    724716}
    725717
    726 #if SKIPFRAME_BUGFIX
    727718Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
    728 #else
    729 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay )
    730 #endif
    731719{
    732720  TComPic*&   pcPic         = m_pcPic;
     
    785773  }
    786774
    787 #if NAL_REF_FLAG
    788775  m_apcSlicePilot->setReferenced(nalu.m_nalRefFlag);
    789 #else
    790   m_apcSlicePilot->setReferenced(nalu.m_nalRefIDC != NAL_REF_IDC_PRIORITY_LOWEST);
    791 #endif
    792776  m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);
    793777
    794778  // ALF CU parameters should be part of the slice header -> needs to be fixed
    795 #if LCU_SYNTAX_ALF
    796779#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
    797780  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet(),m_apcSlicePilot->getVPS()->getDepthFlag(nalu.m_layerId));
     
    799782  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet());
    800783#endif
    801 #else
    802   m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam() );
    803 #endif
    804784  // byte align
    805785  {
     
    816796  if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)
    817797  {
    818 #if START_DECODING_AT_CRA
    819798    if (m_prevPOC >= m_pocRandomAccess)
    820799    {
     
    823802    }
    824803    m_prevPOC = m_apcSlicePilot->getPOC();
    825 #else
    826     m_prevPOC = m_apcSlicePilot->getPOC();
    827     return true;
    828 #endif
    829804  }
    830805  // actual decoding starts here
     
    846821  }
    847822  //detect lost reference picture and insert copy of earlier frame.
    848 #if START_DECODING_AT_CRA
    849823  while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess) > 0)
    850 #else
    851   while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true) > 0)
    852 #endif
    853824  {
    854825    xCreateLostPicture(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), false)-1);
     
    897868  UInt i, j, p;
    898869
    899 #if !REMOVE_TILE_DEPENDENCE
    900   //set the TileBoundaryIndependenceIdr
    901   if(pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)
    902   {
    903     pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getTileBoundaryIndependenceIdr() );
    904   }
    905   else
    906   {
    907     pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getSPS()->getTileBoundaryIndependenceIdr() );
    908   }
    909 #endif
    910870
    911871  if( pcSlice->getPPS()->getColumnRowInfoPresent() == 1 )
     
    12651225{
    12661226  TComSPS* sps = new TComSPS();
    1267 #if RPS_IN_SPS
    12681227  TComRPSList* rps = new TComRPSList();
    12691228  sps->setRPSList(rps);
    1270 #endif
    12711229#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
    12721230  m_cEntropyDecoder.decodeSPS( sps, m_isDepth );
     
    12751233#endif
    12761234  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    1277 #if LCU_SYNTAX_ALF
    12781235  m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
    1279 #endif
    12801236}
    12811237
    12821238Void TDecTop::xDecodePPS()
    12831239{
    1284 #if !RPS_IN_SPS
    1285   TComRPSList* rps = new TComRPSList();
    1286 #endif
    12871240  TComPPS* pps = new TComPPS();
    1288 #if !RPS_IN_SPS
    1289   pps->setRPSList(rps);
    1290 #endif
    1291 #if TILES_OR_ENTROPY_SYNC_IDC
    12921241  m_cEntropyDecoder.decodePPS( pps, &m_parameterSetManagerDecoder );
    1293 #else
    1294   m_cEntropyDecoder.decodePPS( pps );
    1295 #endif
    12961242  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
    12971243
     
    13461292    case NAL_UNIT_CODED_SLICE:
    13471293    case NAL_UNIT_CODED_SLICE_IDR:
    1348 #if H0566_TLA
    13491294#if !QC_REM_IDV_B0046
    13501295    case NAL_UNIT_CODED_SLICE_IDV:
     
    13521297    case NAL_UNIT_CODED_SLICE_CRA:
    13531298    case NAL_UNIT_CODED_SLICE_TLA:
    1354 #else
    1355     case NAL_UNIT_CODED_SLICE_CDR:
    1356 #endif
    13571299      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
    13581300      break;
     
    13751317  sps = pSPSV0;
    13761318  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    1377 #if LCU_SYNTAX_ALF
    13781319  m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
    1379 #endif
    13801320}
    13811321
     
    14121352  else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
    14131353  {
    1414 #if H0566_TLA
    14151354    if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA )
    1416 #else
    1417     if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR )
    1418 #endif
    14191355    {
    14201356      m_pocRandomAccess = m_apcSlicePilot->getPOC(); // set the POC random access since we need to skip the reordered pictures in CRA.
     
    14261362    else
    14271363    {
    1428 #if START_DECODING_AT_CRA
    14291364      static bool warningMessage = false;
    14301365      if(!warningMessage)
     
    14341369      }
    14351370      return true;
    1436 #else
    1437       printf("\nUnsafe random access point. Decoder may crash.");
    1438       m_pocRandomAccess = 0;
    1439 #endif
    14401371    }
    14411372  }
     
    14581389  m_cSAO.allocSaoParam(pAPS->getSaoParam());
    14591390  pAPS->createAlfParam();
    1460 #if !LCU_SYNTAX_ALF
    1461   m_cAdaptiveLoopFilter.allocALFParam(pAPS->getAlfParam());
    1462 #endif
    14631391}
    14641392
  • branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.h

    r280 r294  
    282282  Void      decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };
    283283  Void      xActivateParameterSets();
    284 #if SKIPFRAME_BUGFIX
    285284  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
    286 #else
    287   Bool      xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay);
    288 #endif
    289285#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    290286  Void      xDecodeVPS();
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/NALwrite.cpp

    r210 r294  
    5656
    5757  bsNALUHeader.write(0,1); // forbidden_zero_flag
    58 #if NAL_REF_FLAG
    5958  bsNALUHeader.write(nalu.m_nalRefFlag? 1 : 0, 1); // nal_ref_flag
    6059  bsNALUHeader.write(nalu.m_nalUnitType, 6);          // nal_unit_type
    61 #else
    62   bsNALUHeader.write(nalu.m_nalRefIDC, 2); // nal_ref_idc
    63   bsNALUHeader.write(nalu.m_nalUnitType, 5); // nal_unit_type
    64 #endif
    6560
    6661#if QC_MVHEVC_B0046
     
    7267  bsNALUHeader.write(nalu.m_layerId + 1, 5); // layer_id_plus1
    7368#else
    74 #if H0388
    7569  bsNALUHeader.write(nalu.m_temporalId, 3); // temporal_id
    7670 // bsNALUHeader.write(1, 5); // reserved_one_5bits
    7771  bsNALUHeader.write(nalu.m_viewId+1,4);
    7872  bsNALUHeader.write(nalu.m_isDepth,1);
    79 #else
    80   switch (nalu.m_nalUnitType)
    81   {
    82   case NAL_UNIT_CODED_SLICE:
    83   case NAL_UNIT_CODED_SLICE_IDR:
    84 #if H0566_TLA
    85 #if !QC_REM_IDV_B0046
    86   case NAL_UNIT_CODED_SLICE_IDV:
    87 #endif
    88   case NAL_UNIT_CODED_SLICE_CRA:
    89   case NAL_UNIT_CODED_SLICE_TLA:
    90 #else
    91   case NAL_UNIT_CODED_SLICE_CDR:
    92 #endif
    93     bsNALUHeader.write(nalu.m_temporalId, 3); // temporal_id
    94     bsNALUHeader.write(nalu.m_OutputFlag, 1); // output_flag
    95   //  bsNALUHeader.write(1, 4); // reserved_one_4bits
    96     bsNALUHeader.write(nalu.m_viewId+1,3);
    97     bsNALUHeader.write(nalu.m_isDepth,1);
    98     break;
    99   default: break;
    100   }
    101 #endif
    10273#endif
    10374#endif
     
    209180{
    210181  naluDest.m_nalUnitType = naluSrc.m_nalUnitType;
    211 #if NAL_REF_FLAG
    212182  naluDest.m_nalRefFlag  = naluSrc.m_nalRefFlag;
    213 #else
    214   naluDest.m_nalRefIDC   = naluSrc.m_nalRefIDC;
    215 #endif
    216183#if !VIDYO_VPS_INTEGRATION
    217184  naluDest.m_viewId      = naluSrc.m_viewId;
     
    223190#else
    224191 
    225 #if !H0388
    226   naluDest.m_OutputFlag  = naluSrc.m_OutputFlag;
    227 #endif
    228192#endif
    229193  naluDest.m_Bitstream   = naluSrc.m_Bitstream;
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/NALwrite.h

    r210 r294  
    5454   * written to the bitstream.
    5555   */
    56 #if H0388
    5756  OutputNALUnit(
    5857    NalUnitType nalUnitType,
    59 #if NAL_REF_FLAG
    6058    Bool nalRefFlag,
    61 #else
    62     NalRefIdc nalRefIDC,
    63 #endif
    6459#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    6560    unsigned layerId,
     
    6964#endif
    7065    unsigned temporalID = 0)
    71 #if NAL_REF_FLAG
    7266#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    7367  : NALUnit(nalUnitType, nalRefFlag, layerId, temporalID)
     
    7569  : NALUnit(nalUnitType, nalRefFlag, viewId, isDepth, temporalID)
    7670#endif
    77 #else
    78 #if VIDYO_VPS_INTEGRATION
    79   : NALUnit(nalUnitType, nalRefIDC, layerId, temporalID)
    80 #else
    81   : NALUnit(nalUnitType, nalRefIDC, viewId, isDepth, temporalID)
    82 #endif
    83 #endif
    8471  , m_Bitstream()
    8572  {}
    86 #else
    87   OutputNALUnit(
    88     NalUnitType nalUnitType,
    89     NalRefIdc nalRefIDC,
    90     Int viewId,
    91     Bool isDepth,
    92     unsigned temporalID = 0,
    93     bool outputFlag = true)
    94   : NALUnit(nalUnitType, nalRefIDC, viewId, isDepth, temporalID, outputFlag)
    95   , m_Bitstream()
    96   {}
    97 #endif
    9873
    9974  OutputNALUnit(const NALUnit& src)
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.cpp

    r56 r294  
    4747// Constants
    4848// ====================================================================================================================
    49 #if LCU_SYNTAX_ALF
    5049#define ALF_NUM_OF_REDESIGN 1
    51 #else
    52 #define ALF_NUM_OF_REDESIGN 3
    53 #endif
    5450// ====================================================================================================================
    5551// Tables
    5652// ====================================================================================================================
    57 #if LCU_SYNTAX_ALF
    5853const Int TEncAdaptiveLoopFilter::m_alfNumPartsInRowTab[5] =
    5954{
     
    8277  341,  //level 4
    8378};
    84 #endif
    8579// ====================================================================================================================
    8680// Constructor / destructor
    8781// ====================================================================================================================
    8882
    89 #if LCU_SYNTAX_ALF
    9083///AlfCorrData
    9184AlfCorrData::AlfCorrData()
     
    376369  return *this;
    377370}
    378 #endif
    379371
    380372
    381373TEncAdaptiveLoopFilter::TEncAdaptiveLoopFilter()
    382374{
    383 #if !LCU_SYNTAX_ALF
    384   m_ppdAlfCorr = NULL;
    385   m_ppdAlfCorrCb = NULL;
    386   m_ppdAlfCorrCr = NULL;
    387   m_pdDoubleAlfCoeff = NULL;
    388 #endif
    389375  m_pcEntropyCoder = NULL;
    390 #if !LCU_SYNTAX_ALF
    391   m_pcBestAlfParam = NULL;
    392   m_pcTempAlfParam = NULL;
    393 #endif
    394376  m_pcPicYuvBest = NULL;
    395377  m_pcPicYuvTmp = NULL;
    396 #if !LCU_SYNTAX_ALF
    397   pcAlfParamShape0 = NULL;
    398   pcAlfParamShape1 = NULL;
    399   pcPicYuvRecShape0 = NULL;
    400   pcPicYuvRecShape1 = NULL;
    401   m_pcSliceYuvTmp = NULL;
    402 #endif
    403378
    404379  m_iALFMaxNumberFilters = NO_FILTERS;
     
    411386// ====================================================================================================================
    412387
    413 #if LCU_SYNTAX_ALF
    414388/** convert Level Row Col to Idx
    415389 * \param   level,  row,  col
     
    799773}
    800774
    801 #else
    802 
    803 /** create ALF global buffers
    804  * \param iALFEncodePassReduction 0: 16-pass encoding, 1: 1-pass encoding, 2: 2-pass encoding
    805  * This function is used to create the filter buffers to perform time-delay filtering.
    806  */
    807 Void TEncAdaptiveLoopFilter::createAlfGlobalBuffers(Int iALFEncodePassReduction)
    808 {
    809   if(iALFEncodePassReduction)
    810   {
    811     Int iNumOfBuffer = m_iGOPSize +1;
    812 
    813     for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    814     {
    815       m_mergeTableSavedMethods[i] = new Int*[iNumOfBuffer];
    816       m_aiFilterCoeffSavedMethods[i] = new Int**[iNumOfBuffer];
    817       for(Int j=0; j< iNumOfBuffer; j++)
    818       {
    819         m_mergeTableSavedMethods[i][j] = new Int[NO_VAR_BINS];
    820         m_aiFilterCoeffSavedMethods[i][j] = new Int*[NO_VAR_BINS];
    821         for(Int k=0; k< NO_VAR_BINS; k++)
    822         {
    823           m_aiFilterCoeffSavedMethods[i][j][k] = new Int[ALF_MAX_NUM_COEF];
    824         }
    825       }
    826       m_iPreviousFilterShapeMethods[i] = new Int[iNumOfBuffer];
    827     }
    828 
    829   }
    830 }
    831 /** destroy ALF global buffers
    832  * This function is used to destroy the filter buffers.
    833  */
    834 
    835 Void TEncAdaptiveLoopFilter::destroyAlfGlobalBuffers()
    836 {
    837   if(m_iALFEncodePassReduction)
    838   {
    839     for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    840     {
    841       for(Int j=0; j< m_iGOPSize+1; j++)
    842       {
    843         for(Int k=0; k< NO_VAR_BINS; k++)
    844         {
    845           delete[] m_aiFilterCoeffSavedMethods[i][j][k];
    846         }
    847         delete[] m_aiFilterCoeffSavedMethods[i][j];
    848         delete[] m_mergeTableSavedMethods[i][j];
    849       }
    850       delete[] m_aiFilterCoeffSavedMethods[i];
    851       delete[] m_iPreviousFilterShapeMethods[i];
    852       delete[] m_mergeTableSavedMethods[i];
    853 
    854     }
    855 
    856   }
    857 
    858 }
    859 #endif
    860775/**
    861776 \param pcPic           picture (TComPic) pointer
     
    865780{
    866781  m_pcEntropyCoder = pcEntropyCoder;
    867 #if !LCU_SYNTAX_ALF
    868   xInitParam();
    869 #endif
    870782  xCreateTmpAlfCtrlFlags();
    871783 
     
    876788  m_pcPicYuvTmp->createLuma(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
    877789  m_pcPicYuvBest = pcPic->getPicYuvPred();
    878 #if !LCU_SYNTAX_ALF 
    879   m_pcBestAlfParam = new ALFParam;
    880   m_pcTempAlfParam = new ALFParam;
    881   allocALFParam(m_pcBestAlfParam);
    882   allocALFParam(m_pcTempAlfParam);
    883   pcPicYuvRecShape0 = new TComPicYuv();
    884   pcPicYuvRecShape0->createLuma(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
    885  
    886   pcPicYuvRecShape1 = new TComPicYuv();
    887   pcPicYuvRecShape1->createLuma(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
    888 
    889   pcAlfParamShape0 = new ALFParam;
    890   pcAlfParamShape1 = new ALFParam;
    891 
    892   allocALFParam(pcAlfParamShape0); 
    893   allocALFParam(pcAlfParamShape1);
    894 
    895   // init qc_filter
    896   initMatrix4D_double(&m_EGlobalSym, NUM_ALF_FILTER_SHAPE+1,  NO_VAR_BINS, MAX_SQR_FILT_LENGTH, MAX_SQR_FILT_LENGTH);
    897   initMatrix3D_double(&m_yGlobalSym, NUM_ALF_FILTER_SHAPE+1, NO_VAR_BINS, MAX_SQR_FILT_LENGTH);
    898 #endif
    899790  initMatrix_int(&m_filterCoeffSymQuant, NO_VAR_BINS, ALF_MAX_NUM_COEF);
    900 #if !LCU_SYNTAX_ALF
    901   m_pixAcc = (double *) calloc(NO_VAR_BINS, sizeof(double));
    902 #endif
    903791  initMatrix_Pel(&m_maskImg, m_img_height, m_img_width);
    904792  initMatrix_double(&m_E_temp, MAX_SQR_FILT_LENGTH, MAX_SQR_FILT_LENGTH);//
     
    913801  initMatrix_int(&m_FilterCoeffQuantTemp, NO_VAR_BINS, ALF_MAX_NUM_COEF);//
    914802
    915 #if LCU_SYNTAX_ALF
    916803  m_tempALFp = new ALFParam(ALF_Y);
    917 #else
    918   m_tempALFp = new ALFParam;
    919   allocALFParam(m_tempALFp);
    920   if( m_bUseNonCrossALF )
    921   {
    922     m_pcSliceYuvTmp = new TComPicYuv();
    923     m_pcSliceYuvTmp->create(iWidth, iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
    924   }
    925 #endif
    926804}
    927805
    928806Void TEncAdaptiveLoopFilter::endALFEnc()
    929807{
    930 #if !LCU_SYNTAX_ALF
    931   xUninitParam();
    932 #endif
    933808  xDestroyTmpAlfCtrlFlags();
    934809 
     
    938813  m_pcPic = NULL;
    939814  m_pcEntropyCoder = NULL;
    940 #if !LCU_SYNTAX_ALF
    941   freeALFParam(m_pcBestAlfParam);
    942   freeALFParam(m_pcTempAlfParam);
    943   delete m_pcBestAlfParam;
    944   delete m_pcTempAlfParam;
    945 
    946   pcPicYuvRecShape0->destroyLuma();
    947   delete pcPicYuvRecShape0;
    948   pcPicYuvRecShape0 = NULL;
    949 
    950   pcPicYuvRecShape1->destroyLuma();
    951   delete pcPicYuvRecShape1;
    952   pcPicYuvRecShape1 = NULL;
    953 
    954   freeALFParam(pcAlfParamShape0);
    955   freeALFParam(pcAlfParamShape1);
    956 
    957   delete pcAlfParamShape0;
    958   delete pcAlfParamShape1;
    959 
    960   // delete qc filters
    961   destroyMatrix4D_double(m_EGlobalSym, NUM_ALF_FILTER_SHAPE+1,  NO_VAR_BINS);
    962   destroyMatrix3D_double(m_yGlobalSym, NUM_ALF_FILTER_SHAPE+1);
    963 #endif
    964815  destroyMatrix_int(m_filterCoeffSymQuant);
    965 #if !LCU_SYNTAX_ALF 
    966   free(m_pixAcc);
    967 #endif
    968816  destroyMatrix_Pel(m_maskImg);
    969817  destroyMatrix3D_double(m_E_merged, NO_VAR_BINS);
     
    980828  destroyMatrix_int(m_FilterCoeffQuantTemp);
    981829 
    982 #if LCU_SYNTAX_ALF
    983830  delete m_tempALFp;
    984 #else
    985   freeALFParam(m_tempALFp);
    986   delete m_tempALFp;
    987 
    988   if(m_bUseNonCrossALF)
    989   {
    990     m_pcSliceYuvTmp->destroy();
    991     delete m_pcSliceYuvTmp;
    992     m_pcSliceYuvTmp = NULL;
    993   }
    994 #endif
    995 }
    996 
    997 #if LCU_SYNTAX_ALF
     831}
     832
    998833
    999834/** Assign output ALF parameters
     
    27622597#endif
    27632598
    2764 #if ALF_SINGLE_FILTER_SHAPE
    27652599        calcCorrOneCompRegionChma(pPicOrg, pPicSrc, stride, ypos, xpos, height, width, alfCorr->ECorr[0], alfCorr->yCorr[0], isLastBlock);
    2766 #endif
    27672600      }
    27682601    }
     
    28222655#endif
    28232656
    2824 #if ALF_SINGLE_FILTER_SHAPE
    28252657        calcCorrOneCompRegionLuma(pPicOrg, pPicSrc, stride, ypos, xpos, height, width, alfCorr->ECorr, alfCorr->yCorr, alfCorr->pixAcc, forceCollection, isLastBlock);
    2826 #endif       
    28272658      }
    28282659    }
     
    28382669
    28392670
    2840 #if ALF_SINGLE_FILTER_SHAPE
    28412671/** Gather correlations for one region for chroma component
    28422672 * \param [in] imgOrg picture buffer for original picture
     
    30862916
    30872917}
    3088 #endif
    3089 
    3090 #else
    3091 
    3092 
    3093 #if ALF_CHROMA_LAMBDA 
    3094 /**
    3095  \param pcAlfParam           ALF parameter
    3096  \param [out] pvAlfCtrlParam ALF CU control parameters container for slices
    3097  \param dLambdaLuma          luma lambda value for RD cost computation
    3098  \param dLambdaChroma        chroma lambda value for RD cost computation
    3099  \retval ruiDist             distortion
    3100  \retval ruiBits             required bits
    3101  \retval ruiMaxAlfCtrlDepth  optimal partition depth
    3102  */
    3103 #if HHI_INTERVIEW_SKIP
    3104 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip)
    3105 #else
    3106 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits)
    3107 
    3108 #endif
    3109 #else
    3110 /**
    3111  \param pcAlfParam           ALF parameter
    3112  \param dLambda              lambda value for RD cost computation
    3113  \retval ruiDist             distortion
    3114  \retval ruiBits             required bits
    3115  \retval ruiMaxAlfCtrlDepth  optimal partition depth
    3116  */
    3117 #if HHI_INTERVIEW_SKIP
    3118 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip)
    3119 #else
    3120 Void TEncAdaptiveLoopFilter::ALFProcess( ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits)
    3121 
    3122 #endif
    3123 #endif
    3124 {
    3125  
    3126   // set lambda
    3127 #if ALF_CHROMA_LAMBDA 
    3128   m_dLambdaLuma   = dLambdaLuma;
    3129   m_dLambdaChroma = dLambdaChroma;
    3130 #else
    3131   m_dLambdaLuma   = dLambda;
    3132   m_dLambdaChroma = dLambda;
    3133 #endif
    3134 
    3135   m_lcuHeight = m_pcPic->getSlice(0)->getSPS()->getMaxCUHeight();
    3136 
    3137 #if ALF_SINGLE_FILTER_SHAPE
    3138   m_lineIdxPadBot = m_lcuHeight - 4 - 3; // DFRegion, Vertical Taps
    3139 #else
    3140   m_lineIdxPadBot = m_lcuHeight - 4 - 4; // DFRegion, Vertical Taps
    3141 #endif
    3142   m_lineIdxPadTop = m_lcuHeight - 4; // DFRegion
    3143 
    3144   m_lcuHeightChroma = m_lcuHeight>>1;
    3145 #if ALF_SINGLE_FILTER_SHAPE
    3146   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 3; // DFRegion, Vertical Taps
    3147 #else
    3148   m_lineIdxPadBotChroma = m_lcuHeightChroma - 2 - 4; // DFRegion, Vertical Taps
    3149 #endif
    3150   m_lineIdxPadTopChroma = m_lcuHeightChroma - 2 ; // DFRegion
    3151 
    3152   TComPicYuv* pcPicOrg = m_pcPic->getPicYuvOrg();
    3153  
    3154   // extend image for filtering
    3155   TComPicYuv* pcPicYuvRec    = m_pcPic->getPicYuvRec();
    3156   TComPicYuv* pcPicYuvExtRec = m_pcTempPicYuv;
    3157 #if HHI_INTERVIEW_SKIP
    3158   TComPicYuv* pcUsedPelMap   = m_pcPic->getUsedPelsMap() ;
    3159   if(bInterviewSkip)
    3160     assert( pcUsedPelMap ) ;
    3161 #endif
    3162  
    3163   pcPicYuvRec->copyToPic(pcPicYuvExtRec);
    3164   if(!m_bUseNonCrossALF)
    3165   {
    3166   pcPicYuvExtRec->setBorderExtension( false );
    3167   pcPicYuvExtRec->extendPicBorder   ();
    3168   }
    3169  
    3170   // set min cost
    3171   UInt64 uiMinRate = MAX_INT;
    3172   UInt64 uiMinDist = MAX_INT;
    3173   Double dMinCost  = MAX_DOUBLE;
    3174  
    3175   UInt64  uiOrigRate;
    3176   UInt64  uiOrigDist;
    3177   Double  dOrigCost;
    3178  
    3179   // calc original cost
    3180 #if HHI_INTERVIEW_SKIP
    3181   xCalcRDCost( pcPicOrg, pcPicYuvRec, pcUsedPelMap, NULL, uiOrigRate, uiOrigDist, dOrigCost );
    3182 #else
    3183   xCalcRDCost( pcPicOrg, pcPicYuvRec, NULL, uiOrigRate, uiOrigDist, dOrigCost );
    3184 #endif
    3185   m_pcBestAlfParam->alf_flag = 0;
    3186   // initialize temp_alfps
    3187   m_pcTempAlfParam->alf_flag        = 1;
    3188   m_pcTempAlfParam->chroma_idc      = 0;
    3189 
    3190   m_bAlfCUCtrlEnabled = (pvAlfCtrlParam != NULL)?true:false;
    3191   if(m_bAlfCUCtrlEnabled)
    3192   {
    3193     m_vBestAlfCUCtrlParam.resize(m_uiNumSlicesInPic);
    3194     for(Int s=0; s< m_uiNumSlicesInPic; s++)
    3195     {
    3196       m_vBestAlfCUCtrlParam[s].cu_control_flag = 0;
    3197     }
    3198   }
    3199   else
    3200   {
    3201     m_vBestAlfCUCtrlParam.clear();
    3202   }
    3203 
    3204   setALFEncodingParam(m_pcPic);
    3205 
    3206   // adaptive in-loop wiener filtering
    3207 #if HHI_INTERVIEW_SKIP
    3208   xEncALFLuma( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, uiMinRate, uiMinDist, dMinCost, bInterviewSkip );
    3209 #else
    3210   xEncALFLuma( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, uiMinRate, uiMinDist, dMinCost );
    3211 #endif
    3212 
    3213   // cu-based filter on/off control
    3214 #if HHI_INTERVIEW_SKIP
    3215   xCUAdaptiveControl_qc( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, pcUsedPelMap, uiMinRate, uiMinDist, dMinCost );
    3216 #else
    3217   xCUAdaptiveControl_qc( pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, uiMinRate, uiMinDist, dMinCost );
    3218 #endif
    3219  
    3220   // compare RD cost to non-ALF case
    3221   if( dMinCost < dOrigCost )
    3222   {
    3223     m_pcBestAlfParam->alf_flag = 1;
    3224    
    3225     ruiBits = uiMinRate;
    3226     ruiDist = uiMinDist;
    3227   }
    3228   else
    3229   {
    3230     m_pcBestAlfParam->alf_flag        = 0;
    3231 
    3232     uiMinRate = uiOrigRate;
    3233     uiMinDist = uiOrigDist;
    3234    
    3235     m_pcEntropyCoder->setAlfCtrl(false);
    3236     if(m_bAlfCUCtrlEnabled)
    3237     {
    3238       for(Int s=0; s< m_uiNumSlicesInPic; s++)
    3239       {
    3240         m_vBestAlfCUCtrlParam[s].cu_control_flag = 0;
    3241       }
    3242     }
    3243     pcPicYuvExtRec->copyToPicLuma(pcPicYuvRec);
    3244    
    3245     ruiBits = uiOrigRate;
    3246     ruiDist = uiOrigDist;
    3247   }
    3248   // if ALF works
    3249   if( m_pcBestAlfParam->alf_flag )
    3250   {
    3251     // do additional ALF process for chroma
    3252     xFilterTapDecisionChroma( uiMinRate, pcPicOrg, pcPicYuvExtRec, pcPicYuvRec, ruiDist, ruiBits );
    3253   }
    3254  
    3255   // copy to best storage
    3256   copyALFParam(pcAlfParam, m_pcBestAlfParam);
    3257  
    3258   if(m_bAlfCUCtrlEnabled)
    3259   {
    3260     for(Int s=0; s< m_uiNumSlicesInPic; s++)
    3261     {
    3262       (*pvAlfCtrlParam)[s]= m_vBestAlfCUCtrlParam[s];
    3263     }
    3264   }
    3265 }
    3266 #endif
     2918
    32672919
    32682920/** PCM LF disable process.
     
    32842936// Private member functions
    32852937// ====================================================================================================================
    3286 #if !LCU_SYNTAX_ALF
    3287 Void TEncAdaptiveLoopFilter::xInitParam()
    3288 {
    3289   Int i, j;
    3290  
    3291   if (m_ppdAlfCorr != NULL)
    3292   {
    3293     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3294     {
    3295       for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)
    3296       {
    3297         m_ppdAlfCorr[i][j] = 0;
    3298       }
    3299     }
    3300   }
    3301   else
    3302   {
    3303     m_ppdAlfCorr = new Double*[ALF_MAX_NUM_COEF];
    3304     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3305     {
    3306       m_ppdAlfCorr[i] = new Double[ALF_MAX_NUM_COEF+1];
    3307       for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)
    3308       {
    3309         m_ppdAlfCorr[i][j] = 0;
    3310       }
    3311     }
    3312   }
    3313  
    3314   if (m_pdDoubleAlfCoeff != NULL)
    3315   {
    3316     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3317     {
    3318       m_pdDoubleAlfCoeff[i] = 0;
    3319     }
    3320   }
    3321   else
    3322   {
    3323     m_pdDoubleAlfCoeff = new Double[ALF_MAX_NUM_COEF];
    3324     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3325     {
    3326       m_pdDoubleAlfCoeff[i] = 0;
    3327     }
    3328   }
    3329   if (m_ppdAlfCorrCb != NULL)
    3330   {
    3331     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3332     {
    3333       for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)
    3334       {
    3335         m_ppdAlfCorrCb[i][j] = 0;
    3336       }
    3337     }
    3338   }
    3339   else
    3340   {
    3341     m_ppdAlfCorrCb = new Double*[ALF_MAX_NUM_COEF];
    3342     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3343     {
    3344       m_ppdAlfCorrCb[i] = new Double[ALF_MAX_NUM_COEF+1];
    3345       for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)
    3346       {
    3347         m_ppdAlfCorrCb[i][j] = 0;
    3348       }
    3349     }
    3350   }
    3351  
    3352   if (m_ppdAlfCorrCr != NULL)
    3353   {
    3354     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3355     {
    3356       for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)
    3357       {
    3358         m_ppdAlfCorrCr[i][j] = 0;
    3359       }
    3360     }
    3361   }
    3362   else
    3363   {
    3364     m_ppdAlfCorrCr = new Double*[ALF_MAX_NUM_COEF];
    3365     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3366     {
    3367       m_ppdAlfCorrCr[i] = new Double[ALF_MAX_NUM_COEF+1];
    3368       for (j = 0; j < ALF_MAX_NUM_COEF+1; j++)
    3369       {
    3370         m_ppdAlfCorrCr[i][j] = 0;
    3371       }
    3372     }
    3373   }
    3374 }
    3375 
    3376 Void TEncAdaptiveLoopFilter::xUninitParam()
    3377 {
    3378   Int i;
    3379  
    3380   if (m_ppdAlfCorr != NULL)
    3381   {
    3382     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3383     {
    3384       delete[] m_ppdAlfCorr[i];
    3385       m_ppdAlfCorr[i] = NULL;
    3386     }
    3387     delete[] m_ppdAlfCorr;
    3388     m_ppdAlfCorr = NULL;
    3389   }
    3390  
    3391   if (m_pdDoubleAlfCoeff != NULL)
    3392   {
    3393     delete[] m_pdDoubleAlfCoeff;
    3394     m_pdDoubleAlfCoeff = NULL;
    3395   }
    3396   if (m_ppdAlfCorrCb != NULL)
    3397   {
    3398     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3399     {
    3400       delete[] m_ppdAlfCorrCb[i];
    3401       m_ppdAlfCorrCb[i] = NULL;
    3402     }
    3403     delete[] m_ppdAlfCorrCb;
    3404     m_ppdAlfCorrCb = NULL;
    3405   }
    3406  
    3407   if (m_ppdAlfCorrCr != NULL)
    3408   {
    3409     for (i = 0; i < ALF_MAX_NUM_COEF; i++)
    3410     {
    3411       delete[] m_ppdAlfCorrCr[i];
    3412       m_ppdAlfCorrCr[i] = NULL;
    3413     }
    3414     delete[] m_ppdAlfCorrCr;
    3415     m_ppdAlfCorrCr = NULL;
    3416   }
    3417 }
    3418 #endif
    34192938Void TEncAdaptiveLoopFilter::xCreateTmpAlfCtrlFlags()
    34202939{
     
    35123031}
    35133032
    3514 #if !LCU_SYNTAX_ALF
    3515 
    3516 Void TEncAdaptiveLoopFilter::xCalcCorrelationFunc(Int ypos, Int xpos, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int iWidth, Int iHeight, Int iOrgStride, Int iCmpStride, Bool bSymmCopyBlockMatrix)
    3517 {
    3518   Int     yposEnd = ypos + iHeight -1;
    3519   Int     xposEnd = xpos + iWidth  -1;
    3520   Int     N       = m_sqrFiltLengthTab[filtNo];
    3521 
    3522   Int imgHeightChroma = m_img_height>>1;
    3523   Int yLineInLCU;
    3524   Int paddingline ;
    3525 
    3526   Int ELocal[ALF_MAX_NUM_COEF];
    3527   Pel *pImgPad1, *pImgPad2, *pImgPad3, *pImgPad4;
    3528   Int i, j, k, l;
    3529   Int yLocal;
    3530 
    3531   pImgPad += (ypos*iCmpStride);
    3532   pImgOrg += (ypos*iOrgStride);
    3533 
    3534   switch(filtNo)
    3535   {
    3536 #if !ALF_SINGLE_FILTER_SHAPE
    3537   case ALF_STAR5x5:
    3538     {
    3539       for (i= ypos; i<= yposEnd; i++)
    3540       {
    3541         yLineInLCU = i % m_lcuHeightChroma;
    3542 
    3543         if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )
    3544         {
    3545           pImgPad1 = pImgPad +   iCmpStride;
    3546           pImgPad2 = pImgPad -   iCmpStride;
    3547           pImgPad3 = pImgPad + 2*iCmpStride;
    3548           pImgPad4 = pImgPad - 2*iCmpStride;
    3549         }
    3550         else if (yLineInLCU < m_lineIdxPadTopChroma)
    3551         {
    3552           paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;
    3553           pImgPad1 = pImgPad + min(paddingline, 1)*iCmpStride;
    3554           pImgPad2 = pImgPad -   iCmpStride;
    3555           pImgPad3 = pImgPad + min(paddingline, 2)*iCmpStride;
    3556           pImgPad4 = pImgPad - 2*iCmpStride;
    3557         }
    3558         else
    3559         {
    3560           paddingline = yLineInLCU - m_lineIdxPadTopChroma ;
    3561           pImgPad1 = pImgPad +   iCmpStride;
    3562           pImgPad2 = pImgPad - min(paddingline, 1)*iCmpStride;
    3563           pImgPad3 = pImgPad + 2*iCmpStride;
    3564           pImgPad4 = pImgPad - min(paddingline, 2)*iCmpStride;
    3565         }
    3566 
    3567         if ( (yLineInLCU == m_lineIdxPadTopChroma || yLineInLCU == m_lineIdxPadTopChroma-1) && i-yLineInLCU+m_lcuHeightChroma < imgHeightChroma )
    3568         {
    3569           pImgPad+= iCmpStride;
    3570           pImgOrg+= iOrgStride;
    3571           continue;
    3572         }
    3573         else
    3574         {
    3575         for (j= xpos; j<= xposEnd; j++)
    3576         {
    3577           memset(ELocal, 0, N*sizeof(Int));
    3578 
    3579           ELocal[0] = (pImgPad3[j+2] + pImgPad4[j-2]);
    3580           ELocal[1] = (pImgPad3[j  ] + pImgPad4[j  ]);
    3581           ELocal[2] = (pImgPad3[j-2] + pImgPad4[j+2]);
    3582 
    3583           ELocal[3] = (pImgPad1[j+1] + pImgPad2[j-1]);
    3584           ELocal[4] = (pImgPad1[j  ] + pImgPad2[j  ]);
    3585           ELocal[5] = (pImgPad1[j-1] + pImgPad2[j+1]);
    3586 
    3587           ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]);
    3588           ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]);
    3589           ELocal[8] = (pImgPad[j  ]);
    3590 
    3591           yLocal= (Int)pImgOrg[j];
    3592 
    3593           for(k=0; k<N; k++)
    3594           {
    3595             m_ppdAlfCorr[k][k] += ELocal[k]*ELocal[k];
    3596             for(l=k+1; l<N; l++)
    3597             {
    3598               m_ppdAlfCorr[k][l] += ELocal[k]*ELocal[l];
    3599             }
    3600 
    3601             m_ppdAlfCorr[k][N] += yLocal*ELocal[k];
    3602           }
    3603         }
    3604         pImgPad+= iCmpStride;
    3605         pImgOrg+= iOrgStride;
    3606       }
    3607 
    3608       }
    3609     }
    3610     break;
    3611   case ALF_CROSS9x9:
    3612     {
    3613       Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8;
    3614 #else
    3615   case ALF_CROSS9x7_SQUARE3x3:
    3616     {
    3617       Pel *pImgPad5, *pImgPad6;
    3618 #endif
    3619       for (i= ypos; i<= yposEnd; i++)
    3620       {
    3621         yLineInLCU = i % m_lcuHeightChroma;
    3622 
    3623         if (yLineInLCU<2 && i> 2)
    3624         {
    3625           paddingline = yLineInLCU + 2 ;
    3626           pImgPad1 = pImgPad +   iCmpStride;
    3627           pImgPad2 = pImgPad -   iCmpStride;
    3628           pImgPad3 = pImgPad + 2*iCmpStride;
    3629           pImgPad4 = pImgPad - 2*iCmpStride;
    3630           pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*iCmpStride;
    3631           pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*iCmpStride;;
    3632 #if !ALF_SINGLE_FILTER_SHAPE
    3633           pImgPad7 = (paddingline < 4) ? pImgPad : pImgPad + 4*iCmpStride;
    3634           pImgPad8 = (paddingline < 4) ? pImgPad : pImgPad - min(paddingline, 4)*iCmpStride;;     
    3635 #endif
    3636         }
    3637         else if (yLineInLCU < m_lineIdxPadBotChroma || i-yLineInLCU+m_lcuHeightChroma >= imgHeightChroma )
    3638         {
    3639           pImgPad1 = pImgPad +   iCmpStride;
    3640           pImgPad2 = pImgPad -   iCmpStride;
    3641           pImgPad3 = pImgPad + 2*iCmpStride;
    3642           pImgPad4 = pImgPad - 2*iCmpStride;
    3643           pImgPad5 = pImgPad + 3*iCmpStride;
    3644           pImgPad6 = pImgPad - 3*iCmpStride;
    3645 #if !ALF_SINGLE_FILTER_SHAPE
    3646           pImgPad7 = pImgPad + 4*iCmpStride;
    3647           pImgPad8 = pImgPad - 4*iCmpStride;
    3648 #endif
    3649         }
    3650         else if (yLineInLCU < m_lineIdxPadTopChroma)
    3651         {
    3652           paddingline = - yLineInLCU + m_lineIdxPadTopChroma - 1;
    3653           pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad + min(paddingline, 1)*iCmpStride;
    3654           pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad -   iCmpStride;
    3655           pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + min(paddingline, 2)*iCmpStride;
    3656           pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - 2*iCmpStride;
    3657           pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + min(paddingline, 3)*iCmpStride;
    3658           pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - 3*iCmpStride;
    3659 #if !ALF_SINGLE_FILTER_SHAPE
    3660           pImgPad7 = (paddingline < 4) ? pImgPad : pImgPad + min(paddingline, 4)*iCmpStride;
    3661           pImgPad8 = (paddingline < 4) ? pImgPad : pImgPad - 4*iCmpStride;
    3662 #endif
    3663         }
    3664         else
    3665         {
    3666           paddingline = yLineInLCU - m_lineIdxPadTopChroma ;
    3667           pImgPad1 = (paddingline < 1) ? pImgPad : pImgPad +   iCmpStride;
    3668           pImgPad2 = (paddingline < 1) ? pImgPad : pImgPad - min(paddingline, 1)*iCmpStride;
    3669           pImgPad3 = (paddingline < 2) ? pImgPad : pImgPad + 2*iCmpStride;
    3670           pImgPad4 = (paddingline < 2) ? pImgPad : pImgPad - min(paddingline, 2)*iCmpStride;
    3671           pImgPad5 = (paddingline < 3) ? pImgPad : pImgPad + 3*iCmpStride;
    3672           pImgPad6 = (paddingline < 3) ? pImgPad : pImgPad - min(paddingline, 3)*iCmpStride;
    3673 #if !ALF_SINGLE_FILTER_SHAPE
    3674           pImgPad7 = (paddingline < 4) ? pImgPad : pImgPad + 4*iCmpStride;
    3675           pImgPad8 = (paddingline < 4) ? pImgPad : pImgPad - min(paddingline, 4)*iCmpStride;
    3676 #endif
    3677         }
    3678 
    3679         for (j= xpos; j<= xposEnd; j++)
    3680         {
    3681           memset(ELocal, 0, N*sizeof(Int));
    3682 #if ALF_SINGLE_FILTER_SHAPE
    3683           ELocal[0] = (pImgPad5[j]+pImgPad6[j]);
    3684           ELocal[1] = (pImgPad3[j]+pImgPad4[j]);
    3685           ELocal[2] = (pImgPad1[j-1]+pImgPad2[j+1]);
    3686           ELocal[3] = (pImgPad1[j]+pImgPad2[j]);
    3687           ELocal[4] = (pImgPad1[j+1]+pImgPad2[j-1]);
    3688           ELocal[5] = (pImgPad[j+4]+pImgPad[j-4]);
    3689           ELocal[6] = (pImgPad[j+3]+pImgPad[j-3]);
    3690           ELocal[7] = (pImgPad[j+2]+pImgPad[j-2]);
    3691           ELocal[8] = (pImgPad[j+1]+pImgPad[j-1]);
    3692           ELocal[9] = (pImgPad[j  ]);
    3693 #else
    3694           ELocal[0] = (pImgPad7[j] + pImgPad8[j]);
    3695 
    3696           ELocal[1] = (pImgPad5[j] + pImgPad6[j]);
    3697 
    3698           ELocal[2] = (pImgPad3[j] + pImgPad4[j]);
    3699 
    3700           ELocal[3] = (pImgPad1[j] + pImgPad2[j]);
    3701 
    3702           ELocal[4] = (pImgPad[j+4] + pImgPad[j-4]);
    3703           ELocal[5] = (pImgPad[j+3] + pImgPad[j-3]);
    3704           ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]);
    3705           ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]);
    3706           ELocal[8] = (pImgPad[j  ] );
    3707 #endif
    3708           yLocal= (Int)pImgOrg[j];
    3709 
    3710           for(k=0; k<N; k++)
    3711           {
    3712             m_ppdAlfCorr[k][k] += ELocal[k]*ELocal[k];
    3713             for(l=k+1; l<N; l++)
    3714             {
    3715               m_ppdAlfCorr[k][l] += ELocal[k]*ELocal[l];
    3716             }
    3717 
    3718             m_ppdAlfCorr[k][N] += yLocal*ELocal[k];
    3719           }
    3720         }
    3721         pImgPad+= iCmpStride;
    3722         pImgOrg+= iOrgStride;
    3723       }
    3724 
    3725     }
    3726     break;
    3727   default:
    3728     {
    3729       printf("Not a supported filter shape\n");
    3730       assert(0);
    3731       exit(1);
    3732     }
    3733   }
    3734 
    3735   if(bSymmCopyBlockMatrix)
    3736   {
    3737     for(j=0; j<N-1; j++)
    3738     {
    3739       for(i=j+1; i<N; i++)
    3740       {
    3741         m_ppdAlfCorr[i][j] = m_ppdAlfCorr[j][i];
    3742       }
    3743     }
    3744   }
    3745 }
    3746 
    3747 #endif
    37483033#if IBDI_DISTORTION
    37493034#if HHI_INTERVIEW_SKIP
     
    39463231  Int    *nc;
    39473232  const Int    *pFiltMag;
    3948 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3233#if LCUALF_QP_DEPENDENT_BITS
    39493234  Int alfPrecisionBit = getAlfPrecisionBit( m_alfQP );
    39503235#endif
    39513236
    39523237  N = m_sqrFiltLengthTab[tap];
    3953 #if ALF_SINGLE_FILTER_SHAPE
    39543238  pFiltMag = weightsShape1Sym;
    3955 #else
    3956   // star shape
    3957   if(tap == 0)
    3958   {
    3959     pFiltMag = weightsShape0Sym;
    3960   }
    3961   // cross shape
    3962   else
    3963   {
    3964     pFiltMag = weightsShape1Sym;
    3965   }
    3966 #endif
    39673239
    39683240  dh = new Double[N];
    39693241  nc = new Int[N];
    39703242 
    3971 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS 
     3243#if LCUALF_QP_DEPENDENT_BITS 
    39723244  max_value =   (1<<(1+alfPrecisionBit))-1;
    39733245  min_value = 0-(1<<(1+alfPrecisionBit));
     
    39833255    if(h[i]>=0.0)
    39843256    {
    3985 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3257#if LCUALF_QP_DEPENDENT_BITS
    39863258      qh[i] =  (Int)( h[i]*(1<<alfPrecisionBit)+0.5);
    39873259#else
     
    39913263    else
    39923264    {
    3993 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3265#if LCUALF_QP_DEPENDENT_BITS
    39943266      qh[i] = -(Int)(-h[i]*(1<<alfPrecisionBit)+0.5);
    39953267#else
     
    39983270    }
    39993271
    4000 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3272#if LCUALF_QP_DEPENDENT_BITS
    40013273    dh[i] = (Double)qh[i]/(Double)(1<<alfPrecisionBit) - h[i];
    40023274#else
     
    40103282 
    40113283  // modification of quantized filter coefficients
    4012 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3284#if LCUALF_QP_DEPENDENT_BITS
    40133285  total_gain = (Int)(dbl_total_gain*(1<<alfPrecisionBit)+0.5);
    40143286#else
     
    40823354  nc = NULL;
    40833355}
    4084 #if !LCU_SYNTAX_ALF
    4085 Void TEncAdaptiveLoopFilter::xClearFilterCoefInt(Int* qh, Int N)
    4086 {
    4087   // clear
    4088   memset( qh, 0, sizeof( Int ) * N );
    4089  
    4090   // center pos
    4091   qh[N-1]  = 1<<ALF_NUM_BIT_SHIFT;
    4092 }
    4093 /** Calculate RD cost
    4094  * \param [in] pAlfParam ALF parameters
    4095  * \param [out] ruiRate coding bits
    4096  * \param [in] uiDist distortion
    4097  * \param [out] rdCost rate-distortion cost
    4098  * \param [in] pvAlfCUCtrlParam ALF CU control parameters
    4099  */
    4100 Void TEncAdaptiveLoopFilter::xCalcRDCost(ALFParam* pAlfParam, UInt64& ruiRate, UInt64 uiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam)
    4101 {
    4102   if(pAlfParam != NULL)
    4103   {
    4104     m_pcEntropyCoder->resetEntropy();
    4105     m_pcEntropyCoder->resetBits();
    4106     m_pcEntropyCoder->encodeAlfParam(pAlfParam);
    4107 
    4108     ruiRate = m_pcEntropyCoder->getNumberOfWrittenBits();
    4109 
    4110     if(pvAlfCUCtrlParam != NULL)
    4111     {
    4112       for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    4113       {
    4114         if(!m_pcPic->getValidSlice(s))
    4115         {
    4116           continue;
    4117         }
    4118         m_pcEntropyCoder->resetEntropy();
    4119         m_pcEntropyCoder->resetBits();
    4120         m_pcEntropyCoder->encodeAlfCtrlParam( (*pvAlfCUCtrlParam)[s], m_uiNumCUsInFrame);
    4121         ruiRate += m_pcEntropyCoder->getNumberOfWrittenBits();
    4122       }
    4123     }
    4124     else
    4125     {
    4126       ruiRate += m_uiNumSlicesInPic;
    4127     }
    4128   }
    4129   else
    4130   {
    4131     ruiRate = 1;
    4132   }
    4133  
    4134   rdCost      = (Double)(ruiRate) * m_dLambdaLuma + (Double)(uiDist);
    4135 }
    4136 
    4137 /** Calculate RD cost
    4138  * \param [in] pcPicOrg original picture buffer
    4139  * \param [in] pcPicCmp compared picture buffer
    4140  * \param [in] pAlfParam ALF parameters
    4141  * \param [out] ruiRate coding bits
    4142  * \param [out] ruiDist distortion
    4143  * \param [out] rdCost rate-distortion cost
    4144  * \param [in] pvAlfCUCtrlParam ALF CU control parameters
    4145  */
    4146 #if HHI_INTERVIEW_SKIP
    4147 Void TEncAdaptiveLoopFilter::xCalcRDCost(TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, TComPicYuv* pcUsedPelMap, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam)
    4148 #else
    4149 Void TEncAdaptiveLoopFilter::xCalcRDCost(TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam)
    4150 #endif
    4151 {
    4152   if(pAlfParam != NULL)
    4153   {
    4154     m_pcEntropyCoder->resetEntropy();
    4155     m_pcEntropyCoder->resetBits();
    4156     m_pcEntropyCoder->encodeAlfParam(pAlfParam);
    4157    
    4158     ruiRate = m_pcEntropyCoder->getNumberOfWrittenBits();
    4159 
    4160     if(pvAlfCUCtrlParam != NULL)
    4161     {
    4162       for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    4163       {
    4164         if(! m_pcPic->getValidSlice(s))
    4165         {
    4166           continue;
    4167         }
    4168         m_pcEntropyCoder->resetEntropy();
    4169         m_pcEntropyCoder->resetBits();
    4170         m_pcEntropyCoder->encodeAlfCtrlParam( (*pvAlfCUCtrlParam)[s], m_uiNumCUsInFrame);
    4171         ruiRate += m_pcEntropyCoder->getNumberOfWrittenBits();
    4172       }
    4173 
    4174     }
    4175     else
    4176     {
    4177       ruiRate += m_uiNumSlicesInPic;
    4178     }
    4179   }
    4180   else
    4181   {
    4182     ruiRate = 1;
    4183   }
    4184  
    4185   ruiDist     = xCalcSSD(pcPicOrg->getLumaAddr(), pcPicCmp->getLumaAddr(), pcPicOrg->getWidth(), pcPicOrg->getHeight(), pcPicOrg->getStride());
    4186   rdCost      = (Double)(ruiRate) * m_dLambdaLuma + (Double)(ruiDist);
    4187 }
    4188 /** Calculate RD cost for chroma ALF
    4189  * \param pcPicOrg original picture buffer
    4190  * \param pcPicCmp compared picture buffer
    4191  * \param pAlfParam ALF parameters
    4192  * \returns ruiRate bitrate
    4193  * \returns uiDist distortion
    4194  * \returns rdCost RD cost
    4195  */
    4196 Void TEncAdaptiveLoopFilter::xCalcRDCostChroma(TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost)
    4197 {
    4198   if(pAlfParam->chroma_idc)
    4199   {
    4200     ruiRate = xCalcRateChroma(pAlfParam);
    4201   }
    4202   ruiDist = 0;
    4203   ruiDist += xCalcSSD(pcPicOrg->getCbAddr(), pcPicCmp->getCbAddr(), (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride());
    4204   ruiDist += xCalcSSD(pcPicOrg->getCrAddr(), pcPicCmp->getCrAddr(), (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride());
    4205   rdCost  = (Double)(ruiRate) * m_dLambdaChroma + (Double)(ruiDist);
    4206 }
    4207 
    4208 Void TEncAdaptiveLoopFilter::xFilteringFrameChroma(ALFParam* pcAlfParam, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)
    4209 {
    4210   Int filtNo = pcAlfParam->filter_shape_chroma;
    4211   Int *coeff = pcAlfParam->coeff_chroma;
    4212   Int iChromaFormatShift = 1; //4:2:0
    4213 
    4214   if ((pcAlfParam->chroma_idc>>1)&0x01)
    4215   {
    4216     if(!m_bUseNonCrossALF)
    4217     {
    4218       Int iStride   = pcPicRest->getCStride();
    4219       Pel* pDec  = pcPicDec->getCbAddr();
    4220       Pel* pRest = pcPicRest->getCbAddr();
    4221 
    4222       filterChroma(pRest, pDec, iStride, 0, (Int)(m_img_height>>1) -1, 0, (Int)(m_img_width>>1)-1, filtNo,  coeff);
    4223     }
    4224     else
    4225     {
    4226       xFilterChromaSlices(ALF_Cb, pcPicDec, pcPicRest, coeff, filtNo, iChromaFormatShift);
    4227     }
    4228   }
    4229   if ((pcAlfParam->chroma_idc)&0x01)
    4230   {
    4231     if(!m_bUseNonCrossALF)
    4232     {
    4233       Int iStride   = pcPicRest->getCStride();
    4234       Pel* pDec  = pcPicDec->getCrAddr();
    4235       Pel* pRest = pcPicRest->getCrAddr();
    4236 
    4237       filterChroma(pRest, pDec, iStride, 0, (Int)(m_img_height>>1) -1, 0, (Int)(m_img_width>>1)-1, filtNo,  coeff);
    4238     }
    4239     else
    4240     {
    4241       xFilterChromaSlices(ALF_Cr, pcPicDec, pcPicRest, coeff, filtNo, iChromaFormatShift);
    4242     }
    4243   }
    4244 
    4245   if(pcAlfParam->chroma_idc<3)
    4246   {
    4247     if(pcAlfParam->chroma_idc==1)
    4248     {
    4249       pcPicDec->copyToPicCb(pcPicRest);
    4250     }
    4251     if(pcAlfParam->chroma_idc==2)
    4252     {
    4253       pcPicDec->copyToPicCr(pcPicRest);
    4254     }
    4255   }
    4256 
    4257 }
    4258 #endif
    4259 #if LCU_SYNTAX_ALF
    42603356/** Restore the not-filtered pixels
    42613357 * \param [in] imgDec picture buffer before filtering
     
    42643360 */
    42653361Void TEncAdaptiveLoopFilter::xCopyDecToRestCUs(Pel* imgDec, Pel* imgRest, Int stride)
    4266 #else
    4267 /** Restore the not-filtered pixels
    4268  * \param pcPicDec picture buffer before filtering
    4269  * \param pcPicRest picture buffer after filtering
    4270  */
    4271 Void TEncAdaptiveLoopFilter::xCopyDecToRestCUs(TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)
    4272 #endif
    42733362{
    42743363
    42753364  if(m_uiNumSlicesInPic > 1)
    42763365  {
    4277 #if LCU_SYNTAX_ALF
    42783366    Pel* pPicDecLuma  = imgDec;
    42793367    Pel* pPicRestLuma = imgRest;
    4280 #else
    4281     Pel* pPicDecLuma  = pcPicDec->getLumaAddr();
    4282     Pel* pPicRestLuma = pcPicRest->getLumaAddr();
    4283     Int  stride       = pcPicDec->getStride();
    4284 #endif
    42853368    UInt SUWidth      = m_pcPic->getMinCUWidth();
    42863369    UInt SUHeight     = m_pcPic->getMinCUHeight();
     
    43353418  {
    43363419    TComDataCU* pcCU = m_pcPic->getCU( uiCUAddr );
    4337 #if LCU_SYNTAX_ALF
    43383420    xCopyDecToRestCU(pcCU, 0, 0, imgDec, imgRest, stride);
    4339 #else
    4340     xCopyDecToRestCU(pcCU, 0, 0, pcPicDec, pcPicRest);
    4341 #endif
    4342   }
    4343 }
    4344 
    4345 #if LCU_SYNTAX_ALF
     3421  }
     3422}
     3423
    43463424Void TEncAdaptiveLoopFilter::xCopyDecToRestCU(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Pel* imgDec, Pel* imgRest, Int stride)
    4347 #else
    4348 Void TEncAdaptiveLoopFilter::xCopyDecToRestCU(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest)
    4349 #endif
    43503425{
    43513426  Bool bBoundary = false;
     
    43693444     
    43703445      if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )     
    4371 #if LCU_SYNTAX_ALF
    43723446        xCopyDecToRestCU(pcCU, uiAbsPartIdx, uiDepth+1, imgDec, imgRest, stride);
    4373 #else
    4374         xCopyDecToRestCU(pcCU, uiAbsPartIdx, uiDepth+1, pcPicDec, pcPicRest);
    4375 #endif
    43763447    }
    43773448    return;
     
    43803451  if (!pcCU->getAlfCtrlFlag(uiAbsPartIdx))
    43813452  {
    4382 #if !LCU_SYNTAX_ALF
    4383     UInt uiCUAddr = pcCU->getAddr();
    4384 #endif   
    43853453    Int iWidth = pcCU->getWidth(uiAbsPartIdx);
    43863454    Int iHeight = pcCU->getHeight(uiAbsPartIdx);
    4387 #if LCU_SYNTAX_ALF
    43883455    copyPixelsInOneRegion(imgRest, imgDec, stride, (Int)uiTPelY, iHeight, (Int)uiLPelX, iWidth);
    4389 #else
    4390     Pel* pRec = pcPicDec->getLumaAddr(uiCUAddr, uiAbsPartIdx);
    4391     Pel* pFilt = pcPicRest->getLumaAddr(uiCUAddr, uiAbsPartIdx);
    4392    
    4393     Int iRecStride = pcPicDec->getStride();
    4394     Int iFiltStride = pcPicRest->getStride();
    4395    
    4396     for (Int y = 0; y < iHeight; y++)
    4397     {
    4398       for (Int x = 0; x < iWidth; x++)
    4399       {
    4400         pFilt[x] = pRec[x];
    4401       }
    4402       pRec += iRecStride;
    4403       pFilt += iFiltStride;
    4404     }
    4405 #endif
    44063456  }
    44073457}
     
    44263476Void TEncAdaptiveLoopFilter::predictALFCoeffLumaEnc(ALFParam* pcAlfParam, Int **pfilterCoeffSym, Int filter_shape)
    44273477{
    4428 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3478#if LCUALF_QP_DEPENDENT_BITS
    44293479  Int alfPrecisionBit = getAlfPrecisionBit( m_alfQP );
    44303480#endif
     
    44423492    if((pcAlfParam->predMethod==0)|(ind==0))
    44433493    {
    4444 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3494#if LCUALF_QP_DEPENDENT_BITS
    44453495      coeffPred = ((1<<alfPrecisionBit)-sum) >> 2;
    44463496#else
     
    44653515    if((pcAlfParam->predMethod==0)|(ind==0))
    44663516    {
    4467 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     3517#if LCUALF_QP_DEPENDENT_BITS
    44683518      coeffPred = (1<<alfPrecisionBit)-sum;
    44693519#else
     
    46003650    *pDepthInt=NULL, kMinTab[MAX_SCAN_VAL], bitsCoeffScan[MAX_SCAN_VAL][MAX_EXP_GOLOMB],
    46013651  minKStart, minBitsKStart, bitsKStart;
    4602 #if ALF_SINGLE_FILTER_SHAPE
    46033652  Int minScanVal = MIN_SCAN_POS_CROSS;
    4604 #else 
    4605   int minScanVal = (fl==ALF_STAR5x5) ? 0 : MIN_SCAN_POS_CROSS;
    4606 #endif
    46073653  pDepthInt = pDepthIntTabShapes[fl];
    46083654 
     
    46723718  // Coding parameters
    46733719  //  len += lengthFilterCodingParams(minKStart, maxScanVal, kMinTab, createBitstream);
    4674 #if LCU_SYNTAX_ALF
    46753720  if (filters_per_group == 1)
    46763721  {
     
    46803725  else
    46813726  {
    4682 #endif
    46833727  len += (3 + maxScanVal);
    46843728 
     
    46863730  len += lengthFilterCoeffs(sqrFiltLength, filters_per_group, pDepthInt, pDiffQFilterCoeffIntPP,
    46873731                            kMinTab, createBitstream);
    4688 #if LCU_SYNTAX_ALF
    4689   }
    4690 #endif
     3732  }
    46913733
    46923734  return len;
     
    47353777    {
    47363778      scanPos = pDepthInt[i] - 1;
    4737 #if LCU_SYNTAX_ALF
    47383779      Int k = (filters_per_group == 1) ? kMinTab[i] : kMinTab[scanPos];
    47393780      bit_cnt += lengthGolomb(abs(FilterCoeff[ind][i]), k);
    4740 #else
    4741       bit_cnt += lengthGolomb(abs(FilterCoeff[ind][i]), kMinTab[scanPos]);
    4742 #endif
    47433781    }
    47443782  }
     
    47463784}
    47473785
    4748 #if !LCU_SYNTAX_ALF
    4749 
    4750 Void   TEncAdaptiveLoopFilter::xEncALFLuma ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost )
    4751 {
    4752   //pcPicDec: extended decoded
    4753   //pcPicRest: original decoded: filtered signal will be stored
    4754 
    4755   UInt64  uiRate;
    4756   UInt64  uiDist;
    4757   Double dCost;
    4758   Int    LumaStride = pcPicOrg->getStride();
    4759   Pel* pOrg  = pcPicOrg->getLumaAddr();
    4760   Pel* pRest = pcPicRest->getLumaAddr();
    4761   Pel* pDec  = pcPicDec->getLumaAddr();
    4762 
    4763   Double    dMinMethodCost  = MAX_DOUBLE;
    4764   UInt64    uiMinMethodDist = MAX_UINT;
    4765   UInt64    uiMinMethodRate = MAX_UINT;
    4766   Int       iBestClassMethod = ALF_RA;
    4767   Double    adExtraCostReduction[NUM_ALF_CLASS_METHOD];
    4768   ALFParam  cFrmAlfParam        [NUM_ALF_CLASS_METHOD];
    4769   ALFParam* pcAlfParam = NULL;
    4770 
    4771   for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    4772   {
    4773     pcAlfParam = &(cFrmAlfParam[i]);
    4774     allocALFParam(pcAlfParam);
    4775 
    4776     pcAlfParam->alf_flag        = 1;
    4777     pcAlfParam->chroma_idc      = 0;
    4778 
    4779     switch(i)
    4780     {
    4781     case ALF_RA:
    4782       {
    4783         adExtraCostReduction[i] = (double)(m_img_height * m_img_width) * m_dLambdaLuma * 2.0 / 4096.0;
    4784       }
    4785       break;
    4786     case ALF_BA:
    4787       {
    4788         adExtraCostReduction[i] = 0.0;
    4789       }
    4790       break;
    4791     default:
    4792       {
    4793         printf("Not a support adaptation method\n");
    4794         assert(0);
    4795         exit(-1);
    4796       }
    4797     }
    4798   }
    4799 
    4800 
    4801   for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    4802   {
    4803     m_uiVarGenMethod = i;
    4804 
    4805     pcAlfParam       = &(cFrmAlfParam[m_uiVarGenMethod]);
    4806     m_varImg         = m_varImgMethods[m_uiVarGenMethod];
    4807 
    4808     pcAlfParam->alf_pcr_region_flag = m_uiVarGenMethod;
    4809 
    4810     setInitialMask(pcPicOrg, pcPicDec);
    4811 
    4812     if(m_iALFEncodePassReduction == 0)
    4813     {
    4814       static Int best_filter_shape = 0;
    4815       if (m_uiVarGenMethod == 0)
    4816       {
    4817         UInt64 MinRate_Shape0 = MAX_INT;
    4818         UInt64 MinDist_Shape0 = MAX_INT;
    4819         Double MinCost_Shape0 = MAX_DOUBLE;
    4820 
    4821         UInt64 MinRate_Shape1 = MAX_INT;
    4822         UInt64 MinDist_Shape1 = MAX_INT;
    4823         Double MinCost_Shape1 = MAX_DOUBLE;
    4824 
    4825 #if ALF_SINGLE_FILTER_SHAPE
    4826         Int filter_shape = 0;
    4827 #else       
    4828         for (Int filter_shape = 0; filter_shape < 2 ;filter_shape ++)
    4829 #endif
    4830         {
    4831           pcAlfParam->filter_shape = filter_shape;
    4832           pcAlfParam->num_coeff = m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[filter_shape];
    4833           xFirstFilteringFrameLuma(pOrg, pDec, m_pcPicYuvTmp->getLumaAddr(), pcAlfParam, pcAlfParam->filter_shape, LumaStride);
    4834           xCalcRDCost(pcPicOrg, m_pcPicYuvTmp, pcAlfParam, uiRate, uiDist, dCost);
    4835           if (filter_shape == 0)
    4836           {
    4837             // copy Shape0
    4838             MinRate_Shape0 = uiRate;
    4839             MinDist_Shape0 = uiDist;
    4840             MinCost_Shape0 = dCost;
    4841             m_pcPicYuvTmp->copyToPicLuma(pcPicYuvRecShape0);
    4842             copyALFParam(pcAlfParamShape0, pcAlfParam);
    4843           }
    4844           else //if (filter_shape == 1)
    4845           {
    4846             // copy Shape1
    4847             MinRate_Shape1 = uiRate;
    4848             MinDist_Shape1 = uiDist;
    4849             MinCost_Shape1  = dCost;
    4850             m_pcPicYuvTmp->copyToPicLuma(pcPicYuvRecShape1);
    4851             copyALFParam(pcAlfParamShape1, pcAlfParam);
    4852           }
    4853         }
    4854 
    4855         if (MinCost_Shape0 <= MinCost_Shape1)
    4856         {
    4857           pcPicYuvRecShape0->copyToPicLuma(m_pcPicYuvTmp);
    4858           copyALFParam(pcAlfParam, pcAlfParamShape0);
    4859           uiRate = MinRate_Shape0;
    4860           uiDist = MinDist_Shape0;
    4861           dCost = MinCost_Shape0;
    4862           best_filter_shape = 0;
    4863         }
    4864         else //if (MinCost_Shape1 < MinCost_Shape0)
    4865         {
    4866           pcPicYuvRecShape1->copyToPicLuma(m_pcPicYuvTmp);
    4867           copyALFParam(pcAlfParam, pcAlfParamShape1);
    4868           uiRate = MinRate_Shape1;
    4869           uiDist = MinDist_Shape1;
    4870           dCost = MinCost_Shape1;
    4871           best_filter_shape = 1;
    4872         }
    4873       }
    4874       else
    4875       {
    4876         pcAlfParam->filter_shape = best_filter_shape;
    4877         pcAlfParam->num_coeff = m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[best_filter_shape];
    4878         xFirstFilteringFrameLuma(pOrg, pDec, m_pcPicYuvTmp->getLumaAddr(), pcAlfParam, best_filter_shape, LumaStride);
    4879         xCalcRDCost(pcPicOrg, m_pcPicYuvTmp, pcAlfParam, uiRate, uiDist, dCost);
    4880       }
    4881     }
    4882     else
    4883     {
    4884       decideFilterShapeLuma(pOrg, pDec, LumaStride, pcAlfParam, uiRate, uiDist, dCost);
    4885     }
    4886 
    4887     dCost -= adExtraCostReduction[m_uiVarGenMethod];
    4888 
    4889     if(dCost < dMinMethodCost)
    4890     {
    4891       iBestClassMethod = m_uiVarGenMethod;
    4892       dMinMethodCost = dCost;
    4893       uiMinMethodRate= uiRate;
    4894       uiMinMethodDist = uiDist;
    4895 
    4896       if(m_iALFEncodePassReduction == 0)
    4897       {
    4898         m_pcPicYuvTmp->copyToPicLuma(pcPicRest);
    4899       }
    4900     } 
    4901   }
    4902 
    4903   m_uiVarGenMethod = iBestClassMethod;
    4904   dMinMethodCost += adExtraCostReduction[m_uiVarGenMethod];
    4905   m_varImg= m_varImgMethods[m_uiVarGenMethod];
    4906 
    4907   pcAlfParam = &(cFrmAlfParam[m_uiVarGenMethod]);
    4908 
    4909   ALFParam  cAlfParamWithBestMethod;
    4910   allocALFParam(&cAlfParamWithBestMethod); 
    4911 
    4912 
    4913   if(m_iALFEncodePassReduction ==0)
    4914   {
    4915     copyALFParam(&cAlfParamWithBestMethod, pcAlfParam);
    4916   }
    4917   else
    4918   {
    4919     cAlfParamWithBestMethod.alf_flag = 1;
    4920     cAlfParamWithBestMethod.chroma_idc = 0;
    4921     cAlfParamWithBestMethod.alf_pcr_region_flag = m_uiVarGenMethod;
    4922     cAlfParamWithBestMethod.filter_shape= pcAlfParam->filter_shape;
    4923     cAlfParamWithBestMethod.num_coeff = m_sqrFiltLengthTab[cAlfParamWithBestMethod.filter_shape];
    4924     decodeFilterSet(pcAlfParam, m_varIndTab, m_filterCoeffSym);
    4925     if(!m_bUseNonCrossALF)
    4926     {
    4927       filterLuma(pRest, pDec, LumaStride, 0, m_img_height-1, 0, m_img_width-1,  pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);
    4928     }
    4929     else
    4930     {
    4931       xfilterSlicesEncoder(pDec, pRest, LumaStride, pcAlfParam->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);
    4932     }
    4933     xcodeFiltCoeff(m_filterCoeffSym, pcAlfParam->filter_shape, m_varIndTab, pcAlfParam->filters_per_group,&cAlfParamWithBestMethod);
    4934 
    4935     xCalcRDCost(pcPicOrg, pcPicRest, &cAlfParamWithBestMethod, uiMinMethodRate, uiMinMethodDist, dMinMethodCost);
    4936 
    4937   }
    4938 
    4939   if(dMinMethodCost < rdMinCost )
    4940   {
    4941     ruiMinRate = uiMinMethodRate;
    4942     ruiMinDist = uiMinMethodDist;
    4943     rdMinCost =  dMinMethodCost;
    4944     copyALFParam(m_pcBestAlfParam, &cAlfParamWithBestMethod);
    4945   }
    4946 
    4947   freeALFParam(&cAlfParamWithBestMethod);
    4948   for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    4949   {
    4950     freeALFParam(&cFrmAlfParam[i]);
    4951   }
    4952 }
    4953 
    4954 
    4955 
    4956 Void   TEncAdaptiveLoopFilter::xFirstFilteringFrameLuma(Pel* imgOrg, Pel* imgDec, Pel* imgRest, ALFParam* ALFp, Int filtNo, Int stride)
    4957 {
    4958   if(!m_bUseNonCrossALF)
    4959   {
    4960     xstoreInBlockMatrix(0, 0, m_img_height, m_img_width, true, true, imgOrg, imgDec, filtNo, stride);
    4961   }
    4962   else
    4963   {
    4964     xstoreInBlockMatrixforSlices(imgOrg, imgDec, filtNo, stride);
    4965   }
    4966 
    4967 
    4968   xFilteringFrameLuma(imgOrg, imgDec, imgRest, ALFp, filtNo, stride);
    4969 }
    4970 
    4971 Void   TEncAdaptiveLoopFilter::xstoreInBlockMatrix(Int ypos, Int xpos, Int iheight, Int iwidth, Bool bResetBlockMatrix, Bool bSymmCopyBlockMatrix, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int stride)
    4972 {
    4973 
    4974   Pel  regionOfInterested = (m_iDesignCurrentFilter ==1)?(1):(0);
    4975   Int     sqrFiltLength      = (filtNo == 2)?((Int)(MAX_SQR_FILT_LENGTH)):(m_sqrFiltLengthTab[filtNo]);
    4976   Int     yposEnd            = ypos + iheight -1;
    4977   Int     xposEnd            = xpos + iwidth  -1;
    4978   Double ***EShape           = m_EGlobalSym[filtNo];
    4979   Double **yShape            = m_yGlobalSym[filtNo];
    4980 
    4981   Int ELocal[MAX_SQR_FILT_LENGTH];
    4982   Pel *pImgPad1, *pImgPad2, *pImgPad3, *pImgPad4;
    4983   Int i,j,k,l,varInd, yLocal;
    4984   double **E,*yy;
    4985 
    4986   static Int numValidPels;
    4987   if(bResetBlockMatrix)
    4988   {
    4989     numValidPels = 0;
    4990     memset( m_pixAcc, 0,sizeof(double)*NO_VAR_BINS);
    4991     for (varInd=0; varInd<NO_VAR_BINS; varInd++)
    4992     {
    4993       memset(yShape[varInd],0,sizeof(double)*MAX_SQR_FILT_LENGTH);
    4994       for (k=0; k<sqrFiltLength; k++)
    4995       {
    4996         memset(EShape[varInd][k],0,sizeof(double)*MAX_SQR_FILT_LENGTH);
    4997       }
    4998     }
    4999     for (i = 0; i < m_img_height; i++)
    5000     {
    5001       for (j = 0; j < m_img_width; j++)
    5002       {
    5003         if (m_maskImg[i][j] == regionOfInterested)
    5004         {
    5005           numValidPels++;
    5006         }
    5007       }
    5008     }
    5009   }
    5010 
    5011   Int yLineInLCU;
    5012   Int paddingLine ;
    5013 
    5014   pImgPad += (ypos* stride);
    5015   pImgOrg += (ypos* stride);
    5016 
    5017   switch(filtNo)
    5018   {
    5019 #if !ALF_SINGLE_FILTER_SHAPE
    5020   case ALF_STAR5x5:
    5021     {
    5022       for (i= ypos; i<= yposEnd; i++)
    5023       {
    5024         yLineInLCU = i % m_lcuHeight;
    5025 
    5026         if (yLineInLCU < m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height )
    5027         {
    5028           pImgPad1 = pImgPad +   stride;
    5029           pImgPad2 = pImgPad -   stride;
    5030           pImgPad3 = pImgPad + 2*stride;
    5031           pImgPad4 = pImgPad - 2*stride;
    5032         }
    5033         else if (yLineInLCU < m_lineIdxPadTop)
    5034         {
    5035           paddingLine = - yLineInLCU + m_lineIdxPadTop - 1;
    5036           pImgPad1 = pImgPad + min(paddingLine, 1)*stride;
    5037           pImgPad2 = pImgPad -   stride;
    5038           pImgPad3 = pImgPad + min(paddingLine, 2)*stride;
    5039           pImgPad4 = pImgPad - 2*stride;
    5040         }
    5041         else
    5042         {
    5043           paddingLine = yLineInLCU - m_lineIdxPadTop;
    5044           pImgPad1 = pImgPad +   stride;
    5045           pImgPad2 = pImgPad - min(paddingLine, 1)*stride;
    5046           pImgPad3 = pImgPad + 2*stride;
    5047           pImgPad4 = pImgPad - min(paddingLine, 2)*stride;
    5048         }
    5049 
    5050         if ( (yLineInLCU == m_lineIdxPadTop || yLineInLCU == m_lineIdxPadTop-1) && i-yLineInLCU+m_lcuHeight < m_img_height )
    5051         {
    5052           pImgPad+= stride;
    5053           pImgOrg+= stride;
    5054           continue;
    5055         }
    5056         else
    5057         {
    5058         for (j= xpos; j<= xposEnd; j++)
    5059         {
    5060           if ( (m_maskImg[i][j] == regionOfInterested) || (numValidPels == 0) )
    5061           {
    5062             varInd = m_varImg[i/VAR_SIZE_H][j/VAR_SIZE_W];
    5063             memset(ELocal, 0, 10*sizeof(Int));
    5064 
    5065             ELocal[0] = (pImgPad3[j+2] + pImgPad4[j-2]);
    5066             ELocal[1] = (pImgPad3[j  ] + pImgPad4[j  ]);
    5067             ELocal[2] = (pImgPad3[j-2] + pImgPad4[j+2]);
    5068 
    5069             ELocal[3] = (pImgPad1[j+1] + pImgPad2[j-1]);
    5070             ELocal[4] = (pImgPad1[j  ] + pImgPad2[j  ]);
    5071             ELocal[5] = (pImgPad1[j-1] + pImgPad2[j+1]);
    5072 
    5073             ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]);
    5074             ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]);
    5075             ELocal[8] = (pImgPad[j  ]);
    5076 
    5077             yLocal= pImgOrg[j];
    5078             m_pixAcc[varInd]+=(yLocal*yLocal);
    5079             E= EShape[varInd]; 
    5080             yy= yShape[varInd];
    5081 
    5082             for (k=0; k<10; k++)
    5083             {
    5084               for (l=k; l<10; l++)
    5085               {
    5086                 E[k][l]+=(double)(ELocal[k]*ELocal[l]);
    5087               }
    5088               yy[k]+=(double)(ELocal[k]*yLocal);
    5089             }
    5090 
    5091           }
    5092         }
    5093         pImgPad+= stride;
    5094         pImgOrg+= stride;
    5095         }
    5096       }
    5097     }
    5098     break;
    5099   case ALF_CROSS9x9:
    5100     {
    5101       Pel *pImgPad5, *pImgPad6, *pImgPad7, *pImgPad8;
    5102 #else
    5103   case ALF_CROSS9x7_SQUARE3x3:
    5104     {
    5105       Pel *pImgPad5, *pImgPad6;
    5106 #endif
    5107       for (i= ypos; i<= yposEnd; i++)
    5108       {
    5109         yLineInLCU = i % m_lcuHeight;
    5110 
    5111         if (yLineInLCU<m_lineIdxPadBot || i-yLineInLCU+m_lcuHeight >= m_img_height)
    5112         {
    5113           pImgPad1 = pImgPad +   stride;
    5114           pImgPad2 = pImgPad -   stride;
    5115           pImgPad3 = pImgPad + 2*stride;
    5116           pImgPad4 = pImgPad - 2*stride;
    5117           pImgPad5 = pImgPad + 3*stride;
    5118           pImgPad6 = pImgPad - 3*stride;
    5119 #if !ALF_SINGLE_FILTER_SHAPE
    5120           pImgPad7 = pImgPad + 4*stride;
    5121           pImgPad8 = pImgPad - 4*stride;
    5122 #endif
    5123         }
    5124         else if (yLineInLCU<m_lineIdxPadTop)
    5125         {
    5126           paddingLine = - yLineInLCU + m_lineIdxPadTop - 1;
    5127           pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad + min(paddingLine, 1)*stride;
    5128           pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad -   stride;
    5129           pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + min(paddingLine, 2)*stride;
    5130           pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - 2*stride;
    5131           pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + min(paddingLine, 3)*stride;
    5132           pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - 3*stride;
    5133 #if !ALF_SINGLE_FILTER_SHAPE
    5134           pImgPad7 = (paddingLine < 4) ? pImgPad : pImgPad + min(paddingLine, 4)*stride;
    5135           pImgPad8 = (paddingLine < 4) ? pImgPad : pImgPad - 4*stride;
    5136 #endif
    5137         }
    5138         else
    5139         {
    5140           paddingLine = yLineInLCU - m_lineIdxPadTop;
    5141           pImgPad1 = (paddingLine < 1) ? pImgPad : pImgPad +   stride;
    5142           pImgPad2 = (paddingLine < 1) ? pImgPad : pImgPad - min(paddingLine, 1)*stride;
    5143           pImgPad3 = (paddingLine < 2) ? pImgPad : pImgPad + 2*stride;
    5144           pImgPad4 = (paddingLine < 2) ? pImgPad : pImgPad - min(paddingLine, 2)*stride;
    5145           pImgPad5 = (paddingLine < 3) ? pImgPad : pImgPad + 3*stride;
    5146           pImgPad6 = (paddingLine < 3) ? pImgPad : pImgPad - min(paddingLine, 3)*stride;
    5147 #if !ALF_SINGLE_FILTER_SHAPE
    5148           pImgPad7 = (paddingLine < 4) ? pImgPad : pImgPad + 4*stride;
    5149           pImgPad8 = (paddingLine < 4) ? pImgPad : pImgPad - min(paddingLine, 4)*stride;
    5150 #endif
    5151         }         
    5152 
    5153         for (j= xpos; j<= xposEnd; j++)
    5154         {
    5155           if ( (m_maskImg[i][j] == regionOfInterested) || (numValidPels == 0) )
    5156           {
    5157             varInd = m_varImg[i/VAR_SIZE_H][j/VAR_SIZE_W];
    5158 
    5159 #if ALF_SINGLE_FILTER_SHAPE
    5160             memset(ELocal, 0, (sqrFiltLength+1)*sizeof(Int));
    5161 
    5162             ELocal[0] = (pImgPad5[j]+pImgPad6[j]);
    5163             ELocal[1] = (pImgPad3[j]+pImgPad4[j]);
    5164             ELocal[2] = (pImgPad1[j-1]+pImgPad2[j+1]);
    5165             ELocal[3] = (pImgPad1[j]+pImgPad2[j]);
    5166             ELocal[4] = (pImgPad1[j+1]+pImgPad2[j-1]);
    5167             ELocal[5] = (pImgPad[j+4]+pImgPad[j-4]);
    5168             ELocal[6] = (pImgPad[j+3]+pImgPad[j-3]);
    5169             ELocal[7] = (pImgPad[j+2]+pImgPad[j-2]);
    5170             ELocal[8] = (pImgPad[j+1]+pImgPad[j-1]);
    5171             ELocal[9] = (pImgPad[j  ]);
    5172 #else
    5173             memset(ELocal, 0, 10*sizeof(Int));
    5174 
    5175             ELocal[0] = (pImgPad7[j] + pImgPad8[j]);
    5176 
    5177             ELocal[1] = (pImgPad5[j] + pImgPad6[j]);
    5178 
    5179             ELocal[2] = (pImgPad3[j] + pImgPad4[j]);
    5180 
    5181             ELocal[3] = (pImgPad1[j] + pImgPad2[j]);
    5182 
    5183             ELocal[4] = (pImgPad[j+4] + pImgPad[j-4]);
    5184             ELocal[5] = (pImgPad[j+3] + pImgPad[j-3]);
    5185             ELocal[6] = (pImgPad[j+2] + pImgPad[j-2]);
    5186             ELocal[7] = (pImgPad[j+1] + pImgPad[j-1]);
    5187             ELocal[8] = (pImgPad[j  ] );
    5188 #endif
    5189             yLocal= pImgOrg[j];
    5190             m_pixAcc[varInd]+=(yLocal*yLocal);
    5191             E= EShape[varInd];
    5192             yy= yShape[varInd];
    5193 
    5194 #if ALF_SINGLE_FILTER_SHAPE
    5195             for (k=0; k<(sqrFiltLength+1); k++)
    5196             {
    5197               for (l=k; l<(sqrFiltLength+1); l++)
    5198               {
    5199                 E[k][l]+=(double)(ELocal[k]*ELocal[l]);
    5200               }
    5201               yy[k]+=(double)(ELocal[k]*yLocal);
    5202             }
    5203 #else
    5204             for (k=0; k<10; k++)
    5205             {
    5206               for (l=k; l<10; l++)
    5207               {
    5208                 E[k][l]+=(double)(ELocal[k]*ELocal[l]);
    5209               }
    5210               yy[k]+=(double)(ELocal[k]*yLocal);
    5211             }
    5212 #endif
    5213           }
    5214         }
    5215         pImgPad+= stride;
    5216         pImgOrg+= stride;
    5217       }
    5218 
    5219     }
    5220     break;
    5221   default:
    5222     {
    5223       printf("Not a supported filter shape\n");
    5224       assert(0);
    5225       exit(1);
    5226     }
    5227   }
    5228 
    5229   if(bSymmCopyBlockMatrix)
    5230   {
    5231     for (varInd=0; varInd<NO_VAR_BINS; varInd++)
    5232     {
    5233       double **pE = EShape[varInd];
    5234       for (k=1; k<sqrFiltLength; k++)
    5235       {
    5236         for (l=0; l<k; l++)
    5237         {
    5238           pE[k][l]=pE[l][k];
    5239         }
    5240       }
    5241     }
    5242   }
    5243 }
    5244 
    5245 
    5246 Void   TEncAdaptiveLoopFilter::xFilteringFrameLuma(Pel* imgOrg, Pel* imgPad, Pel* imgFilt, ALFParam* ALFp, Int filtNo, Int stride)
    5247 {
    5248   static double **ySym, ***ESym;
    5249   Int  filters_per_fr;
    5250   Int lambdaVal = (Int) m_dLambdaLuma;
    5251   lambdaVal = lambdaVal * (1<<(2*g_uiBitIncrement));
    5252 
    5253   ESym=m_EGlobalSym[filtNo]; 
    5254   ySym=m_yGlobalSym[filtNo];
    5255 
    5256   xfindBestFilterVarPred(ySym, ESym, m_pixAcc, m_filterCoeffSym, m_filterCoeffSymQuant, filtNo, &filters_per_fr,m_varIndTab, NULL, m_varImg, m_maskImg, NULL, lambdaVal);
    5257 
    5258   if(!m_bUseNonCrossALF)
    5259   {
    5260     filterLuma(imgFilt, imgPad, stride, 0, m_img_height-1, 0, m_img_width-1,  ALFp->filter_shape, m_filterCoeffSym, m_varIndTab, m_varImg);
    5261   }
    5262   else
    5263   {
    5264     xfilterSlicesEncoder(imgPad, imgFilt, stride, filtNo, m_filterCoeffSym, m_varIndTab, m_varImg);
    5265   }
    5266 
    5267   xcodeFiltCoeff(m_filterCoeffSymQuant, filtNo, m_varIndTab, filters_per_fr,ALFp);
    5268 }
    5269 #endif
    5270 
    5271 #if LCU_SYNTAX_ALF
     3786
    52723787Void TEncAdaptiveLoopFilter::xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant, Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val, Int numMaxFilters)
    5273 #else
    5274 Void TEncAdaptiveLoopFilter::xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant, Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val)
    5275 #endif
    52763788{
    52773789  Int filters_per_fr, firstFilt, interval[NO_VAR_BINS][2], intervalBest[NO_VAR_BINS][2];
     
    53053817
    53063818    lagrangian=xfindBestCoeffCodMethod(filterCoeffSymQuant, filter_shape, sqrFiltLength, filters_per_fr, errorForce0CoeffTab, lambda_val);
    5307 #if LCU_SYNTAX_ALF
    53083819    if (lagrangian<lagrangianMin || firstFilt==1 || filters_per_fr == numMaxFilters)
    5309 #else
    5310     if (lagrangian<lagrangianMin || firstFilt==1 || filters_per_fr == m_iALFMaxNumberFilters)
    5311 #endif
    53123820    {
    53133821      firstFilt=0;
     
    53193827    filters_per_fr--;
    53203828  }
    5321 #if !ALF_16_BA_GROUPS
    5322   if ( (m_uiVarGenMethod == ALF_BA) && ((*filters_per_fr_best) > 1) )
    5323   {
    5324     Int iLastFilter = (*filters_per_fr_best)-1;
    5325     if (intervalBest[iLastFilter][0] == NO_VAR_BINS-1)
    5326     {
    5327       intervalBest[iLastFilter-1][1] = NO_VAR_BINS-1;
    5328       (*filters_per_fr_best) = iLastFilter;
    5329     }
    5330   }
    5331 #endif
    53323829  findFilterCoeff(ESym, ySym, pixAcc, filterCoeffSym, filterCoeffSymQuant, intervalBest,
    53333830    varIndTab, sqrFiltLength, (*filters_per_fr_best), weights, errorForce0CoeffTab);
     
    54893986 * \param [in,out]vAlfCUCtrlParam ALF CU control parameters
    54903987 */
    5491 #if LCU_SYNTAX_ALF 
    54923988#if HHI_INTERVIEW_SKIP
    54933989Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlags(UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Pel* imgUsed, Int stride, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)
     
    54953991Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlags(UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Int stride, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)
    54963992#endif
    5497 #else
    5498 #if HHI_INTERVIEW_SKIP
    5499 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlags_qc(UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, TComPicYuv* pUsedPelMap, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)
    5500 #else
    5501 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlags_qc(UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam)
    5502 #endif
    5503 #endif
    55043993{
    55053994  ruiDist = 0;
     
    55204009  {
    55214010    TComDataCU* pcCU = m_pcPic->getCU( CUAddr );
    5522 #if LCU_SYNTAX_ALF
    55234011#if HHI_INTERVIEW_SKIP
    55244012    setCUAlfCtrlFlag(pcCU, 0, 0, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, imgUsed, stride, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag);
    55254013#else
    55264014    setCUAlfCtrlFlag(pcCU, 0, 0, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, stride, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag);
    5527 #endif
    5528 #else
    5529 #if HHI_INTERVIEW_SKIP
    5530     xSetCUAlfCtrlFlag_qc(pcCU, 0, 0, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest,imgUsed, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag);
    5531 #else
    5532     xSetCUAlfCtrlFlag_qc(pcCU, 0, 0, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest, ruiDist, vAlfCUCtrlParam[0].alf_cu_flag);
    5533 #endif
    55344015#endif
    55354016  }
     
    55694050}
    55704051
    5571 #if LCU_SYNTAX_ALF
    55724052#if HHI_INTERVIEW_SKIP
    55734053Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Pel* imgUsed, Int stride, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag)
    55744054#else
    55754055Void TEncAdaptiveLoopFilter::setCUAlfCtrlFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, Pel* imgOrg, Pel* imgDec, Pel* imgRest, Int stride, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag)
    5576 #endif
    5577 #else
    5578 #if HHI_INTERVIEW_SKIP
    5579 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlag_qc(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, TComPicYuv* pcUsedPelMap, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag)
    5580 #else
    5581 Void TEncAdaptiveLoopFilter::xSetCUAlfCtrlFlag_qc(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag)
    5582 #endif
    55834056#endif
    55844057{
     
    56034076     
    56044077      if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
    5605 #if LCU_SYNTAX_ALF
    56064078#if HHI_INTERVIEW_SKIP
    56074079        setCUAlfCtrlFlag(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, imgUsed, stride, ruiDist, vCUCtrlFlag);
     
    56094081        setCUAlfCtrlFlag(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, imgOrg, imgDec, imgRest, stride, ruiDist, vCUCtrlFlag);
    56104082#endif
    5611 #else
    5612 #if HHI_INTERVIEW_SKIP
    5613         xSetCUAlfCtrlFlag_qc(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest, imgUsed, ruiDist, vCUCtrlFlag);
    5614 #else
    5615         xSetCUAlfCtrlFlag_qc(pcCU, uiAbsPartIdx, uiDepth+1, uiAlfCtrlDepth, pcPicOrg, pcPicDec, pcPicRest, ruiDist, vCUCtrlFlag);
    5616 #endif
    5617 #endif
    56184083    }
    56194084    return;
     
    56244089    return;
    56254090  }
    5626 #if !LCU_SYNTAX_ALF
    5627   UInt uiCUAddr = pcCU->getAddr();
    5628 #endif
    56294091  UInt64 uiRecSSD = 0;
    56304092  UInt64 uiFiltSSD = 0;
     
    56614123  }
    56624124 
    5663 #if LCU_SYNTAX_ALF
    56644125  Int  offset = uiTPelY*stride + uiLPelX;
    56654126  Pel* pOrg  = imgOrg  + offset;
     
    56794140  uiFiltSSD += xCalcSSD( pOrg, pFilt, iWidth, iHeight, stride );
    56804141#endif
    5681 #else
    5682   Pel* pOrg = pcPicOrg->getLumaAddr(uiCUAddr, uiAbsPartIdx);
    5683   Pel* pRec = pcPicDec->getLumaAddr(uiCUAddr, uiAbsPartIdx);
    5684   Pel* pFilt = pcPicRest->getLumaAddr(uiCUAddr, uiAbsPartIdx);
    5685  
    5686 #if HHI_INTERVIEW_SKIP
    5687   Pel* pUsed = pcUsedPelMap->getLumaAddr(uiCUAddr, uiAbsPartIdx);
    5688   uiRecSSD  += xCalcSSD( pOrg, pRec, pUsed, iWidth, iHeight, pcPicOrg->getStride() );
    5689   uiFiltSSD += xCalcSSD( pOrg, pFilt, pUsed, iWidth, iHeight, pcPicOrg->getStride() );
    5690 #else
    5691   uiRecSSD  += xCalcSSD( pOrg, pRec,  iWidth, iHeight, pcPicOrg->getStride() );
    5692   uiFiltSSD += xCalcSSD( pOrg, pFilt, iWidth, iHeight, pcPicOrg->getStride() );
    5693 #endif
    5694 #endif
    56954142  if (uiFiltSSD < uiRecSSD)
    56964143  {
     
    56994146    vCUCtrlFlag.push_back(1);
    57004147
    5701 #if LCU_SYNTAX_ALF
    57024148    for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(m_img_height-1))  ;i++)
    57034149    {
    57044150      for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(m_img_width-1)) ;j++)
    57054151      {
    5706 #else
    5707     for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(pcPicOrg->getHeight()-1))  ;i++)
    5708     {
    5709       for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(pcPicOrg->getWidth()-1)) ;j++)
    5710       {
    5711 #endif
    57124152        m_maskImg[i][j]=1;
    57134153      }
     
    57194159    pcCU->setAlfCtrlFlagSubParts(0, uiAbsPartIdx, uiSetDepth);
    57204160    vCUCtrlFlag.push_back(0);
    5721 #if LCU_SYNTAX_ALF
    57224161    for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(m_img_height-1))  ;i++)
    57234162    {
    57244163      for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(m_img_width-1)) ;j++)
    57254164      {
    5726 #else
    5727     for (int i=uiTPelY ;i<=min(uiBPelY,(unsigned int)(pcPicOrg->getHeight()-1))  ;i++)
    5728     {
    5729       for (int j=uiLPelX ;j<=min(uiRPelX,(unsigned int)(pcPicOrg->getWidth()-1)) ;j++)
    5730       {
    5731 #endif
    57324165        m_maskImg[i][j]=0;
    57334166      }
     
    57364169}
    57374170
    5738 #if !LCU_SYNTAX_ALF
    5739 
    5740 Void TEncAdaptiveLoopFilter::xReDesignFilterCoeff_qc(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, Bool bReadCorr)
    5741 {
    5742   Int tap = m_pcTempAlfParam->filter_shape;
    5743   Int    LumaStride = pcPicOrg->getStride();
    5744   Pel* pOrg  = pcPicOrg->getLumaAddr();
    5745   Pel* pDec  = pcPicDec->getLumaAddr();
    5746   Pel* pRest = pcPicRest->getLumaAddr();
    5747   xFirstFilteringFrameLuma(pOrg, pDec, pRest, m_pcTempAlfParam, tap, LumaStride);
    5748  
    5749   if (m_iALFEncodePassReduction)
    5750   {
    5751     if(!m_iUsePreviousFilter)
    5752     {
    5753       saveFilterCoeffToBuffer(m_filterCoeffSym, m_pcTempAlfParam->filters_per_group, m_varIndTab, m_pcTempAlfParam->alf_pcr_region_flag, tap);
    5754     }
    5755   }
    5756 }
    5757 
    5758 Void TEncAdaptiveLoopFilter::xCUAdaptiveControl_qc(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost)
    5759 {
    5760   if(!m_bAlfCUCtrlEnabled) return;
    5761   Bool bChanged = false;
    5762   std::vector<AlfCUCtrlInfo> vAlfCUCtrlParamTemp(m_vBestAlfCUCtrlParam);
    5763 
    5764   Pel** maskImgTemp;
    5765 
    5766   if(m_iALFEncodePassReduction == 2)
    5767   {
    5768     initMatrix_Pel(&maskImgTemp, m_img_height, m_img_width);
    5769   }
    5770 
    5771   m_pcEntropyCoder->setAlfCtrl(true);
    5772  
    5773   UInt uiBestDepth = 0;
    5774  
    5775   ALFParam cFrmAlfParam;
    5776   allocALFParam(&cFrmAlfParam);
    5777   copyALFParam(&cFrmAlfParam, m_pcBestAlfParam);
    5778  
    5779   for (UInt uiDepth = 0; uiDepth < g_uiMaxCUDepth; uiDepth++)
    5780   {
    5781     m_pcEntropyCoder->setMaxAlfCtrlDepth(uiDepth);
    5782     pcPicRest->copyToPicLuma(m_pcPicYuvTmp);
    5783     copyALFParam(m_pcTempAlfParam, &cFrmAlfParam);
    5784 
    5785     for (UInt uiRD = 0; uiRD <= m_iALFNumOfRedesign; uiRD++)
    5786     {
    5787       if (uiRD)
    5788       {
    5789         // re-design filter coefficients
    5790         xReDesignFilterCoeff_qc(pcPicOrg, pcPicDec, m_pcPicYuvTmp, true); //use filtering of mine
    5791       }
    5792      
    5793       UInt64 uiRate, uiDist;
    5794       Double dCost;
    5795      //m_pcPicYuvTmp: filtered signal, pcPicDec: orig reconst
    5796       xSetCUAlfCtrlFlags_qc(uiDepth, pcPicOrg, pcPicDec, m_pcPicYuvTmp, uiDist, vAlfCUCtrlParamTemp);
    5797       xCalcRDCost(m_pcTempAlfParam, uiRate, uiDist, dCost, &vAlfCUCtrlParamTemp);
    5798       if (dCost < rdMinCost)
    5799       {
    5800         bChanged = true;
    5801         m_vBestAlfCUCtrlParam = vAlfCUCtrlParamTemp;
    5802         uiBestDepth = uiDepth;
    5803         rdMinCost = dCost;
    5804         ruiMinDist = uiDist;
    5805         ruiMinRate = uiRate;
    5806         m_pcPicYuvTmp->copyToPicLuma(m_pcPicYuvBest);
    5807         copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);
    5808         //save maskImg
    5809         xCopyTmpAlfCtrlFlagsFrom();
    5810         if(m_iALFEncodePassReduction == 2)
    5811         {
    5812           ::memcpy(maskImgTemp[0], m_maskImg[0], sizeof(Pel)*m_img_height* m_img_width);
    5813         }
    5814       }
    5815     }
    5816   }
    5817 
    5818   if(bChanged)
    5819   {
    5820     if(m_iALFEncodePassReduction == 2)
    5821     {
    5822       UInt uiDepth = uiBestDepth;
    5823       ::memcpy(m_maskImg[0], maskImgTemp[0], sizeof(Pel)*m_img_height* m_img_width);
    5824       xCopyTmpAlfCtrlFlagsTo();
    5825  
    5826       copyALFParam(&cFrmAlfParam, m_pcBestAlfParam);
    5827 
    5828       m_pcEntropyCoder->setAlfCtrl(true);
    5829       m_pcEntropyCoder->setMaxAlfCtrlDepth(uiDepth);
    5830       copyALFParam(m_pcTempAlfParam, &cFrmAlfParam);
    5831 
    5832       xReDesignFilterCoeff_qc(pcPicOrg, pcPicDec, m_pcPicYuvTmp, true); //use filtering of mine
    5833 
    5834       UInt64 uiRate, uiDist;
    5835       Double dCost;
    5836       xSetCUAlfCtrlFlags_qc(uiDepth, pcPicOrg, pcPicDec, m_pcPicYuvTmp, uiDist, vAlfCUCtrlParamTemp);
    5837       xCalcRDCost(m_pcTempAlfParam, uiRate, uiDist, dCost, &vAlfCUCtrlParamTemp);
    5838       if (dCost < rdMinCost)
    5839       {
    5840         rdMinCost = dCost;
    5841         ruiMinDist = uiDist;
    5842         ruiMinRate = uiRate;
    5843         m_pcPicYuvTmp->copyToPicLuma(m_pcPicYuvBest);
    5844         copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);
    5845         xCopyTmpAlfCtrlFlagsFrom();
    5846         m_vBestAlfCUCtrlParam = vAlfCUCtrlParamTemp;
    5847       }
    5848     }
    5849 
    5850     m_pcEntropyCoder->setAlfCtrl(true);
    5851     m_pcEntropyCoder->setMaxAlfCtrlDepth(uiBestDepth);
    5852     xCopyTmpAlfCtrlFlagsTo();
    5853 
    5854     m_pcPicYuvBest->copyToPicLuma(pcPicRest);//copy m_pcPicYuvBest to pcPicRest
    5855     xCopyDecToRestCUs(pcPicDec, pcPicRest); //pcPicRest = pcPicDec
    5856   }
    5857   else
    5858   {
    5859     m_pcEntropyCoder->setAlfCtrl(false);
    5860     m_pcEntropyCoder->setMaxAlfCtrlDepth(0);
    5861   }
    5862   freeALFParam(&cFrmAlfParam);
    5863 
    5864   if(m_iALFEncodePassReduction == 2)
    5865   {
    5866     destroyMatrix_Pel(maskImgTemp);
    5867   }
    5868 }
    5869 
    5870 #endif
    58714171
    58724172#define ROUND(a)  (((a) < 0)? (int)((a) - 0.5) : (int)((a) + 0.5))
     
    62424542{
    62434543  double error;
    6244 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     4544#if LCUALF_QP_DEPENDENT_BITS
    62454545  Int factor = (1<<(getAlfPrecisionBit(m_alfQP)));
    62464546#else
     
    63844684}
    63854685
    6386 #if !LCU_SYNTAX_ALF
    6387 
    6388 /** Save redesigned filter set to buffer
    6389  * \param filterCoeffPrevSelected filter set buffer
    6390  */
    6391 Void TEncAdaptiveLoopFilter::saveFilterCoeffToBuffer(Int **filterSet, Int numFilter, Int* mergeTable, Int mode, Int filtNo)
    6392 {
    6393   Int iBufferIndex = m_iCurrentPOC % m_iGOPSize;
    6394 
    6395   static Bool bFirst = true;
    6396   static Bool* pbFirstAccess;
    6397   if(bFirst)
    6398   {
    6399     pbFirstAccess = new Bool[NUM_ALF_CLASS_METHOD];
    6400     for(Int i=0; i< NUM_ALF_CLASS_METHOD; i++)
    6401     {
    6402       pbFirstAccess[i]= true;
    6403     }
    6404     bFirst = false;
    6405   }
    6406 
    6407   if(iBufferIndex == 0)
    6408   {
    6409     if(pbFirstAccess[mode])
    6410     {
    6411       //store merge table
    6412       ::memcpy(m_mergeTableSavedMethods[mode][m_iGOPSize], mergeTable, sizeof(Int)*NO_VAR_BINS);
    6413       //store coefficients
    6414       for(Int varInd=0; varInd< numFilter; varInd++)
    6415       {
    6416         ::memcpy(m_aiFilterCoeffSavedMethods[mode][m_iGOPSize][varInd],filterSet[varInd], sizeof(Int)*ALF_MAX_NUM_COEF );
    6417       }
    6418       //store filter shape
    6419       m_iPreviousFilterShapeMethods[mode][m_iGOPSize]= filtNo;
    6420 
    6421       pbFirstAccess[mode] = false;
    6422     }
    6423 
    6424 
    6425     //store merge table
    6426     ::memcpy(m_mergeTableSavedMethods[mode][0         ], m_mergeTableSavedMethods[mode][m_iGOPSize], sizeof(Int)*NO_VAR_BINS);
    6427     ::memcpy(m_mergeTableSavedMethods[mode][m_iGOPSize], mergeTable,                          sizeof(Int)*NO_VAR_BINS);
    6428 
    6429     //store coefficients
    6430     for(Int varInd=0; varInd< NO_VAR_BINS; varInd++)
    6431     {
    6432       ::memcpy(m_aiFilterCoeffSavedMethods[mode][0][varInd],m_aiFilterCoeffSavedMethods[mode][m_iGOPSize][varInd], sizeof(Int)*ALF_MAX_NUM_COEF );
    6433     }
    6434 
    6435     for(Int varInd=0; varInd< numFilter; varInd++)
    6436     {
    6437       ::memcpy(m_aiFilterCoeffSavedMethods[mode][m_iGOPSize][varInd],filterSet[varInd], sizeof(Int)*ALF_MAX_NUM_COEF );
    6438     }
    6439 
    6440     //store filter shape
    6441     m_iPreviousFilterShapeMethods[mode][0]= m_iPreviousFilterShapeMethods[mode][m_iGOPSize];
    6442     m_iPreviousFilterShapeMethods[mode][m_iGOPSize]= filtNo;
    6443   }
    6444   else
    6445   {
    6446 
    6447     //store merge table
    6448     ::memcpy(m_mergeTableSavedMethods[mode][iBufferIndex], mergeTable, sizeof(Int)*NO_VAR_BINS);
    6449 
    6450     //store coefficients
    6451     for(Int varInd=0; varInd< numFilter; varInd++)
    6452     {
    6453       ::memcpy(m_aiFilterCoeffSavedMethods[mode][iBufferIndex][varInd],filterSet[varInd], sizeof(Int)*ALF_MAX_NUM_COEF );
    6454     }
    6455     //store filter_shape
    6456     m_iPreviousFilterShapeMethods[mode][iBufferIndex]= filtNo;
    6457 
    6458   }
    6459 }
    6460 
    6461 
    6462 /** set initial m_maskImg with previous (time-delayed) filters
    6463  * \param pcPicOrg original picture
    6464  * \param pcPicDec reconstructed picture after deblocking
    6465  */
    6466 Void TEncAdaptiveLoopFilter::setMaskWithTimeDelayedResults(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec)
    6467 {
    6468 
    6469   static Pel** bestImgMask;
    6470   static Bool bFirst = true;
    6471   if(bFirst)
    6472   {
    6473     initMatrix_Pel(&bestImgMask, m_img_height, m_img_width);
    6474     bFirst = false;
    6475   }
    6476 
    6477   Pel*    pDec       = pcPicDec->getLumaAddr();
    6478   Pel*    pOrg       = pcPicOrg->getLumaAddr();
    6479   Pel*    pRest      = m_pcPicYuvTmp->getLumaAddr();
    6480   Int     LumaStride = pcPicOrg->getStride();
    6481   Int***   pppCoeffSaved     = m_aiFilterCoeffSavedMethods  [m_uiVarGenMethod];
    6482   Int**    ppMergeTableSaved = m_mergeTableSavedMethods     [m_uiVarGenMethod];
    6483   Int*     pFilterShapeSaved = m_iPreviousFilterShapeMethods[m_uiVarGenMethod];
    6484   Int      iBufIdx;
    6485 
    6486   UInt64    uiRate, uiDist;
    6487   Double    dCost, dMinCost = MAX_DOUBLE;
    6488   ALFParam  cAlfParam;
    6489   allocALFParam(&cAlfParam);
    6490   cAlfParam.alf_flag        = 0;
    6491   cAlfParam.chroma_idc      = 0;
    6492 
    6493   //filter frame with the previous time-delayed filters
    6494   Int filtNo;
    6495   Int maxDepth = (pcPicOrg->getWidth() < 1000) ?(2):(g_uiMaxCUDepth);
    6496   m_pcEntropyCoder->setAlfCtrl(true);
    6497   m_pcTempAlfParam->alf_flag = 1;
    6498   m_pcTempAlfParam->alf_pcr_region_flag = m_uiVarGenMethod;
    6499 
    6500   for (Int index=0; index<2; index++)
    6501   {
    6502     iBufIdx = setFilterIdx(index);
    6503     filtNo = m_pcTempAlfParam->filter_shape = pFilterShapeSaved[iBufIdx];
    6504 #if ALF_SINGLE_FILTER_SHAPE
    6505     assert(filtNo == ALF_CROSS9x7_SQUARE3x3);
    6506 #else
    6507     assert(filtNo == ALF_STAR5x5 || filtNo == ALF_CROSS9x9);
    6508 #endif
    6509     m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[filtNo];
    6510     if(!m_bUseNonCrossALF)
    6511     {
    6512       filterLuma(pRest, pDec, LumaStride, 0, m_img_height-1, 0, m_img_width-1,  filtNo, pppCoeffSaved[iBufIdx], ppMergeTableSaved[iBufIdx], m_varImg);
    6513     }
    6514     else
    6515     {
    6516       xfilterSlicesEncoder(pDec, pRest, LumaStride, filtNo, pppCoeffSaved[iBufIdx], ppMergeTableSaved[iBufIdx], m_varImg);
    6517     }
    6518 
    6519     for (UInt uiDepth = 0; uiDepth < maxDepth; uiDepth++)
    6520     {
    6521       m_pcEntropyCoder->setMaxAlfCtrlDepth(uiDepth);
    6522       std::vector<AlfCUCtrlInfo> vAlfCUCtrlParamTemp(m_uiNumSlicesInPic);
    6523       xSetCUAlfCtrlFlags_qc(uiDepth, pcPicOrg, pcPicDec, m_pcPicYuvTmp, uiDist, vAlfCUCtrlParamTemp);
    6524       m_pcEntropyCoder->resetEntropy();
    6525       m_pcEntropyCoder->resetBits();
    6526       xEncodeCUAlfCtrlFlags(vAlfCUCtrlParamTemp);
    6527       uiRate = m_pcEntropyCoder->getNumberOfWrittenBits();
    6528       dCost  = (Double)(uiRate) * m_dLambdaLuma + (Double)(uiDist);
    6529 
    6530       if (dCost < dMinCost)
    6531       {
    6532         dMinCost    = dCost;
    6533         copyALFParam(&cAlfParam, m_pcTempAlfParam);
    6534         ::memcpy(bestImgMask[0], m_maskImg[0], sizeof(Pel)*m_img_height* m_img_width);
    6535       }
    6536     }
    6537   }
    6538   filtNo = cAlfParam.filter_shape;
    6539 
    6540 
    6541   ::memcpy(m_maskImg[0], bestImgMask[0], sizeof(Pel)*m_img_height* m_img_width);
    6542 
    6543   m_pcEntropyCoder->setAlfCtrl(false);
    6544   m_pcEntropyCoder->setMaxAlfCtrlDepth(0);
    6545 
    6546   // generate filters for future reference
    6547   m_iDesignCurrentFilter = 0;
    6548 
    6549   int  filters_per_fr;
    6550   int  lambda_val = (Int)m_dLambdaLuma;
    6551 
    6552   lambda_val = lambda_val * (1<<(2*g_uiBitIncrement));
    6553 
    6554   if(!m_bUseNonCrossALF)
    6555   {
    6556     xstoreInBlockMatrix(0, 0, m_img_height, m_img_width, true, true, pOrg, pDec, cAlfParam.filter_shape, LumaStride);
    6557   }
    6558   else
    6559   {
    6560     xstoreInBlockMatrixforSlices(pOrg, pDec, cAlfParam.filter_shape, LumaStride);
    6561   }
    6562   xfindBestFilterVarPred(m_yGlobalSym[filtNo], m_EGlobalSym[filtNo], m_pixAcc,
    6563     m_filterCoeffSym, m_filterCoeffSymQuant,
    6564     filtNo, &filters_per_fr,
    6565     m_varIndTab, NULL, m_varImg, m_maskImg, NULL, lambda_val);
    6566 
    6567   saveFilterCoeffToBuffer(m_filterCoeffSym, filters_per_fr, m_varIndTab, cAlfParam.alf_pcr_region_flag, filtNo);
    6568   m_iDesignCurrentFilter = 1;
    6569 
    6570   freeALFParam(&cAlfParam);
    6571 
    6572 }
    6573 
    6574 
    6575 /** set ALF encoding parameters
    6576  * \param pcPic picture pointer
    6577  */
    6578 Void TEncAdaptiveLoopFilter::setALFEncodingParam(TComPic *pcPic)
    6579 {
    6580   if(m_iALFEncodePassReduction)
    6581   {
    6582     m_iALFNumOfRedesign = 0;
    6583     m_iCurrentPOC = m_pcPic->getPOC();
    6584     if((pcPic->getSlice(0)->getSliceType() == I_SLICE) || (m_iGOPSize==8 && (m_iCurrentPOC % 4 == 0)))
    6585     {
    6586       m_iUsePreviousFilter = 0;
    6587     }
    6588     else
    6589     {
    6590       m_iUsePreviousFilter = 1;
    6591     }
    6592   }
    6593   else
    6594   {
    6595     m_iALFNumOfRedesign = ALF_NUM_OF_REDESIGN;
    6596   }
    6597   m_iDesignCurrentFilter = 1;
    6598 
    6599 }
    6600 
    6601 /** set filter buffer index
    6602  * \param index the processing order of time-delayed filtering
    6603  */
    6604 Int TEncAdaptiveLoopFilter::setFilterIdx(Int index)
    6605 {
    6606   Int iBufIdx;
    6607 
    6608   if (m_iGOPSize == 8)
    6609   {
    6610     switch(m_iCurrentPOC % m_iGOPSize)
    6611     {
    6612     case 0:
    6613       {
    6614         iBufIdx = (index == 0)?0:m_iGOPSize;
    6615       }
    6616       break;
    6617     case 1:
    6618       {
    6619         iBufIdx = (index == 0)?0:2;
    6620       }
    6621       break;
    6622     case 2:
    6623       {
    6624         iBufIdx = (index == 0)?0:4;
    6625       }
    6626       break;
    6627     case 3:
    6628       {
    6629         iBufIdx = (index == 0)?2:4;
    6630       }
    6631       break;
    6632     case 4:
    6633       {
    6634         iBufIdx = (index == 0)?0:m_iGOPSize;
    6635       }
    6636       break;
    6637     case 5:
    6638       {
    6639         iBufIdx = (index == 0)?4:6;
    6640       }
    6641       break;
    6642     case 6:
    6643       {
    6644         iBufIdx = (index == 0)?4:m_iGOPSize;
    6645       }
    6646       break;
    6647     case 7:
    6648       {
    6649         iBufIdx = (index == 0)?6:m_iGOPSize;
    6650       }
    6651       break;
    6652     default:
    6653       {
    6654         printf("error\n");
    6655         assert(0);
    6656       }
    6657     }
    6658   }
    6659   else
    6660   {
    6661     iBufIdx = (index == 0)?0:m_iGOPSize;
    6662   }
    6663 
    6664   return iBufIdx;
    6665 }
    6666 
    6667 
    6668 /** set initial m_maskImg
    6669  * \param pcPicOrg original picture pointer
    6670  * \param pcPicDec reconstructed picture pointer
    6671  */
    6672 Void TEncAdaptiveLoopFilter::setInitialMask(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec)
    6673 {
    6674   Int Height = pcPicOrg->getHeight();
    6675   Int Width = pcPicOrg->getWidth();
    6676   Int LumaStride = pcPicOrg->getStride();
    6677   Pel* pDec = pcPicDec->getLumaAddr();
    6678 
    6679   calcVar(m_varImg, pDec, LumaStride, m_uiVarGenMethod);
    6680 
    6681   if(!m_iALFEncodePassReduction || !m_iUsePreviousFilter)
    6682   {
    6683     for(Int y=0; y<Height; y++)
    6684     {
    6685       for(Int x=0; x<Width; x++)
    6686       {
    6687         m_maskImg[y][x] = 1;
    6688       }
    6689     }
    6690   }
    6691   else
    6692   {
    6693     setMaskWithTimeDelayedResults(pcPicOrg, pcPicDec);
    6694   }
    6695 }
    6696 
    6697 
    6698 
    6699 /** Estimate RD cost of all filter size & store the best one
    6700  * \param ImgOrg original picture
    6701  * \param ImgDec reconstructed picture after deblocking
    6702  * \param Sride  line buffer size of picture buffer
    6703  * \param pcAlfSaved the best Alf parameters
    6704  * \returns ruiDist             estimated distortion
    6705  * \returns ruiRate             required bits
    6706  * \returns rdCost              estimated R-D cost
    6707  */
    6708 
    6709 Void  TEncAdaptiveLoopFilter::decideFilterShapeLuma(Pel* ImgOrg, Pel* ImgDec, Int Stride, ALFParam* pcAlfSaved, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost)
    6710 {
    6711   static Double **ySym, ***ESym;
    6712   Int    lambda_val = ((Int) m_dLambdaLuma) * (1<<(2*g_uiBitIncrement));
    6713   Int    filtNo, filters_per_fr;
    6714   Int64  iEstimatedDist;
    6715   UInt64 uiRate;
    6716   Double dEstimatedCost, dEstimatedMinCost = MAX_DOUBLE;;
    6717 
    6718   UInt   uiBitShift = (g_uiBitIncrement<<1);
    6719   Int64  iEstimateDistBeforeFilter;
    6720   Int*   coeffNoFilter[NUM_ALF_FILTER_SHAPE][NO_VAR_BINS];
    6721   for(Int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE; filter_shape++)
    6722   {
    6723     for(Int i=0; i< NO_VAR_BINS; i++)
    6724     {
    6725       coeffNoFilter[filter_shape][i]= new Int[ALF_MAX_NUM_COEF];
    6726       ::memset(coeffNoFilter[filter_shape][i], 0, sizeof(Int)*ALF_MAX_NUM_COEF);
    6727       coeffNoFilter[filter_shape][i][ m_sqrFiltLengthTab[filter_shape]-1 ] = (1 << ((Int)ALF_NUM_BIT_SHIFT));
    6728     }
    6729   }
    6730 
    6731   m_pcTempAlfParam->alf_flag = 1;
    6732   m_pcTempAlfParam->chroma_idc = 0;
    6733   m_pcTempAlfParam->alf_pcr_region_flag = m_uiVarGenMethod;
    6734 
    6735   for (int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE ;filter_shape ++)
    6736   {
    6737     m_pcTempAlfParam->filter_shape = filtNo = filter_shape;
    6738     m_pcTempAlfParam->num_coeff = m_sqrFiltLengthTab[filtNo] ; 
    6739 
    6740     ESym     = m_EGlobalSym     [filtNo];
    6741     ySym     = m_yGlobalSym     [filtNo];
    6742 
    6743     if(!m_bUseNonCrossALF)
    6744     {
    6745       xstoreInBlockMatrix(0, 0, m_img_height, m_img_width, true, true, ImgOrg, ImgDec, filter_shape, Stride);
    6746     }
    6747     else
    6748     {
    6749       xstoreInBlockMatrixforSlices(ImgOrg, ImgDec, filter_shape, Stride);
    6750     }
    6751     xfindBestFilterVarPred(ySym, ESym, m_pixAcc, m_filterCoeffSym, m_filterCoeffSymQuant, filtNo, &filters_per_fr, m_varIndTab, NULL, m_varImg, m_maskImg, NULL, lambda_val);
    6752 
    6753     //estimate R-D cost
    6754     uiRate         = xcodeFiltCoeff(m_filterCoeffSymQuant, filtNo, m_varIndTab, filters_per_fr, m_pcTempAlfParam);
    6755     iEstimatedDist = xEstimateFiltDist(filters_per_fr, m_varIndTab, ESym, ySym, m_filterCoeffSym, m_pcTempAlfParam->num_coeff);
    6756     iEstimateDistBeforeFilter = xEstimateFiltDist(filters_per_fr, m_varIndTab, ESym, ySym, coeffNoFilter[filter_shape], m_pcTempAlfParam->num_coeff);
    6757     iEstimatedDist -= iEstimateDistBeforeFilter;
    6758     dEstimatedCost = (Double)(uiRate) * m_dLambdaLuma + (Double)(iEstimatedDist);
    6759 
    6760     if(dEstimatedCost < dEstimatedMinCost)
    6761     {
    6762       dEstimatedMinCost   = dEstimatedCost;
    6763       copyALFParam(pcAlfSaved, m_pcTempAlfParam);
    6764       iEstimatedDist += iEstimateDistBeforeFilter;
    6765 
    6766       for(Int i=0; i< filters_per_fr; i++ )
    6767       {
    6768         iEstimatedDist += (((Int64)m_pixAcc_merged[i]) >> uiBitShift);
    6769       }
    6770       ruiDist = (iEstimatedDist > 0)?((UInt64)iEstimatedDist):(0);
    6771       rdCost  = dEstimatedMinCost + (Double)(ruiDist);
    6772       ruiRate = uiRate;
    6773     }
    6774   }
    6775 
    6776   if (!m_iUsePreviousFilter)
    6777   {
    6778     decodeFilterSet(pcAlfSaved, m_varIndTab, m_filterCoeffSym);
    6779     saveFilterCoeffToBuffer(m_filterCoeffSym, pcAlfSaved->filters_per_group, m_varIndTab, pcAlfSaved->alf_pcr_region_flag, pcAlfSaved->filter_shape);
    6780   }
    6781 
    6782   if( m_iUsePreviousFilter )
    6783   {
    6784     UInt64 uiOffRegionDistortion = 0;
    6785     Int    iPelDiff;
    6786     Pel*   pOrgTemp = (Pel*)ImgOrg;
    6787     Pel*   pDecTemp = (Pel*)ImgDec;
    6788     for(Int y=0; y< m_img_height; y++)
    6789     {
    6790       for(Int x=0; x< m_img_width; x++)
    6791       {
    6792         if(m_maskImg[y][x] == 0)
    6793         {
    6794           iPelDiff = pOrgTemp[x] - pDecTemp[x];
    6795           uiOffRegionDistortion += (UInt64)(  (iPelDiff*iPelDiff) >> uiBitShift );
    6796         }
    6797       }
    6798       pOrgTemp += Stride;
    6799       pDecTemp += Stride;
    6800 
    6801       ruiDist += uiOffRegionDistortion;
    6802       rdCost  += (Double)uiOffRegionDistortion;
    6803     }
    6804   }
    6805  
    6806 #if !ALF_SINGLE_FILTER_SHAPE
    6807   // if ALF_STAR5x5 is selected, the distortion of 2 skipped lines per LCU should be added.
    6808   if(pcAlfSaved->filter_shape == ALF_STAR5x5)
    6809   {
    6810     Int    iPelDiff;
    6811     UInt64  uiSkipPelsDistortion = 0;
    6812     Pel   *pOrgTemp, *pDecTemp;
    6813     for(Int y= m_lineIdxPadTop-1; y< m_img_height - m_lcuHeight ; y += m_lcuHeight)
    6814     {
    6815       pOrgTemp = ImgOrg + y*Stride;
    6816       pDecTemp = ImgDec + y*Stride;
    6817       for(Int x=0; x< m_img_width; x++)
    6818       {
    6819         if(m_maskImg[y][x] == 1)
    6820         {
    6821           iPelDiff = pOrgTemp[x] - pDecTemp[x];
    6822           uiSkipPelsDistortion += (UInt64)(  (iPelDiff*iPelDiff) >> uiBitShift );
    6823         }
    6824       }
    6825 
    6826       pOrgTemp += Stride;
    6827       pDecTemp += Stride;
    6828       for(Int x=0; x< m_img_width; x++)
    6829       {
    6830         if(m_maskImg[y+1][x] == 1)
    6831         {
    6832           iPelDiff = pOrgTemp[x] - pDecTemp[x];
    6833           uiSkipPelsDistortion += (UInt64)(  (iPelDiff*iPelDiff) >> uiBitShift );
    6834         }
    6835       }
    6836     }
    6837     ruiDist += uiSkipPelsDistortion;
    6838     rdCost  += (Double)uiSkipPelsDistortion;
    6839   }
    6840 #endif
    6841 
    6842   for(Int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE; filter_shape++)
    6843   {
    6844     for(Int i=0; i< NO_VAR_BINS; i++)
    6845     {
    6846       delete[] coeffNoFilter[filter_shape][i];
    6847     }
    6848   }
    6849 }
    6850 
    6851 
    6852 #endif
    68534686
    68544687/** Estimate filtering distortion by correlation values and filter coefficients
     
    68674700  Int64  iDist;
    68684701  Double dDist, dsum;
    6869 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     4702#if LCUALF_QP_DEPENDENT_BITS
    68704703  Int alfPrecisionBit = getAlfPrecisionBit( m_alfQP );
    68714704#endif
     
    68734706  for(i=0; i< iFiltLength; i++)
    68744707  {
    6875 #if LCU_SYNTAX_ALF && LCUALF_QP_DEPENDENT_BITS
     4708#if LCUALF_QP_DEPENDENT_BITS
    68764709    pdcoeff[i]= (Double)piCoeff[i] / (Double)(1<<alfPrecisionBit);
    68774710#else
     
    69084741
    69094742
    6910 #if !LCU_SYNTAX_ALF
    6911 
    6912 /** Estimate total filtering cost of all groups
    6913  * \param filters_per_fr number of filters for the slice
    6914  * \param VarIndTab merge index of all groups
    6915  * \param pppdE  auto-correlation matrix pointer for all groups
    6916  * \param ppdy cross-correlation array pointer for all groups
    6917  * \returns estimated distortion
    6918  */
    6919 Int64 TEncAdaptiveLoopFilter::xEstimateFiltDist(Int filters_per_fr, Int* VarIndTab,
    6920                                                 Double*** pppdE, Double** ppdy,
    6921                                                 Int** ppiCoeffSet, Int iFiltLength)
    6922 
    6923 {
    6924   Int64     iDist;
    6925   Double**  ppdDstE;
    6926   Double**  ppdSrcE;
    6927   Double*   pdDsty; 
    6928   Double*   pdSrcy;
    6929   Int       f, j, i, varInd;
    6930   Int*      piCoeff;
    6931 
    6932   //clean m_E_merged & m_y_merged
    6933   for(f=0; f< filters_per_fr; f++)
    6934   {
    6935     for(j =0; j < iFiltLength; j++)
    6936     {
    6937       //clean m_E_merged one line
    6938       for(i=0; i < iFiltLength; i++)
    6939       {
    6940         m_E_merged[f][j][i] = 0;
    6941       }
    6942 
    6943       //clean m_y_merged
    6944       m_y_merged[f][j] = 0;
    6945     }
    6946     m_pixAcc_merged[f] = 0;
    6947   }
    6948 
    6949 
    6950   //merge correlation values
    6951   for (varInd=0; varInd< NO_VAR_BINS; varInd++)
    6952   {
    6953     ppdSrcE = pppdE[varInd];
    6954     ppdDstE = m_E_merged[ VarIndTab[varInd] ];
    6955 
    6956     pdSrcy  = ppdy[varInd];
    6957     pdDsty  = m_y_merged[ VarIndTab[varInd] ];
    6958 
    6959     for(j=0; j< iFiltLength; j++)
    6960     {
    6961       for(i=0; i< iFiltLength; i++)
    6962       {
    6963         ppdDstE[j][i] += ppdSrcE[j][i];
    6964       }
    6965 
    6966       pdDsty[j] += pdSrcy[j];
    6967     }
    6968     m_pixAcc_merged[ VarIndTab[varInd]  ] += m_pixAcc[varInd];
    6969 
    6970   }
    6971 
    6972   //estimate distortion reduction by using FFDE (JCTVC-C143)
    6973   iDist = 0;
    6974   for(f=0; f< filters_per_fr; f++)
    6975   {
    6976     piCoeff = ppiCoeffSet[f];
    6977     ppdDstE = m_E_merged [f];
    6978     pdDsty  = m_y_merged [f];
    6979 
    6980     iDist += xFastFiltDistEstimation(ppdDstE, pdDsty, piCoeff, iFiltLength);
    6981   }
    6982 
    6983 
    6984   return iDist;
    6985 
    6986 }
    6987 
    6988 /** Calculate ALF grouping indices for ALF slices
    6989  * \param varmap grouping indices buffer
    6990  * \param imgY_Dec picture buffer
    6991  * \param pad_size (max. filter tap)/2
    6992  * \param fl  VAR_SIZE
    6993  * \param img_stride picture buffer stride
    6994  */
    6995 Void TEncAdaptiveLoopFilter::xfilterSlicesEncoder(Pel* ImgDec, Pel* ImgRest, Int iStride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg)
    6996 {
    6997   Pel* pPicSrc   = (Pel *)ImgDec;
    6998   Pel* pPicSlice = m_pcSliceYuvTmp->getLumaAddr();
    6999 
    7000   for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    7001   {
    7002     if(!m_pcPic->getValidSlice(s))
    7003     {
    7004       continue;
    7005     }
    7006     std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];
    7007 
    7008     for(Int t=0; t< (Int)vpSliceTileAlfLCU.size(); t++)
    7009     {
    7010       std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];
    7011       copyRegion(vpAlfLCU, pPicSlice, pPicSrc, iStride);
    7012       extendRegionBorder(vpAlfLCU, pPicSlice, iStride);
    7013       filterLumaRegion(vpAlfLCU, pPicSlice, ImgRest, iStride, filtNo, filterCoeff, mergeTable, varImg);
    7014     }
    7015   }
    7016 }
    7017 
    7018 /** Calculate block autocorrelations and crosscorrelations for ALF slices
    7019  * \param ImgOrg original picture
    7020  * \param ImgDec picture before filtering
    7021  * \param tap  filter tap size
    7022  * \param iStride picture buffer stride
    7023  */
    7024 Void   TEncAdaptiveLoopFilter::xstoreInBlockMatrixforSlices(Pel* ImgOrg, Pel* ImgDec, Int tap, Int iStride)
    7025 {
    7026   Pel* pPicSrc   = (Pel *)ImgDec;
    7027   Pel* pPicSlice = m_pcSliceYuvTmp->getLumaAddr();
    7028 
    7029   UInt iLastValidSliceID =0;
    7030   for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    7031   {
    7032     if(m_pcPic->getValidSlice(s))
    7033     {
    7034       iLastValidSliceID = s;
    7035     }
    7036   }
    7037 
    7038   for(UInt s=0; s<= iLastValidSliceID; s++)
    7039   {
    7040     if(!m_pcPic->getValidSlice(s))
    7041     {
    7042       continue;
    7043     }
    7044     std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];
    7045     Int numValidTilesInSlice = (Int)vpSliceTileAlfLCU.size();
    7046     for(Int t=0; t< numValidTilesInSlice; t++)
    7047     {
    7048       std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];
    7049       copyRegion(vpAlfLCU, pPicSlice, pPicSrc, iStride);
    7050       extendRegionBorder(vpAlfLCU, pPicSlice, iStride);
    7051       xstoreInBlockMatrixforRegion(vpAlfLCU, ImgOrg, pPicSlice, tap, iStride, (s==0)&&(t==0), (s== iLastValidSliceID)&&(t==numValidTilesInSlice-1));
    7052     }
    7053   }
    7054 }
    7055 
    7056 /** Calculate block autocorrelations and crosscorrelations for one ALF region
    7057  * \param vpAlfLCU ALF LCU data container
    7058  * \param ImgOrg original picture
    7059  * \param ImgDec picture before filtering
    7060  * \param tap  filter tap size
    7061  * \param iStride picture buffer stride
    7062  * \param bFirstSlice  true for the first processing slice of the picture
    7063  * \param bLastSlice true for the last processing slice of the picture
    7064  */
    7065 Void   TEncAdaptiveLoopFilter::xstoreInBlockMatrixforRegion(std::vector< AlfLCUInfo* > &vpAlfLCU,
    7066                                                               Pel* ImgOrg, Pel* ImgDec,
    7067                                                               Int tap, Int iStride,
    7068                                                               Bool bFirstSlice,
    7069                                                               Bool bLastSlice
    7070                                                               )
    7071 {
    7072 
    7073   UInt uiNumLCUs = (UInt)vpAlfLCU.size();
    7074   Int iHeight, iWidth;
    7075   Int ypos, xpos;
    7076   Bool bFirstLCU, bLastLCU;
    7077   Bool bFirstSGU, bLastSGU;
    7078   UInt numSGUs;
    7079 
    7080   for(UInt i=0; i< uiNumLCUs; i++)
    7081   {
    7082     bFirstLCU = (i==0);
    7083     bLastLCU  = (i== uiNumLCUs -1);
    7084     AlfLCUInfo& cAlfLCU = *(vpAlfLCU[i]);
    7085     numSGUs = cAlfLCU.numSGU;
    7086     for(UInt j=0; j< numSGUs; j++)
    7087     {
    7088       bFirstSGU= (j ==0);
    7089       bLastSGU = (j == numSGUs -1);
    7090 
    7091       ypos    = (Int)(cAlfLCU[j].posY  );
    7092       xpos    = (Int)(cAlfLCU[j].posX  );
    7093       iHeight = (Int)(cAlfLCU[j].height);
    7094       iWidth  = (Int)(cAlfLCU[j].width );
    7095 
    7096       xstoreInBlockMatrix(ypos, xpos, iHeight, iWidth,
    7097         (bFirstSlice && bFirstLCU && bFirstSGU),(bLastSlice && bLastLCU && bLastSGU),
    7098         ImgOrg, ImgDec,tap, iStride);
    7099     }
    7100   }
    7101 }
    7102 
    7103 
    7104 /** Calculate autocorrelations and crosscorrelations for chroma slices
    7105  * \param ComponentID Cb or Cr
    7106  * \param pOrg original picture
    7107  * \param pCmp picture before filtering
    7108  * \param iTap  filter tap size
    7109  * \param iOrgStride picture buffer stride for pOrg
    7110  * \param iCmpStride picture buffer stride for pCmp
    7111  */
    7112 Void TEncAdaptiveLoopFilter::xCalcCorrelationFuncforChromaSlices(Int ComponentID, Pel* pOrg, Pel* pCmp, Int iTap, Int iOrgStride, Int iCmpStride)
    7113 {
    7114 
    7115   assert(iOrgStride == iCmpStride);
    7116 
    7117   Pel* pPicSrc   = pCmp;
    7118   Pel* pPicSlice = (ComponentID == ALF_Cb)?(m_pcSliceYuvTmp->getCbAddr()):(m_pcSliceYuvTmp->getCrAddr());
    7119   Int chromaFormatShift = 1;
    7120 
    7121   UInt iLastValidSliceID =0;
    7122   for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    7123   {
    7124     if(m_pcPic->getValidSlice(s))
    7125     {
    7126       iLastValidSliceID = s;
    7127     }
    7128   }
    7129 
    7130   for(UInt s=0; s<= iLastValidSliceID; s++)
    7131   {
    7132     if(!m_pcPic->getValidSlice(s))
    7133     {
    7134       continue;
    7135     }
    7136     std::vector< std::vector<AlfLCUInfo*> > & vpSliceTileAlfLCU = m_pvpSliceTileAlfLCU[s];
    7137     Int numValidTilesInSlice = (Int)vpSliceTileAlfLCU.size();
    7138     for(Int t=0; t< numValidTilesInSlice; t++)
    7139     {
    7140       std::vector<AlfLCUInfo*> & vpAlfLCU = vpSliceTileAlfLCU[t];
    7141       copyRegion(vpAlfLCU, pPicSlice, pPicSrc, iCmpStride, chromaFormatShift);
    7142       extendRegionBorder(vpAlfLCU, pPicSlice, iCmpStride, chromaFormatShift);
    7143       xCalcCorrelationFuncforChromaRegion(vpAlfLCU, pOrg, pPicSlice, iTap, iCmpStride,(s== iLastValidSliceID)&&(t== numValidTilesInSlice-1), chromaFormatShift);
    7144     }
    7145   }
    7146 }
    7147 
    7148 /** Calculate autocorrelations and crosscorrelations for one chroma slice
    7149  * \param vpAlfLCU ALF LCU data container
    7150  * \param pOrg original picture
    7151  * \param pCmp picture before filtering
    7152  * \param iTap  filter tap size
    7153  * \param iStride picture buffer stride
    7154  * \param bLastSlice the last processing slice of picture
    7155  */
    7156 Void TEncAdaptiveLoopFilter::xCalcCorrelationFuncforChromaRegion(std::vector< AlfLCUInfo* > &vpAlfLCU, Pel* pOrg, Pel* pCmp, Int filtNo, Int iStride, Bool bLastSlice, Int iFormatShift)
    7157 {
    7158   UInt uiNumLCUs = (UInt)vpAlfLCU.size();
    7159 
    7160   Int iHeight, iWidth;
    7161   Int ypos, xpos;
    7162   Bool bLastLCU;
    7163   Bool bLastSGU;
    7164   UInt numSGUs;
    7165 
    7166   for(UInt i=0; i< uiNumLCUs; i++)
    7167   {
    7168     bLastLCU  = (i== uiNumLCUs -1);
    7169 
    7170     AlfLCUInfo& cAlfLCU = *(vpAlfLCU[i]);
    7171     numSGUs = cAlfLCU.numSGU;
    7172     for(UInt j=0; j< numSGUs; j++)
    7173     {
    7174       bLastSGU = (j == numSGUs -1);
    7175       ypos    = (Int)(cAlfLCU[j].posY   >> iFormatShift);
    7176       xpos    = (Int)(cAlfLCU[j].posX   >> iFormatShift);
    7177       iHeight = (Int)(cAlfLCU[j].height >> iFormatShift);
    7178       iWidth  = (Int)(cAlfLCU[j].width  >> iFormatShift);
    7179       xCalcCorrelationFunc(ypos, xpos, pOrg, pCmp, filtNo, iWidth, iHeight, iStride, iStride, (bLastSlice && bLastLCU && bLastSGU) );
    7180     }
    7181   }
    7182 }
    7183 
    7184 // ====================================================================================================================
    7185 // Protected member functions
    7186 // ====================================================================================================================
    7187 
    7188 Void TEncAdaptiveLoopFilter::xFilterTapDecisionChroma( UInt64 uiLumaRate, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, UInt64& ruiBits )
    7189 {
    7190   Int   iShape, num_coeff;
    7191   Int64 iOrgDistCb, iOrgDistCr, iFiltDistCb, iFiltDistCr, iDist;
    7192   Bool  bChanged = false;
    7193   Int*  qh = m_pcTempAlfParam->coeff_chroma;
    7194 
    7195   UInt64 uiMinRate = uiLumaRate;
    7196   UInt64 uiMinDist = MAX_INT;
    7197   Double dMinCost  = MAX_DOUBLE;
    7198   Double dLocalMinCost = MAX_DOUBLE;
    7199 
    7200   copyALFParam(m_pcTempAlfParam, m_pcBestAlfParam);
    7201   xCalcRDCostChroma(pcPicOrg, pcPicRest, m_pcTempAlfParam, uiMinRate, uiMinDist, dMinCost);
    7202 
    7203 #if ALF_SINGLE_FILTER_SHAPE
    7204   iShape = 0;
    7205 #else
    7206   for(iShape = 0; iShape < 2; iShape++)
    7207 #endif 
    7208   {
    7209     // set global variables
    7210     num_coeff = m_sqrFiltLengthTab[iShape];
    7211     m_pcTempAlfParam->chroma_idc = 3;
    7212     m_pcTempAlfParam->filter_shape_chroma = iShape;
    7213     m_pcTempAlfParam->num_coeff_chroma = num_coeff;
    7214 
    7215     // keep original corr pointer
    7216     Double **ppdTmpCorr = m_ppdAlfCorr;
    7217 
    7218     // calc Cb matrix
    7219     m_pcTempAlfParam->chroma_idc = 2;
    7220     m_ppdAlfCorr = m_ppdAlfCorrCb;
    7221     for(Int i=0; i<ALF_MAX_NUM_COEF; i++)
    7222     {
    7223       ::memset(m_ppdAlfCorr[i], 0, sizeof(Double) * (ALF_MAX_NUM_COEF + 1));
    7224     }
    7225     Pel *pOrg = pcPicOrg->getCbAddr();
    7226     Pel *pCmp = pcPicDec->getCbAddr();
    7227     if(!m_bUseNonCrossALF)
    7228     {
    7229       xCalcCorrelationFunc(0, 0, pOrg, pCmp, iShape, (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride(), pcPicDec->getCStride(), true);
    7230     }
    7231     else
    7232     {
    7233       xCalcCorrelationFuncforChromaSlices(ALF_Cb, pOrg, pCmp, iShape, pcPicOrg->getCStride(), pcPicDec->getCStride());
    7234     }
    7235 
    7236     // calc Cr matrix
    7237     m_pcTempAlfParam->chroma_idc = 1;
    7238     m_ppdAlfCorr = m_ppdAlfCorrCr;
    7239     for(Int i=0; i<ALF_MAX_NUM_COEF; i++)
    7240     {
    7241       ::memset(m_ppdAlfCorr[i], 0, sizeof(Double) * (ALF_MAX_NUM_COEF + 1));
    7242     }
    7243     pOrg = pcPicOrg->getCrAddr();
    7244     pCmp = pcPicDec->getCrAddr();
    7245     if(!m_bUseNonCrossALF)
    7246     {
    7247       xCalcCorrelationFunc(0, 0, pOrg, pCmp, iShape, (pcPicOrg->getWidth()>>1), (pcPicOrg->getHeight()>>1), pcPicOrg->getCStride(), pcPicDec->getCStride(), true);
    7248     }
    7249     else
    7250     {
    7251       xCalcCorrelationFuncforChromaSlices(ALF_Cr, pOrg, pCmp, iShape, pcPicOrg->getCStride(), pcPicDec->getCStride());
    7252     }
    7253 
    7254     // restore original corr pointer
    7255     m_ppdAlfCorr = ppdTmpCorr;
    7256 
    7257     // calc original dist
    7258     memset(qh, 0, sizeof(Int)*num_coeff);
    7259     qh[num_coeff-1] = 1<<((Int)ALF_NUM_BIT_SHIFT);
    7260     iOrgDistCb = xFastFiltDistEstimationChroma(m_ppdAlfCorrCb, qh, num_coeff);
    7261     iOrgDistCr = xFastFiltDistEstimationChroma(m_ppdAlfCorrCr, qh, num_coeff);
    7262 
    7263     for(Int iCmp=1; iCmp<=3; iCmp++)
    7264     {
    7265       m_pcTempAlfParam->chroma_idc = iCmp;
    7266       xCalcALFCoeffChroma(iCmp, iShape, qh);
    7267       iFiltDistCb = ((iCmp>>1)&0x1) ? xFastFiltDistEstimationChroma(m_ppdAlfCorrCb, qh, num_coeff) : iOrgDistCb;
    7268       iFiltDistCr = ((iCmp)   &0x1) ? xFastFiltDistEstimationChroma(m_ppdAlfCorrCr, qh, num_coeff) : iOrgDistCr;
    7269       iDist = iFiltDistCb + iFiltDistCr;
    7270       UInt64 uiRate = xCalcRateChroma(m_pcTempAlfParam);
    7271       Double dCost  = (Double)iDist + m_dLambdaChroma * (Double)uiRate;
    7272       if(dCost < dLocalMinCost)
    7273       {
    7274         dLocalMinCost = dCost;
    7275         copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);
    7276         bChanged = true;
    7277       }
    7278     }
    7279   }
    7280   copyALFParam(m_pcTempAlfParam, m_pcBestAlfParam);
    7281   if(!bChanged)
    7282   {
    7283     m_pcBestAlfParam->chroma_idc = 0;
    7284     return;
    7285   }
    7286 
    7287   // Adaptive in-loop wiener filtering for chroma
    7288   xFilteringFrameChroma(m_pcTempAlfParam, pcPicOrg, pcPicDec, pcPicRest);
    7289 
    7290   // filter on/off decision for chroma
    7291   Int iCWidth = (pcPicOrg->getWidth()>>1);
    7292   Int iCHeight = (pcPicOrg->getHeight()>>1);
    7293   Int iCStride = pcPicOrg->getCStride();
    7294   UInt64 uiFiltDistCb = xCalcSSD(pcPicOrg->getCbAddr(), pcPicRest->getCbAddr(), iCWidth, iCHeight, iCStride);
    7295   UInt64 uiFiltDistCr = xCalcSSD(pcPicOrg->getCrAddr(), pcPicRest->getCrAddr(), iCWidth, iCHeight, iCStride);
    7296   UInt64 uiOrgDistCb  = xCalcSSD(pcPicOrg->getCbAddr(), pcPicDec->getCbAddr(), iCWidth, iCHeight, iCStride);
    7297   UInt64 uiOrgDistCr  = xCalcSSD(pcPicOrg->getCrAddr(), pcPicDec->getCrAddr(), iCWidth, iCHeight, iCStride);
    7298   if(((m_pcTempAlfParam->chroma_idc)>>1 & 0x1) && (uiOrgDistCb<=uiFiltDistCb))
    7299   {
    7300     m_pcTempAlfParam->chroma_idc -= 2;
    7301     pcPicDec->copyToPicCb(pcPicRest);
    7302   }
    7303   if(((m_pcTempAlfParam->chroma_idc)    & 0x1) && (uiOrgDistCr<=uiFiltDistCr))
    7304   {
    7305     m_pcTempAlfParam->chroma_idc -= 1;
    7306     pcPicDec->copyToPicCr(pcPicRest);
    7307   }
    7308 
    7309   if(m_pcTempAlfParam->chroma_idc)
    7310   {
    7311     UInt64 uiRate, uiDist;
    7312     Double dCost;
    7313     xCalcRDCostChroma(pcPicOrg, pcPicRest, m_pcTempAlfParam, uiRate, uiDist, dCost);
    7314 
    7315     if( dCost < dMinCost )
    7316     {
    7317       copyALFParam(m_pcBestAlfParam, m_pcTempAlfParam);
    7318       predictALFCoeffChroma(m_pcBestAlfParam);
    7319      
    7320       ruiBits += uiRate;
    7321       ruiDist += uiDist;
    7322     }
    7323     else
    7324     {
    7325       m_pcBestAlfParam->chroma_idc = 0;
    7326      
    7327       if((m_pcTempAlfParam->chroma_idc>>1)&0x01)
    7328       {
    7329         pcPicDec->copyToPicCb(pcPicRest);
    7330       }
    7331       if(m_pcTempAlfParam->chroma_idc&0x01)
    7332       {
    7333         pcPicDec->copyToPicCr(pcPicRest);
    7334       }
    7335      
    7336       ruiBits += uiMinRate;
    7337       ruiDist += uiMinDist;
    7338     }
    7339   }
    7340   else
    7341   {
    7342     m_pcBestAlfParam->chroma_idc = 0;
    7343    
    7344     ruiBits += uiMinRate;
    7345     ruiDist += uiMinDist;
    7346    
    7347     pcPicDec->copyToPicCb(pcPicRest);
    7348     pcPicDec->copyToPicCr(pcPicRest);
    7349   }
    7350 }
    7351 
    7352 Int64 TEncAdaptiveLoopFilter::xFastFiltDistEstimationChroma(Double** ppdCorr, Int* piCoeff, Int iSqrFiltLength)
    7353 {
    7354   Double pdcoeff[ALF_MAX_NUM_COEF];
    7355   Int    i,j;
    7356   Int64  iDist;
    7357   Double dDist, dsum;
    7358   for(i=0; i< iSqrFiltLength; i++)
    7359   {
    7360     pdcoeff[i]= (Double)piCoeff[i] / (Double)(1<< ((Int)ALF_NUM_BIT_SHIFT) );
    7361   }
    7362 
    7363   dDist =0;
    7364   for(i=0; i< iSqrFiltLength; i++)
    7365   {
    7366     dsum= ((Double)ppdCorr[i][i]) * pdcoeff[i];
    7367     for(j=i+1; j< iSqrFiltLength; j++)
    7368     {
    7369       dsum += (Double)(2*ppdCorr[i][j])* pdcoeff[j];
    7370     }
    7371 
    7372     dDist += ((dsum - 2.0 * ppdCorr[i][iSqrFiltLength])* pdcoeff[i] );
    7373   }
    7374 
    7375   UInt uiShift = g_uiBitIncrement<<1;
    7376   if(dDist < 0)
    7377   {
    7378     iDist = -(((Int64)(-dDist + 0.5)) >> uiShift);
    7379   }
    7380   else //dDist >=0
    7381   {
    7382     iDist= ((Int64)(dDist+0.5)) >> uiShift;
    7383   }
    7384 
    7385   return iDist;
    7386 }
    7387 
    7388 Void TEncAdaptiveLoopFilter::xCalcALFCoeffChroma(Int iChromaIdc, Int iShape, Int* piCoeff)
    7389 {
    7390   Int iSqrFiltLength = m_sqrFiltLengthTab[iShape];
    7391 
    7392   for(Int i=0; i<iSqrFiltLength; i++)
    7393   {
    7394     memset(m_ppdAlfCorr[i], 0, sizeof(Double)*(iSqrFiltLength + 1));
    7395   }
    7396 
    7397   // retrive
    7398   if((iChromaIdc>>1) & 0x1)
    7399   {
    7400     for(Int i=0; i<iSqrFiltLength; i++)
    7401     {
    7402       for(Int j=i; j<iSqrFiltLength+1; j++)
    7403       {
    7404         m_ppdAlfCorr[i][j] += m_ppdAlfCorrCb[i][j];
    7405       }
    7406     }
    7407   }
    7408   if(iChromaIdc & 0x1)
    7409   {
    7410     for(Int i=0; i<iSqrFiltLength; i++)
    7411     {
    7412       for(Int j=i; j<iSqrFiltLength+1; j++)
    7413       {
    7414         m_ppdAlfCorr[i][j] += m_ppdAlfCorrCr[i][j];
    7415       }
    7416     }
    7417   }
    7418 
    7419   // copy
    7420   for(Int i=1; i<iSqrFiltLength; i++)
    7421   {
    7422     for(Int j=0; j<i; j++)
    7423     {
    7424       m_ppdAlfCorr[i][j] = m_ppdAlfCorr[j][i];
    7425     }
    7426   }
    7427 
    7428   Double *corr = new Double[iSqrFiltLength];
    7429   for(Int i=0; i<iSqrFiltLength; i++)
    7430   {
    7431     corr[i] = m_ppdAlfCorr[i][iSqrFiltLength];
    7432   }
    7433 
    7434   // calc coeff
    7435   gnsSolveByChol(m_ppdAlfCorr, corr, m_pdDoubleAlfCoeff, iSqrFiltLength);
    7436   xQuantFilterCoef(m_pdDoubleAlfCoeff, piCoeff, iShape, g_uiBitDepth + g_uiBitIncrement);
    7437   delete [] corr;
    7438 }
    7439 
    7440 UInt64 TEncAdaptiveLoopFilter::xCalcRateChroma(ALFParam* pAlfParam)
    7441 {
    7442   UInt64 uiRate;
    7443   Int* piTmpCoef;
    7444   piTmpCoef = new Int[ALF_MAX_NUM_COEF];
    7445   memcpy(piTmpCoef, pAlfParam->coeff_chroma, sizeof(Int)*pAlfParam->num_coeff_chroma);
    7446 
    7447   predictALFCoeffChroma(pAlfParam);
    7448 
    7449   m_pcEntropyCoder->resetEntropy();
    7450   m_pcEntropyCoder->resetBits();
    7451   m_pcEntropyCoder->encodeAlfParam(pAlfParam);
    7452   uiRate = m_pcEntropyCoder->getNumberOfWrittenBits();
    7453   if (m_vBestAlfCUCtrlParam.size() != 0)
    7454   {
    7455     for(UInt s=0; s< m_uiNumSlicesInPic; s++)
    7456     {
    7457       if(!m_pcPic->getValidSlice(s))
    7458       {
    7459         continue;
    7460       }
    7461       m_pcEntropyCoder->resetEntropy();
    7462       m_pcEntropyCoder->resetBits();
    7463       m_pcEntropyCoder->encodeAlfCtrlParam( m_vBestAlfCUCtrlParam[s], m_uiNumCUsInFrame);
    7464       uiRate += m_pcEntropyCoder->getNumberOfWrittenBits();
    7465     }
    7466   }
    7467   else
    7468   {
    7469     uiRate += m_uiNumSlicesInPic;
    7470   }
    7471   memcpy(pAlfParam->coeff_chroma, piTmpCoef, sizeof(int)*pAlfParam->num_coeff_chroma);
    7472   delete[] piTmpCoef;
    7473   piTmpCoef = NULL;
    7474 
    7475   return uiRate;
    7476 }
    7477 #endif
    74784743
    74794744//! \}
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.h

    r56 r294  
    4949//! \{
    5050
    51 #if LCU_SYNTAX_ALF
    5251#define LCUALF_FILTER_BUDGET_CONTROL_ENC        1 //!< filter budget control
    5352#define LCUALF_AVOID_USING_BOTTOM_LINES_ENCODER 1 //!< avoid using LCU bottom lines when lcu-based encoder RDO is used
    54 #endif
    5553
    5654// ====================================================================================================================
     
    5856// ====================================================================================================================
    5957
    60 #if LCU_SYNTAX_ALF
    6158/// correlation info
    6259struct AlfCorrData
     
    110107};
    111108
    112 #endif
    113109
    114110
     
    120116  /// variables for correlation calculation
    121117  ///
    122 #if !LCU_SYNTAX_ALF
    123   Double** m_ppdAlfCorr;
    124   Double* m_pdDoubleAlfCoeff;
    125   Double** m_ppdAlfCorrCb;
    126   Double** m_ppdAlfCorrCr;
    127   double ***m_yGlobalSym;
    128   double ****m_EGlobalSym;
    129   double *m_pixAcc;
    130 #endif
    131118  double **m_y_merged;
    132119  double ***m_E_merged;
     
    134121  double *m_y_temp;
    135122  double **m_E_temp;
    136 #if LCU_SYNTAX_ALF
    137123  static const Int  m_alfNumPartsInRowTab[5];
    138124  static const Int  m_alfNumPartsLevelTab[5];
     
    154140  Int    m_alfUsedFilterNum;
    155141#endif
    156 #endif
    157142
    158143  ///
    159144  /// ALF parameters
    160145  ///
    161 #if !LCU_SYNTAX_ALF
    162   ALFParam* m_pcBestAlfParam;
    163   ALFParam* m_pcTempAlfParam;
    164   ALFParam* pcAlfParamShape0;
    165   ALFParam* pcAlfParamShape1;
    166 #endif
    167146  ALFParam *m_tempALFp;
    168147
     
    172151  TComPicYuv* m_pcPicYuvBest;
    173152  TComPicYuv* m_pcPicYuvTmp;
    174 #if !LCU_SYNTAX_ALF
    175   TComPicYuv* pcPicYuvRecShape0;
    176   TComPicYuv* pcPicYuvRecShape1;
    177 #endif
    178153
    179154  ///
     
    186161  Int    **m_diffFilterCoeffQuant;
    187162  Int    **m_FilterCoeffQuantTemp;
    188 #if !LCU_SYNTAX_ALF
    189   Int**  m_mergeTableSavedMethods[NUM_ALF_CLASS_METHOD];
    190   Int*** m_aiFilterCoeffSavedMethods[NUM_ALF_CLASS_METHOD];  //!< time-delayed filter set buffer
    191   Int*   m_iPreviousFilterShapeMethods[NUM_ALF_CLASS_METHOD];
    192 #endif
    193163  ///
    194164  /// coding control parameters
     
    196166  Double m_dLambdaLuma;
    197167  Double m_dLambdaChroma;
    198 #if !LCU_SYNTAX_ALF
    199   Int  m_iUsePreviousFilter;     //!< for N-pass encoding- 1: time-delayed filtering is allowed. 0: not allowed.
    200   Int  m_iDesignCurrentFilter;   //!< for N-pass encoding- 1: design filters for current slice. 0: design filters for future slice reference
    201   Int  m_iGOPSize;                //!< GOP size
    202   Int  m_iCurrentPOC;             //!< POC
    203 #endif
    204168  Int  m_iALFEncodePassReduction; //!< 0: 16-pass encoding, 1: 1-pass encoding, 2: 2-pass encoding
    205169
     
    221185private:
    222186
    223 #if LCU_SYNTAX_ALF
    224187  Void disableComponentAlfParam(Int compIdx, AlfParamSet* alfParamSet, AlfUnitParam* alfUnitPic);
    225188  Void copyAlfParamSet(AlfParamSet* dst, AlfParamSet* src);
     
    252215  Void xCopyDecToRestCUs( Pel* imgDec, Pel* imgRest, Int stride );
    253216  Void xCopyDecToRestCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Pel* imgDec, Pel* imgRest, Int stride );
    254 #if ALF_SINGLE_FILTER_SHAPE
    255217  Void calcCorrOneCompRegionChma(Pel* imgOrg, Pel* imgPad, Int stride, Int yPos, Int xPos, Int height, Int width, Double **eCorr, Double *yCorr, Bool isSymmCopyBlockMatrix); //!< Calculate correlations for chroma                                       
    256218  Void calcCorrOneCompRegionLuma(Pel* imgOrg, Pel* imgPad, Int stride, Int yPos, Int xPos, Int height, Int width, Double ***eCorr, Double **yCorr, Double *pixAcc, Bool isforceCollection, Bool isSymmCopyBlockMatrix);
    257 #endif
    258219
    259220  //LCU-based mode decision
     
    291252  Void transferToAlfParamSet(Int compIdx, AlfUnitParam* alfUnitPic, AlfParamSet* & alfParamSet);
    292253  Int  calculateAlfParamSetRateRDO(Int compIdx, AlfParamSet* alfParamSet, std::vector<AlfCUCtrlInfo>* alfCUCtrlParam);
    293 #endif
    294 #if !LCU_SYNTAX_ALF
    295   // init / uninit internal variables
    296   Void xInitParam      ();
    297   Void xUninitParam    ();
    298 #endif
    299254  // ALF on/off control related functions
    300255  Void xCreateTmpAlfCtrlFlags   ();
     
    305260  Void xEncodeCUAlfCtrlFlags  (std::vector<AlfCUCtrlInfo> &vAlfCUCtrlParam);
    306261  Void xEncodeCUAlfCtrlFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
    307 #if !LCU_SYNTAX_ALF 
    308   Void xCUAdaptiveControl_qc           ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost );
    309   Void xSetCUAlfCtrlFlags_qc            (UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<AlfCUCtrlInfo>& vAlfCUCtrlParam);
    310   Void xSetCUAlfCtrlFlag_qc             (TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiAlfCtrlDepth, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, std::vector<UInt>& vCUCtrlFlag);
    311 
    312   // functions related to correlation computation
    313   Void xstoreInBlockMatrix(Int ypos, Int xpos, Int iheight, Int iwidth, Bool bResetBlockMatrix, Bool bSymmCopyBlockMatrix, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int stride); //!< Calculate correlations for luma
    314   Void xstoreInBlockMatrixforRegion(std::vector< AlfLCUInfo* > &vpAlfLCU, Pel* ImgOrg, Pel* ImgDec, Int tap, Int iStride, Bool bFirstSlice, Bool bLastSlice); //!< Calculate block autocorrelations and crosscorrelations for one ALF slice
    315   Void xstoreInBlockMatrixforSlices  (Pel* ImgOrg, Pel* ImgDec, Int tap, Int iStride); //!< Calculate block autocorrelations and crosscorrelations for ALF slices
    316   Void xCalcCorrelationFunc(Int ypos, Int xpos, Pel* pImgOrg, Pel* pImgPad, Int filtNo, Int iWidth, Int iHeight, Int iOrgStride, Int iCmpStride, Bool bSymmCopyBlockMatrix); //!< Calculate correlations for chroma
    317   Void xCalcCorrelationFuncforChromaRegion(std::vector< AlfLCUInfo* > &vpAlfLCU, Pel* pOrg, Pel* pCmp, Int filtNo, Int iStride, Bool bLastSlice, Int iFormatShift); //!< Calculate autocorrelations and crosscorrelations for one chroma slice
    318   Void xCalcCorrelationFuncforChromaSlices  (Int ComponentID, Pel* pOrg, Pel* pCmp, Int iTap, Int iOrgStride, Int iCmpStride); //!< Calculate autocorrelations and crosscorrelations for chroma slices
    319 #endif
    320262  // functions related to filtering
    321263  Void xFilterCoefQuickSort   ( Double *coef_data, Int *coef_num, Int upper, Int lower );
    322264  Void xQuantFilterCoef       ( Double* h, Int* qh, Int tap, int bit_depth );
    323 #if !LCU_SYNTAX_ALF
    324   Void xClearFilterCoefInt    ( Int* qh, Int N );
    325   Void xCopyDecToRestCUs      ( TComPicYuv* pcPicDec, TComPicYuv* pcPicRest );
    326   Void xCopyDecToRestCU       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest );
    327   Void xFilteringFrameChroma  (ALFParam* pcAlfParam, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest);
    328   Int  setFilterIdx(Int index); //!< set filter buffer index
    329   Void setInitialMask(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec); //!< set initial m_maskImg
    330   Void saveFilterCoeffToBuffer(Int **filterSet, Int numFilter, Int* mergeTable, Int mode, Int filtNo); //!< save filter coefficients to buffer
    331   Void setMaskWithTimeDelayedResults(TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec); //!< set initial m_maskImg with previous (time-delayed) filters
    332   Void decideFilterShapeLuma(Pel* ImgOrg, Pel* ImgDec, Int Stride, ALFParam* pcAlfSaved, UInt64& ruiRate, UInt64& ruiDist,Double& rdCost); //!< Estimate RD cost of all filter size & store the best one
    333   Void   xFilterTapDecisionChroma      (UInt64 uiLumaRate, TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiDist, UInt64& ruiBits);
    334   Int64  xFastFiltDistEstimationChroma (Double** ppdCorr, Int* piCoeff, Int iSqrFiltLength);
    335   Void  xfilterSlicesEncoder(Pel* ImgDec, Pel* ImgRest, Int iStride, Int filtNo, Int** filterCoeff, Int* mergeTable, Pel** varImg); //!< Calculate ALF grouping indices for ALF slices
    336   Void  setALFEncodingParam(TComPic *pcPic); //!< set ALF encoding parameters
    337   Void xReDesignFilterCoeff_qc          (TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec,  TComPicYuv* pcPicRest, Bool bReadCorr);
    338   Void xFirstFilteringFrameLuma (Pel* imgOrg, Pel* imgDec, Pel* imgRest, ALFParam* ALFp, Int filtNo, Int stride);
    339   Void xFilteringFrameLuma(Pel* imgOrg, Pel* imgPad, Pel* imgFilt, ALFParam* ALFp, Int filtNo, Int stride);
    340   Void xEncALFLuma  ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, UInt64& ruiMinRate, UInt64& ruiMinDist, Double& rdMinCost ); //!< estimate adaptation mode and filter shape
    341 #endif
    342265  // distortion / misc functions
    343266#if HHI_INTERVIEW_SKIP
     
    346269  UInt64 xCalcSSD             ( Pel* pOrg, Pel* pCmp, Int iWidth, Int iHeight, Int iStride );
    347270#endif
    348 #if !LCU_SYNTAX_ALF
    349 #if HHI_INTERVIEW_SKIP
    350   Void  xCalcRDCost          ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);
    351   Void  xCalcRDCost          ( ALFParam* pAlfParam, UInt64& ruiRate, UInt64 uiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);
    352   Void  xCalcRDCostChroma    ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost );
    353 #else
    354   Void  xCalcRDCost          ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);
    355   Void  xCalcRDCost          ( ALFParam* pAlfParam, UInt64& ruiRate, UInt64 uiDist, Double& rdCost, std::vector<AlfCUCtrlInfo>* pvAlfCUCtrlParam = NULL);
    356   Void  xCalcRDCostChroma    ( TComPicYuv* pcPicOrg, TComPicYuv* pcPicCmp, ALFParam* pAlfParam, UInt64& ruiRate, UInt64& ruiDist, Double& rdCost );
    357 #endif
    358 #endif
    359271  Int64 xFastFiltDistEstimation(Double** ppdE, Double* pdy, Int* piCoeff, Int iFiltLength); //!< Estimate filtering distortion by correlation values and filter coefficients
    360 #if !LCU_SYNTAX_ALF
    361   Int64 xEstimateFiltDist      (Int filters_per_fr, Int* VarIndTab, Double*** pppdE, Double** ppdy, Int** ppiCoeffSet, Int iFiltLength); //!< Estimate total filtering cost of all groups 
    362   UInt64 xCalcRateChroma               (ALFParam* pAlfParam);
    363   Void   xCalcALFCoeffChroma           (Int iChromaIdc, Int iShape, Int* piCoeff);
    364 #endif
    365272
    366273  /// code filter coefficients
    367274  UInt xcodeFiltCoeff(Int **filterCoeffSymQuant, Int filter_shape, Int varIndTab[], Int filters_per_fr_best, ALFParam* ALFp);
    368 #if LCU_SYNTAX_ALF
    369275  Void xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant,Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val, Int numMaxFilters = NO_FILTERS);
    370 #else
    371   Void xfindBestFilterVarPred(double **ySym, double ***ESym, double *pixAcc, Int **filterCoeffSym, Int **filterCoeffSymQuant,Int filter_shape, Int *filters_per_fr_best, Int varIndTab[], Pel **imgY_rec, Pel **varImg, Pel **maskImg, Pel **imgY_pad, double lambda_val);
    372 #endif
    373276  double xfindBestCoeffCodMethod(int **filterCoeffSymQuant, int filter_shape, int sqrFiltLength, int filters_per_fr, double errorForce0CoeffTab[NO_VAR_BINS][2], double lambda);
    374277  Int xsendAllFiltersPPPred(int **FilterCoeffQuant, int filter_shape, int sqrFiltLength, int filters_per_group, int createBistream, ALFParam* ALFp);
     
    400303  Void startALFEnc(TComPic* pcPic, TEncEntropy* pcEntropyCoder); //!< allocate temporal memory
    401304  Void endALFEnc(); //!< destroy temporal memory
    402 #if LCU_SYNTAX_ALF
    403305#if ALF_CHROMA_LAMBDA
    404306#if HHI_INTERVIEW_SKIP
     
    418320  Void resetPicAlfUnit();
    419321  Void setAlfCoefInSlice(Bool b) {m_alfCoefInSlice = b;}
    420 #else
    421 #if ALF_CHROMA_LAMBDA 
    422 #if HHI_INTERVIEW_SKIP
    423   Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip); //!< estimate ALF parameters
    424 #else
    425   Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambdaLuma, Double dLambdaChroma, UInt64& ruiDist, UInt64& ruiBits); //!< estimate ALF parameters
    426 #endif
    427 #else
    428 #if HHI_INTERVIEW_SKIP
    429   Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits, Bool bInterviewSkip); //!< estimate ALF parameters
    430 #else
    431   Void ALFProcess(ALFParam* pcAlfParam, std::vector<AlfCUCtrlInfo>* pvAlfCtrlParam, Double dLambda, UInt64& ruiDist, UInt64& ruiBits); //!< estimate ALF parameters
    432 #endif
    433 #endif
    434 
    435   Void setGOPSize(Int val) { m_iGOPSize = val; } //!< set GOP size
    436 #endif
    437322  Void setALFEncodePassReduction (Int iVal) {m_iALFEncodePassReduction = iVal;} //!< set N-pass encoding. 0: 16(14)-pass encoding, 1: 1-pass encoding, 2: 2-pass encoding
    438323
    439324  Void setALFMaxNumberFilters    (Int iVal) {m_iALFMaxNumberFilters = iVal;} //!< set ALF Max Number of Filters
    440325
    441 #if LCU_SYNTAX_ALF
    442326  Void createAlfGlobalBuffers(); //!< create ALF global buffers
    443327  Void initPicQuadTreePartition(Bool isPicBasedEncode);
    444 #else
    445   Void createAlfGlobalBuffers(Int iALFEncodePassReduction); //!< create ALF global buffers
    446 #endif
    447328  Void destroyAlfGlobalBuffers(); //!< destroy ALF global buffers
    448329  Void PCMLFDisableProcess (TComPic* pcPic);
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncBinCoder.h

    r56 r294  
    5656  virtual Void  finish            ()                                          = 0;
    5757  virtual Void  copyState         ( TEncBinIf* pcTEncBinIf )                  = 0;
    58 #if OL_FLUSH
    5958  virtual Void  flush            ()                                           = 0;
    60 #endif
    6159
    6260  virtual Void  encodeFlush     (Bool bEnd) = 0;
    6361
    6462  virtual Void  resetBac          ()                                          = 0;
    65 #if BURST_IPCM
    6663  virtual Void  encodeNumSubseqIPCM( Int numSubseqIPCM )                   = 0;
    67 #endif
    6864  virtual Void  encodePCMAlignBits()                                          = 0;
    6965  virtual Void  xWritePCMCode     ( UInt uiCode, UInt uiLength )              = 0;
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp

    r56 r294  
    105105}
    106106
    107 #if OL_FLUSH
    108107Void TEncBinCABAC::flush()
    109108{
     
    117116  start();
    118117}
    119 #endif
    120118
    121119/** Reset BAC register and counter values.
     
    127125}
    128126
    129 #if BURST_IPCM
    130127/** Encode # of subsequent IPCM blocks.
    131128 * \param numSubseqIPCM
     
    153150  }
    154151}
    155 #endif
    156152
    157153/** Encode PCM alignment zero bits.
     
    160156Void TEncBinCABAC::encodePCMAlignBits()
    161157{
    162 #if !BURST_IPCM
    163   finish();
    164   m_pcTComBitIf->write( 1, 1 ); // stop bit
    165 #endif
    166158  m_pcTComBitIf->writeAlignZero(); // pcm align zero
    167159}
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncBinCoderCABAC.h

    r56 r294  
    5757  Void  finish            ();
    5858  Void  copyState         ( TEncBinIf* pcTEncBinIf );
    59 #if OL_FLUSH
    6059  Void  flush            ();
    61 #endif
    6260
    6361  Void  resetBac          ();
    64 #if BURST_IPCM
    6562  Void  encodeNumSubseqIPCM( Int numSubseqIPCM );
    66 #endif
    6763  Void  encodePCMAlignBits();
    6864  Void  xWritePCMCode     ( UInt uiCode, UInt uiLength );
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp

    r292 r294  
    161161  //DF flag
    162162  WRITE_FLAG(pcAPS->getLoopFilterOffsetInAPS()?1:0, "aps_deblocking_filter_flag");
    163 #if !SAO_UNIT_INTERLEAVING
    164   //SAO flag
    165   WRITE_FLAG( pcAPS->getSaoEnabled()?1:0, "aps_sample_adaptive_offset_flag");
    166 #endif
    167 #if !LCU_SYNTAX_ALF
    168   //ALF flag
    169   WRITE_FLAG( pcAPS->getAlfEnabled()?1:0, "aps_adaptive_loop_filter_flag");
    170 #endif
    171 }
    172 #if LCU_SYNTAX_ALF
     163}
    173164Void TEncCavlc::codeAPSAlflag(UInt uiCode)
    174165{
    175166  WRITE_FLAG(uiCode, "aps_adaptive_loop_filter_flag");
    176167}
    177 #endif
    178168
    179169Void TEncCavlc::codeDFFlag(UInt uiCode, const Char *pSymbolName)
     
    186176}
    187177
    188 #if RPS_IN_SPS
    189178Void TEncCavlc::codeShortTermRefPicSet( TComSPS* pcSPS, TComReferencePictureSet* rps )
    190 #else
    191 Void TEncCavlc::codeShortTermRefPicSet( TComPPS* pcPPS, TComReferencePictureSet* rps )
    192 #endif
    193179{
    194180#if PRINT_RPS_INFO
     
    245231  xTracePPSHeader (pcPPS);
    246232#endif
    247 #if !RPS_IN_SPS
    248   TComRPSList* rpsList = pcPPS->getRPSList();
    249 #endif
    250233 
    251234  WRITE_UVLC( pcPPS->getPPSId(),                             "pic_parameter_set_id" );
    252235  WRITE_UVLC( pcPPS->getSPSId(),                             "seq_parameter_set_id" );
    253236
    254 #if MULTIBITS_DATA_HIDING
    255237  WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" );
    256238  if( pcPPS->getSignHideFlag() )
     
    258240    WRITE_CODE(pcPPS->getTSIG(), 4, "sign_hiding_threshold");
    259241  }
    260 #endif
    261242#if CABAC_INIT_FLAG
    262243  WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0,   "cabac_init_present_flag" );
    263 #endif
    264 #if !RPS_IN_SPS
    265   // RPS is put before entropy_coding_mode_flag
    266   // since entropy_coding_mode_flag will probably be removed from the WD
    267   TComReferencePictureSet*      rps;
    268 
    269   WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" );
    270   for(UInt i=0; i < rpsList->getNumberOfReferencePictureSets(); i++)
    271   {
    272     rps = rpsList->getReferencePictureSet(i);
    273     codeShortTermRefPicSet(pcPPS,rps);
    274   }
    275   WRITE_FLAG( pcPPS->getLongTermRefsPresent() ? 1 : 0,         "long_term_ref_pics_present_flag" );
    276244#endif
    277245  // entropy_coding_mode_flag
     
    280248  if (pcPPS->getEntropyCodingMode())
    281249  {
    282 #if !WPP_SIMPLIFICATION
    283     WRITE_UVLC( pcPPS->getEntropyCodingSynchro(),            "entropy_coding_synchro" );
    284     WRITE_FLAG( pcPPS->getCabacIstateReset() ? 1 : 0,        "cabac_istate_reset" );
    285 #endif
    286 #if !TILES_OR_ENTROPY_SYNC_IDC
    287 #if !WPP_SIMPLIFICATION
    288     if ( pcPPS->getEntropyCodingSynchro() )
    289 #endif
    290     {
    291       WRITE_UVLC( pcPPS->getNumSubstreams()-1,               "num_substreams_minus1" );
    292     }
    293 #endif
    294   }
    295 #if !H0566_TLA
    296   WRITE_UVLC( pcPPS->getNumTLayerSwitchingFlags(),           "num_temporal_layer_switching_point_flags" );
    297   for( UInt i = 0; i < pcPPS->getNumTLayerSwitchingFlags(); i++ )
    298   {
    299     WRITE_FLAG( pcPPS->getTLayerSwitchingFlag( i ) ? 1 : 0 , "temporal_layer_switching_point_flag" );
    300   }
    301 #endif
     250  }
    302251  //   num_ref_idx_l0_default_active_minus1
    303252  //   num_ref_idx_l1_default_active_minus1
     
    313262  WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0,  "weighted_pred_flag" );   // Use of Weighting Prediction (P_SLICE)
    314263  WRITE_CODE( pcPPS->getWPBiPredIdc(), 2, "weighted_bipred_idc" );  // Use of Weighting Bi-Prediction (B_SLICE)
    315 #if H0388
    316264  WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0,  "output_flag_present_flag" );
    317 #endif
    318 #if TILES_OR_ENTROPY_SYNC_IDC
    319265  if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==1)
    320266  {
    321 #endif
    322267    WRITE_FLAG( pcPPS->getColumnRowInfoPresent(),           "tile_info_present_flag" );
    323268    WRITE_FLAG( pcPPS->getTileBehaviorControlPresentFlag(),  "tile_control_present_flag");
     
    347292      if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0)
    348293      {
    349 #if !REMOVE_TILE_DEPENDENCE
    350         WRITE_FLAG( pcPPS->getTileBoundaryIndependenceIdr(),                         "tile_boundary_independence_flag" );
    351         if(pcPPS->getTileBoundaryIndependenceIdr() == 1)
    352         {
    353 #endif
    354294          WRITE_FLAG( pcPPS->getLFCrossTileBoundaryFlag()?1 : 0,            "loop_filter_across_tile_flag");
    355 #if !REMOVE_TILE_DEPENDENCE
    356         }
    357 #endif
    358       }
    359     }
    360 #if TILES_OR_ENTROPY_SYNC_IDC
     295      }
     296    }
    361297  }
    362298  else if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==2)
     
    364300    WRITE_UVLC( pcPPS->getNumSubstreams()-1,               "num_substreams_minus1" );
    365301  }
    366 #endif
    367 
    368 #if DBL_CONTROL
     302
    369303  WRITE_FLAG( pcPPS->getDeblockingFilterControlPresent()?1 : 0, "deblocking_filter_control_present_flag");
    370 #endif
    371 #if PARALLEL_MERGE
    372304  WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
    373 #endif
    374305  WRITE_FLAG( 0, "pps_extension_flag" );
    375306}
     
    531462  WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
    532463  WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
    533 #if PIC_CROPPING
    534464  WRITE_FLAG( pcSPS->getPicCroppingFlag(),          "pic_cropping_flag" );
    535465  if (pcSPS->getPicCroppingFlag())
     
    540470    WRITE_UVLC( pcSPS->getPicCropBottomOffset(),    "pic_crop_bottom_offset" );
    541471  }
    542 #endif
    543472
    544473#if FULL_NBIT
     
    566495
    567496  WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
    568 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    569497  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    570498  {
     
    573501    WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "max_latency_increase[i]" );
    574502  }
    575 #else
    576   WRITE_UVLC( pcSPS->getMaxNumberOfReferencePictures(), "max_num_ref_pics" );
    577   WRITE_UVLC( pcSPS->getNumReorderFrames(),             "num_reorder_frames" );
    578   WRITE_UVLC(pcSPS->getMaxDecFrameBuffering(),          "max_dec_frame_buffering" );
    579   WRITE_UVLC(pcSPS->getMaxLatencyIncrease(),            "max_latency_increase"    );
    580 #endif
    581503  assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
    582504 
     
    589511  }
    590512
    591 #if H0412_REF_PIC_LIST_RESTRICTION
    592513  WRITE_FLAG( pcSPS->getRestrictedRefPicListsFlag(),                                 "restricted_ref_pic_lists_flag" );
    593514  if( pcSPS->getRestrictedRefPicListsFlag() )
     
    595516    WRITE_FLAG( pcSPS->getListsModificationPresentFlag(),                            "lists_modification_present_flag" );
    596517  }
    597 #endif
    598518  WRITE_UVLC( log2MinCUSize - 3,                                                     "log2_min_coding_block_size_minus3" );
    599519  WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth,                                 "log2_diff_max_min_coding_block_size" );
     
    621541  WRITE_FLAG( pcSPS->getUseSAO() ? 1 : 0,                                            "sample_adaptive_offset_enabled_flag");
    622542  WRITE_FLAG( pcSPS->getUseALF () ? 1 : 0,                                           "adaptive_loop_filter_enabled_flag");
    623 #if LCU_SYNTAX_ALF
    624543  if(pcSPS->getUseALF())
    625544  {
    626545    WRITE_FLAG( (pcSPS->getUseALFCoefInSlice()) ? 1 : 0,                             "alf_coef_in_slice_flag");
    627546  }
    628 #endif
    629547
    630548  if( pcSPS->getUsePCM() )
     
    637555  WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0,                             "temporal_id_nesting_flag" );
    638556
    639 #if RPS_IN_SPS
    640557  TComRPSList* rpsList = pcSPS->getRPSList();
    641558  TComReferencePictureSet*      rps;
     
    648565  }   
    649566  WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0,         "long_term_ref_pics_present_flag" );
    650 #endif
    651 #if !PIC_CROPPING
    652   //!!!KS: Syntax not in WD !!!
    653  
    654   xWriteUvlc  ( pcSPS->getPad (0) );
    655   xWriteUvlc  ( pcSPS->getPad (1) );
    656 #endif
    657567  // AMVP mode for each depth
    658568  for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++)
     
    661571  }
    662572
    663 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    664573  Int tilesOrEntropyCodingSyncIdc = 0;
    665574  if ( pcSPS->getNumColumnsMinus1() > 0 || pcSPS->getNumRowsMinus1() > 0)
     
    673582  pcSPS->setTilesOrEntropyCodingSyncIdc( tilesOrEntropyCodingSyncIdc );
    674583  WRITE_CODE(tilesOrEntropyCodingSyncIdc, 2, "tiles_or_entropy_coding_sync_idc");
    675 #endif
    676 
    677 #if TILES_OR_ENTROPY_SYNC_IDC
     584
    678585  if(tilesOrEntropyCodingSyncIdc == 1)
    679586  {
    680 #endif
    681587    WRITE_UVLC( pcSPS->getNumColumnsMinus1(),                           "num_tile_columns_minus1" );
    682588    WRITE_UVLC( pcSPS->getNumRowsMinus1(),                              "num_tile_rows_minus1" );
     
    697603    if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0)
    698604    {
    699 #if !REMOVE_TILE_DEPENDENCE
    700       WRITE_FLAG( pcSPS->getTileBoundaryIndependenceIdr(),                "tile_boundary_independence_flag" );
    701       if(pcSPS->getTileBoundaryIndependenceIdr() == 1)
    702       {
    703 #endif
    704605        WRITE_FLAG( pcSPS->getLFCrossTileBoundaryFlag()?1 : 0,            "loop_filter_across_tile_flag");
    705 #if !REMOVE_TILE_DEPENDENCE
    706       }
    707 #endif
    708     }
    709 #if TILES_OR_ENTROPY_SYNC_IDC
    710   }
    711 #endif
     606    }
     607  }
    712608  WRITE_FLAG( 1, "sps_extension_flag" );
    713609#if !QC_MVHEVC_B0046
     
    896792    WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "pic_parameter_set_id" );
    897793#endif
    898 #if H0388
    899794    if( pcSlice->getPPS()->getOutputFlagPresentFlag() )
    900795    {
    901796      WRITE_FLAG( pcSlice->getPicOutputFlag() ? 1 : 0, "pic_output_flag" );
    902797    }
    903 #endif
    904798#if QC_REM_IDV_B0046
    905799    if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_IDR && pcSlice->getViewId() == 0)
     
    924818        {
    925819          WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
    926 #if RPS_IN_SPS
    927820          codeShortTermRefPicSet(pcSlice->getSPS(), rps);
    928 #else
    929           codeShortTermRefPicSet(pcSlice->getPPS(), rps);
    930 #endif
    931821        }
    932822        else
     
    935825          WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" );
    936826        }
    937 #if RPS_IN_SPS
    938827        if(pcSlice->getSPS()->getLongTermRefsPresent())
    939 #else
    940         if(pcSlice->getPPS()->getLongTermRefsPresent())
    941 #endif
    942828        {
    943829          WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics");
    944830          Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC();
    945831          Int prev = 0;
    946 #if LTRP_MULT
    947832          Int prevDeltaPocLt=0;
    948833          Int currDeltaPocLt=0;
    949 #endif
    950834          for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--)
    951835          {
    952836            WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt");
    953837         
    954 #if LTRP_MULT
    955838            currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt;
    956839
     
    983866            }
    984867            prevDeltaPocLt=currDeltaPocLt;
    985 #endif
    986868            prev = rps->getDeltaPOC(i);
    987869            WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag");
     
    995877        {
    996878          WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
    997 #if RPS_IN_SPS
    998879          codeShortTermRefPicSet(pcSlice->getSPS(), rps);
    999 #else
    1000           codeShortTermRefPicSet(pcSlice->getPPS(), rps);
    1001 #endif
    1002880        }
    1003881        else
     
    1006884          WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" );
    1007885        }
    1008 #if RPS_IN_SPS
    1009886        if(pcSlice->getSPS()->getLongTermRefsPresent())
    1010 #else
    1011         if(pcSlice->getPPS()->getLongTermRefsPresent())
    1012 #endif
    1013887        {
    1014888          WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics");
    1015889          Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC();
    1016890          Int prev = 0;
    1017 #if LTRP_MULT
    1018891          Int prevDeltaPocLt=0;
    1019892          Int currDeltaPocLt=0;
    1020 #endif
    1021893          for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--)
    1022894          {
    1023895            WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt");
    1024896         
    1025 #if LTRP_MULT
    1026897            currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt;
    1027898
     
    1054925            }
    1055926            prevDeltaPocLt=currDeltaPocLt;
    1056 #endif
    1057927            prev = rps->getDeltaPOC(i);
    1058928            WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag");
     
    1066936      if (pcSlice->getSPS()->getUseALF())
    1067937      {
    1068 #if !LCU_SYNTAX_ALF
    1069          if (pcSlice->getAlfEnabledFlag())
    1070          {
    1071            assert (pcSlice->getAPS()->getAlfEnabled());
    1072          }
    1073 #endif
    1074938         WRITE_FLAG( pcSlice->getAlfEnabledFlag(), "ALF on/off flag in slice header" );
    1075939      }
    1076940      if (pcSlice->getSPS()->getUseSAO())
    1077941      {
    1078 #if SAO_UNIT_INTERLEAVING
    1079942        WRITE_FLAG( pcSlice->getSaoInterleavingFlag(), "SAO interleaving flag" );
    1080 #endif
    1081943         assert (pcSlice->getSaoEnabledFlag() == pcSlice->getAPS()->getSaoEnabled());
    1082944         WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "SAO on/off flag in slice header" );
    1083 #if SAO_UNIT_INTERLEAVING
    1084945         if (pcSlice->getSaoInterleavingFlag()&&pcSlice->getSaoEnabledFlag() )
    1085946         {
     
    1087948           WRITE_FLAG( pcSlice->getAPS()->getSaoParam()->bSaoFlag[2], "SAO on/off flag for Cr in slice header" );
    1088949         }
    1089 #endif
    1090950      }
    1091951      WRITE_UVLC( pcSlice->getAPS()->getAPSID(), "aps_id");
     
    1110970      pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
    1111971    }
    1112 #if H0412_REF_PIC_LIST_RESTRICTION
    1113972    if( pcSlice->getSPS()->getListsModificationPresentFlag() )
    1114973    {
    1115 #endif
    1116974    TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    1117 #if H0137_0138_LIST_MODIFICATION
    1118975    if( !pcSlice->isIntra() )
    1119976    {
     
    11581015      }
    11591016    }
    1160 #else
    1161       if(!pcSlice->isIntra())
    1162       {
    1163         WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0() ? 1 : 0,       "ref_pic_list_modification_flag" );   
    1164         for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL0(); i++)
    1165         {
    1166           WRITE_UVLC( refPicListModification->getListIdcL0(i), "ref_pic_list_modification_idc");
    1167           WRITE_UVLC( refPicListModification->getRefPicSetIdxL0(i), "ref_pic_set_idx");
    1168         }
    1169         if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0())
    1170           WRITE_UVLC( 3, "ref_pic_list_modification_idc");
    1171       }
    1172       if(pcSlice->isInterB())
    1173       {   
    1174         WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1() ? 1 : 0,       "ref_pic_list_modification_flag" );
    1175         for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL1(); i++)
    1176         {
    1177           WRITE_UVLC( refPicListModification->getListIdcL1(i), "ref_pic_list_modification_idc");
    1178           WRITE_UVLC( refPicListModification->getRefPicSetIdxL1(i), "ref_pic_set_idx");
    1179         }
    1180         if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1())
    1181           WRITE_UVLC( 3, "ref_pic_list_modification_idc");
    1182       }
    1183 #endif
    1184     }
    1185 #if H0412_REF_PIC_LIST_RESTRICTION
    1186   }
    1187 #endif
     1017    }
     1018  }
    11881019  // ref_pic_list_combination( )
    11891020  // maybe move to own function?
     
    11951026      WRITE_UVLC( pcSlice->getNumRefIdx(REF_PIC_LIST_C) - 1,          "num_ref_idx lc_active_minus1");
    11961027     
    1197 #if H0412_REF_PIC_LIST_RESTRICTION
    11981028      if( pcSlice->getSPS()->getListsModificationPresentFlag() )
    11991029      {
    1200 #endif
    12011030        WRITE_FLAG( pcSlice->getRefPicListModificationFlagLC() ? 1 : 0, "ref_pic_list_modification_flag_lc" );
    12021031        if(pcSlice->getRefPicListModificationFlagLC())
     
    12051034          {
    12061035            WRITE_FLAG( pcSlice->getListIdFromIdxOfLC(i),               "pic_from_list_0_flag" );
    1207 #if H0137_0138_LIST_MODIFICATION
    12081036          if (((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_0) && pcSlice->getNumRefIdx( REF_PIC_LIST_0 )>1 ) || ((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_1) && pcSlice->getNumRefIdx( REF_PIC_LIST_1 )>1 ) )
    12091037          {
    12101038            WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i),               "ref_idx_list_curr" );
    12111039          }
    1212 #else
    1213             WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i),               "ref_idx_list_curr" );
    1214 #endif
    12151040          }
    12161041        }
    1217 #if H0412_REF_PIC_LIST_RESTRICTION
    1218       }
    1219 #endif
     1042      }
    12201043    }
    12211044  }
    12221045   
    1223 #if H0111_MVD_L1_ZERO
    12241046  if (pcSlice->isInterB())
    12251047  {
    12261048    WRITE_FLAG( pcSlice->getMvdL1ZeroFlag() ? 1 : 0,   "mvd_l1_zero_flag");
    12271049  }
    1228 #endif
    12291050
    12301051  if(pcSlice->getPPS()->getEntropyCodingMode() && !pcSlice->isIntra())
     
    12491070    Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 );
    12501071    WRITE_SVLC( iCode, "slice_qp_delta" );
    1251 #if DBL_CONTROL
    12521072    if (pcSlice->getPPS()->getDeblockingFilterControlPresent())
    12531073    {
     
    12561076        WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag");
    12571077      }
    1258 #else
    1259     WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag");
    1260 #endif
    12611078      if (!pcSlice->getInheritDblParamFromAPS())
    12621079      {
     
    12681085        }
    12691086      }
    1270 #if DBL_CONTROL
    1271     }
    1272 #endif
     1087    }
    12731088    if ( pcSlice->getSliceType() == B_SLICE )
    12741089    {
     
    13411156 \param pcSlice Where we find the substream size information.
    13421157 */
    1343 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    13441158Void  TEncCavlc::codeTilesWPPEntryPoint( TComSlice* pSlice )
    13451159{
     
    14411255  delete [] entryPointOffset;
    14421256}
    1443 #else
    1444 Void TEncCavlc::codeSliceHeaderSubstreamTable( TComSlice* pcSlice )
    1445 {
    1446   UInt uiNumSubstreams = pcSlice->getPPS()->getNumSubstreams();
    1447   UInt*puiSubstreamSizes = pcSlice->getSubstreamSizes();
    1448 
    1449   // Write header information for all substreams except the last.
    1450   for (UInt ui = 0; ui+1 < uiNumSubstreams; ui++)
    1451   {
    1452     UInt uiNumbits = puiSubstreamSizes[ui];
    1453 
    1454     //the 2 first bits are used to give the size of the header
    1455     if ( uiNumbits < (1<<8) )
    1456     {
    1457       xWriteCode(0,         2  );
    1458       xWriteCode(uiNumbits, 8  );
    1459     }
    1460     else if ( uiNumbits < (1<<16) )
    1461     {
    1462       xWriteCode(1,         2  );
    1463       xWriteCode(uiNumbits, 16 );
    1464     }
    1465     else if ( uiNumbits < (1<<24) )
    1466     {
    1467       xWriteCode(2,         2  );
    1468       xWriteCode(uiNumbits, 24 );
    1469     }
    1470     else if ( uiNumbits < (1<<31) )
    1471     {
    1472       xWriteCode(3,         2  );
    1473       xWriteCode(uiNumbits, 32 );
    1474     }
    1475     else
    1476     {
    1477       printf("Error in codeSliceHeaderTable\n");
    1478       exit(-1);
    1479     }
    1480   }
    1481 }
    1482 #endif
    14831257
    14841258Void TEncCavlc::codeTerminatingBit      ( UInt uilsLast )
     
    15991373}
    16001374
    1601 #if BURST_IPCM
    16021375/** Code I_PCM information.
    16031376 * \param pcCU pointer to CU
     
    16111384  assert(0);
    16121385}
    1613 #else
    1614 /** Code I_PCM information.
    1615  * \param pcCU pointer to CU
    1616  * \param uiAbsPartIdx CU index
    1617  * \returns Void
    1618  *
    1619  * If I_PCM flag indicates that the CU is I_PCM, code its PCM alignment bits and codes. 
    1620  */
    1621 Void TEncCavlc::codeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx)
    1622 {
    1623   UInt uiIPCM = (pcCU->getIPCMFlag(uiAbsPartIdx) == true)? 1 : 0;
    1624 
    1625   xWriteFlag(uiIPCM);
    1626 
    1627   if (uiIPCM)
    1628   {
    1629     xWritePCMAlignZero();
    1630 
    1631     UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
    1632     UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    1633     UInt uiChromaOffset = uiLumaOffset>>2;
    1634 
    1635     Pel* piPCMSample;
    1636     UInt uiWidth;
    1637     UInt uiHeight;
    1638     UInt uiSampleBits;
    1639     UInt uiX, uiY;
    1640 
    1641     piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset;
    1642     uiWidth = pcCU->getWidth(uiAbsPartIdx);
    1643     uiHeight = pcCU->getHeight(uiAbsPartIdx);
    1644     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
    1645 
    1646     for(uiY = 0; uiY < uiHeight; uiY++)
    1647     {
    1648       for(uiX = 0; uiX < uiWidth; uiX++)
    1649       {
    1650         UInt uiSample = piPCMSample[uiX];
    1651 
    1652         xWriteCode(uiSample, uiSampleBits);
    1653       }
    1654       piPCMSample += uiWidth;
    1655     }
    1656 
    1657     piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
    1658     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    1659     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    1660     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    1661 
    1662     for(uiY = 0; uiY < uiHeight; uiY++)
    1663     {
    1664       for(uiX = 0; uiX < uiWidth; uiX++)
    1665       {
    1666         UInt uiSample = piPCMSample[uiX];
    1667 
    1668         xWriteCode(uiSample, uiSampleBits);
    1669       }
    1670       piPCMSample += uiWidth;
    1671     }
    1672 
    1673     piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;
    1674     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    1675     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    1676     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    1677 
    1678     for(uiY = 0; uiY < uiHeight; uiY++)
    1679     {
    1680       for(uiX = 0; uiX < uiWidth; uiX++)
    1681       {
    1682         UInt uiSample = piPCMSample[uiX];
    1683 
    1684         xWriteCode(uiSample, uiSampleBits);
    1685       }
    1686       piPCMSample += uiWidth;
    1687     }
    1688   }
    1689 }
    1690 #endif
    16911386
    16921387Void TEncCavlc::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx )
     
    17191414  Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );
    17201415
    1721 #if H0736_AVC_STYLE_QP_RANGE
    17221416  Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffsetY();
    17231417  iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
    1724 #endif
    17251418
    17261419  xWriteSvlc( iDQp );
     
    17531446  xWriteSvlc( iCode );
    17541447}
    1755 #if LCU_SYNTAX_ALF
    17561448/** Code the fixed length code (smaller than one max value) in OSALF
    17571449 * \param idx:  coded value
     
    17781470  }
    17791471}
    1780 #endif
    17811472
    17821473Void TEncCavlc::codeSaoFlag( UInt uiCode )
     
    17941485    xWriteSvlc( iCode );
    17951486}
    1796 #if SAO_UNIT_INTERLEAVING
    17971487/** Code SAO run.
    17981488 * \param uiCode
     
    18181508  WRITE_CODE( uiCode, uiLength, "sao_run_diff");
    18191509}
    1820 #endif
    18211510
    18221511Void TEncCavlc::estBit( estBitsSbacStruct* pcEstBitsCabac, Int width, Int height, TextType eTType )
     
    21231812Void TEncCavlc::xCodeScalingList(TComScalingList* scalingList, UInt sizeId, UInt listId)
    21241813{
    2125 #if SCALING_LIST
    21261814  Int coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
    21271815  UInt* scan    = g_auiFrameScanXY [ (sizeId == 0)? 1 : 2];
    2128 #else
    2129   Int coefNum = (Int)g_scalingListSize[sizeId];
    2130   UInt* scan    = g_auiFrameScanXY [ sizeId + 1];
    2131 #endif
    21321816  Int nextCoef = SCALING_LIST_START_VALUE;
    21331817  Int data;
    21341818  Int *src = scalingList->getScalingListAddress(sizeId, listId);
    2135 #if SCALING_LIST
    21361819  if(sizeId > SCALING_LIST_8x8 && scalingList->getUseDefaultScalingMatrixFlag(sizeId,listId))
    21371820  {
     
    21641847    }
    21651848  }
    2166 #else
    2167   for(Int i=0;i<coefNum;i++)
    2168   {
    2169     data = src[scan[i]] - nextCoef;
    2170     nextCoef = src[scan[i]];
    2171     if(data > 127)
    2172     {
    2173       data = data - 256;
    2174     }
    2175     if(data < -128)
    2176     {
    2177       data = data + 256;
    2178     }
    2179 
    2180     WRITE_SVLC( data,  "delta_coef");
    2181   }
    2182 #endif
    21831849}
    21841850Bool TComScalingList::checkPredMode(UInt sizeId, UInt listId)
     
    21861852  for(Int predListIdx = (Int)listId -1 ; predListIdx >= 0; predListIdx--)
    21871853  {
    2188 #if SCALING_LIST
    21891854    if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix
    21901855     && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value
    2191 #else
    2192     if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*(Int)g_scalingListSize[sizeId])) // check value of matrix
    2193 #endif
    21941856    {
    21951857      setRefMatrixId(sizeId, listId, predListIdx);
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCavlc.h

    r292 r294  
    8888  Void  xWriteUnaryMaxSymbol  ( UInt uiSymbol, UInt uiMaxSymbol );
    8989
    90 #if RPS_IN_SPS
    9190  Void codeShortTermRefPicSet              ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS );
    92 #else
    93   Void codeShortTermRefPicSet              ( TComPPS* pcPPS, TComReferencePictureSet* pcRPS );
    94 #endif
    9591 
    9692  UInt  xConvertToUInt        ( Int iValue ) {  return ( iValue <= 0) ? -iValue<<1 : (iValue<<1)-1; }
     
    129125  Void codeTileMarkerFlag(TComSlice* pcSlice);
    130126
    131 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    132127  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
    133 #else
    134   Void  codeSliceHeaderSubstreamTable( TComSlice* pcSlice );
    135 #endif
    136128  Void  codeTerminatingBit      ( UInt uilsLast );
    137129  Void  codeSliceFinish         ();
     
    148140  Void codeAlfSvlc       ( Int   iCode );
    149141  Void codeAlfCtrlDepth();
    150 #if LCU_SYNTAX_ALF
    151142  Void codeAPSAlflag(UInt uiCode);
    152143  Void codeAlfFixedLengthIdx( UInt idx, UInt numFilterSetsInBuffer);
    153 #endif
    154144  Void codeSaoFlag       ( UInt uiCode );
    155145  Void codeSaoUvlc       ( UInt uiCode );
    156146  Void codeSaoSvlc       ( Int   iCode );
    157 #if SAO_UNIT_INTERLEAVING
    158147  Void codeSaoRun        ( UInt uiCode, UInt maxValue  );
    159148  Void codeSaoMergeLeft  ( UInt uiCode, UInt compIdx ){;}
     
    161150  Void codeSaoTypeIdx    ( UInt uiCode ){ xWriteUvlc(uiCode   );}
    162151  Void codeSaoUflc       ( UInt uiCode ){ assert(uiCode < 32); xWriteCode(uiCode, 5);}
    163 #endif
    164152
    165153  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     
    189177  Void codePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    190178 
    191 #if BURST_IPCM
    192179  Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Int numIPCM, Bool firstIPCMFlag);
    193 #else
    194   Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    195 #endif
    196180
    197181  Void codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx );
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCfg.h

    r292 r294  
    109109  Int       m_iSourceWidth;
    110110  Int       m_iSourceHeight;
    111 #if PIC_CROPPING
    112111  Int       m_croppingMode;
    113112  Int       m_cropLeft;
     
    115114  Int       m_cropTop;
    116115  Int       m_cropBottom;
    117 #endif
    118116  Int       m_iFrameToBeEncoded;
    119117  Double    m_adLambdaModifier[ MAX_TLAYER ];
     
    125123  GOPEntryMvc m_GOPList[MAX_GOP+1];
    126124  Int       m_extraRPSs;
    127 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    128125  Int       m_maxDecPicBuffering[MAX_TLAYER];
    129126  Int       m_numReorderPics[MAX_TLAYER];
    130 #else
    131   Int       m_maxNumberOfReferencePictures;
    132   Int       m_numReorderFrames;
    133 #endif
    134127 
    135128  Int       m_iQP;                              //  if (AdaptiveQP == OFF)
     
    142135                                                 // TODO: We need to have a common sliding mechanism used by both the encoder and decoder
    143136
    144 #if H0566_TLA
    145137  Int       m_maxTempLayer;                      ///< Max temporal layer
    146 #else
    147   Bool      m_bTLayering;                        ///< indicates whether temporal IDs are set based on the hierarchical coding structure
    148   Bool      m_abTLayerSwitchingFlag[MAX_TLAYER]; ///< temporal layer switching flags corresponding to temporal layer
    149 #endif
    150138  Bool      m_bDisInter4x4;
    151139  Bool m_useAMP;
     
    163151  Int       m_loopFilterBetaOffsetDiv2;
    164152  Int       m_loopFilterTcOffsetDiv2;
    165 #if DBL_CONTROL
    166153  Bool      m_DeblockingFilterControlPresent;
    167 #endif
    168154  Bool      m_bUseSAO;
    169155#if LGE_ILLUCOMP_B0045
     
    173159  Bool      m_bUseIVS;
    174160#endif
    175 #if SAO_UNIT_INTERLEAVING
    176161  Int       m_maxNumOffsetsPerPic;
    177162  Bool      m_saoInterleavingFlag;
    178 #endif
    179163
    180164  //====== Lossless ========
     
    232216
    233217  Int       m_iALFMaxNumberFilters;
    234 #if LCU_SYNTAX_ALF
    235218  Bool      m_bALFParamInSlice;
    236219  Bool      m_bALFPicBasedEncode;
    237 #endif
    238220
    239221  Bool      m_bUseASR;
     
    242224  Bool      m_bLCMod;
    243225  Bool      m_bUseRDOQ;
    244 #if !PIC_CROPPING
    245   Bool      m_bUsePAD;
    246 #endif
    247226  Bool      m_bUseFastEnc;
    248227  Bool      m_bUseEarlyCU;
    249228
    250 #if FAST_DECISION_FOR_MRG_RD_COST
    251229  Bool      m_useFastDecisionForMerge;
    252 #endif
    253230  Bool      m_bUseCbfFastMode;
    254231  Bool      m_bUseLMChroma;
     
    308285
    309286  Bool      m_bEnableTMVP;
    310 #if MULTIBITS_DATA_HIDING
    311287  Int       m_signHideFlag;
    312288  Int       m_signHidingThreshold;
    313 #endif
    314289
    315290#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
     
    386361  Void      setSourceWidth                  ( Int   i )      { m_iSourceWidth = i; }
    387362  Void      setSourceHeight                 ( Int   i )      { m_iSourceHeight = i; }
    388 #if PIC_CROPPING
    389363  Void      setCroppingMode                 ( Int   i )      { m_croppingMode = i; }
    390364  Void      setCropLeft                     ( Int   i )      { m_cropLeft = i; }
     
    392366  Void      setCropTop                      ( Int   i )      { m_cropTop = i; }
    393367  Void      setCropBottom                   ( Int   i )      { m_cropBottom = i; }
    394 #endif
    395368  Void      setFrameToBeEncoded             ( Int   i )      { m_iFrameToBeEncoded = i; }
    396369 
     
    402375  Void      setExtraRPSs                    ( Int   i )      { m_extraRPSs = i; }
    403376  GOPEntryMvc getGOPEntry                   ( Int   i )      { return m_GOPList[i]; }
    404 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    405377  Void      setMaxDecPicBuffering           ( UInt u, UInt tlayer ) { m_maxDecPicBuffering[tlayer] = u;    }
    406378  Void      setNumReorderPics               ( Int  i, UInt tlayer ) { m_numReorderPics[tlayer] = i;    }
    407 #else
    408   Void      setMaxNumberOfReferencePictures ( Int u )       { m_maxNumberOfReferencePictures = u;    }
    409   Void      setNumReorderFrames             ( Int  i )       { m_numReorderFrames = i;    }
    410 #endif
    411379 
    412380#if HHI_INTERVIEW_SKIP
     
    426394  Void      setMaxRefPicNum                 ( Int iMaxRefPicNum )           { m_iMaxRefPicNum = iMaxRefPicNum;  }
    427395
    428 #if H0566_TLA
    429396  Bool      getMaxTempLayer                 ()                              { return m_maxTempLayer;              }
    430397  Void      setMaxTempLayer                 ( Int maxTempLayer )            { m_maxTempLayer = maxTempLayer;      }
    431 #else
    432   Bool      getTLayering                    ()                              { return m_bTLayering;              }
    433   Void      setTLayering                    ( Bool bTLayering )             { m_bTLayering = bTLayering;        }
    434   Bool      getTLayerSwitchingFlag          ( UInt uiTLayer )               { assert (uiTLayer < MAX_TLAYER ); return  m_abTLayerSwitchingFlag[uiTLayer];                   }
    435   Void      setTLayerSwitchingFlag          ( Bool* pbTLayerSwitchingFlag ) { for ( Int i = 0; i < MAX_TLAYER; i++ ) m_abTLayerSwitchingFlag[i] = pbTLayerSwitchingFlag[i]; }
    436 #endif
    437398
    438399  Bool      getDisInter4x4                  ()              { return m_bDisInter4x4;        }
     
    470431  Void      setLoopFilterBetaOffset         ( Int   i )      { m_loopFilterBetaOffsetDiv2  = i; }
    471432  Void      setLoopFilterTcOffset           ( Int   i )      { m_loopFilterTcOffsetDiv2    = i; }
    472 #if DBL_CONTROL
    473433  Void      setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; }
    474 #endif
    475434
    476435  //====== Motion search ========
     
    527486  Int       getSourceWidth                  ()      { return  m_iSourceWidth; }
    528487  Int       getSourceHeight                 ()      { return  m_iSourceHeight; }
    529 #if PIC_CROPPING
    530488  Int       getCroppingMode                 ()      { return  m_croppingMode; }
    531489  Int       getCropLeft                     ()      { return  m_cropLeft; }
     
    533491  Int       getCropTop                      ()      { return  m_cropTop; }
    534492  Int       getCropBottom                   ()      { return  m_cropBottom; }
    535 #endif
    536493  Int       getFrameToBeEncoded             ()      { return  m_iFrameToBeEncoded; }
    537494  void setLambdaModifier                    ( UInt uiIndex, Double dValue ) { m_adLambdaModifier[ uiIndex ] = dValue; }
     
    542499  UInt      getDecodingRefreshType          ()      { return  m_uiDecodingRefreshType; }
    543500  Int       getGOPSize                      ()      { return  m_iGOPSize; }
    544 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    545501  Int       getMaxDecPicBuffering           (UInt tlayer) { return m_maxDecPicBuffering[tlayer]; }
    546502  Int       getNumReorderPics               (UInt tlayer) { return m_numReorderPics[tlayer]; }
    547 #else
    548   Int      getMaxNumberOfReferencePictures ()      { return m_maxNumberOfReferencePictures; }
    549   Int       geNumReorderFrames              ()      { return m_numReorderFrames; }
    550 #endif
    551503  Int       getQP                           ()      { return  m_iQP; }
    552504 
     
    565517  Int       getLoopFilterBetaOffset         ()      { return m_loopFilterBetaOffsetDiv2; }
    566518  Int       getLoopFilterTcOffset           ()      { return m_loopFilterTcOffsetDiv2; }
    567 #if DBL_CONTROL
    568519  Bool      getDeblockingFilterControlPresent()  { return  m_DeblockingFilterControlPresent; }
    569 #endif
    570520
    571521  //==== Motion search ========
     
    610560  Void      setLCMod                        ( Bool  b )     { m_bLCMod   = b;    }
    611561  Void      setUseRDOQ                      ( Bool  b )     { m_bUseRDOQ    = b; }
    612 #if !PIC_CROPPING
    613   Void      setUsePAD                       ( Bool  b )     { m_bUsePAD     = b; }
    614 #endif
    615562#if HHI_VSO
    616563  Void      setUseVSO                       ( Bool  b )     { m_bUseVSO     = b; }
     
    624571  Void      setUseFastEnc                   ( Bool  b )     { m_bUseFastEnc = b; }
    625572  Void      setUseEarlyCU                   ( Bool  b )     { m_bUseEarlyCU = b; }
    626 #if FAST_DECISION_FOR_MRG_RD_COST
    627573  Void      setUseFastDecisionForMerge      ( Bool  b )     { m_useFastDecisionForMerge = b; }
    628 #endif
    629574  Void      setUseCbfFastMode            ( Bool  b )     { m_bUseCbfFastMode = b; }
    630575  Void      setUseConstrainedIntraPred      ( Bool  b )     { m_bUseConstrainedIntraPred = b; }
     
    645590  Void      setALFMaxNumberFilters          (Int i)  { m_iALFMaxNumberFilters = i; }
    646591  Int       getALFMaxNumberFilters          ()       { return m_iALFMaxNumberFilters; }
    647 #if LCU_SYNTAX_ALF
    648592  Void      setALFParamInSlice              (Bool b) {m_bALFParamInSlice = b;}
    649593  Bool      getALFParamInSlice              ()       {return m_bALFParamInSlice;}
    650594  Void      setALFPicBasedEncode            (Bool b) {m_bALFPicBasedEncode = b;}
    651595  Bool      getALFPicBasedEncode            ()       {return m_bALFPicBasedEncode;}
    652 #endif
    653596
    654597  Bool      getUseLComb                     ()      { return m_bUseLComb;   }
    655598  Bool      getLCMod                        ()      { return m_bLCMod; }
    656599  Bool      getUseRDOQ                      ()      { return m_bUseRDOQ;    }
    657 #if !PIC_CROPPING
    658   Bool      getUsePAD                       ()      { return m_bUsePAD;     }
    659 #endif
    660600
    661601#if HHI_VSO
     
    669609  Bool      getUseFastEnc                   ()      { return m_bUseFastEnc; }
    670610  Bool      getUseEarlyCU                   ()      { return m_bUseEarlyCU; }
    671 #if FAST_DECISION_FOR_MRG_RD_COST
    672611  Bool      getUseFastDecisionForMerge      ()      { return m_useFastDecisionForMerge; }
    673 #endif
    674612  Bool      getUseCbfFastMode           ()      { return m_bUseCbfFastMode; }
    675613  Bool      getUseConstrainedIntraPred      ()      { return m_bUseConstrainedIntraPred; }
     
    721659  Bool  getUseIVS                       ()              {return m_bUseIVS;}
    722660#endif
    723 #if SAO_UNIT_INTERLEAVING
    724661  Void  setMaxNumOffsetsPerPic                   (Int iVal)            { m_maxNumOffsetsPerPic = iVal; }
    725662  Int   getMaxNumOffsetsPerPic                   ()                    { return m_maxNumOffsetsPerPic; }
    726663  Void  setSaoInterleavingFlag                   (bool bVal)           { m_saoInterleavingFlag = bVal; }
    727664  Bool  getSaoInterleavingFlag                   ()                    { return m_saoInterleavingFlag; }
    728 #endif
    729665  Void  setTileBehaviorControlPresentFlag        ( Int i )             { m_iTileBehaviorControlPresentFlag = i;    }
    730666  Int   getTileBehaviorControlPresentFlag        ()                    { return m_iTileBehaviorControlPresentFlag; }
     
    735671  Void  setUniformSpacingIdr           ( Int i )           { m_iUniformSpacingIdr = i; }
    736672  Int   getUniformSpacingIdr           ()                  { return m_iUniformSpacingIdr; }
    737 #if !REMOVE_TILE_DEPENDENCE
    738   Void  setTileBoundaryIndependenceIdr ( Int i )           { m_iTileBoundaryIndependenceIdr = i; }
    739   Int   getTileBoundaryIndependenceIdr ()                  { return m_iTileBoundaryIndependenceIdr; }
    740 #endif
    741673  Void  setNumColumnsMinus1            ( Int i )           { m_iNumColumnsMinus1 = i; }
    742674  Int   getNumColumnsMinus1            ()                  { return m_iNumColumnsMinus1; }
     
    834766  Void      setEnableTMVP          ( Bool b )    { m_bEnableTMVP = b;    }
    835767  Bool      getEnableTMVP          ()            { return m_bEnableTMVP; }
    836 #if MULTIBITS_DATA_HIDING
    837768  Void      setSignHideFlag( Int signHideFlag )  { m_signHideFlag = signHideFlag; }
    838769  Void      setTSIG( Int tsig )                  { m_signHidingThreshold = tsig; }
    839770  Int       getSignHideFlag()                    { return m_signHideFlag; }
    840771  Int       getTSIG()                            { return m_signHidingThreshold; }
    841 #endif
    842772#if VIDYO_VPS_INTEGRATION |QC_MVHEVC_B0046
    843773  Void      setLayerId             ( UInt layerId )   { m_layerId = layerId; }
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp

    r292 r294  
    107107 
    108108  m_bEncodeDQP = false;
    109 #if BURST_IPCM
    110109  m_checkBurstIPCMFlag = false;
    111 #endif
    112110
    113111  // initialize partition order.
     
    285283  }
    286284
    287 #if BURST_IPCM
    288285  TComPic* pcPic = pcCU->getPic();
    289286  Bool checkBurstIPCMFlag = (pcPic->getSlice(0)->getSPS()->getUsePCM())? true : false;
     
    293290  pcCU->setNumSucIPCM(0);
    294291  pcCU->setLastCUSucIPCMFlag(false);
    295 #endif
    296292
    297293  // Encode CU data
    298294  xEncodeCU( pcCU, 0, 0 );
    299295 
    300 #if OL_FLUSH
    301296  bool bTerminateSlice = bForceTerminate;
    302297  UInt uiCUAddr = pcCU->getAddr();
    303298    /* If at the end of an LCU line but not at the end of a substream, perform CABAC flush */
    304 #if WPP_SIMPLIFICATION
    305299    if (!bTerminateSlice && pcCU->getSlice()->getPPS()->getNumSubstreams() > 1)
    306 #else
    307     if (!bTerminateSlice && pcCU->getSlice()->getPPS()->getCabacIstateReset())
    308 #endif
    309300    {
    310301      Int iNumSubstreams = pcCU->getSlice()->getPPS()->getNumSubstreams();
     
    312303      UInt uiCol     = uiCUAddr % uiWidthInLCUs;
    313304      UInt uiLin     = uiCUAddr / uiWidthInLCUs;
    314 #if !REMOVE_TILE_DEPENDENCE
    315       Int iBreakDep = pcCU->getPic()->getPicSym()->getTileBoundaryIndependenceIdr();
    316 #endif
    317305      UInt uiTileStartLCU = pcCU->getPic()->getPicSym()->getTComTile(pcCU->getPic()->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr();
    318306      UInt uiTileLCUX = uiTileStartLCU % uiWidthInLCUs;
     
    321309      UInt uiTileHeight = pcCU->getPic()->getPicSym()->getTComTile(pcCU->getPic()->getPicSym()->getTileIdxMap(uiCUAddr))->getTileHeight();
    322310      Int iNumSubstreamsPerTile = iNumSubstreams;
    323 #if !REMOVE_TILE_DEPENDENCE
    324 #if WPP_SIMPLIFICATION
    325       if (iBreakDep && pcCU->getSlice()->getPPS()->getNumSubstreams() > 1)
    326 #else
    327       if (iBreakDep && pcCU->getSlice()->getPPS()->getEntropyCodingSynchro())
    328 #endif
     311      if (pcCU->getSlice()->getPPS()->getNumSubstreams() > 1)
     312      {
    329313        iNumSubstreamsPerTile /= pcCU->getPic()->getPicSym()->getNumTiles();
    330       if ((iBreakDep && (uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))
    331           || (!iBreakDep && (uiCol == uiWidthInLCUs-1) && (uiLin+iNumSubstreams < pcCU->getPic()->getFrameHeightInCU())))
     314      }
     315      if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))
    332316      {
    333317        m_pcEntropyCoder->encodeFlush();
    334318      }
    335 #else
    336 #if WPP_SIMPLIFICATION
    337       if (pcCU->getSlice()->getPPS()->getNumSubstreams() > 1)
    338 #else
    339       if (pcCU->getSlice()->getPPS()->getEntropyCodingSynchro())
    340 #endif
    341       {
    342         iNumSubstreamsPerTile /= pcCU->getPic()->getPicSym()->getNumTiles();
    343       }
    344       if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))
    345       {
    346         m_pcEntropyCoder->encodeFlush();
    347       }
    348 #endif
    349     }
    350 #endif // OL_FLUSH
     319    }
    351320}
    352321
     
    556525#if LOSSLESS_CODING
    557526  Bool isAddLowestQP = false;
    558 #if H0736_AVC_STYLE_QP_RANGE
    559527  Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY();
    560 #else
    561   Int lowestQP = 0;
    562 #endif
    563528#endif
    564529
     
    566531  {
    567532    Int idQP = m_pcEncCfg->getMaxDeltaQP();
    568 #if H0736_AVC_STYLE_QP_RANGE
    569533    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    570534    iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
     
    576540
    577541    }
    578 #endif
    579 #else
    580     iMinQP = Clip3( MIN_QP, MAX_QP, iBaseQP-idQP );
    581     iMaxQP = Clip3( MIN_QP, MAX_QP, iBaseQP+idQP );
    582 #if LOSSLESS_CODING
    583     if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )
    584     {
    585       isAddLowestQP = true;
    586       iMinQP = iMinQP - 1;
    587     }
    588 #endif
    589542#endif
    590543  }
     
    13171270  {
    13181271    Int idQP = m_pcEncCfg->getMaxDeltaQP();
    1319 #if H0736_AVC_STYLE_QP_RANGE
    13201272    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    13211273    iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
     
    13261278      iMinQP = iMinQP - 1;     
    13271279    }
    1328 #endif
    1329 #else
    1330     iMinQP = Clip3( MIN_QP, MAX_QP, iBaseQP-idQP );
    1331     iMaxQP = Clip3( MIN_QP, MAX_QP, iBaseQP+idQP );
    1332 #if LOSSLESS_CODING
    1333     if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )
    1334     {
    1335       isAddLowestQP = true;
    1336       iMinQP = iMinQP - 1;
    1337     }
    1338 #endif
    13391280#endif
    13401281  }
     
    16351576    &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight));
    16361577 
    1637 #if BURST_IPCM
    16381578  if(granularityBoundary && (!(pcCU->getIPCMFlag(uiAbsPartIdx) && ( pcCU->getNumSucIPCM() > 1 ))))
    1639 #else
    1640   if(granularityBoundary)
    1641 #endif
    16421579  {
    16431580    // The 1-terminating bit is added to all streams, so don't add it here when it's 1.
     
    17311668    iQpOffset = Int(floor( dQpOffset + 0.49999 ));
    17321669  }
    1733 #if H0736_AVC_STYLE_QP_RANGE
    17341670  return Clip3(-pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQp+iQpOffset );
    1735 #else
    1736   return Clip3( MIN_QP, MAX_QP, iBaseQp+iQpOffset );
    1737 #endif
    17381671}
    17391672
     
    17541687  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
    17551688 
    1756 #if BURST_IPCM
    17571689  if( getCheckBurstIPCMFlag() )
    17581690  {
     
    17601692    pcCU->setNumSucIPCM( countNumSucIPCM ( pcCU, uiAbsPartIdx ) );
    17611693  }
    1762 #endif
    17631694
    17641695  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
     
    18331764      setdQPFlag(true);
    18341765    }
    1835 #if BURST_IPCM
    18361766    pcCU->setNumSucIPCM(0);
    18371767    pcCU->setLastCUSucIPCMFlag(false);
    1838 #endif
    18391768    for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++, uiAbsPartIdx+=uiQNumParts )
    18401769    {
     
    19911920#endif
    19921921
    1993 #if FAST_DECISION_FOR_MRG_RD_COST
    19941922  Bool bestIsSkip = false;
    1995 #endif
    19961923 
    19971924  for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
     
    20231950#endif
    20241951      {
    2025 #if FAST_DECISION_FOR_MRG_RD_COST
    20261952        if( !(bestIsSkip && uiNoResidual == 0) )
    20271953        {
    2028 #endif
    20291954          // set MC parameters
    20301955          rpcTempCU->setPredModeSubParts( MODE_SKIP, 0, uhDepth ); // interprets depth relative to LCU level
     
    20882013          else
    20892014          {
    2090 #if FAST_DECISION_FOR_MRG_RD_COST
    20912015            if( bestIsSkip)
    20922016            {
     
    21072031            else
    21082032            {
    2109 #endif
    21102033              if ( pcPredYuvTemp != m_ppcPredYuvTemp[uhDepth])
    21112034              {
     
    21132036                pcPredYuvTemp = m_ppcPredYuvBest[uhDepth];
    21142037              }
    2115 #if FAST_DECISION_FOR_MRG_RD_COST
    21162038            }
    2117 #endif
    21182039          }
    21192040#if HHI_VSO
     
    21402061          Bool bQtRootCbf = rpcTempCU->getQtRootCbf(0) == 1;
    21412062
    2142 #if H0736_AVC_STYLE_QP_RANGE
    21432063          Int orgQP = rpcTempCU->getQP( 0 );
    21442064          xCheckDQP( rpcTempCU );
    21452065          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    21462066          rpcTempCU->initEstData( uhDepth, orgQP );
    2147 #else
    2148           UInt uiOrgQP = rpcTempCU->getQP( 0 );
    2149           xCheckDQP( rpcTempCU );
    2150           xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    2151           rpcTempCU->initEstData( uhDepth, uiOrgQP );
    2152 #endif
    2153 
    2154 #if FAST_DECISION_FOR_MRG_RD_COST
     2067
    21552068          if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
    21562069          {
    21572070            bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
    21582071          }
    2159 #endif
    21602072
    21612073          if (!bQtRootCbf)
    21622074            break;
    2163 #if FAST_DECISION_FOR_MRG_RD_COST
    21642075        }
    2165 #endif
    21662076      }
    21672077    }
     
    25152425}
    25162426
    2517 #if BURST_IPCM
    25182427/** Check whether the last CU shares the same root as the current CU and is IPCM or not. 
    25192428 * \param pcCU
     
    26072516  return numSucIPCM;
    26082517}
    2609 #endif
    26102518
    26112519Void TEncCu::xCopyAMVPInfo (AMVPInfo* pSrc, AMVPInfo* pDst)
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCu.h

    r231 r294  
    8484  //  Data : encoder control
    8585  Bool                    m_bEncodeDQP;
    86 #if BURST_IPCM
    8786  Bool                    m_checkBurstIPCMFlag;
    88 #endif
    8987
    9088  //  Access channel
     
    173171  Void setdQPFlag           ( Bool b )                { m_bEncodeDQP = b;           }
    174172
    175 #if BURST_IPCM
    176173  Bool getCheckBurstIPCMFlag()                        { return m_checkBurstIPCMFlag;   }
    177174  Void setCheckBurstIPCMFlag( Bool b )                { m_checkBurstIPCMFlag = b;      }
     
    179176  Bool checkLastCUSucIPCM   ( TComDataCU* pcCU, UInt uiCurAbsPartIdx );
    180177  Int  countNumSucIPCM      ( TComDataCU* pcCU, UInt uiCurAbsPartIdx );
    181 #endif
    182178
    183179#if ADAPTIVE_QP_SELECTION
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp

    r292 r294  
    5252Void TEncEntropy::encodeSliceHeader ( TComSlice* pcSlice )
    5353{
    54 #if SAO_UNIT_INTERLEAVING
    5554  if (pcSlice->getSPS()->getUseSAO())
    5655  {
     
    6867    }
    6968  }
    70 #endif
    7169
    7270  m_pcEntropyCoderIf->codeSliceHeader( pcSlice );
     
    7472}
    7573
    76 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    7774Void  TEncEntropy::encodeTilesWPPEntryPoint( TComSlice* pSlice )
    7875{
    7976  m_pcEntropyCoderIf->codeTilesWPPEntryPoint( pSlice );
    8077}
    81 #else
    82 Void TEncEntropy::encodeSliceHeaderSubstreamTable( TComSlice* pcSlice )
    83 {
    84   m_pcEntropyCoderIf->codeSliceHeaderSubstreamTable( pcSlice );
    85 }
    86 #endif
    8778
    8879Void TEncEntropy::encodeTerminatingBit      ( UInt uiIsLast )
     
    9889}
    9990
    100 #if OL_FLUSH
    10191Void TEncEntropy::encodeFlush()
    10292{
     
    10797  m_pcEntropyCoderIf->encodeStart();
    10898}
    109 #endif
    11099
    111100Void TEncEntropy::encodeSEI(const SEI& sei)
     
    157146    uiAbsPartIdx = 0;
    158147  }
    159 #if BURST_IPCM
    160148  if( !bRD )
    161149  {
     
    165153    }
    166154  }
    167 #endif
    168155  m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx );
    169156}
     
    226213  //  m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->realfiltNo);
    227214
    228 #if !LCU_SYNTAX_ALF
    229   m_pcEntropyCoderIf->codeAlfFlag(pAlfParam->alf_pcr_region_flag);
    230 #endif
    231 #if !ALF_SINGLE_FILTER_SHAPE
    232   m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->filter_shape);
    233 #endif
    234215  Int noFilters = min(pAlfParam->filters_per_group-1, 2);
    235216  m_pcEntropyCoderIf->codeAlfUvlc(noFilters);
     
    241222  else if (noFilters == 2)
    242223  {
    243 #if LCU_SYNTAX_ALF
    244 #if ALF_16_BA_GROUPS
    245224    Int numMergeFlags = 16;
    246 #else
    247     Int numMergeFlags = 15;
    248 #endif
    249 #else
    250 #if ALF_16_BA_GROUPS
    251     Int numMergeFlags = 16;
    252 #else
    253     Int numMergeFlags = pAlfParam->alf_pcr_region_flag ? 16 : 15;
    254 #endif
    255 #endif
    256225    for (Int i=1; i<numMergeFlags; i++)
    257226    {
     
    285254  pDepthInt = pDepthIntTabShapes[ALFp->filter_shape];
    286255  maxScanVal = 0;
    287 #if ALF_SINGLE_FILTER_SHAPE
    288256  int minScanVal = MIN_SCAN_POS_CROSS;
    289 #else
    290   int minScanVal = ( ALFp->filter_shape==ALF_STAR5x5 ) ? 0 : MIN_SCAN_POS_CROSS;
    291 #endif
    292257
    293258  for(i = 0; i < sqrFiltLength; i++)
     
    355320  // Coding parameters
    356321  ALFp->minKStart = minKStart;
    357 #if !LCU_SYNTAX_ALF 
    358   ALFp->maxScanVal = maxScanVal;
    359 #endif
    360322  for(scanPos = minScanVal; scanPos < maxScanVal; scanPos++)
    361323  {
     
    363325  }
    364326
    365 #if LCU_SYNTAX_ALF
    366327  if (ALFp->filters_per_group == 1)
    367328  {
     
    370331  else
    371332  {
    372 #endif
    373333  len += writeFilterCodingParams(minKStart, minScanVal, maxScanVal, kMinTab);
    374334
    375335  // Filter coefficients
    376336  len += writeFilterCoeffs(sqrFiltLength, filters_per_group, pDepthInt, ALFp->coeffmulti, kMinTab);
    377 #if LCU_SYNTAX_ALF
    378   }
    379 #endif
     337  }
    380338 
    381339  return len;
     
    415373    {
    416374      scanPos = pDepthInt[i] - 1;
    417 #if LCU_SYNTAX_ALF
    418375      Int k = (filters_per_group == 1) ? kMinTab[i] : kMinTab[scanPos];
    419376      golombEncode(FilterCoeff[ind][i], k);
    420 #else
    421       golombEncode(FilterCoeff[ind][i], kMinTab[scanPos]);
    422 #endif
    423377    }
    424378  }
     
    526480#endif
    527481
    528 #if LCU_SYNTAX_ALF
    529482/** parse the fixed length code (smaller than one max value) in ALF
    530483 * \param run: coded value
     
    793746
    794747}
    795 #endif
    796748
    797749
    798750Void TEncEntropy::encodeAlfParam(ALFParam* pAlfParam)
    799751{
    800 #if LCU_SYNTAX_ALF
    801752  const Int numCoeff = (Int)ALF_MAX_NUM_COEF;
    802753
     
    826777    }
    827778  }
    828 #else
    829   if (!pAlfParam->alf_flag)
    830   {
    831     return;
    832   }
    833   Int pos;
    834   codeAux(pAlfParam);
    835   codeFilt(pAlfParam);
    836  
    837   // filter parameters for chroma
    838   m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->chroma_idc);
    839   if(pAlfParam->chroma_idc)
    840   {
    841 #if !ALF_SINGLE_FILTER_SHAPE
    842     m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->filter_shape_chroma);
    843 #endif
    844     // filter coefficients for chroma
    845     for(pos=0; pos<pAlfParam->num_coeff_chroma; pos++)
    846     {
    847       m_pcEntropyCoderIf->codeAlfSvlc(pAlfParam->coeff_chroma[pos]);
    848     }
    849   }
    850 #endif
    851779}
    852780
     
    907835    uiAbsPartIdx = 0;
    908836  }
    909 #if BURST_IPCM
    910837  if( !bRD )
    911838  {
     
    915842    }
    916843  }
    917 #endif
    918844
    919845#if !RWTH_SDC_DLT_B0036
     
    943869    uiAbsPartIdx = 0;
    944870  }
    945 #if BURST_IPCM
    946871  if( !bRD )
    947872  {
     
    951876    }
    952877  }
    953 #endif
    954878
    955879  m_pcEntropyCoderIf->codeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    969893    uiAbsPartIdx = 0;
    970894  }
    971 #if BURST_IPCM
    972895  if( !bRD )
    973896  {
     
    977900    }
    978901  }
    979 #endif 
    980902#if RWTH_SDC_DLT_B0036
    981903  if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx)  )
     
    1031953  }
    1032954 
    1033 #if BURST_IPCM
    1034955  Int numIPCM = 0;
    1035956  Bool firstIPCMFlag = false;
     
    1047968  }
    1048969  m_pcEntropyCoderIf->codeIPCMInfo ( pcCU, uiAbsPartIdx, numIPCM, firstIPCMFlag);
    1049 #else
    1050   m_pcEntropyCoderIf->codeIPCMInfo ( pcCU, uiAbsPartIdx );
    1051 #endif
    1052 
    1053 }
    1054 
    1055 #if UNIFIED_TRANSFORM_TREE
     970
     971}
     972
    1056973Void TEncEntropy::xEncodeTransform( TComDataCU* pcCU,UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP )
    1057 #else
    1058 Void TEncEntropy::xEncodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )
    1059 #endif
    1060974{
    1061975  const UInt uiSubdiv = pcCU->getTransformIdx( uiAbsPartIdx ) + pcCU->getDepth( uiAbsPartIdx ) > uiDepth;
    1062976  const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth;
    1063 #if UNIFIED_TRANSFORM_TREE
    1064977  UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA    , uiTrIdx );
    1065978  UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
     
    1084997    }
    1085998  }
    1086 #endif // UNIFIED_TRANSFORM_TREE
    1087999  {//CABAC
    10881000    if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) )
     
    11641076    if( uiSubdiv )
    11651077    {
    1166 #if UNIFIED_TRANSFORM_TREE
    11671078      UInt size;
    11681079      width  >>= 1;
     
    11701081      size = width*height;
    11711082      uiTrIdx++;
    1172 #endif // UNIFIED_TRANSFORM_TREE
    11731083      ++uiDepth;
    1174 #if UNIFIED_TRANSFORM_TREE
    11751084      const UInt partNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    1176 #else
    1177       const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    1178 #endif
    11791085     
    11801086      UInt uiCurrentCbfY = 0;
     
    11821088      UInt uiCurrentCbfV = 0;
    11831089     
    1184 #if UNIFIED_TRANSFORM_TREE
    11851090      UInt nsAddr = 0;
    11861091      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 0, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
     
    11981103      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 3, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    11991104      xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, 3, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP );     
    1200 #else // UNIFIED_TRANSFORM_TREE
    1201       UInt nsAddr = 0;
    1202       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 0, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1203       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 0, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1204 
    1205       uiAbsPartIdx += uiQPartNum;
    1206       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 1, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1207       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 1, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1208 
    1209       uiAbsPartIdx += uiQPartNum;
    1210       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 2, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1211       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 2, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1212 
    1213       uiAbsPartIdx += uiQPartNum;
    1214       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 3, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );
    1215       xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 3, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
    1216 #endif // UNIFIED_TRANSFORM_TREE
    12171105     
    12181106      uiYCbfFront3 += uiCurrentCbfY;
     
    12581146      }
    12591147     
    1260 #if UNIFIED_TRANSFORM_TREE
    12611148      if ( cbfY || cbfU || cbfV )
    12621149      {
     
    13101197        }
    13111198      }
    1312 #endif // UNIFIED_TRANSFORM_TREE
    1313     }
    1314   }
    1315 }
    1316 
    1317 #if !UNIFIED_TRANSFORM_TREE
    1318 // transform index
    1319 Void TEncEntropy::encodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD )
    1320 {
    1321   assert( !bRD ); // parameter bRD can be removed
    1322   if( bRD )
    1323   {
    1324     uiAbsPartIdx = 0;
    1325   }
    1326  
    1327   DTRACE_CABAC_VL( g_nSymbolCounter++ )
    1328   DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
    1329   DTRACE_CABAC_V( uiDepth )
    1330   DTRACE_CABAC_T( "\n" )
    1331   UInt temp = 0;
    1332   UInt temp1 = 0;
    1333   UInt temp2 = 0;
    1334   xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
    1335 }
    1336 #endif // !UNIFIED_TRANSFORM_TREE
     1199    }
     1200  }
     1201}
     1202
    13371203
    13381204// Intra direction for Luma
     
    15501416
    15511417// texture
    1552 #if !UNIFIED_TRANSFORM_TREE
    1553 Void TEncEntropy::xEncodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP )
    1554 {
    1555   UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2;
    1556   UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx );
    1557   UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    1558   UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    1559 
    1560   if( uiLog2TrSize == 2 )
    1561   {
    1562     UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    1563     if( ( uiAbsPartIdx % uiQPDiv ) == 0 )
    1564     {
    1565       m_uiBakAbsPartIdx   = uiAbsPartIdx;
    1566       m_uiBakChromaOffset = uiChromaOffset;
    1567     }
    1568     else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    1569     {
    1570       uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
    1571       uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
    1572     }
    1573   }
    1574 
    1575   if ( uiCbfY || uiCbfU || uiCbfV )
    1576   {
    1577     // dQP: only for LCU once
    1578     if ( pcCU->getSlice()->getPPS()->getUseDQP() )
    1579     {
    1580       if ( bCodeDQP )
    1581       {
    1582         encodeQP( pcCU, uiAbsPartIdx );
    1583         bCodeDQP = false;
    1584       }
    1585     }
    1586     UInt uiLumaTrMode, uiChromaTrMode;
    1587     pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );
    1588     const UInt uiStopTrMode = uiLumaTrMode;
    1589    
    1590     assert(1); // as long as quadtrees are not used for residual transform
    1591    
    1592     if( uiTrIdx == uiStopTrMode )
    1593     {
    1594       if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) )
    1595       {
    1596         Int trWidth = uiWidth;
    1597         Int trHeight = uiHeight;
    1598         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    1599         m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
    1600       }
    1601 
    1602       uiWidth  >>= 1;
    1603       uiHeight >>= 1;
    1604 
    1605       if( uiLog2TrSize == 2 )
    1606       {
    1607         UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
    1608         if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
    1609         {
    1610           uiWidth  <<= 1;
    1611           uiHeight <<= 1;
    1612           Int trWidth = uiWidth;
    1613           Int trHeight = uiHeight;
    1614           pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight );
    1615           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    1616           {
    1617             m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    1618           }
    1619           if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    1620           {
    1621             m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    1622           }
    1623         }
    1624       }
    1625       else
    1626       {
    1627         Int trWidth = uiWidth;
    1628         Int trHeight = uiHeight;
    1629         pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
    1630         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
    1631         {
    1632           m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
    1633         }
    1634         if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
    1635         {
    1636           m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
    1637         }
    1638       }
    1639     }
    1640     else
    1641     {
    1642       {
    1643         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    1644         DTRACE_CABAC_T( "\tgoing down\tdepth=" );
    1645         DTRACE_CABAC_V( uiDepth );
    1646         DTRACE_CABAC_T( "\ttridx=" );
    1647         DTRACE_CABAC_V( uiTrIdx );
    1648         DTRACE_CABAC_T( "\n" );
    1649       }
    1650       if( uiCurrTrIdx <= uiTrIdx )
    1651         assert(1);
    1652      
    1653       UInt uiSize;
    1654       uiWidth  >>= 1;
    1655       uiHeight >>= 1;
    1656       uiSize = uiWidth*uiHeight;
    1657       uiDepth++;
    1658       uiTrIdx++;
    1659      
    1660       UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    1661       UInt uiIdx      = uiAbsPartIdx;
    1662      
    1663       {
    1664         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1665         uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    1666 
    1667         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1668         uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    1669 
    1670         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1671         uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
    1672 
    1673         xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
    1674       }
    1675       {
    1676         DTRACE_CABAC_VL( g_nSymbolCounter++ );
    1677         DTRACE_CABAC_T( "\tgoing up\n" );
    1678       }
    1679     }
    1680   }
    1681 }
    1682 #endif // !UNIFIED_TRANSFORM_TREE
    16831418
    16841419/** encode coefficients
     
    17181453    DTRACE_CABAC_V( uiDepth )
    17191454    DTRACE_CABAC_T( "\n" )
    1720 #if !UNIFIED_TRANSFORM_TREE
    1721     UInt temp = 0;
    1722     UInt temp1 = 0;
    1723     UInt temp2 = 0;
    1724     xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
    1725 #endif // !UNIFIED_TRANSFORM_TREE
    17261455  }
    17271456  else
     
    17471476      }
    17481477    }
    1749 #if !UNIFIED_TRANSFORM_TREE
    1750     encodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
    1751 #endif
    17521478  }
    17531479 
     
    17681494#endif
    17691495
    1770 #if UNIFIED_TRANSFORM_TREE
    17711496  UInt temp = 0;
    17721497  UInt temp1 = 0;
    17731498  UInt temp2 = 0;
    17741499  xEncodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP );
    1775 #else // UNIFIED_TRANSFORM_TREE
    1776   xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );
    1777 #endif // UNIFIED_TRANSFORM_TREE
    17781500
    17791501#if FIX_MPI_B0065
     
    17971519}
    17981520
    1799 #if SAO_UNIT_INTERLEAVING
    18001521/** Encode SAO Offset
    18011522 * \param  saoLcuParam SAO LCU paramters
     
    19851706  }
    19861707}
    1987 #else
    1988 /** Encode SAO for one partition
    1989  * \param  pSaoParam, iPartIdx
    1990  */
    1991 Void TEncEntropy::encodeSaoOnePart(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
    1992 {
    1993   SAOQTPart*  pAlfPart = NULL;
    1994   pAlfPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
    1995 
    1996   UInt uiSymbol;
    1997 
    1998   if(!pAlfPart->bSplit)
    1999   {
    2000     if (pAlfPart->bEnableFlag)
    2001     {
    2002       uiSymbol = pAlfPart->iBestType + 1;
    2003     }
    2004     else
    2005     {
    2006       uiSymbol = 0;
    2007     }
    2008    
    2009     m_pcEntropyCoderIf->codeSaoUvlc(uiSymbol);
    2010 
    2011     if (pAlfPart->bEnableFlag)
    2012     {
    2013       for(Int i=0; i< pAlfPart->iLength; i++)
    2014       {
    2015         m_pcEntropyCoderIf->codeSaoSvlc(pAlfPart->iOffset[i]);
    2016       }   
    2017     }
    2018     return;
    2019   }
    2020 
    2021   //split
    2022   if (pAlfPart->PartLevel < pSaoParam->iMaxSplitLevel)
    2023   {
    2024     for (Int i=0;i<NUM_DOWN_PART;i++)
    2025     {
    2026       encodeSaoOnePart(pSaoParam, pAlfPart->DownPartsIdx[i], iYCbCr);
    2027     }
    2028   }
    2029 }
    2030 
    2031 /** Encode quadtree split flag
    2032  * \param  pSaoParam, iPartIdx
    2033  */
    2034 Void TEncEntropy::encodeQuadTreeSplitFlag(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
    2035 {
    2036   SAOQTPart*  pSaoPart = NULL;
    2037   pSaoPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
    2038 
    2039   if(pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel)
    2040   {
    2041     //send one flag
    2042     m_pcEntropyCoderIf->codeSaoFlag( (pSaoPart->bSplit)?(1):(0)  );
    2043 
    2044     if(pSaoPart->bSplit)
    2045     {
    2046       for (Int i=0;i<NUM_DOWN_PART;i++)
    2047       {
    2048         encodeQuadTreeSplitFlag(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr);
    2049       }
    2050     }
    2051   }
    2052 }
    2053 /** Encode SAO parameters
    2054  * \param  pSaoParam
    2055  */
    2056 Void TEncEntropy::encodeSaoParam(SAOParam* pSaoParam)
    2057 {
    2058   if (pSaoParam->bSaoFlag[0])
    2059   {
    2060     encodeQuadTreeSplitFlag(pSaoParam, 0, 0);
    2061     encodeSaoOnePart(pSaoParam, 0, 0);
    2062     m_pcEntropyCoderIf->codeSaoFlag(pSaoParam->bSaoFlag[1]);
    2063     if (pSaoParam->bSaoFlag[1])
    2064     {
    2065       encodeQuadTreeSplitFlag(pSaoParam, 0, 1);
    2066       encodeSaoOnePart(pSaoParam, 0, 1);
    2067     }
    2068     m_pcEntropyCoderIf->codeSaoFlag(pSaoParam->bSaoFlag[2]);
    2069     if (pSaoParam->bSaoFlag[2])
    2070     {
    2071       encodeQuadTreeSplitFlag(pSaoParam, 0, 2);
    2072       encodeSaoOnePart(pSaoParam, 0, 2);
    2073     }
    2074   }
    2075 }
    2076 #endif
    20771708
    20781709Int TEncEntropy::countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize )
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncEntropy.h

    r292 r294  
    9090  virtual Void codeTileMarkerFlag      ( TComSlice* pcSlice )                                  = 0;
    9191
    92 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    9392  virtual Void  codeTilesWPPEntryPoint  ( TComSlice* pSlice )     = 0;
    94 #else
    95   virtual Void  codeSliceHeaderSubstreamTable( TComSlice* pcSlice )                             = 0;
    96 #endif
    9793  virtual Void  codeTerminatingBit      ( UInt uilsLast )                                       = 0;
    9894  virtual Void  codeSliceFinish         ()                                                      = 0;
    99 #if OL_FLUSH
    10095  virtual Void  codeFlush               ()                                                      = 0;
    10196  virtual Void  encodeStart             ()                                                      = 0;
    102 #endif
    10397 
    10498  virtual Void codeAlfCtrlDepth() = 0;
     
    134128#endif
    135129 
    136 #if BURST_IPCM
    137130  virtual Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Int numIPCM, Bool firstIPCMFlag) = 0;
    138 #else
    139   virtual Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    140 #endif
    141131
    142132  virtual Void codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx ) = 0;
     
    155145  virtual Void codeAlfUvlc          ( UInt uiCode ) = 0;
    156146  virtual Void codeAlfSvlc          ( Int   iCode ) = 0;
    157 #if LCU_SYNTAX_ALF
    158147  virtual Void codeAlfFixedLengthIdx( UInt idx, UInt numFilterSetsInBuffer) = 0;
    159148  virtual Void codeAPSAlflag(UInt uiCode) = 0;
    160 #endif
    161149  /// set slice granularity
    162150  virtual Void setSliceGranularity(Int iSliceGranularity) = 0;
     
    169157  virtual Void codeSaoUvlc          ( UInt uiCode ) = 0;
    170158  virtual Void codeSaoSvlc          ( Int   iCode ) = 0;
    171 #if SAO_UNIT_INTERLEAVING
    172159  virtual Void codeSaoRun          ( UInt   uiCode, UInt uiMaxValue  ) = 0;
    173160  virtual Void codeSaoMergeLeft    ( UInt   uiCode, UInt uiCompIdx  ) = 0;
     
    175162  virtual Void codeSaoTypeIdx      ( UInt   uiCode) = 0;
    176163  virtual Void codeSaoUflc         ( UInt   uiCode) = 0;
    177 #endif
    178164  virtual Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType) = 0;
    179165 
     
    198184  UInt    m_uiBakAbsPartIdx;
    199185  UInt    m_uiBakChromaOffset;
    200 #if UNIFIED_TRANSFORM_TREE
    201186  UInt    m_bakAbsPartIdxCU;
    202 #endif
    203187
    204188public:
     
    216200  Void    encodeSliceHeader         ( TComSlice* pcSlice );
    217201  Void    encodeTileMarkerFlag       (TComSlice* pcSlice) {m_pcEntropyCoderIf->codeTileMarkerFlag(pcSlice);}
    218 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    219202  Void    encodeTilesWPPEntryPoint( TComSlice* pSlice );
    220 #else
    221   Void    encodeSliceHeaderSubstreamTable( TComSlice* pcSlice );
    222 #endif
    223203  Void    encodeTerminatingBit      ( UInt uiIsLast );
    224204  Void    encodeSliceFinish         ();
    225 #if OL_FLUSH
    226205  Void    encodeFlush               ();
    227206  Void    encodeStart               ();
    228 #endif
    229 #if LCU_SYNTAX_ALF
    230207  Void encodeAlfFlag(UInt code) {m_pcEntropyCoderIf->codeAlfFlag(code);}
    231208  Void encodeAlfStoredFilterSetIdx(UInt idx, UInt numFilterSetsInBuffer);
     
    236213  Int  getAlfRun(Int compIdx, AlfParamSet* pAlfParamSet, Int lcuIdxInSlice, Int lcuPos, Int startlcuPosX, Int endlcuPosX);
    237214  Void encodeAPSAlfFlag(UInt code) {m_pcEntropyCoderIf->codeAPSAlflag(code);}
    238 #endif 
    239215  Void encodeAlfParam(ALFParam* pAlfParam);
    240216 
     
    297273  Void encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    298274 
    299 #if !UNIFIED_TRANSFORM_TREE
    300   Void encodeTransformIdx      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
    301 #endif
    302275  Void encodeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx );
    303276  Void encodeQtCbf             ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
     
    320293
    321294private:
    322 #if UNIFIED_TRANSFORM_TREE
    323295  Void xEncodeTransform        ( TComDataCU* pcCU,UInt offsetLumaOffset, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP );
    324 #else
    325   Void xEncodeTransformSubdiv  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 );
    326   Void xEncodeCoeff            ( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP );
    327 #endif // !UNIFIED_TRANSFORM_TREE
    328296public:
    329297  Void encodeCoeff             ( TComDataCU* pcCU,                 UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP );
     
    345313  Int golombEncode(int coeff, int k);
    346314  Int lengthGolomb(int coeffVal, int k);
    347 #if SAO_UNIT_INTERLEAVING
    348315  Void    encodeSaoUnit(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Int repeatedRow);
    349316  Void    encodeSaoOffset(SaoLcuParam* saoLcuParam);
    350317  Void    encodeSaoUnitInterleaving(Int rx, Int ry, SAOParam* saoParam, TComDataCU* cu, Int cuAddrInSlice, Int cuAddrUpInSlice, Bool lfCrossSliceBoundaryFlag);
    351318  Void    encodeSaoParam         (TComAPS*  aps);
    352 #else
    353   Void    encodeSaoOnePart       (SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr);
    354   Void    encodeQuadTreeSplitFlag(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr);
    355   Void    encodeSaoParam         (SAOParam* pSaoParam);
    356 #endif
    357319
    358320  static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize );
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncGOP.cpp

    r292 r294  
    159159  TComOutputBitstream  *pcBitstreamRedirect;
    160160  pcBitstreamRedirect = new TComOutputBitstream;
    161 #if !REMOVE_TILE_DEPENDENCE
    162   OutputNALUnit        *naluBuffered             = NULL;
    163   Bool                  bIteratorAtListStart     = false;
    164 #endif
    165161  AccessUnit::iterator  itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted
    166162  UInt                  uiOneBitstreamPerSliceLength = 0;
     
    283279          pcSlice->setDefaultScalingList ();
    284280        }
    285 #if SCALING_LIST
    286281        pcSlice->getScalingList()->checkDcOfMatrix();
    287 #endif
    288282        pcSlice->getScalingList()->setScalingListPresentFlag(pcSlice->checkDefaultScalingList());
    289283        m_pcEncTop->getTrQuant()->setScalingList(pcSlice->getScalingList());
     
    333327      pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS());
    334328
    335 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS
     329#if H0566_TLA_SET_FOR_SWITCHING_POINTS
    336330      if(pcSlice->getTLayer() > 0)
    337331      {
     
    354348      TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    355349      refPicListModification->setRefPicListModificationFlagL0( false );
    356 #if !H0137_0138_LIST_MODIFICATION
    357       refPicListModification->setNumberOfRefPicListModificationsL0(0);
    358 #endif
    359350      refPicListModification->setRefPicListModificationFlagL1( false );
    360 #if !H0137_0138_LIST_MODIFICATION
    361       refPicListModification->setNumberOfRefPicListModificationsL1(0);
    362 #endif
    363351      xSetRefPicListModificationsMvc( pcSlice, uiPOCCurr, iGOPid );
    364352
     
    525513      }
    526514
    527 #if H0111_MVD_L1_ZERO
    528515      Bool bGPBcheck=false;
    529516      if ( pcSlice->getSliceType() == B_SLICE)
     
    552539      }
    553540      pcPic->getSlice(pcSlice->getSliceIdx())->setMvdL1ZeroFlag(pcSlice->getMvdL1ZeroFlag());
    554 #endif
    555541
    556542      UInt uiNumSlices = 1;
     
    581567    UInt uiEncCUAddr;
    582568   
    583 #if !REMOVE_TILE_DEPENDENCE
    584     if(pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)
    585     {
    586       pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getTileBoundaryIndependenceIdr() );
    587     }
    588     else
    589     {
    590       pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getSPS()->getTileBoundaryIndependenceIdr() );
    591 
    592     }
    593 #endif
    594569
    595570    if( pcSlice->getPPS()->getColumnRowInfoPresent() == 1 )    //derive the tile parameters from PPS
     
    839814      Bool bLFCrossTileBoundary = (pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)?
    840815                                  (pcSlice->getPPS()->getLFCrossTileBoundaryFlag()):(pcSlice->getPPS()->getSPS()->getLFCrossTileBoundaryFlag());
    841 #if DBL_CONTROL
    842816      m_pcLoopFilter->setCfg(pcSlice->getPPS()->getDeblockingFilterControlPresent(), pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary);
    843 #else
    844       m_pcLoopFilter->setCfg(pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary);
    845 #endif
    846817      m_pcLoopFilter->loopFilterPic( pcPic );
    847818
     
    861832      }
    862833
    863 #if LCU_SYNTAX_ALF
    864834      AlfParamSet* alfSliceParams = NULL;
    865835      std::vector<AlfCUCtrlInfo>* alfCUCtrlParam = NULL;
    866 #else
    867       std::vector<AlfCUCtrlInfo> vAlfCUCtrlParam;
    868 #endif
    869836      pcSlice = pcPic->getSlice(0);
    870837
    871838      if(pcSlice->getSPS()->getUseALF())
    872839      {
    873 #if LCU_SYNTAX_ALF
    874840        m_pcAdaptiveLoopFilter->createPicAlfInfo(pcPic, uiNumSlices, pcSlice->getSliceQp());
    875841        m_pcAdaptiveLoopFilter->initALFEnc(m_pcCfg->getALFParamInSlice(), m_pcCfg->getALFPicBasedEncode(), uiNumSlices, alfSliceParams, alfCUCtrlParam);
    876 #else
    877         vAlfCUCtrlParam.resize(uiNumSlices);
    878         m_pcAdaptiveLoopFilter->createPicAlfInfo(pcPic, uiNumSlices);
    879 #endif
    880842      }
    881843
     
    900862        }
    901863#endif
    902 #if NAL_REF_FLAG
    903864#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    904865        OutputNALUnit nalu(NAL_UNIT_SPS, true, m_pcEncTop->getLayerId());
     
    906867        OutputNALUnit nalu(NAL_UNIT_SPS, true, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    907868#endif
    908 #else
    909         OutputNALUnit nalu(NAL_UNIT_SPS, NAL_REF_IDC_PRIORITY_HIGHEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    910 #endif
    911869        m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    912 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    913870        pcSlice->getSPS()->setNumSubstreams( pcSlice->getPPS()->getNumSubstreams() );
    914 #endif
    915871#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
    916872        m_pcEntropyCoder->encodeSPS(pcSlice->getSPS(), m_pcEncTop->getIsDepth());
     
    921877        accessUnit.push_back(new NALUnitEBSP(nalu));
    922878
    923 #if NAL_REF_FLAG
    924879#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    925880#if QC_MVHEVC_B0046
     
    930885#else
    931886        nalu = NALUnit(NAL_UNIT_PPS, true, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    932 #endif
    933 #else
    934         nalu = NALUnit(NAL_UNIT_PPS, NAL_REF_IDC_PRIORITY_HIGHEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    935887#endif
    936888        m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    10571009        m_pcEntropyCoder->resetEntropy      ();
    10581010        /* start slice NALunit */
    1059 #if H0388
    1060 #if NAL_REF_FLAG
    10611011        OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced(),
    10621012#if !VIDYO_VPS_INTEGRATION &!QC_MVHEVC_B0046
     
    10641014#else
    10651015                           m_pcEncTop->getLayerId(), pcSlice->getTLayer() );
    1066 #endif
    1067 #else
    1068         OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST,
    1069 #if !VIDYO_VPS_INTEGRATION
    1070                            m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer() );
    1071 #else
    1072                            m_pcEncTop->getLayerId(), pcSlice->getTLayer() );
    1073 #endif
    1074 #endif
    1075 #else
    1076         OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST,
    1077 #if !VIDYO_VPS_INTEGRATION
    1078                            m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer(), true );
    1079 #else
    1080                            m_pcEncTop->getLayerId(), pcSlice->getTLayer(), true );
    1081 #endif
    1082 
    10831016#endif
    10841017           
     
    11031036          if (pcSlice->getSPS()->getUseALF())
    11041037          {
    1105 #if LCU_SYNTAX_ALF
    11061038            if(pcSlice->getAlfEnabledFlag())
    1107 #else
    1108             if(pcSlice->getAPS()->getAlfEnabled())
    1109 #endif
    11101039            {
    11111040
    1112 #if LCU_SYNTAX_ALF
    11131041              if( pcSlice->getSPS()->getUseALFCoefInSlice())
    11141042              {
     
    11221050              {
    11231051                AlfCUCtrlInfo& cAlfCUCtrlParam = (*alfCUCtrlParam)[pcSlice->getSliceIdx()];
    1124 #else
    1125               AlfCUCtrlInfo& cAlfCUCtrlParam = vAlfCUCtrlParam[pcSlice->getSliceIdx()];
    1126 #endif
    11271052              if(cAlfCUCtrlParam.cu_control_flag)
    11281053              {
     
    11381063              m_pcEntropyCoder->encodeAlfCtrlParam(cAlfCUCtrlParam, m_pcAdaptiveLoopFilter->getNumCUsInPic());
    11391064           
    1140 #if LCU_SYNTAX_ALF
    11411065              }
    1142 #endif           
    11431066            }
    11441067          }
     
    12141137          UInt uiTotalCodedSize = 0; // for padding calcs.
    12151138          UInt uiNumSubstreamsPerTile = iNumSubstreams;
    1216 #if !REMOVE_TILE_DEPENDENCE
    1217 #if WPP_SIMPLIFICATION
    1218          if (pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && iNumSubstreams > 1)
    1219 #else
    1220           if (pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && pcSlice->getPPS()->getEntropyCodingSynchro())
    1221 #endif
     1139          if (iNumSubstreams > 1)
     1140          {
    12221141            uiNumSubstreamsPerTile /= pcPic->getPicSym()->getNumTiles();
    1223 #else
    1224 #if WPP_SIMPLIFICATION
    1225           if (iNumSubstreams > 1)
    1226 #else
    1227           if (pcSlice->getPPS()->getEntropyCodingSynchro())
    1228 #endif
    1229           {
    1230             uiNumSubstreamsPerTile /= pcPic->getPicSym()->getNumTiles();
    1231           }
    1232 #endif
     1142          }
    12331143          for ( UInt ui = 0 ; ui < iNumSubstreams; ui++ )
    12341144          {
     
    12401150            m_pcEntropyCoder->encodeSliceFinish();
    12411151            pcSubstreamsOut[ui].write( 1, 1 ); // stop bit.
    1242 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    12431152            pcSubstreamsOut[ui].writeAlignZero();
    1244 #endif
    12451153            // Byte alignment is necessary between tiles when tiles are independent.
    12461154            uiTotalCodedSize += pcSubstreamsOut[ui].getNumberOfWrittenBits();
     
    12691177          m_pcEntropyCoder->setEntropyCoder   ( m_pcCavlcCoder, pcSlice );
    12701178          m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    1271 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    12721179          if (m_pcCfg->getTileLocationInSliceHeaderFlag()==0)
    12731180          {
     
    12751182          }
    12761183          m_pcEntropyCoder->encodeTilesWPPEntryPoint( pcSlice );
    1277 #else
    1278           m_pcEntropyCoder->encodeSliceHeaderSubstreamTable(pcSlice);
    1279 #endif
    12801184          // Substreams...
    12811185          TComOutputBitstream *pcOut = pcBitstreamRedirect;
     
    13091213        uiBoundingAddrEntropySlice = m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx];         
    13101214        uiNextCUAddr               = min(uiBoundingAddrSlice, uiBoundingAddrEntropySlice);
    1311 #if !REMOVE_TILE_DEPENDENCE
    1312         Bool bNextCUInNewSlice     = (uiNextCUAddr >= uiRealEndAddress) || (uiNextCUAddr == m_uiStoredStartCUAddrForEncodingSlice[uiStartCUAddrSliceIdx]);
    1313 #endif
    13141215        // If current NALU is the first NALU of slice (containing slice header) and more NALUs exist (due to multiple entropy slices) then buffer it.
    13151216        // If current NALU is the last NALU of slice and a NALU was buffered, then (a) Write current NALU (b) Update an write buffered NALU at approproate location in NALU list.
    13161217        Bool bNALUAlignedWrittenToList    = false; // used to ensure current NALU is not written more than once to the NALU list.
    1317 #if !REMOVE_TILE_DEPENDENCE
    1318         if (pcSlice->getSPS()->getTileBoundaryIndependenceIdr() && !pcSlice->getSPS()->getTileBoundaryIndependenceIdr())
    1319         {
    1320           if (bNextCUInNewSlice)
    1321           {
    1322             if (!bEntropySlice) // there were no entropy slices
    1323             {
    1324               xWriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);
    1325             }
    1326             // (a) writing current NALU
    1327             writeRBSPTrailingBits(nalu.m_Bitstream);
    1328             accessUnit.push_back(new NALUnitEBSP(nalu));
    1329             bNALUAlignedWrittenToList = true;
    1330 
    1331             // (b) update and write buffered NALU
    1332             if (bEntropySlice) // if entropy slices existed in the slice then perform concatenation for the buffered nalu-bitstream and buffered payload bitstream
    1333             {
    1334               // Perform bitstream concatenation of slice header and partial slice payload
    1335               xWriteTileLocationToSliceHeader((*naluBuffered), pcBitstreamRedirect, pcSlice);
    1336               if (bIteratorAtListStart)
    1337               {
    1338                 itLocationToPushSliceHeaderNALU = accessUnit.begin();
    1339               }
    1340               else
    1341               {
    1342                 itLocationToPushSliceHeaderNALU++;
    1343               }
    1344               accessUnit.insert(itLocationToPushSliceHeaderNALU, (new NALUnitEBSP((*naluBuffered))) );
    1345 
    1346               // free buffered nalu
    1347               delete naluBuffered;
    1348               naluBuffered     = NULL;
    1349             }
    1350           }
    1351           else // another entropy slice exists
    1352           {
    1353             // Is this start-of-slice NALU? i.e. the one containing slice header. If Yes, then buffer it.
    1354             if (!bEntropySlice)
    1355             {
    1356               // store a pointer to where NALU for slice header is to be written in NALU list
    1357               itLocationToPushSliceHeaderNALU = accessUnit.end();
    1358               if (accessUnit.begin() == accessUnit.end())
    1359               {
    1360                 bIteratorAtListStart = true;
    1361               }
    1362               else
    1363               {
    1364                 bIteratorAtListStart = false;
    1365                 itLocationToPushSliceHeaderNALU--;
    1366               }
    1367 
    1368               // buffer nalu for later writing
    1369 #if H0388
    1370               naluBuffered = new OutputNALUnit( pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer() );
    1371 #else
    1372               naluBuffered = new OutputNALUnit(pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer(), true);
    1373 #endif
    1374               copyNaluData( (*naluBuffered), nalu );
    1375 
    1376               // perform byte-alignment to get appropriate bitstream length (used for explicit tile location signaling in slice header)
    1377               writeRBSPTrailingBits((*pcBitstreamRedirect));
    1378               bNALUAlignedWrittenToList = true; // This is not really a write to bitsream but buffered for later. The flag is set to prevent writing of current NALU to list.
    1379               uiOneBitstreamPerSliceLength += pcBitstreamRedirect->getNumberOfWrittenBits(); // length of bitstream after byte-alignment
    1380             }
    1381             else // write out entropy slice
    1382             {
    1383               writeRBSPTrailingBits(nalu.m_Bitstream);
    1384               accessUnit.push_back(new NALUnitEBSP(nalu));
    1385               bNALUAlignedWrittenToList = true;
    1386               uiOneBitstreamPerSliceLength += nalu.m_Bitstream.getNumberOfWrittenBits(); // length of bitstream after byte-alignment
    1387             }
    1388           }
    1389         }
    1390         else
    1391         {
    1392 #endif
    13931218        xWriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);
    13941219        writeRBSPTrailingBits(nalu.m_Bitstream);
     
    13961221        bNALUAlignedWrittenToList = true;
    13971222        uiOneBitstreamPerSliceLength += nalu.m_Bitstream.getNumberOfWrittenBits(); // length of bitstream after byte-alignment
    1398 #if !REMOVE_TILE_DEPENDENCE
    1399         }
    1400 #endif
    14011223
    14021224        if (!bNALUAlignedWrittenToList)
     
    14171239            TComAPS cAPS;
    14181240            allocAPS(&cAPS, pcSlice->getSPS());
    1419 #if SAO_UNIT_INTERLEAVING
    14201241            cAPS.setSaoInterleavingFlag(m_pcCfg->getSaoInterleavingFlag());
    1421 #endif
    14221242            // set entropy coder for RD
    14231243            m_pcEntropyCoder->setEntropyCoder ( m_pcCavlcCoder, pcSlice );
     
    14451265
    14461266            // adaptive loop filter
    1447 #if !LCU_SYNTAX_ALF
    1448             UInt64 uiDist, uiBits;
    1449 #endif
    14501267            if ( pcSlice->getSPS()->getUseALF())
    14511268            {
     
    14531270              m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
    14541271              m_pcAdaptiveLoopFilter->startALFEnc(pcPic, m_pcEntropyCoder );
    1455 #if LCU_SYNTAX_ALF
    14561272              AlfParamSet* pAlfEncParam = (pcSlice->getSPS()->getUseALFCoefInSlice())?( alfSliceParams ):( cAPS.getAlfParam());
    14571273#if ALF_CHROMA_LAMBDA
     
    14771293#endif
    14781294
    1479 #else
    1480               ALFParam& cAlfParam = *( cAPS.getAlfParam());
    1481 
    1482 #if ALF_CHROMA_LAMBDA
    1483 #if HHI_INTERVIEW_SKIP
    1484               m_pcAdaptiveLoopFilter->ALFProcess( &cAlfParam, &vAlfCUCtrlParam, pcPic->getSlice(0)->getLambdaLuma(), pcPic->getSlice(0)->getLambdaChroma(), uiDist, uiBits, m_pcEncTop->getInterViewSkip());
    1485 #else
    1486               m_pcAdaptiveLoopFilter->ALFProcess( &cAlfParam, &vAlfCUCtrlParam, pcPic->getSlice(0)->getLambdaLuma(), pcPic->getSlice(0)->getLambdaChroma(), uiDist, uiBits);
    1487 #endif
    1488 #else
    1489 #if SAO_CHROMA_LAMBDA
    1490 #if HHI_INTERVIEW_SKIP
    1491               m_pcAdaptiveLoopFilter->ALFProcess( &cAlfParam, &vAlfCUCtrlParam, pcPic->getSlice(0)->getLambdaLuma(), uiDist, uiBits, m_pcEncTop->getInterViewSkip());
    1492 #else
    1493               m_pcAdaptiveLoopFilter->ALFProcess( &cAlfParam, &vAlfCUCtrlParam, pcPic->getSlice(0)->getLambdaLuma(), uiDist, uiBits);
    1494 #endif
    1495 #else
    1496 #if HHI_INTERVIEW_SKIP
    1497               m_pcAdaptiveLoopFilter->ALFProcess( &cAlfParam, &vAlfCUCtrlParam, pcPic->getSlice(0)->getLambdaLuma(), uiDist, uiBits, m_pcEncTop->getInterViewSkip());
    1498 #else
    1499               m_pcAdaptiveLoopFilter->ALFProcess( &cAlfParam, &vAlfCUCtrlParam, pcPic->getSlice(0)->getLambda(), uiDist, uiBits);
    1500 #endif
    1501 #endif
    1502 #endif
    1503 #endif
    15041295              m_pcAdaptiveLoopFilter->endALFEnc();
    15051296
     
    15181309              if (pcSlice->getSPS()->getUseALF())
    15191310              {
    1520 #if LCU_SYNTAX_ALF
    15211311                pcPic->getSlice(s)->setAlfEnabledFlag(  (pcSlice->getSPS()->getUseALFCoefInSlice())?(alfSliceParams[s].isEnabled[ALF_Y]):(cAPS.getAlfEnabled())   );
    1522 #else
    1523                 pcPic->getSlice(s)->setAlfEnabledFlag((cAPS.getAlfParam()->alf_flag==1)?true:false);
    1524 #endif
    15251312              }
    15261313              if (pcSlice->getSPS()->getUseSAO())
     
    15351322        case ENCODE_APS:
    15361323          {
    1537 #if NAL_REF_FLAG
    15381324#if VIDYO_VPS_INTEGRATION | QC_MVHEVC_B0046
    15391325            OutputNALUnit nalu(NAL_UNIT_APS, true, m_pcEncTop->getLayerId());
    15401326#else
    15411327            OutputNALUnit nalu(NAL_UNIT_APS, true, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    1542 #endif
    1543 #else
    1544             OutputNALUnit nalu(NAL_UNIT_APS, NAL_REF_IDC_PRIORITY_HIGHEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    15451328#endif
    15461329            encodeAPS(&(vAPS[iCodedAPSIdx]), nalu.m_Bitstream, pcSliceForAPS);
     
    15691352        if(pcSlice->getSPS()->getUseALF())
    15701353        {
    1571 #if LCU_SYNTAX_ALF
    15721354          m_pcAdaptiveLoopFilter->uninitALFEnc(alfSliceParams, alfCUCtrlParam);
    1573 #endif
    15741355          m_pcAdaptiveLoopFilter->destroyPicAlfInfo();
    15751356        }
     
    16011382        digestStr = digestToString(sei_recon_picture_digest.digest);
    16021383
    1603 #if NAL_REF_FLAG
    16041384#if VIDYO_VPS_INTEGRATION | QC_MVHEVC_B0046
    16051385        OutputNALUnit nalu(NAL_UNIT_SEI, false, m_pcEncTop->getLayerId());
    16061386#else
    16071387        OutputNALUnit nalu(NAL_UNIT_SEI, false, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    1608 #endif
    1609 #else
    1610         OutputNALUnit nalu(NAL_UNIT_SEI, NAL_REF_IDC_PRIORITY_LOWEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth());
    16111388#endif
    16121389
     
    16631440  {
    16641441    pAPS->createAlfParam();
    1665 #if LCU_SYNTAX_ALF
    16661442    //alf Enabled flag in APS is false after pAPS->createAlfParam();
    16671443    if(!pSPS->getUseALFCoefInSlice())
     
    16701446      pAPS->getAlfParam()->createALFParam();
    16711447    }
    1672 #else
    1673     m_pcAdaptiveLoopFilter->allocALFParam(pAPS->getAlfParam());
    1674 #endif
    16751448  }
    16761449}
     
    16951468    if(pAPS->getAlfParam() != NULL)
    16961469    {
    1697 #if LCU_SYNTAX_ALF
    16981470      if(!pSPS->getUseALFCoefInSlice())
    16991471      {
    17001472        pAPS->getAlfParam()->releaseALFParam();
    17011473      }
    1702 #else
    1703       m_pcAdaptiveLoopFilter->freeALFParam(pAPS->getAlfParam());
    1704 #endif
    17051474      pAPS->destroyAlfParam();
    17061475    }
     
    17281497
    17291498  cAPS.setSaoEnabled(pcSlice->getSPS()->getUseSAO() ? (cAPS.getSaoParam()->bSaoFlag[0] ):(false));
    1730 #if LCU_SYNTAX_ALF
    17311499  cAPS.setAlfEnabled(pcSlice->getSPS()->getUseALF() ? (cAPS.getAlfParam()->isEnabled[0]):(false));
    1732 #else
    1733   cAPS.setAlfEnabled(pcSlice->getSPS()->getUseALF() ? (cAPS.getAlfParam()->alf_flag ==1):(false));
    1734 #endif
    17351500  cAPS.setLoopFilterOffsetInAPS(m_pcCfg->getLoopFilterOffsetInAPS());
    17361501  cAPS.setLoopFilterDisable(m_pcCfg->getLoopFilterDisable());
     
    17711536    m_pcEntropyCoder->encodeDFParams(pcAPS);
    17721537  }
    1773 #if SAO_UNIT_INTERLEAVING
    17741538  m_pcEntropyCoder->encodeSaoParam(pcAPS);
    1775 #else
    1776   if(pcAPS->getSaoEnabled())
    1777   {
    1778     m_pcEntropyCoder->encodeSaoParam(pcAPS->getSaoParam());
    1779   }
    1780 #endif
    1781 #if LCU_SYNTAX_ALF
    17821539  m_pcEntropyCoder->encodeAPSAlfFlag( pcAPS->getAlfEnabled()?1:0);
    1783 #endif
    17841540  if(pcAPS->getAlfEnabled())
    17851541  {
     
    17961552  TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
    17971553  Bool bCalcDist = false;
    1798 #if DBL_CONTROL
    17991554  m_pcLoopFilter->setCfg(pcSlice->getPPS()->getDeblockingFilterControlPresent(), pcSlice->getLoopFilterDisable(), m_pcCfg->getLoopFilterBetaOffset(), m_pcCfg->getLoopFilterTcOffset(), m_pcCfg->getLFCrossTileBoundaryFlag());
    1800 #else
    1801   m_pcLoopFilter->setCfg(pcSlice->getLoopFilterDisable(), m_pcCfg->getLoopFilterBetaOffset(), m_pcCfg->getLoopFilterTcOffset(), m_pcCfg->getLFCrossTileBoundaryFlag());
    1802 #endif
    18031555  m_pcLoopFilter->loopFilterPic( pcPic );
    18041556 
     
    18171569    m_pcAdaptiveLoopFilter->createPicAlfInfo(pcPic);
    18181570
    1819 #if LCU_SYNTAX_ALF
    18201571    AlfParamSet* alfParamSet;
    18211572    std::vector<AlfCUCtrlInfo>* alfCUCtrlParam = NULL;
     
    18241575    alfParamSet->createALFParam();
    18251576    m_pcAdaptiveLoopFilter->initALFEnc(false, true, 1, alfParamSet, alfCUCtrlParam);
    1826 #else
    1827     ALFParam cAlfParam;
    1828     m_pcAdaptiveLoopFilter->allocALFParam(&cAlfParam);
    1829 #endif   
    18301577    m_pcAdaptiveLoopFilter->startALFEnc(pcPic, m_pcEntropyCoder);
    18311578   
    18321579
    1833 #if LCU_SYNTAX_ALF
    18341580
    18351581#if ALF_CHROMA_LAMBDA
     
    18551601#endif
    18561602
    1857 #else
    1858 #if ALF_CHROMA_LAMBDA 
    1859     m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, NULL, pcSlice->getLambdaLuma(), pcSlice->getLambdaChroma(), ruiDist, ruiBits, m_pcEncTop->getInterViewSkip());
    1860 #if HHI_INTERVIEW_SKIP
    1861 #else
    1862     m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, NULL, pcSlice->getLambdaLuma(), pcSlice->getLambdaChroma(), ruiDist, ruiBits);
    1863 #endif
    1864 #else
    1865 #if SAO_CHROMA_LAMBDA
    1866 #if HHI_INTERVIEW_SKIP
    1867     m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, NULL, pcSlice->getLambdaLuma(), ruiDist, ruiBits, m_pcEncTop->getInterViewSkip());
    1868 #else
    1869     m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, NULL, pcSlice->getLambdaLuma(), ruiDist, ruiBits);
    1870 #endif
    1871 #else
    1872 #if HHI_INTERVIEW_SKIP
    1873     m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, NULL, pcSlice->getLambda(), ruiDist, ruiBits, m_pcEncTop->getInterViewSkip());
    1874 #else
    1875     m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, NULL, pcSlice->getLambda(), ruiDist, ruiBits);
    1876 #endif
    1877 #endif
    1878 
    1879 #endif
    1880 #endif
    18811603    m_pcAdaptiveLoopFilter->endALFEnc();
    18821604
    1883 #if LCU_SYNTAX_ALF
    18841605    alfParamSet->releaseALFParam();
    18851606    delete alfParamSet;
    18861607    delete alfCUCtrlParam;
    1887 #else
    1888     m_pcAdaptiveLoopFilter->freeALFParam(&cAlfParam);
    1889 #endif
    18901608    m_pcAdaptiveLoopFilter->PCMLFDisableProcess(pcPic);
    18911609    m_pcAdaptiveLoopFilter->destroyPicAlfInfo();
     
    20391757  {
    20401758  case NAL_UNIT_CODED_SLICE: return "SLICE";
    2041 #if H0566_TLA
    20421759#if !QC_REM_IDV_B0046
    20431760  case NAL_UNIT_CODED_SLICE_IDV: return "IDV";
     
    20451762  case NAL_UNIT_CODED_SLICE_CRA: return "CRA";
    20461763  case NAL_UNIT_CODED_SLICE_TLA: return "TLA";
    2047 #else
    2048   case NAL_UNIT_CODED_SLICE_CDR: return "CDR";
    2049 #endif
    20501764  case NAL_UNIT_CODED_SLICE_IDR: return "IDR";
    20511765  case NAL_UNIT_SEI: return "SEI";
     
    22821996      else
    22831997      {
    2284 #if H0566_TLA
    22851998      return NAL_UNIT_CODED_SLICE_CRA;
    2286 #else
    2287       return NAL_UNIT_CODED_SLICE_CDR;
    2288 #endif
    22891999      }
    22902000    }
     
    23182028    if( m_pcCfg->getDecodingRefreshType() == 1 )
    23192029    {
    2320 #if H0566_TLA
    23212030      return NAL_UNIT_CODED_SLICE_CRA;
    2322 #else
    2323       return NAL_UNIT_CODED_SLICE_CDR;
    2324 #endif
    23252031    }
    23262032    else if( m_pcCfg->getDecodingRefreshType() == 2 )
     
    23842090{
    23852091  {
    2386 #if !TILES_WPP_ENTRY_POINT_SIGNALLING
    2387     Int iTransmitTileLocationInSliceHeader = (rpcSlice->getTileLocationCount()==0 || m_pcCfg->getTileLocationInSliceHeaderFlag()==0) ? 0 : 1;
    2388     rNalu.m_Bitstream.write(iTransmitTileLocationInSliceHeader, 1);   // write flag indicating whether tile location information communicated in slice header
    2389 
    2390     if (iTransmitTileLocationInSliceHeader)
    2391     {
    2392       rNalu.m_Bitstream.write(rpcSlice->getTileLocationCount()-1, 5);   // write number of tiles
    2393 
    2394       Int *aiDiff;
    2395       aiDiff = new Int [rpcSlice->getTileLocationCount()];
    2396 
    2397       // Find largest number of bits required by Diff
    2398       Int iLastSize = 0, iDiffMax = 0, iDiffMin = 0;
    2399       for (UInt uiIdx=0; uiIdx<rpcSlice->getTileLocationCount(); uiIdx++)
    2400       {
    2401         Int iCurDiff, iCurSize;
    2402         if (uiIdx==0)
    2403         {
    2404           iCurDiff  = rpcSlice->getTileLocation( uiIdx );
    2405           iLastSize = rpcSlice->getTileLocation( uiIdx );
    2406         }
    2407         else
    2408         {
    2409           iCurSize  = rpcSlice->getTileLocation( uiIdx )  - rpcSlice->getTileLocation( uiIdx-1 );
    2410           iCurDiff  = iCurSize - iLastSize;
    2411           iLastSize = iCurSize;
    2412         }
    2413         // Store Diff so it may be written to slice header later without re-calculating.
    2414         aiDiff[uiIdx] = iCurDiff;
    2415 
    2416         if (iCurDiff>iDiffMax)
    2417         {
    2418           iDiffMax = iCurDiff;
    2419         }
    2420         if (iCurDiff<iDiffMin)
    2421         {
    2422           iDiffMin = iCurDiff;
    2423         }
    2424       }
    2425 
    2426       Int iDiffMinAbs, iDiffMaxAbs;
    2427       iDiffMinAbs = (iDiffMin<0) ? (-iDiffMin) : iDiffMin;
    2428       iDiffMaxAbs = (iDiffMax<0) ? (-iDiffMax) : iDiffMax;
    2429 
    2430       Int iBitsUsedByDiff = 0, iDiffAbsLargest;
    2431       iDiffAbsLargest = (iDiffMinAbs < iDiffMaxAbs) ? iDiffMaxAbs : iDiffMinAbs;       
    2432       while (1)
    2433       {
    2434         if (iDiffAbsLargest >= (1 << iBitsUsedByDiff) )
    2435         {
    2436           iBitsUsedByDiff++;
    2437         }
    2438         else
    2439         {
    2440           break;
    2441         }
    2442       }
    2443       iBitsUsedByDiff++;
    2444 
    2445       if (iBitsUsedByDiff > 32)
    2446       {
    2447         printf("\nDiff magnitude uses more than 32-bits");
    2448         assert ( 0 );
    2449         exit ( 0 ); // trying to catch any problems with using fixed bits for Diff information
    2450       }
    2451 
    2452       rNalu.m_Bitstream.write( iBitsUsedByDiff-1, 5 ); // write number of bits used by Diff
    2453 
    2454       // Write diff to slice header (rNalu)
    2455       for (UInt uiIdx=0; uiIdx<rpcSlice->getTileLocationCount(); uiIdx++)
    2456       {
    2457         Int iCurDiff = aiDiff[uiIdx];
    2458 
    2459         // write sign of diff
    2460         if (uiIdx!=0)
    2461         {
    2462           if (iCurDiff<0)         
    2463           {
    2464             rNalu.m_Bitstream.write(1, 1);
    2465           }
    2466           else
    2467           {
    2468             rNalu.m_Bitstream.write(0, 1);
    2469           }
    2470         }
    2471 
    2472         // write abs value of diff
    2473         Int iAbsDiff = (iCurDiff<0) ? (-iCurDiff) : iCurDiff;
    2474         if (iAbsDiff > ((((UInt64)1)<<32)-1))
    2475         {
    2476           printf("\niAbsDiff exceeds 32-bit limit");
    2477           exit(0);
    2478         }
    2479         rNalu.m_Bitstream.write( iAbsDiff, iBitsUsedByDiff-1 );
    2480       }
    2481 
    2482       delete [] aiDiff;
    2483     }
    2484 #endif
    24852092  }
    24862093
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r56 r294  
    100100 * \param  *psQTPart, iPartIdx, dLambda
    101101 */
    102 #if SAO_UNIT_INTERLEAVING
    103102Void TEncSampleAdaptiveOffset::rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda)
    104103{
     
    340339}
    341340
    342 #else
    343 Void TEncSampleAdaptiveOffset::rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda)
    344 {
    345   Int iTypeIdx;
    346   Int iNumTotalType = MAX_NUM_SAO_TYPE;
    347   SAOQTPart*  pOnePart = &(psQTPart[iPartIdx]);
    348 
    349   Int64 iEstDist;
    350   Int64 iOffsetOrg;
    351   Int64 iOffset;
    352   Int64 iCount;
    353   Int iClassIdx;
    354   Int uiShift = g_uiBitIncrement << 1;
    355 
    356   UInt uiDepth = pOnePart->PartLevel;
    357 
    358   m_iDistOrg [iPartIdx] =  0;
    359 
    360   for (iTypeIdx=-1; iTypeIdx<iNumTotalType; iTypeIdx++)
    361   {
    362     if( m_bUseSBACRD )
    363     {
    364       m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
    365       m_pcRDGoOnSbacCoder->resetBits();
    366     }
    367     else
    368     {
    369       m_pcEntropyCoder->resetEntropy();
    370       m_pcEntropyCoder->resetBits();
    371     }
    372 
    373     iEstDist = 0;
    374 
    375     m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoUvlc(iTypeIdx+1);
    376 
    377     if (iTypeIdx>=0)
    378     {
    379 
    380       for(iClassIdx=1; iClassIdx < m_iNumClass[iTypeIdx]+1; iClassIdx++)
    381       {
    382         if(m_iCount [iPartIdx][iTypeIdx][iClassIdx])
    383         {
    384 #if FULL_NBIT
    385           m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]<<g_uiBitDepth-8) / (Double)(m_iCount [iPartIdx][iTypeIdx][iClassIdx]<<m_uiSaoBitIncrease));
    386 #else
    387           m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]<<g_uiBitIncrement) / (Double)(m_iCount [iPartIdx][iTypeIdx][iClassIdx]<<m_uiSaoBitIncrease));
    388 #endif
    389           m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = Clip3(-m_iOffsetTh, m_iOffsetTh-1, (Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]);
    390           {
    391             Int64 iterOffset, tempOffset;
    392             Int64 tempDist, tempRate;
    393             Double tempCost, tempMinCost;
    394             UInt codeLength, tempValue;
    395 
    396             iterOffset = m_iOffset[iPartIdx][iTypeIdx][iClassIdx];
    397             m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0;
    398             tempMinCost = dLambda; // Assuming sending quantized value 0 results in zero offset and sending the value zero needs 1 bit. entropy coder can be used to measure the exact rate here.
    399 
    400             while (iterOffset != 0)
    401             {
    402               // Calculate the bits required for signalling the offset
    403               codeLength = 1;
    404               tempValue = (UInt)((iterOffset <= 0) ? ( (-iterOffset<<1) + 1 ) : (iterOffset<<1));
    405               while( 1 != tempValue )
    406               {
    407                 tempValue >>= 1;
    408                 codeLength += 2;
    409               }
    410               tempRate = (codeLength >> 1) + ((codeLength+1) >> 1);
    411 
    412               // Do the dequntization before distorion calculation
    413               tempOffset    =  iterOffset << m_uiSaoBitIncrease;
    414               tempDist  = (( m_iCount [iPartIdx][iTypeIdx][iClassIdx]*tempOffset*tempOffset-m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]*tempOffset*2 ) >> uiShift);
    415 
    416               tempCost = ((Double)tempDist + dLambda * (Double) tempRate);
    417               if(tempCost < tempMinCost)
    418               {
    419                 tempMinCost = tempCost;
    420                 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = iterOffset;
    421               }
    422               iterOffset = (iterOffset > 0) ? (iterOffset-1):(iterOffset+1);
    423             }
    424           }
    425         }
    426         else
    427         {
    428           m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx] = 0;
    429           m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0;
    430         }
    431 
    432         iCount     =  m_iCount [iPartIdx][iTypeIdx][iClassIdx];
    433         iOffset    =  m_iOffset[iPartIdx][iTypeIdx][iClassIdx] << m_uiSaoBitIncrease;
    434         iOffsetOrg =  m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx];
    435         iEstDist   += (( iCount*iOffset*iOffset-iOffsetOrg*iOffset*2 ) >> uiShift);
    436         m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoSvlc((Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]);
    437       }
    438       m_iDist[iPartIdx][iTypeIdx] = iEstDist;
    439       m_iRate[iPartIdx][iTypeIdx] = m_pcEntropyCoder->getNumberOfWrittenBits();
    440 
    441       m_dCost[iPartIdx][iTypeIdx] = (Double)((Double)m_iDist[iPartIdx][iTypeIdx] + dLambda * (Double) m_iRate[iPartIdx][iTypeIdx]);
    442 
    443       if(m_dCost[iPartIdx][iTypeIdx] < m_dCostPartBest[iPartIdx])
    444       {
    445         m_iDistOrg [iPartIdx] = 0;
    446         m_dCostPartBest[iPartIdx] = m_dCost[iPartIdx][iTypeIdx];
    447         m_iTypePartBest[iPartIdx] = iTypeIdx;
    448         if( m_bUseSBACRD )
    449           m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] );
    450       }
    451     }
    452     else
    453     {
    454       if(m_iDistOrg[iPartIdx] < m_dCostPartBest[iPartIdx] )
    455       {
    456         m_dCostPartBest[iPartIdx] = (Double) m_iDistOrg[iPartIdx] + m_pcEntropyCoder->getNumberOfWrittenBits()*dLambda ;
    457         m_iTypePartBest[iPartIdx] = -1;
    458         if( m_bUseSBACRD )
    459           m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] );
    460       }
    461     }
    462   }
    463 
    464   pOnePart->bProcessed = true;
    465   pOnePart->bSplit     = false;
    466   pOnePart->iMinDist   =        m_iTypePartBest[iPartIdx] >= 0 ? m_iDist[iPartIdx][m_iTypePartBest[iPartIdx]] : m_iDistOrg[iPartIdx];
    467   pOnePart->iMinRate   = (Int) (m_iTypePartBest[iPartIdx] >= 0 ? m_iRate[iPartIdx][m_iTypePartBest[iPartIdx]] : 0);
    468   pOnePart->dMinCost   = pOnePart->iMinDist + dLambda * pOnePart->iMinRate;
    469   pOnePart->iBestType  = m_iTypePartBest[iPartIdx];
    470   if (pOnePart->iBestType != -1)
    471   {
    472     pOnePart->bEnableFlag =  1;
    473     pOnePart->iLength = m_iNumClass[pOnePart->iBestType];
    474     for (Int i=0; i<pOnePart->iLength ; i++)
    475       pOnePart->iOffset[i] = (Int) m_iOffset[iPartIdx][pOnePart->iBestType][i+1];
    476   }
    477   else
    478   {
    479     pOnePart->bEnableFlag = 0;
    480     pOnePart->iLength     = 0;
    481   }
    482 }
    483 
    484 #endif
    485341/** Run partition tree disable
    486342 */
     
    488344{
    489345  SAOQTPart*  pOnePart= &(psQTPart[iPartIdx]);
    490 #if !SAO_UNIT_INTERLEAVING
    491   pOnePart->bEnableFlag = false;
    492 #endif
    493346  pOnePart->bSplit      = false;
    494347  pOnePart->iLength     =  0;
     
    556409      dCostFinal = dCostSplit;
    557410      pOnePart->bSplit      = true;
    558 #if !SAO_UNIT_INTERLEAVING
    559       pOnePart->bEnableFlag = false;
    560 #endif
    561411      pOnePart->iLength     =  0;
    562412      pOnePart->iBestType   = -1;
     
    810660  Int x, y;
    811661
    812 #if SAO_UNIT_INTERLEAVING
    813662  //--------- Band offset-----------//
    814663  stats = ppStats[SAO_BO];
     
    830679    pRec += stride;
    831680  }
    832 #else
    833   //--------- Band offset 0-----------//
    834   stats = ppStats[SAO_BO_0];
    835   count = ppCount[SAO_BO_0];
    836   pOrg   = pOrgStart;
    837   pRec   = pRecStart;
    838   for (y=0; y< height; y++)
    839   {
    840     for (x=0; x< width; x++)
    841     {
    842       classIdx = m_ppLumaTableBo0[pRec[x]];
    843       if (classIdx)
    844       {
    845         stats[classIdx] += (pOrg[x] - pRec[x]);
    846         count[classIdx] ++;
    847       }
    848     }
    849     pOrg += stride;
    850     pRec += stride;
    851   }
    852 
    853   //--------- Band offset 1-----------//
    854   stats = ppStats[SAO_BO_1];
    855   count = ppCount[SAO_BO_1];
    856   pOrg   = pOrgStart;
    857   pRec   = pRecStart;
    858 
    859   for (y=0; y< height; y++)
    860   {
    861     for (x=0; x< width; x++)
    862     {
    863       classIdx = m_ppLumaTableBo1[pRec[x]];
    864       if (classIdx)
    865       {
    866         stats[classIdx] += (pOrg[x] - pRec[x]);
    867         count[classIdx] ++;
    868       }
    869     }
    870     pOrg += stride;
    871     pRec += stride;
    872   }
    873 #endif
    874681  //---------- Edge offset 0--------------//
    875682  stats = ppStats[SAO_EO_0];
     
    1166973
    1167974  Int iIsChroma = (iYCbCr!=0)? 1:0;
    1168 #if SAO_UNIT_INTERLEAVING
    1169975  Int numSkipLine = iIsChroma? 2:4;
    1170976  if (m_saoInterleavingFlag == 0)
     
    1172978    numSkipLine = 0;
    1173979  }
    1174 #endif
    1175980
    1176981  iPicWidthTmp  = m_iPicWidth  >> iIsChroma;
     
    1194999#endif
    11951000  {
    1196 #if SAO_UNIT_INTERLEAVING
    11971001    iStats = m_iOffsetOrg[iPartIdx][SAO_BO];
    11981002    iCount = m_iCount    [iPartIdx][SAO_BO];
    1199 #else
    1200     iStats = m_iOffsetOrg[iPartIdx][SAO_BO_0];
    1201     iCount = m_iCount    [iPartIdx][SAO_BO_0];
    1202 #endif
    12031003
    12041004    pOrg = getPicYuvAddr(m_pcPic->getPicYuvOrg(), iYCbCr, iAddr);
    12051005    pRec = getPicYuvAddr(m_pcPic->getPicYuvRec(), iYCbCr, iAddr);
    12061006
    1207 #if SAO_UNIT_INTERLEAVING
    12081007    iEndY   = (uiBPelY == iPicHeightTmp) ? iLcuHeight : iLcuHeight-numSkipLine;
    12091008    for (y=0; y<iEndY; y++)
    1210 #else
    1211     for (y=0; y<iLcuHeight; y++)
    1212 #endif
    12131009    {
    12141010      for (x=0; x<iLcuWidth; x++)
    12151011      {
    1216 #if SAO_UNIT_INTERLEAVING
    12171012        iClassIdx = m_lumaTableBo[pRec[x]];
    1218 #else
    1219         iClassIdx = m_ppLumaTableBo0[pRec[x]];
    1220 #endif
    12211013        if (iClassIdx)
    12221014        {
     
    12291021    }
    12301022
    1231 #if !SAO_UNIT_INTERLEAVING
    1232     iStats = m_iOffsetOrg[iPartIdx][SAO_BO_1];
    1233     iCount = m_iCount    [iPartIdx][SAO_BO_1];
    1234 
    1235     pOrg = getPicYuvAddr(m_pcPic->getPicYuvOrg(), iYCbCr, iAddr);
    1236     pRec = getPicYuvAddr(m_pcPic->getPicYuvRec(), iYCbCr, iAddr);
    1237 
    1238     for (y=0; y<iLcuHeight; y++)
    1239     {
    1240       for (x=0; x<iLcuWidth; x++)
    1241       {
    1242         iClassIdx = m_ppLumaTableBo1[pRec[x]];
    1243         if (iClassIdx)
    1244         {
    1245           iStats[iClassIdx] += (pOrg[x] - pRec[x]);
    1246           iCount[iClassIdx] ++;
    1247         }
    1248       }
    1249       pOrg += iStride;
    1250       pRec += iStride;
    1251     }
    1252 #endif
    12531023  }
    12541024  Int iSignLeft;
     
    12751045      iStartX = (uiLPelX == 0) ? 1 : 0;
    12761046      iEndX   = (uiRPelX == iPicWidthTmp) ? iLcuWidth-1 : iLcuWidth;
    1277 #if SAO_UNIT_INTERLEAVING
    12781047      for (y=0; y<iLcuHeight-numSkipLine; y++)
    1279 #else
    1280       for (y=0; y<iLcuHeight; y++)
    1281 #endif
    12821048      {
    12831049        iSignLeft = xSign(pRec[iStartX] - pRec[iStartX-1]);
     
    13051071
    13061072      iStartY = (uiTPelY == 0) ? 1 : 0;
    1307 #if SAO_UNIT_INTERLEAVING
    13081073      iEndY   = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight-numSkipLine;
    1309 #else
    1310       iEndY   = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight;
    1311 #endif
    13121074      if (uiTPelY == 0)
    13131075      {
     
    13471109
    13481110      iStartY = (uiTPelY == 0) ? 1 : 0;
    1349 #if SAO_UNIT_INTERLEAVING
    13501111      iEndY   = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight-numSkipLine;
    1351 #else
    1352       iEndY   = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight;
    1353 #endif
    13541112      if (uiTPelY == 0)
    13551113      {
     
    13941152
    13951153      iStartY = (uiTPelY == 0) ? 1 : 0;
    1396 #if SAO_UNIT_INTERLEAVING
    13971154      iEndY   = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight-numSkipLine;
    1398 #else
    1399       iEndY   = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight;
    1400 #endif
    14011155      if (iStartY == 1)
    14021156      {
     
    14861240          for (iTypeIdx=0; iTypeIdx<iNumTotalType; iTypeIdx++)
    14871241          {
    1488 #if SAO_UNIT_INTERLEAVING
    14891242            for (iClassIdx=0; iClassIdx< (iTypeIdx < SAO_BO ? m_iNumClass[iTypeIdx] : SAO_MAX_BO_CLASSES) +1; iClassIdx++)
    1490 #else
    1491             for (iClassIdx=0; iClassIdx<m_iNumClass[iTypeIdx]+1; iClassIdx++)
    1492 #endif
    14931243            {
    14941244              m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx] += m_iOffsetOrg[iDownPartIdx][iTypeIdx][iClassIdx];
     
    15741324  Double dCostFinal = 0;
    15751325
    1576 #if !SAO_UNIT_INTERLEAVING
    1577   Int iCb = 1;
    1578   Int iCr = 2;
    1579   Double dCostFinalCb = 0;
    1580   Double dCostFinalCr = 0;
    1581 #endif
    1582 
    1583 #if SAO_UNIT_INTERLEAVING
     1326
    15841327  if ( m_saoInterleavingFlag)
    15851328  {
     
    16161359    }
    16171360  }
    1618 #else
    1619   getSaoStats(pcSaoParam->psSaoPart[iY], iY);
    1620   runQuadTreeDecision(pcSaoParam->psSaoPart[iY], 0, dCostFinal, m_uiMaxSplitLevel, m_dLambdaLuma);
    1621   pcSaoParam->bSaoFlag[iY] = dCostFinal < m_iDistOrg[0] ? 1:0;
    1622   if(pcSaoParam->bSaoFlag[iY])
    1623   {
    1624     processSaoQuadTree(pcSaoParam->psSaoPart[iY], 0, 0);
    1625 
    1626     resetStats();
    1627     getSaoStats(pcSaoParam->psSaoPart[iCb], iCb);
    1628     runQuadTreeDecision(pcSaoParam->psSaoPart[iCb], 0, dCostFinalCb, m_uiMaxSplitLevel, m_dLambdaChroma);
    1629     pcSaoParam->bSaoFlag[iCb] = dCostFinalCb < 0 ? 1:0;
    1630     if (pcSaoParam->bSaoFlag[iCb])
    1631     {
    1632       processSaoQuadTree(pcSaoParam->psSaoPart[iCb], 0, iCb);
    1633     }
    1634 
    1635     resetStats();
    1636     getSaoStats(pcSaoParam->psSaoPart[iCr], iCr);
    1637     runQuadTreeDecision(pcSaoParam->psSaoPart[iCr], 0, dCostFinalCr, m_uiMaxSplitLevel, m_dLambdaChroma);
    1638     pcSaoParam->bSaoFlag[iCr] = dCostFinalCr < 0 ? 1:0;
    1639     if (pcSaoParam->bSaoFlag[iCr])
    1640     {
    1641       processSaoQuadTree(pcSaoParam->psSaoPart[iCr], 0, iCr);
    1642     }
    1643   }
    1644 #endif
    1645 }
    1646 #if SAO_UNIT_INTERLEAVING
     1361}
    16471362/** Check merge SAO unit
    16481363 * \param saoUnitCurr current SAO unit
     
    22601975}
    22611976
    2262 #endif
    22631977
    22641978//! \}
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h

    r56 r294  
    101101  Void destroyEncBuffer();
    102102  Void createEncBuffer();
    103 #if SAO_UNIT_INTERLEAVING
    104103  Void assignSaoUnitSyntax(SaoLcuParam* saoLcuParam,  SAOQTPart* saoPart, Bool &oneUnitFlag, Int yCbCr);
    105104  Void checkMerge(SaoLcuParam * lcuParamCurr,SaoLcuParam * lcuParamCheck, Int dir);
     
    108107  Void setMaxNumOffsetsPerPic(Int iVal) {m_maxNumOffsetsPerPic = iVal; }
    109108  Int  getMaxNumOffsetsPerPic() {return m_maxNumOffsetsPerPic; }
    110 #endif
    111109};
    112110
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp

    r292 r294  
    9595, m_cALFUvlcSCModel           ( 1,             1,               NUM_ALF_UVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    9696, m_cALFSvlcSCModel           ( 1,             1,               NUM_ALF_SVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    97 #if AMP_CTX
    9897, m_cCUAMPSCModel             ( 1,             1,               NUM_CU_AMP_CTX                , m_contextModels + m_numContextModels, m_numContextModels)
    99 #else
    100 , m_cCUXPosiSCModel           ( 1,             1,               NUM_CU_X_POS_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    101 , m_cCUYPosiSCModel           ( 1,             1,               NUM_CU_Y_POS_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    102 #endif
    10398, m_cSaoFlagSCModel           ( 1,             1,               NUM_SAO_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    10499, m_cSaoUvlcSCModel           ( 1,             1,               NUM_SAO_UVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    105100, m_cSaoSvlcSCModel           ( 1,             1,               NUM_SAO_SVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    106 #if SAO_UNIT_INTERLEAVING
    107101, m_cSaoMergeLeftSCModel      ( 1,             1,               NUM_SAO_MERGE_LEFT_FLAG_CTX   , m_contextModels + m_numContextModels, m_numContextModels)
    108102, m_cSaoMergeUpSCModel        ( 1,             1,               NUM_SAO_MERGE_UP_FLAG_CTX     , m_contextModels + m_numContextModels, m_numContextModels)
    109103, m_cSaoTypeIdxSCModel        ( 1,             1,               NUM_SAO_TYPE_IDX_CTX          , m_contextModels + m_numContextModels, m_numContextModels)
    110 #endif
    111104#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    112105, m_cDmmFlagSCModel           ( 1,             1,               NUM_DMM_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     
    166159#endif
    167160  m_cCUPartSizeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PART_SIZE );
    168 #if AMP_CTX
    169161  m_cCUAMPSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS );
    170 #else
    171   m_cCUXPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_X_POS );
    172   m_cCUYPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_Y_POS );
    173 #endif
    174162  m_cCUPredModeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PRED_MODE );
    175163  m_cCUIntraPredSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE );
     
    195183  m_cSaoUvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC );
    196184  m_cSaoSvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC );
    197 #if SAO_UNIT_INTERLEAVING
    198185  m_cSaoMergeLeftSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
    199186  m_cSaoMergeUpSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
    200187  m_cSaoTypeIdxSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX );
    201 #endif
    202188#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    203189  m_cDmmFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG );
     
    259245#endif
    260246      curCost += m_cCUPartSizeSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_PART_SIZE );
    261 #if AMP_CTX
    262247      curCost += m_cCUAMPSCModel.calcCost             ( curSliceType, qp, (UChar*)INIT_CU_AMP_POS );
    263 #else
    264       curCost += m_cCUXPosiSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_CU_X_POS );
    265       curCost += m_cCUYPosiSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_CU_Y_POS );
    266 #endif
    267248      curCost += m_cCUPredModeSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_PRED_MODE );
    268249      curCost += m_cCUIntraPredSCModel.calcCost       ( curSliceType, qp, (UChar*)INIT_INTRA_PRED_MODE );
     
    288269      curCost += m_cSaoUvlcSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_SAO_UVLC );
    289270      curCost += m_cSaoSvlcSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_SAO_SVLC );
    290 #if SAO_UNIT_INTERLEAVING
    291271      curCost += m_cSaoMergeLeftSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
    292272      curCost += m_cSaoMergeUpSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
    293273      curCost += m_cSaoTypeIdxSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_SAO_TYPE_IDX );
    294 #endif
    295274
    296275      if (curCost < bestCost)
     
    333312#endif
    334313  m_cCUPartSizeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PART_SIZE );
    335 #if AMP_CTX
    336314  m_cCUAMPSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS );
    337 #else
    338   m_cCUXPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_X_POS );
    339   m_cCUYPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_Y_POS );
    340 #endif
    341315  m_cCUPredModeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PRED_MODE );
    342316  m_cCUIntraPredSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE );
     
    362336  m_cSaoUvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC );
    363337  m_cSaoSvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC );
    364 #if SAO_UNIT_INTERLEAVING
    365338  m_cSaoMergeLeftSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
    366339  m_cSaoMergeUpSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
    367340  m_cSaoTypeIdxSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX );
    368 #endif
    369341#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    370342  m_cDmmFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG );
     
    426398}
    427399
    428 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    429400Void TEncSbac::codeTilesWPPEntryPoint( TComSlice* pSlice )
    430401{
     
    432403  return;
    433404}
    434 #else
    435 Void TEncSbac::codeSliceHeaderSubstreamTable( TComSlice* pcSlice )
    436 {
    437   assert (0);
    438 }
    439 #endif
    440405
    441406Void TEncSbac::codeTerminatingBit( UInt uilsLast )
     
    449414}
    450415
    451 #if OL_FLUSH
    452416Void TEncSbac::codeFlush()
    453417{
     
    459423  m_pcBinIf->start();
    460424}
    461 #endif
    462425
    463426Void TEncSbac::xWriteUnarySymbol( UInt uiSymbol, ContextModel* pcSCModel, Int iOffset )
     
    557520  m_pcBinIf->encodeBinsEP( ( binValues << ruiGoRiceParam ) + uiCodeWord - ( uiQuotient << ruiGoRiceParam ), numBins + ruiGoRiceParam );
    558521 
    559 #if EIGHT_BITS_RICE_CODE
    560522  ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( uiSymbol, 23 ) ];
    561 #else
    562   ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( uiSymbol, 15 ) ];
    563 #endif
    564523 
    565524  if( bExGolomb )
     
    669628        if (eSize == SIZE_2NxN)
    670629        {
    671 #if AMP_CTX           
    672630          m_pcBinIf->encodeBin(1, m_cCUAMPSCModel.get( 0, 0, 0 ));
    673 #else
    674           m_pcBinIf->encodeBin(1, m_cCUYPosiSCModel.get( 0, 0, 0 ));
    675 #endif
    676631        }
    677632        else
    678633        {
    679 #if AMP_CTX
    680634          m_pcBinIf->encodeBin(0, m_cCUAMPSCModel.get( 0, 0, 0 ));         
    681635          m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));
    682 #else
    683           m_pcBinIf->encodeBin(0, m_cCUYPosiSCModel.get( 0, 0, 0 ));
    684           m_pcBinIf->encodeBin((eSize == SIZE_2NxnU? 0: 1), m_cCUYPosiSCModel.get( 0, 0, 1 ));
    685 #endif
    686636        }
    687637      }
     
    702652        if (eSize == SIZE_Nx2N)
    703653        {
    704 #if AMP_CTX
    705654          m_pcBinIf->encodeBin(1, m_cCUAMPSCModel.get( 0, 0, 0 ));
    706 #else
    707           m_pcBinIf->encodeBin(1, m_cCUXPosiSCModel.get( 0, 0, 0 ));
    708 #endif
    709655        }
    710656        else
    711657        {
    712 #if AMP_CTX
    713658          m_pcBinIf->encodeBin(0, m_cCUAMPSCModel.get( 0, 0, 0 ));
    714659          m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));
    715 #else
    716           m_pcBinIf->encodeBin(0, m_cCUXPosiSCModel.get( 0, 0, 0 ));
    717           m_pcBinIf->encodeBin((eSize == SIZE_nLx2N? 0: 1), m_cCUXPosiSCModel.get( 0, 0, 1 ));
    718 #endif
    719660        }
    720661      }
     
    851792{
    852793  UInt uiNumCand = MRG_MAX_NUM_CANDS;
    853 #if !MRG_IDX_CTX_RED
    854   UInt auiCtx[4] = { 0, 1, 2, 3 };
    855 #endif
    856794  UInt uiUnaryIdx = pcCU->getMergeIndex( uiAbsPartIdx );
    857795  uiNumCand = pcCU->getSlice()->getMaxNumMergeCand();
     
    876814    {
    877815      const UInt uiSymbol = ui == uiUnaryIdx ? 0 : 1;
    878 #if MRG_IDX_CTX_RED
    879816      if ( ui==0 )
    880817      {
     
    885822        m_pcBinIf->encodeBinEP( uiSymbol );
    886823      }
    887 #else
    888       m_pcBinIf->encodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, auiCtx[ui] ) );
    889 #endif
    890824      if( uiSymbol == 0 )
    891825      {
     
    11351069  {
    11361070#endif
    1137 #if !LOGI_INTRA_NAME_3MPM
    1138   Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx);
    1139 #endif
    11401071#if LGE_EDGE_INTRA_A0070
    11411072  Bool bCodeEdgeIntra = false;
     
    11481079#endif
    11491080 
    1150 #if LOGI_INTRA_NAME_3MPM
    11511081  Int uiPreds[3] = {-1, -1, -1};
    1152 #else
    1153   Int uiPreds[2] = {-1, -1};
    1154 #endif
    11551082  Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); 
    11561083
     
    11681095  {
    11691096    m_pcBinIf->encodeBin( 1, m_cCUIntraPredSCModel.get( 0, 0, 0 ) );
    1170 #if LOGI_INTRA_NAME_3MPM
    11711097    m_pcBinIf->encodeBinEP( uiPredIdx ? 1 : 0 );
    11721098    if (uiPredIdx)
     
    11741100      m_pcBinIf->encodeBinEP( uiPredIdx-1 );
    11751101    }
    1176 #else
    1177     m_pcBinIf->encodeBinEP( uiPredIdx );
    1178 #endif
    11791102  }
    11801103  else
     
    11821105    m_pcBinIf->encodeBin( 0, m_cCUIntraPredSCModel.get( 0, 0, 0 ) );
    11831106 
    1184 #if LOGI_INTRA_NAME_3MPM
    11851107    if (uiPreds[0] > uiPreds[1])
    11861108    {
     
    11951117      std::swap(uiPreds[1], uiPreds[2]);
    11961118    }
    1197 #endif
    11981119
    11991120    for(Int i = (uiPredNum - 1); i >= 0; i--)
     
    12021123    }
    12031124
    1204 #if LOGI_INTRA_NAME_3MPM
    12051125    m_pcBinIf->encodeBinsEP( uiDir, 5 );
    12061126#if LGE_EDGE_INTRA_A0070
     
    12081128    if (uiDir == 31) m_pcBinIf->encodeBinsEP(0,1);
    12091129#endif
    1210 #else
    1211     if ( uiDir < 31 )
    1212     {
    1213       m_pcBinIf->encodeBinsEP( uiDir, g_aucIntraModeBitsAng[ iIntraIdx ] - 1 );
    1214     }
    1215     else
    1216     {
    1217       m_pcBinIf->encodeBinsEP( 31, 5 );
    1218       m_pcBinIf->encodeBinEP( uiDir - 31 );
    1219     }
    1220 #endif
    12211130   }
    12221131#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    12581167      m_pcBinIf->encodeBin( 1, m_cCUChromaPredSCModel.get( 0, 0, 1 ));
    12591168    }
    1260 #if  CHROMA_MODE_CODING
    12611169    m_pcBinIf->encodeBinsEP( uiIntraDirChroma, 2 );
    1262 #else
    1263     xWriteUnaryMaxSymbol( uiIntraDirChroma, m_cCUChromaPredSCModel.get( 0, 0 ) + 1, 0, 3 );
    1264 #endif
    12651170  }
    12661171  return;
     
    13191224Void TEncSbac::codeMvd( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList )
    13201225{
    1321 #if H0111_MVD_L1_ZERO
    13221226  if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3)
    13231227  {
    13241228    return;
    13251229  }
    1326 #endif
    13271230
    13281231  const TComCUMvField* pcCUMvField = pcCU->getCUMvField( eRefList );
     
    13771280  Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );
    13781281 
    1379 #if H0736_AVC_STYLE_QP_RANGE
    13801282  Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffsetY();
    13811283  iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
    1382 #else
    1383 #if LOSSLESS_CODING
    1384   if(pcCU->getSlice()->getSPS()->getUseLossless())
    1385   {
    1386     if(iDQp > 25)
    1387     {
    1388       iDQp = iDQp - 52;
    1389     }
    1390     if(iDQp < -26)
    1391     {
    1392       iDQp = iDQp + 52;
    1393     }
    1394   }
    1395 #endif
    1396 #endif
    13971284
    13981285  if ( iDQp == 0 )
     
    14051292   
    14061293    UInt uiSign = (iDQp > 0 ? 0 : 1);
    1407 #if !H0736_AVC_STYLE_QP_RANGE
    1408     UInt uiQpBdOffsetY = 6*(g_uiBitIncrement + g_uiBitDepth - 8);
    1409 #endif
    14101294
    14111295    m_pcBinIf->encodeBinEP(uiSign);
    14121296
    1413 #if H0736_AVC_STYLE_QP_RANGE
    14141297    assert(iDQp >= -(26+(qpBdOffsetY/2)));
    14151298    assert(iDQp <=  (25+(qpBdOffsetY/2)));
    14161299
    14171300    UInt uiMaxAbsDQpMinus1 = 24 + (qpBdOffsetY/2) + (uiSign);
    1418 #else
    1419     assert(iDQp >= -(26+(Int)(uiQpBdOffsetY/2)));
    1420     assert(iDQp <=  (25+(Int)(uiQpBdOffsetY/2)));
    1421 
    1422     UInt uiMaxAbsDQpMinus1 = 24 + (uiQpBdOffsetY/2) + (uiSign);
    1423 #endif
    14241301    UInt uiAbsDQpMinus1 = (UInt)((iDQp > 0)? iDQp  : (-iDQp)) - 1;
    14251302    xWriteUnaryMaxSymbol( uiAbsDQpMinus1, &m_cCUDeltaQpSCModel.get( 0, 0, 1 ), 1, uiMaxAbsDQpMinus1);
     
    14471324}
    14481325
    1449 #if BURST_IPCM
    14501326/** Code I_PCM information.
    14511327 * \param pcCU pointer to CU
     
    14561332 */
    14571333Void TEncSbac::codeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, Int numIPCM, Bool firstIPCMFlag)
    1458 #else
    1459 /** Code I_PCM information.
    1460  * \param pcCU pointer to CU
    1461  * \param uiAbsPartIdx CU index
    1462  * \returns Void
    1463  *
    1464  * If I_PCM flag indicates that the CU is I_PCM, code its PCM alignment bits and codes. 
    1465  */
    1466 Void TEncSbac::codeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx)
    1467 #endif
    14681334{
    14691335  UInt uiIPCM = (pcCU->getIPCMFlag(uiAbsPartIdx) == true)? 1 : 0;
    14701336
    1471 #if BURST_IPCM
    14721337  Bool writePCMSampleFlag = pcCU->getIPCMFlag(uiAbsPartIdx);
    14731338
     
    14821347    }
    14831348  }
    1484 #else
    1485   m_pcBinIf->encodeBinTrm (uiIPCM);
    1486 #endif
    1487 
    1488 #if BURST_IPCM
     1349
    14891350  if (writePCMSampleFlag)
    1490 #else
    1491   if (uiIPCM)
    1492 #endif
    1493   {
    1494 #if !BURST_IPCM
    1495     m_pcBinIf->encodePCMAlignBits();
    1496 #endif
     1351  {
    14971352    UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
    14981353    UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
     
    15511406      piPCMSample += uiWidth;
    15521407    }
    1553 #if BURST_IPCM
    15541408    numIPCM--;
    15551409    if(numIPCM == 0)
     
    15571411      m_pcBinIf->resetBac();
    15581412    }
    1559 #else
    1560     m_pcBinIf->resetBac();
    1561 #endif
    15621413  }
    15631414}
     
    16031454
    16041455  // posX
    1605 #if LAST_CTX_REDUCTION
    16061456  Int widthCtx = eTType? 4: width;
    16071457  const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ widthCtx ] * ( g_aucConvertToBit[ widthCtx ] + 3 ) );
    1608 #else
    1609   const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ width ] * ( g_aucConvertToBit[ width ] + 3 ) );
    1610 #endif
    16111458  for( uiCtxLast = 0; uiCtxLast < uiGroupIdxX; uiCtxLast++ )
    16121459  {
    1613 #if LAST_CTX_REDUCTION
    16141460    if (eTType)
    16151461    {
     
    16181464    else
    16191465    {
    1620 #endif
    16211466      m_pcBinIf->encodeBin( 1, *( pCtxX + puiCtxIdxX[ uiCtxLast ] ) );
    1622 #if LAST_CTX_REDUCTION
    1623     }
    1624 #endif
     1467    }
    16251468  }
    16261469  if( uiGroupIdxX < g_uiGroupIdx[ width - 1 ])
    16271470  {
    1628 #if LAST_CTX_REDUCTION
    16291471    if ( eTType )
    16301472    {
     
    16331475    else
    16341476    {
    1635 #endif
    16361477      m_pcBinIf->encodeBin( 0, *( pCtxX + puiCtxIdxX[ uiCtxLast ] ) );
    1637 #if LAST_CTX_REDUCTION
    1638     }
    1639 #endif
     1478    }
    16401479  }
    16411480
    16421481  // posY
    1643 #if LAST_CTX_REDUCTION
    16441482  Int heightCtx = eTType? 4: height;
    16451483  const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ heightCtx ] * ( g_aucConvertToBit[ heightCtx ] + 3 ) );
    1646 #else
    1647   const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ height ] * ( g_aucConvertToBit[ height ] + 3 ) );
    1648 #endif
    16491484  for( uiCtxLast = 0; uiCtxLast < uiGroupIdxY; uiCtxLast++ )
    16501485  {
    1651 #if LAST_CTX_REDUCTION
    16521486    if (eTType)
    16531487    {
     
    16561490    else
    16571491    {
    1658 #endif
    16591492      m_pcBinIf->encodeBin( 1, *( pCtxY + puiCtxIdxY[ uiCtxLast ] ) );
    1660 #if LAST_CTX_REDUCTION
    1661     }
    1662 #endif
     1493    }
    16631494  }
    16641495  if( uiGroupIdxY < g_uiGroupIdx[ height - 1 ])
    16651496  {
    1666 #if LAST_CTX_REDUCTION
    16671497    if (eTType)
    16681498    {
     
    16711501    else
    16721502    {
    1673 #endif
    16741503      m_pcBinIf->encodeBin( 0, *( pCtxY + puiCtxIdxY[ uiCtxLast ] ) );
    1675 #if LAST_CTX_REDUCTION
    1676     }
    1677 #endif
     1504    }
    16781505    }
    16791506  if ( uiGroupIdxX > 3 )
     
    17651592  }
    17661593 
    1767 #if MULTIBITS_DATA_HIDING
    17681594  UInt const tsig = pcCU->getSlice()->getPPS()->getTSIG();
    17691595#if LOSSLESS_CODING
     
    17801606  Bool beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0;
    17811607#endif
    1782 #endif
    17831608
    17841609  // Find position of last coefficient
     
    17901615  {
    17911616    scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0 ];
    1792 #if MULTILEVEL_SIGMAP_EXT
    17931617    if( uiLog2BlockSize == 3 )
    17941618    {
     
    17991623      scanCG = g_sigLastScanCG32x32;
    18001624    }
    1801 #endif
    18021625  }
    18031626  else
     
    18091632  const UInt uiNumBlkSide = uiWidth >> uiShift;
    18101633
    1811 #if !MULTILEVEL_SIGMAP_EXT
    1812   if( blockType > 3 )
    1813   {
    1814 #endif
    18151634    ::memset( uiSigCoeffGroupFlag, 0, sizeof(UInt) * MLS_GRP_NUM );
    18161635
     
    18231642      UInt uiPosX    = posLast - ( uiPosY << uiLog2BlockSize );
    18241643      UInt uiBlkIdx  = uiNumBlkSide * (uiPosY >> uiShift) + (uiPosX >> uiShift);
    1825 #if MULTILEVEL_SIGMAP_EXT
    18261644      if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) )
    18271645      {
     
    18351653        }
    18361654      }
    1837 #endif
    18381655      if( pcCoef[ posLast ] )
    18391656      {
     
    18441661    }
    18451662    while ( uiNumSig > 0 );
    1846 #if !MULTILEVEL_SIGMAP_EXT
    1847   }
    1848   else
    1849   {
    1850  
    1851   do
    1852   {
    1853     posLast = scan[ ++scanPosLast ];
    1854     uiNumSig -= ( pcCoef[ posLast ] != 0 );
    1855   }
    1856   while ( uiNumSig > 0 );
    1857 
    1858   }
    1859 #endif
    18601663
    18611664  // Code position of last coefficient
     
    18821685    UInt coeffSigns = 0;
    18831686
    1884 #if MULTIBITS_DATA_HIDING
    18851687    Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE;
    1886 #endif
    18871688
    18881689    if( iScanPosSig == scanPosLast )
     
    18911692      coeffSigns    = ( pcCoef[ posLast ] < 0 );
    18921693      numNonZero    = 1;
    1893 #if MULTIBITS_DATA_HIDING
    18941694      lastNZPosInCG  = iScanPosSig;
    18951695      firstNZPosInCG = iScanPosSig;
    1896 #endif
    18971696      iScanPosSig--;
    18981697    }
    18991698
    1900 #if !MULTILEVEL_SIGMAP_EXT
    1901     if( blockType > 3 )
    1902     {
    1903 #endif
    19041699      // encode significant_coeffgroup_flag
    19051700      Int iCGBlkPos = scanCG[ iSubSet ];
    19061701      Int iCGPosY   = iCGBlkPos / uiNumBlkSide;
    19071702      Int iCGPosX   = iCGBlkPos - (iCGPosY * uiNumBlkSide);
    1908 #if MULTILEVEL_SIGMAP_EXT
    19091703      if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) )
    19101704      {
     
    19121706        iCGPosX = (uiScanIdx == SCAN_VER ? iCGBlkPos : 0);
    19131707      }
    1914 #endif
    1915 #if !REMOVE_INFER_SIGGRP
    1916       Bool bInferredCGFlag = false;
    1917 #endif
    1918 #if REMOVE_INFER_SIGGRP
    19191708      if( iSubSet == iLastScanSet || iSubSet == 0)
    1920 #else     
    1921       if( iSubSet == iLastScanSet )
    1922 #endif
    19231709      {
    19241710        uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;
     
    19261712      else
    19271713      {
    1928 #if !REMOVE_INFER_SIGGRP
    1929 #if MULTILEVEL_SIGMAP_EXT
    1930         if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight ) && ( iSubSet ) )
    1931 #else
    1932         if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ) && ( iSubSet ) )
    1933 #endif
    1934         {
    1935 #endif
    19361714          UInt uiSigCoeffGroup   = (uiSigCoeffGroupFlag[ iCGBlkPos ] != 0);
    1937 #if MULTILEVEL_SIGMAP_EXT
    19381715          UInt uiCtxSig  = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight );
    1939 #else
    1940           UInt uiCtxSig  = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight );
    1941 #endif
    19421716          m_pcBinIf->encodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] );
    1943 #if !REMOVE_INFER_SIGGRP
    1944         }
    1945         else
    1946         {
    1947           uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;
    1948           bInferredCGFlag = true;
    1949         }
    1950 #endif
    19511717      }
    19521718     
     
    19611727          uiPosX    = uiBlkPos - ( uiPosY << uiLog2BlockSize );
    19621728          uiSig     = (pcCoef[ uiBlkPos ] != 0);
    1963 #if REMOVE_INFER_SIGGRP
    19641729          if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero )
    1965 #else
    1966           if( iScanPosSig > iSubPos || bInferredCGFlag || numNonZero )
    1967 #endif
    19681730          {
    19691731            uiCtxSig  = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
     
    19751737            coeffSigns = 2 * coeffSigns + ( pcCoef[ uiBlkPos ] < 0 );
    19761738            numNonZero++;
    1977 #if MULTIBITS_DATA_HIDING
    19781739            if( lastNZPosInCG == -1 )
    19791740            {
     
    19811742            }
    19821743            firstNZPosInCG = iScanPosSig;
    1983 #endif
    19841744          }
    19851745        }
     
    19891749        iScanPosSig = iSubPos - 1;
    19901750      }
    1991 #if !MULTILEVEL_SIGMAP_EXT
    1992     }
    1993     else
    1994     {
    1995 
    1996     for( ; iScanPosSig >= iSubPos; iScanPosSig-- )
    1997     {
    1998       UInt  uiBlkPos  = scan[ iScanPosSig ];
    1999       UInt  uiPosY    = uiBlkPos >> uiLog2BlockSize;
    2000       UInt  uiPosX    = uiBlkPos - ( uiPosY << uiLog2BlockSize );
    2001       UInt  uiSig     = 0;
    2002       if( pcCoef[ uiBlkPos ] != 0 )
    2003       {
    2004         uiSig = 1;
    2005         absCoeff[ numNonZero ] = abs( pcCoef[ uiBlkPos ] );
    2006         coeffSigns = 2 * coeffSigns + ( pcCoef[ uiBlkPos ] < 0 );
    2007         numNonZero++;
    2008 #if MULTIBITS_DATA_HIDING
    2009         if( lastNZPosInCG == -1 )
    2010         {
    2011           lastNZPosInCG = iScanPosSig;
    2012         }
    2013         firstNZPosInCG = iScanPosSig;
    2014 #endif
    2015       }     
    2016       UInt  uiCtxSig  = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
    2017       m_pcBinIf->encodeBin( uiSig, baseCtx[ uiCtxSig ] );
    2018     }
    2019 
    2020     }
    2021 #endif
    20221751
    20231752    if( numNonZero > 0 )
    20241753    {
    2025 #if MULTIBITS_DATA_HIDING
    20261754      Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= (Int)tsig );
    2027 #endif  // MULTIBITS_DATA_HIDING
    20281755
    20291756      UInt c1 = 1;
    2030 #if !RESTRICT_GR1GR2FLAG_NUMBER
    2031       UInt c2 = 0;
    2032 #endif
    2033 #if LEVEL_CTX_LUMA_RED
    20341757      UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0;
    2035 #else
    2036       UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 3 : 0;
    2037 #endif
    20381758     
    20391759      if( uiNumOne > 0 )
    20401760      {
    20411761        uiCtxSet++;
    2042 #if !LEVEL_CTX_LUMA_RED
    2043         if( uiNumOne > 3 && eTType==TEXT_LUMA)
    2044         {
    2045           uiCtxSet++;
    2046         }
    2047 #endif
    20481762      }
    20491763     
     
    20511765      ContextModel *baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUOneSCModel.get( 0, 0 ) + 4 * uiCtxSet : m_cCUOneSCModel.get( 0, 0 ) + NUM_ONE_FLAG_CTX_LUMA + 4 * uiCtxSet;
    20521766     
    2053 #if RESTRICT_GR1GR2FLAG_NUMBER
    20541767      Int numC1Flag = min(numNonZero, C1FLAG_NUMBER);
    20551768      Int firstC2FlagIdx = -1;
    20561769      for( Int idx = 0; idx < numC1Flag; idx++ )
    2057 #else
    2058       for ( Int idx = 0; idx < numNonZero; idx++ )
    2059 #endif
    20601770      {
    20611771        UInt uiSymbol = absCoeff[ idx ] > 1;
     
    20651775          c1 = 0;
    20661776
    2067 #if RESTRICT_GR1GR2FLAG_NUMBER
    20681777          if (firstC2FlagIdx == -1)
    20691778          {
    20701779            firstC2FlagIdx = idx;
    20711780          }
    2072 #endif
    20731781        }
    20741782        else if( (c1 < 3) && (c1 > 0) )
     
    20811789      {
    20821790
    2083 #if RESTRICT_GR1GR2FLAG_NUMBER
    20841791        baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet;
    20851792        if ( firstC2FlagIdx != -1)
     
    20881795          m_pcBinIf->encodeBin( symbol, baseCtxMod[0] );
    20891796        }
    2090 #else   
    2091         baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + 3 * uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + 3 * uiCtxSet;
     1797      }
     1798     
     1799      if( beValid && signHidden )
     1800      {
     1801        m_pcBinIf->encodeBinsEP( (coeffSigns >> 1), numNonZero-1 );
     1802      }
     1803      else
     1804      {
     1805        m_pcBinIf->encodeBinsEP( coeffSigns, numNonZero );
     1806      }
     1807     
     1808      Int iFirstCoeff2 = 1;   
     1809      if (c1 == 0 || numNonZero > C1FLAG_NUMBER)
     1810      {
    20921811        for ( Int idx = 0; idx < numNonZero; idx++ )
    20931812        {
    2094           if( absCoeff[ idx ] > 1 )
    2095           {
    2096             UInt symbol = absCoeff[ idx ] > 2;
    2097             m_pcBinIf->encodeBin( symbol, baseCtxMod[c2] );
    2098             c2 += (c2 < 2);
    2099             uiNumOne++;
    2100           }
    2101         }
    2102 #endif
    2103       }
    2104      
    2105 #if MULTIBITS_DATA_HIDING
    2106       if( beValid && signHidden )
    2107       {
    2108         m_pcBinIf->encodeBinsEP( (coeffSigns >> 1), numNonZero-1 );
    2109       }
    2110       else
    2111       {
    2112         m_pcBinIf->encodeBinsEP( coeffSigns, numNonZero );
    2113       }
    2114 #else
    2115       m_pcBinIf->encodeBinsEP( coeffSigns, numNonZero );
    2116 #endif
    2117      
    2118 #if RESTRICT_GR1GR2FLAG_NUMBER
    2119       Int iFirstCoeff2 = 1;   
    2120       if (c1 == 0 || numNonZero > C1FLAG_NUMBER)
    2121 #else
    2122       if (c1 == 0)
    2123 #endif
    2124       {
    2125         for ( Int idx = 0; idx < numNonZero; idx++ )
    2126         {
    2127 #if RESTRICT_GR1GR2FLAG_NUMBER
    21281813          UInt baseLevel  = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2 ) : 1;
    21291814
     
    21371822            uiNumOne++;
    21381823          }
    2139 #else
    2140           if ( absCoeff[ idx ] > 2 )
    2141           {
    2142             xWriteGoRiceExGolomb( absCoeff[ idx ]  - 3, uiGoRiceParam );           
    2143           }
    2144 #endif
    21451824        }       
    21461825      }
     
    22731952  }
    22741953}
    2275 #if SAO_UNIT_INTERLEAVING
    22761954/** Code SAO band position
    22771955 * \param uiCode
     
    23332011  }
    23342012}
    2335 #endif
    23362013/*!
    23372014 ****************************************************************************
     
    24422119  const UInt *puiCtxIdx;
    24432120  Int ctx;
    2444 #if LAST_CTX_REDUCTION
    24452121  Int widthCtx = eTType? 4 : width;
    24462122  puiCtxIdx = g_uiLastCtx + (g_aucConvertToBit[ widthCtx ]*(g_aucConvertToBit[ widthCtx ]+3));
    2447 #else 
    2448   puiCtxIdx = g_uiLastCtx + (g_aucConvertToBit[ width ]*(g_aucConvertToBit[ width ]+3));
    2449 #endif
    24502123  ContextModel *pCtxX      = m_cCuCtxLastX.get( 0, eTType );
    24512124  for (ctx = 0; ctx < g_uiGroupIdx[ width - 1 ]; ctx++)
    24522125  {
    24532126    Int ctxOffset = puiCtxIdx[ ctx ];
    2454 #if LAST_CTX_REDUCTION
    24552127    if (eTType)
    24562128    {
     
    24612133    else
    24622134    {
    2463 #endif
    24642135      pcEstBitsSbac->lastXBits[ ctx ] = iBitsX + pCtxX[ ctxOffset ].getEntropyBits( 0 );
    24652136      iBitsX += pCtxX[ ctxOffset ].getEntropyBits( 1 );
    2466 #if LAST_CTX_REDUCTION
    2467     }
    2468 #endif
     2137    }
    24692138    }
    24702139  pcEstBitsSbac->lastXBits[ctx] = iBitsX;
    24712140
    2472 #if LAST_CTX_REDUCTION
    24732141  Int heightCtx = eTType? 4 : height;
    24742142  puiCtxIdx = g_uiLastCtx + (g_aucConvertToBit[ heightCtx ]*(g_aucConvertToBit[ heightCtx ]+3));
    2475 #else
    2476   puiCtxIdx = g_uiLastCtx + (g_aucConvertToBit[ height ]*(g_aucConvertToBit[ height ]+3));
    2477 #endif
    24782143  ContextModel *pCtxY      = m_cCuCtxLastY.get( 0, eTType );
    24792144  for (ctx = 0; ctx < g_uiGroupIdx[ height - 1 ]; ctx++)
    24802145  {
    24812146    Int ctxOffset = puiCtxIdx[ ctx ];
    2482 #if LAST_CTX_REDUCTION
    24832147    if (eTType)
    24842148    {
     
    24892153    else
    24902154    {
    2491 #endif
    24922155      pcEstBitsSbac->lastYBits[ ctx ] = iBitsY + pCtxY[ ctxOffset ].getEntropyBits( 0 );
    24932156      iBitsY += pCtxY[ ctxOffset ].getEntropyBits( 1 );
    2494 #if LAST_CTX_REDUCTION
    2495     }
    2496 #endif
     2157    }
    24972158    }
    24982159  pcEstBitsSbac->lastYBits[ctx] = iBitsY;
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSbac.h

    r292 r294  
    111111  Void  codeSliceHeader         ( TComSlice* pcSlice );
    112112  Void codeTileMarkerFlag(TComSlice* pcSlice) {printf("Not supported\n"); assert(0); exit(1);}
    113 #if TILES_WPP_ENTRY_POINT_SIGNALLING
    114113  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
    115 #else
    116   Void  codeSliceHeaderSubstreamTable( TComSlice* pcSlice );
    117 #endif
    118114  Void  codeTerminatingBit      ( UInt uilsLast      );
    119115  Void  codeSliceFinish         ();
    120 #if OL_FLUSH
    121116  Void  codeFlush               ();
    122117  Void  encodeStart             ();
    123 #endif
    124118 
    125119  Void  codeAlfFlag       ( UInt uiCode );
     
    127121  Void  codeAlfSvlc       ( Int  uiCode );
    128122  Void  codeAlfCtrlDepth  ();
    129 #if LCU_SYNTAX_ALF
    130123  Void codeAPSAlflag(UInt uiCode) {assert (0);  return;}
    131124  Void codeAlfFixedLengthIdx( UInt idx, UInt maxValue){ assert (0);  return;}
    132 #endif
    133125
    134126  Void codeAlfCtrlFlag       ( UInt uiSymbol );
     
    137129  Void  codeSaoUvlc       ( UInt uiCode );
    138130  Void  codeSaoSvlc       ( Int  uiCode );
    139 #if SAO_UNIT_INTERLEAVING
    140131  Void  codeSaoRun        ( UInt  uiCode, UInt uiMaxValue  ) {;}
    141132  Void  codeSaoMergeLeft  ( UInt  uiCode, UInt uiCompIdx );
     
    143134  Void  codeSaoTypeIdx    ( UInt  uiCode);
    144135  Void  codeSaoUflc       ( UInt  uiCode);
    145 #endif
    146136  Void  codeScalingList      ( TComScalingList* scalingList     ){ assert (0);  return;};
    147137 
     
    228218  Void codePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    229219  Void codePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    230 #if BURST_IPCM
    231220  Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Int numIPCM, Bool firstIPCMFlag);
    232 #else
    233   Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    234 #endif
    235221  Void codeTransformSubdivFlag ( UInt uiSymbol, UInt uiCtx );
    236222  Void codeQtCbf               ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
     
    305291  ContextModel3DBuffer m_cALFUvlcSCModel;
    306292  ContextModel3DBuffer m_cALFSvlcSCModel;
    307 #if AMP_CTX
    308293  ContextModel3DBuffer m_cCUAMPSCModel;
    309 #else
    310   ContextModel3DBuffer m_cCUXPosiSCModel;
    311   ContextModel3DBuffer m_cCUYPosiSCModel;
    312 #endif
    313294  ContextModel3DBuffer m_cSaoFlagSCModel;
    314295  ContextModel3DBuffer m_cSaoUvlcSCModel;
    315296  ContextModel3DBuffer m_cSaoSvlcSCModel;
    316 #if SAO_UNIT_INTERLEAVING
    317297  ContextModel3DBuffer m_cSaoMergeLeftSCModel;
    318298  ContextModel3DBuffer m_cSaoMergeUpSCModel;
    319299  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
    320 #endif
    321300
    322301#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp

    r292 r294  
    10801080  pcCU       ->setTrIdxSubParts ( uiTrDepth, uiAbsPartIdx, uiFullDepth );
    10811081
    1082 #if H0736_AVC_STYLE_QP_RANGE
    10831082  m_pcTrQuant->setQPforQuant    ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    1084 #else
    1085   m_pcTrQuant->setQPforQuant    ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    1086 #endif
    10871083
    10881084#if RDOQ_CHROMA_LAMBDA
     
    12781274    UInt uiAbsSum = 0;
    12791275
    1280 #if H0736_AVC_STYLE_QP_RANGE
    12811276    if(eText == TEXT_CHROMA_U)
    12821277    {
     
    12871282      m_pcTrQuant->setQPforQuant     ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    12881283    }
    1289 #else
    1290     if(eText == TEXT_CHROMA_U)
    1291       m_pcTrQuant->setQPforQuant     ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    1292     else
    1293       m_pcTrQuant->setQPforQuant     ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    1294 #endif
    12951284
    12961285#if RDOQ_CHROMA_LAMBDA
     
    20412030   
    20422031    //===== determine set of modes to be tested (using prediction signal only) =====
    2043 #if LOGI_INTRA_NAME_3MPM
    20442032    Int numModesAvailable     = 35; //total number of Intra modes
    2045 #else
    2046     Int numModesAvailable     = g_aucIntraModeNumAng[uiWidthBit];
    2047 #endif
    20482033    Pel* piOrg         = pcOrgYuv ->getLumaAddr( uiPU, uiWidth );
    20492034    Pel* piPred        = pcPredYuv->getLumaAddr( uiPU, uiWidth );
     
    21592144   
    21602145#if FAST_UDI_USE_MPM
    2161 #if LOGI_INTRA_NAME_3MPM
    21622146      Int uiPreds[3] = {-1, -1, -1};
    2163 #else
    2164       Int uiPreds[2] = {-1, -1};
    2165 #endif
    21662147      Int iMode = -1;
    21672148      Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode );
    2168 #if LOGI_INTRA_NAME_3MPM
    21692149      if( iMode >= 0 )
    21702150      {
    21712151        numCand = iMode;
    21722152      }
    2173 #else
    2174       if( iMode >= 0 )
    2175       {
    2176         numCand = 1;
    2177         uiPreds[0] = iMode;
    2178       }
    2179 #endif
    21802153     
    21812154      for( Int j=0; j < numCand; j++)
     
    31693142  PartSize      ePartSize = pcCU->getPartitionSize( 0 );
    31703143
    3171 #if H0111_MVD_L1_ZERO
    31723144  Int           bestBiPRefIdxL1 = 0;
    31733145  Int           bestBiPMvpL1 = 0;
    31743146  UInt          biPDistTemp = MAX_INT;
    3175 #endif
    31763147
    31773148#if ZERO_MVD_EST
     
    32123183    UInt          auiZeroMvdBits[3];
    32133184#endif
    3214 #if H0111_MVD_L1_ZERO
    32153185    UInt          bestBiPDist = MAX_INT;
    3216 #endif
    32173186
    32183187    UInt          uiCostTempL0[MAX_NUM_REF];
     
    32743243          if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;
    32753244        }
    3276 #if H0111_MVD_L1_ZERO
    32773245#if ZERO_MVD_EST
    32783246        xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp, &uiZeroMvdDistTemp);
    32793247#else
    32803248        xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp);
    3281 #endif
    3282 #else
    3283 #if ZERO_MVD_EST
    3284         xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &uiZeroMvdDistTemp);
    3285 #else
    3286         xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp]);
    3287 #endif
    32883249#endif
    32893250        aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr);
    32903251        aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr);
    32913252       
    3292 #if H0111_MVD_L1_ZERO
    32933253        if(pcCU->getSlice()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist)
    32943254        {
     
    32973257          bestBiPRefIdxL1 = iRefIdxTemp;
    32983258        }
    3299 #endif
    33003259
    33013260#if H3D_IVMP
     
    34103369            pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
    34113370
    3412 #if H0111_MVD_L1_ZERO
    34133371            if(!pcCU->getSlice()->getMvdL1ZeroFlag())
    34143372            {
    3415 #endif
    34163373              // storing list 1 prediction signal for iterative bi-directional prediction
    34173374              if ( eRefPicList == REF_PIC_LIST_1 )
     
    34333390#endif
    34343391              }
    3435 #if H0111_MVD_L1_ZERO
    34363392            }
    3437 #endif
    34383393          }
    34393394      }
     
    34573412      ::memcpy(aaiMvpIdxBi, aaiMvpIdx, sizeof(aaiMvpIdx));
    34583413     
    3459 #if H0111_MVD_L1_ZERO
    34603414      UInt uiMotBits[2];
    34613415
     
    35023456        uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1];
    35033457      }
    3504 #else   
    3505       UInt uiMotBits[2] = { uiBits[0] - uiMbBits[0], uiBits[1] - uiMbBits[1] };
    3506       uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1];
    3507 #endif     
    35083458
    35093459      // 4-times iteration (default)
     
    35113461     
    35123462      // fast encoder setting: only one iteration
    3513 #if H0111_MVD_L1_ZERO
    35143463      if ( m_pcEncCfg->getUseFastEnc() || pcCU->getSlice()->getMvdL1ZeroFlag())
    3515 #else
    3516       if ( m_pcEncCfg->getUseFastEnc() )
    3517 #endif
    35183464      {
    35193465        iNumIter = 1;
     
    35303476        RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    35313477
    3532 #if H0111_MVD_L1_ZERO
    35333478        if(pcCU->getSlice()->getMvdL1ZeroFlag())
    35343479        {
     
    35363481          eRefPicList = REF_PIC_LIST_0;
    35373482        }
    3538 #endif
    35393483
    35403484        Bool bChanged = false;
     
    36063550            uiBits[2]           = uiBitsTemp;
    36073551           
    3608 #if H0111_MVD_L1_ZERO
    36093552            if(iNumIter!=1)
    36103553            {
    3611 #endif
    36123554              //  Set motion
    36133555              pcCU->getCUMvField( eRefPicList )->setAllMv( cMvBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
     
    36203562              motionCompensation( pcCU, pcYuvPred, eRefPicList, iPartIdx );
    36213563#endif
    3622 #if H0111_MVD_L1_ZERO
    36233564            }
    3624 #endif
    36253565          }
    36263566        } // for loop-iRefIdxTemp
     
    36323572            xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo());
    36333573            xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi);
    3634 #if H0111_MVD_L1_ZERO
    36353574            if(!pcCU->getSlice()->getMvdL1ZeroFlag())
    36363575            {
    3637 #endif
    36383576              xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo());
    36393577              xCheckBestMVP(pcCU, REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], uiBits[2], uiCostBi);
    3640 #if H0111_MVD_L1_ZERO
    36413578            }
    3642 #endif
    36433579          }
    36443580          break;
     
    39863922
    39873923// AMVP
    3988 #if H0111_MVD_L1_ZERO
    39893924#if ZERO_MVD_EST
    39903925Void TEncSearch::xEstimateMvPredAMVP( TComDataCU* pcCU, TComYuv* pcOrgYuv, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred, Bool bFilled, UInt* puiDistBiP, UInt* puiDist  )
    39913926#else
    39923927Void TEncSearch::xEstimateMvPredAMVP( TComDataCU* pcCU, TComYuv* pcOrgYuv, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred, Bool bFilled, UInt* puiDistBiP )
    3993 #endif
    3994 #else
    3995 #if ZERO_MVD_EST
    3996 Void TEncSearch::xEstimateMvPredAMVP( TComDataCU* pcCU, TComYuv* pcOrgYuv, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred, Bool bFilled, UInt* puiDist )
    3997 #else
    3998 Void TEncSearch::xEstimateMvPredAMVP( TComDataCU* pcCU, TComYuv* pcOrgYuv, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred, Bool bFilled )
    3999 #endif
    40003928#endif
    40013929{
     
    40293957    pcCU->setMVPNumSubParts( pcAMVPInfo->iN, eRefPicList, uiPartAddr, uiPartIdx, pcCU->getDepth(uiPartAddr));
    40303958
    4031 #if H0111_MVD_L1_ZERO
    40323959    if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefPicList==REF_PIC_LIST_1)
    40333960    {
     
    40473974#endif
    40483975    }
    4049 #endif
    40503976    return;
    40513977  }
     
    40874013        cBestMv   = pcAMVPInfo->m_acMvCand[i];
    40884014        iBestIdx  = i;
    4089         #if H0111_MVD_L1_ZERO
    40904015        (*puiDistBiP) = uiTmpCost;
    4091         #endif
    40924016        #if ZERO_MVD_EST
    40934017        (*puiDist) = uiDist;
     
    49764900 
    49774901  //  Residual coding.
    4978 #if H0736_AVC_STYLE_QP_RANGE
    49794902  Int    qp, qpBest = 0, qpMin, qpMax;
    4980 #else
    4981   UInt    uiQp, uiQpBest = 0, uiQpMin, uiQpMax;
    4982 #endif
    49834903  Double  dCost, dCostBest = MAX_DOUBLE;
    49844904 
     
    49924912  while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--;
    49934913 
    4994 #if H0736_AVC_STYLE_QP_RANGE
    49954914  qpMin =  bHighPass ? Clip3( -pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) - m_iMaxDeltaQP ) : pcCU->getQP( 0 );
    49964915  qpMax =  bHighPass ? Clip3( -pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) + m_iMaxDeltaQP ) : pcCU->getQP( 0 );
    4997 #else
    4998   uiQpMin      = bHighPass ? min( MAX_QP, max( MIN_QP, pcCU->getQP(0) - m_iMaxDeltaQP ) ) : pcCU->getQP( 0 );
    4999   uiQpMax      = bHighPass ? min( MAX_QP, max( MIN_QP, pcCU->getQP(0) + m_iMaxDeltaQP ) ) : pcCU->getQP( 0 );
    5000 #endif
    50014916
    50024917  #if HHI_INTERVIEW_SKIP
     
    50374952#endif
    50384953
    5039 #if H0736_AVC_STYLE_QP_RANGE
    50404954  for ( qp = qpMin; qp <= qpMax; qp++ )
    5041 #else
    5042   for ( uiQp = uiQpMin; uiQp <= uiQpMax; uiQp++ )
    5043 #endif
    50444955  {
    50454956    dCost = 0.;
     
    51585069      }
    51595070     
    5160 #if H0736_AVC_STYLE_QP_RANGE
    51615071      if( qpMin != qpMax && qp != qpMax )
    5162 #else
    5163       if( uiQpMin != uiQpMax && uiQp != uiQpMax )
    5164 #endif
    51655072      {
    51665073        const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (pcCU->getDepth(0) << 1);
     
    51815088      uiDistortionBest = uiDistortion;
    51825089      dCostBest        = dCost;
    5183 #if H0736_AVC_STYLE_QP_RANGE
    51845090      qpBest           = qp;
    5185 #else
    5186       uiQpBest         = uiQp;
    5187 #endif     
    51885091      if( m_bUseSBACRD )
    51895092      {
     
    52095112  assert ( dCostBest != MAX_DOUBLE );
    52105113 
    5211 #if H0736_AVC_STYLE_QP_RANGE
    52125114  if( qpMin != qpMax && qpBest != qpMax )
    5213 #else
    5214   if( uiQpMin != uiQpMax && uiQpBest != uiQpMax )
    5215 #endif
    52165115  {
    52175116    if( m_bUseSBACRD )
     
    53045203  }
    53055204 
    5306 #if H0736_AVC_STYLE_QP_RANGE
    53075205  pcCU->setQPSubParts( qpBest, 0, pcCU->getDepth(0) );
    5308 #else
    5309   pcCU->setQPSubParts( uiQpBest, 0, pcCU->getDepth(0) );
    5310 #endif
    53115206
    53125207  // set Model
     
    53375232  const UInt uiLog2TrSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth]+2;
    53385233 
    5339 #if G519_TU_AMP_NSQT_HARMONIZATION
    53405234  UInt SplitFlag = ((pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ));
    5341 #else
    5342   UInt SplitFlag = ((pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER && ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N));
    5343 #endif
    53445235  Bool bCheckFull;
    53455236  if ( SplitFlag && uiDepth == pcCU->getDepth(uiAbsPartIdx) && ( uiLog2TrSize >  pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) )
     
    54065297    }
    54075298
    5408 #if H0736_AVC_STYLE_QP_RANGE
    54095299    m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    5410 #else
    5411     m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    5412 #endif
    54135300
    54145301#if RDOQ_CHROMA_LAMBDA
     
    54305317      }
    54315318
    5432 #if H0736_AVC_STYLE_QP_RANGE
    54335319      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    5434 #else
    5435       m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    5436 #endif
    54375320
    54385321#if RDOQ_CHROMA_LAMBDA
     
    54455328#endif       
    54465329                                 trWidthC, trHeightC, uiAbsSumU, TEXT_CHROMA_U, uiAbsPartIdx );
    5447 #if H0736_AVC_STYLE_QP_RANGE
    54485330      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    5449 #else
    5450       m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    5451 #endif
    54525331      m_pcTrQuant->transformNxN( pcCU, pcResi->getCrAddr(absTUPartIdxC), pcResi->getCStride(), pcCoeffCurrV,
    54535332#if ADAPTIVE_QP_SELECTION
     
    55485427      Pel *pcResiCurrY = m_pcQTTempTComYuv[ uiQTTempAccessLayer ].getLumaAddr( absTUPartIdx );
    55495428
    5550 #if H0736_AVC_STYLE_QP_RANGE
    55515429      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    5552 #else
    5553       m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    5554 #endif
    55555430
    55565431      Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA];
     
    57055580        Pel *pcResiCurrU = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC );
    57065581
    5707 #if H0736_AVC_STYLE_QP_RANGE
    57085582        m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    5709 #else
    5710         m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    5711 #endif
    57125583
    57135584        Int scalingListType = 3 + g_eTTable[(Int)TEXT_CHROMA_U];
     
    57945665        if( !uiAbsSumU )
    57955666        {
    5796 #if H0736_AVC_STYLE_QP_RANGE
    57975667          m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    5798 #else
    5799           m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    5800 #endif
    58015668        }
    58025669        Int scalingListType = 3 + g_eTTable[(Int)TEXT_CHROMA_V];
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSearch.h

    r292 r294  
    464464                                    TComMv&     rcMvPred,
    465465                                    Bool        bFilled = false
    466                                   #if H0111_MVD_L1_ZERO
    467466                                  , UInt*       puiDistBiP = NULL
    468                                   #endif
    469467                                  #if ZERO_MVD_EST
    470468                                  , UInt*       puiDist = NULL
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSlice.cpp

    r292 r294  
    185185  rpcSlice->initSlice();
    186186  rpcSlice->initTiles();
    187 #if H0388
    188187  rpcSlice->setPicOutputFlag( true );
    189 #endif
    190188  rpcSlice->setPOC( uiPOCCurr );
    191189 
     
    262260  {
    263261#if LOSSLESS_CODING
    264 #if H0736_AVC_STYLE_QP_RANGE
    265262    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
    266 #else
    267     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == 0 ) && (rpcSlice->getSPS()->getUseLossless())))
    268 #endif
    269263#endif
    270264    {
     
    334328    }
    335329   
    336 #if H0736_AVC_STYLE_QP_RANGE
    337330    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    338 #else
    339     iQP = max( MIN_QP, min( MAX_QP, (Int)floor( dQP + 0.5 ) ) );
    340 #endif
    341331
    342332    m_pdRdPicLambda[iDQpIdx] = dLambda;
     
    360350// for RDO
    361351  // in RdCost there is only one lambda because the luma and chroma bits are not separated, instead we weight the distortion of chroma.
    362 #if H0736_AVC_STYLE_QP_RANGE
    363352  Double weight = 1.0;
    364353  if(iQP >= 0)
     
    366355    weight = pow( 2.0, (iQP-g_aucChromaScale[iQP])/3.0 );  // takes into account of the chroma qp mapping without chroma qp Offset
    367356  }
    368 #else
    369   Double weight = pow( 2.0, (iQP-g_aucChromaScale[iQP])/3.0 );  // takes into account of the chroma qp mapping without chroma qp Offset
    370 #endif
    371357  m_pcRdCost ->setChromaDistortionWeight( weight );     
    372358#endif
     
    432418 
    433419  rpcSlice->setLoopFilterOffsetInAPS( m_pcCfg->getLoopFilterOffsetInAPS() );
    434 #if DBL_CONTROL
    435420  if (rpcSlice->getPPS()->getDeblockingFilterControlPresent())
    436421  {
    437 #endif
    438422    rpcSlice->setInheritDblParamFromAPS( m_pcCfg->getLoopFilterOffsetInAPS() ? 1 : 0 );
    439423    rpcSlice->setLoopFilterDisable( m_pcCfg->getLoopFilterDisable() );
     
    443427      rpcSlice->setLoopFilterTcOffset( m_pcCfg->getLoopFilterTcOffset() );
    444428    }
    445 #if DBL_CONTROL
    446   }
    447 #endif
     429  }
    448430
    449431  rpcSlice->setDepth            ( iDepth );
     
    455437  }
    456438  rpcSlice->setTLayer( pcPic->getTLayer() );
    457 #if !H0566_TLA
    458   rpcSlice->setTLayerSwitchingFlag( pPPS->getTLayerSwitchingFlag( pcPic->getTLayer() ) );
    459 #endif
    460439
    461440  assert( m_apcPicYuvPred );
     
    558537    // in RdCost there is only one lambda because the luma and chroma bits are not separated, instead we weight the distortion of chroma.
    559538    int iQP = m_piRdPicQp    [uiQpIdx];
    560 #if H0736_AVC_STYLE_QP_RANGE
    561539    Double weight = 1.0;
    562540    if(iQP >= 0)
     
    564542      weight = pow( 2.0, (iQP-g_aucChromaScale[iQP])/3.0 );  // takes into account of the chroma qp mapping without chroma qp Offset
    565543    }
    566 #else
    567     Double weight = pow( 2.0, (iQP-g_aucChromaScale[iQP])/3.0 );  // takes into account of the chroma qp mapping without chroma qp Offset
    568 #endif
    569544    m_pcRdCost    ->setChromaDistortionWeight( weight );     
    570545#endif
     
    614589  // in RdCost there is only one lambda because the luma and chroma bits are not separated, instead we weight the distortion of chroma.
    615590  int iQP = m_piRdPicQp    [uiQpIdxBest];
    616 #if H0736_AVC_STYLE_QP_RANGE
    617591  Double weight = 1.0;
    618592  if(iQP >= 0)
     
    620594    weight = pow( 2.0, (iQP-g_aucChromaScale[iQP])/3.0 );  // takes into account of the chroma qp mapping without chroma qp Offset
    621595  }
    622 #else
    623   Double weight = pow( 2.0, (iQP-g_aucChromaScale[iQP])/3.0 );  // takes into account of the chroma qp mapping without chroma qp Offset
    624 #endif
    625596  m_pcRdCost ->setChromaDistortionWeight( weight );     
    626597#endif
     
    832803  //UInt uiHeightInLCUs = rpcPic->getPicSym()->getFrameHeightInCU();
    833804  UInt uiCol=0, uiLin=0, uiSubStrm=0;
    834 #if !REMOVE_TILE_DEPENDENCE
    835   Int  iBreakDep      = 0;
    836 #endif
    837805  UInt uiTileCol      = 0;
    838806  UInt uiTileStartLCU = 0;
     
    869837    if( m_pcCfg->getUseSBACRD() )
    870838    {
    871 #if !REMOVE_TILE_DEPENDENCE
    872       iBreakDep = rpcPic->getPicSym()->getTileBoundaryIndependenceIdr();
    873 #endif
    874839      uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // what column of tiles are we in?
    875840      uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr();
     
    878843      uiCol     = uiCUAddr % uiWidthInLCUs;
    879844      uiLin     = uiCUAddr / uiWidthInLCUs;
    880 #if !REMOVE_TILE_DEPENDENCE
    881 #if WPP_SIMPLIFICATION
    882       if (iBreakDep && pcSlice->getPPS()->getNumSubstreams() > 1)
    883 #else
    884       if (iBreakDep && pcSlice->getPPS()->getEntropyCodingSynchro())
    885 #endif
    886 #else
    887 #if WPP_SIMPLIFICATION
    888845      if (pcSlice->getPPS()->getNumSubstreams() > 1)
    889 #else
    890       if (pcSlice->getPPS()->getEntropyCodingSynchro())
    891 #endif
    892 #endif
    893846      {
    894847        // independent tiles => substreams are "per tile".  iNumSubstreams has already been multiplied.
     
    902855        uiSubStrm = uiLin % iNumSubstreams;
    903856      }
    904 #if WPP_SIMPLIFICATION
    905857      if ( pcSlice->getPPS()->getNumSubstreams() > 1 && (uiCol == uiTileLCUX) )
    906 #else
    907       if ( pcSlice->getPPS()->getEntropyCodingSynchro() && (uiCol == uiTileLCUX) )
    908 #endif
    909858      {
    910859        // We'll sync if the TR is available.
     
    913862        UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
    914863        TComDataCU *pcCUTR = NULL;
    915 #if WPP_SIMPLIFICATION
    916864        if ( pcCUUp && ((uiCUAddr%uiWidthInCU+1) < uiWidthInCU)  )
    917865        {
    918866          pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 );
    919867        }
    920 #else
    921         if ( pcCUUp && ((uiCUAddr%uiWidthInCU+pcSlice->getPPS()->getEntropyCodingSynchro()) < uiWidthInCU)  )
    922         {
    923           pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + pcSlice->getPPS()->getEntropyCodingSynchro() );
    924         }
    925 #endif
    926868        if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    927869             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    928 #if !REMOVE_TILE_DEPENDENCE
    929              (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    930 #else
    931870             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    932 #endif
    933871             )||
    934872             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    935873             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getEntropySliceCurStartCUAddr()) ||
    936 #if !REMOVE_TILE_DEPENDENCE
    937              (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    938 #else
    939874             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    940 #endif
    941875             )
    942876           )
     
    975909#endif
    976910    }
    977 #if !REMOVE_TILE_DEPENDENCE
    978     if( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
    979     {
    980       // Synchronize cabac probabilities with LCU among Tiles
    981       if( (uiTileLCUX != 0) &&
    982           (uiCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr()) )
    983       {
    984         TComDataCU *pcCULeft = pcCU->getCULeft();
    985         UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
    986 
    987         if ( (true/*bEnforceSliceRestriction*/ &&
    988               ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||
    989                ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr())
    990               )
    991              )||
    992              (true/*bEnforceEntropySliceRestriction*/ &&
    993               ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||
    994                ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr())
    995               )
    996              )
    997            )
    998         {
    999           // Left not available.
    1000         }
    1001         else
    1002         {
    1003           // Left is available, we use it.
    1004           ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->loadContexts( &m_pcBufferLowLatSbacCoders[uiTileCol-1] );
    1005           m_pppcRDSbacCoder[0][CI_CURR_BEST]->loadContexts( ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST] ); //this load is used to simplify the code
    1006         }
    1007       }
    1008     }
    1009 #endif
    1010911    // if RD based on SBAC is used
    1011912    if( m_pcCfg->getUseSBACRD() )
     
    1045946       
    1046947         //Store probabilties of second LCU in line into buffer
    1047 #if WPP_SIMPLIFICATION
    1048948        if (pcSlice->getPPS()->getNumSubstreams() > 1 && uiCol == uiTileLCUX+1)
    1049 #else
    1050         if (pcSlice->getPPS()->getEntropyCodingSynchro() && uiCol == uiTileLCUX+pcSlice->getPPS()->getEntropyCodingSynchro())
    1051 #endif
    1052949        {
    1053950          m_pcBufferSbacCoders[uiTileCol].loadContexts(ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]);
    1054951        }
    1055952      }
    1056 #if !REMOVE_TILE_DEPENDENCE
    1057       if( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
    1058       {
    1059          //Store probabilties for next tile
    1060         if( (uiLin == (rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr() / uiWidthInLCUs )) &&
    1061             (uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getRightEdgePosInCU()) )
    1062         {
    1063           m_pcBufferLowLatSbacCoders[uiTileCol].loadContexts(ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]);
    1064         }
    1065       }
    1066 #endif
    1067953    }
    1068954    // other case: encodeCU is not called
     
    11481034  UInt uiWidthInLCUs  = rpcPic->getPicSym()->getFrameWidthInCU();
    11491035  UInt uiCol=0, uiLin=0, uiSubStrm=0;
    1150 #if !REMOVE_TILE_DEPENDENCE
    1151   Int  iBreakDep      = 0;
    1152 #endif
    11531036  UInt uiTileCol      = 0;
    11541037  UInt uiTileStartLCU = 0;
     
    11661049    if( m_pcCfg->getUseSBACRD() )
    11671050    {
    1168 #if !REMOVE_TILE_DEPENDENCE
    1169       iBreakDep = rpcPic->getPicSym()->getTileBoundaryIndependenceIdr();
    1170 #endif
    11711051      uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // what column of tiles are we in?
    11721052      uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr();
     
    11751055      uiCol     = uiCUAddr % uiWidthInLCUs;
    11761056      uiLin     = uiCUAddr / uiWidthInLCUs;
    1177 #if !REMOVE_TILE_DEPENDENCE
    1178 #if WPP_SIMPLIFICATION
    1179       if (iBreakDep && pcSlice->getPPS()->getNumSubstreams() > 1)
    1180 #else
    1181       if (iBreakDep && pcSlice->getPPS()->getEntropyCodingSynchro())
    1182 #endif
    1183 #else
    1184 #if WPP_SIMPLIFICATION
    11851057      if (pcSlice->getPPS()->getNumSubstreams() > 1)
    1186 #else
    1187       if (pcSlice->getPPS()->getEntropyCodingSynchro())
    1188 #endif
    1189 #endif
    11901058      {
    11911059        // independent tiles => substreams are "per tile".  iNumSubstreams has already been multiplied.
     
    12031071
    12041072      // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line.
    1205 #if WPP_SIMPLIFICATION
    12061073      if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiCol == uiTileLCUX))
    1207 #else
    1208       if (pcSlice->getPPS()->getEntropyCodingSynchro() && (uiCol == uiTileLCUX))
    1209 #endif
    12101074      {
    12111075        // We'll sync if the TR is available.
     
    12141078        UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
    12151079        TComDataCU *pcCUTR = NULL;
    1216 #if WPP_SIMPLIFICATION
    12171080        if ( pcCUUp && ((uiCUAddr%uiWidthInCU+1) < uiWidthInCU)  )
    12181081        {
    12191082          pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 );
    12201083        }
    1221 #else
    1222         if ( pcCUUp && ((uiCUAddr%uiWidthInCU+pcSlice->getPPS()->getEntropyCodingSynchro()) < uiWidthInCU)  )
    1223         {
    1224           pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + pcSlice->getPPS()->getEntropyCodingSynchro() );
    1225         }
    1226 #endif
    12271084        if ( (true/*bEnforceSliceRestriction*/ &&
    12281085             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    12291086             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    1230 #if !REMOVE_TILE_DEPENDENCE
    1231              (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    1232 #else
    12331087             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    1234 #endif
    12351088             ))||
    12361089             (true/*bEnforceEntropySliceRestriction*/ &&
    12371090             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    12381091             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getEntropySliceCurStartCUAddr()) ||
    1239 #if !REMOVE_TILE_DEPENDENCE
    1240              (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    1241 #else
    12421092             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
    1243 #endif
    12441093             ))
    12451094           )
     
    12751124        // When tiles are independent, we have "substreams per tile".  Each substream has already been terminated, and we no longer
    12761125        // have to perform it here.
    1277 #if WPP_SIMPLIFICATION
    12781126        if (pcSlice->getPPS()->getNumSubstreams() > 1)
    1279 #else
    1280         if (pcSlice->getPPS()->getEntropyCodingSynchro())
    1281 #endif
    12821127        {
    12831128          ; // do nothing.
     
    13291174
    13301175    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );   
    1331 #if !REMOVE_TILE_DEPENDENCE
    1332     if( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
    1333     {   
    1334       // Synchronize cabac probabilities with LCU among Tiles
    1335       if( (uiTileLCUX != 0) &&
    1336           (uiCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr()) )
    1337       {
    1338         TComDataCU *pcCULeft = pcCU->getCULeft();
    1339         UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
    1340 
    1341         if ( (true/*bEnforceSliceRestriction*/ &&
    1342               ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||
    1343                ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr())
    1344               )
    1345              )||
    1346              (true/*bEnforceEntropySliceRestriction*/ &&
    1347               ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) ||
    1348                ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr())
    1349               )
    1350              )
    1351            )
    1352         {
    1353           // Left not available.
    1354         }
    1355         else
    1356         {
    1357           // Left is available, we use it.
    1358           pcSbacCoders[uiSubStrm].loadContexts( &m_pcBufferLowLatSbacCoders[uiTileCol-1] );
    1359           m_pcSbacCoder->loadContexts(&pcSbacCoders[uiSubStrm]);  //this load is used to simplify the code (avoid to change all the call to m_pcSbacCoder)
    1360         }
    1361       }
    1362     }
    1363 #endif
    1364 
    1365 #if SAO_UNIT_INTERLEAVING
     1176
    13661177    if ( pcSlice->getSPS()->getUseSAO() && pcSlice->getAPS()->getSaoInterleavingFlag() && pcSlice->getSaoEnabledFlag() )
    13671178    {
     
    13731184      m_pcEntropyCoder->encodeSaoUnitInterleaving( rx, ry, pcSlice->getAPS()->getSaoParam(),pcCU, iCUAddrInSlice, iCUAddrUpInSlice, pcSlice->getSPS()->getLFCrossSliceBoundaryFlag());
    13741185    }
    1375 #endif
    13761186#if ENC_DEC_TRACE
    13771187    g_bJustDoIt = g_bEncDecTraceEnable;
     
    13951205
    13961206       //Store probabilties of second LCU in line into buffer
    1397 #if WPP_SIMPLIFICATION
    13981207      if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiCol == uiTileLCUX+1))
    1399 #else
    1400       if (pcSlice->getPPS()->getEntropyCodingSynchro() && (uiCol == uiTileLCUX+pcSlice->getPPS()->getEntropyCodingSynchro()))
    1401 #endif
    14021208      {
    14031209        m_pcBufferSbacCoders[uiTileCol].loadContexts( &pcSbacCoders[uiSubStrm] );
    14041210      }
    14051211    }
    1406 #if !REMOVE_TILE_DEPENDENCE
    1407     if( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
    1408     {
    1409       pcSbacCoders[uiSubStrm].load(m_pcSbacCoder);   //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder
    1410        //Store probabilties for next tile
    1411       if( (uiLin == (rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr() / uiWidthInLCUs )) &&
    1412           (uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getRightEdgePosInCU()) )
    1413       {
    1414         m_pcBufferLowLatSbacCoders[uiTileCol].loadContexts( &pcSbacCoders[uiSubStrm] );
    1415       }
    1416     }
    1417 #endif
    14181212
    14191213#if OL_QTLIMIT_PREDCODING_B0068
     
    14451239  TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx());
    14461240  UInt uiStartCUAddrSlice, uiBoundingCUAddrSlice;
    1447 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    14481241  UInt tileIdxIncrement;
    14491242  UInt tileIdx;
     
    14511244  UInt tileHeightInLcu;
    14521245  UInt tileTotalCount;
    1453 #endif
    14541246
    14551247  uiStartCUAddrSlice        = pcSlice->getSliceCurStartCUAddr();
     
    14691261      uiBoundingCUAddrSlice    = pcSlice->getSliceCurEndCUAddr();
    14701262      break;
    1471 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    14721263    case AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE:
    14731264      tileIdx                = rpcPic->getPicSym()->getTileIdxMap(
     
    14891280      uiBoundingCUAddrSlice    = ((uiStartCUAddrSlice + uiCUAddrIncrement) < uiNumberOfCUsInFrame*rpcPic->getNumPartInCU()) ? (uiStartCUAddrSlice + uiCUAddrIncrement) : uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    14901281      break;
    1491 #endif
    14921282    default:
    14931283      uiCUAddrIncrement        = rpcPic->getNumCUsInFrame();
     
    15061296      uiBoundingCUAddrSlice    = ((uiStartCUAddrSlice + uiCUAddrIncrement) < uiNumberOfCUsInFrame*rpcPic->getNumPartInCU()) ? (uiStartCUAddrSlice + uiCUAddrIncrement) : uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    15071297      break;
    1508 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    15091298    case AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE:
    15101299      tileIdx                = rpcPic->getPicSym()->getTileIdxMap(
     
    15261315      uiBoundingCUAddrSlice    = ((uiStartCUAddrSlice + uiCUAddrIncrement) < uiNumberOfCUsInFrame*rpcPic->getNumPartInCU()) ? (uiStartCUAddrSlice + uiCUAddrIncrement) : uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    15271316      break;
    1528 #endif
    15291317    default:
    15301318      uiCUAddrIncrement        = rpcPic->getNumCUsInFrame();
     
    15351323  }
    15361324
    1537 #if COMPLETE_SLICES_IN_TILE
    15381325  Bool tileBoundary = false;
    15391326  if ((m_pcCfg->getSliceMode() == AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE || m_pcCfg->getSliceMode() == AD_HOC_SLICES_FIXED_NUMBER_OF_BYTES_IN_SLICE) &&
     
    15581345    }
    15591346  }
    1560 #endif
    15611347
    15621348  // Entropy slice
     
    16631449      || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getEntropySliceMode()==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE)
    16641450      || (m_pcCfg->getSliceMode()==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE && m_pcCfg->getEntropySliceMode()==0)
    1665 #if FIXED_NUMBER_OF_TILES_SLICE_MODE
    16661451      || (m_pcCfg->getSliceMode()==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE && m_pcCfg->getEntropySliceMode()==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE)
    16671452      || (m_pcCfg->getSliceMode()==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE && m_pcCfg->getEntropySliceMode()==0)
    1668 #endif
    1669 #if COMPLETE_SLICES_IN_TILE
    16701453      || tileBoundary
    1671 #endif
    16721454)
    16731455    {
  • branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncTop.cpp

    r292 r294  
    103103  if (m_bUseSAO)
    104104  {
    105 #if SAO_UNIT_INTERLEAVING
    106105    m_cEncSAO.setSaoInterleavingFlag(getSaoInterleavingFlag());
    107106    m_cEncSAO.setMaxNumOffsetsPerPic(getMaxNumOffsetsPerPic());
    108 #endif
    109107    m_cEncSAO.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
    110108    m_cEncSAO.createEncBuffer();
     
    128126  if(m_bUseALF)
    129127  {
    130 #if LCU_SYNTAX_ALF
    131128    m_cAdaptiveLoopFilter.setAlfCoefInSlice(m_bALFParamInSlice);
    132129    m_cAdaptiveLoopFilter.createAlfGlobalBuffers();
    133 #else
    134     m_cAdaptiveLoopFilter.setGOPSize( getGOPSize() );
    135     m_cAdaptiveLoopFilter.createAlfGlobalBuffers(m_iALFEncodePassReduction);
    136 #endif
    137130  }
    138131
     
    333326  // initialize PPS
    334327  m_cPPS.setSPS(&m_cSPS);
    335 #if RPS_IN_SPS
    336328  m_cSPS.setRPSList(&m_RPSList);
    337 #else
    338   m_cPPS.setRPSList(&m_RPSList);
    339 #endif
    340329  xInitPPS();
    341330  xInitRPS();
     
    384373    m_cAdaptiveLoopFilter.setALFEncodePassReduction( m_iALFEncodePassReduction );
    385374    m_cAdaptiveLoopFilter.setALFMaxNumberFilters( m_iALFMaxNumberFilters );
    386 #if LCU_SYNTAX_ALF
    387375    m_cAdaptiveLoopFilter.initPicQuadTreePartition(m_bALFPicBasedEncode );   
    388 #endif
    389376  }
    390377
     
    553540  TComSlice::sortPicList(m_cListPic);
    554541 
    555 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    556542  if (m_cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) )
    557 #else
    558   if (m_cListPic.size() >= (UInt)(m_iGOPSize + getMaxNumberOfReferencePictures() + 2) )
    559 #endif
    560543  {
    561544    TComList<TComPic*>::iterator iterPic  = m_cListPic.begin();
     
    611594  m_cSPS.setPicWidthInLumaSamples         ( m_iSourceWidth      );
    612595  m_cSPS.setPicHeightInLumaSamples        ( m_iSourceHeight     );
    613 #if PIC_CROPPING
    614596  m_cSPS.setPicCroppingFlag( m_croppingMode!= 0 );
    615597  if (m_croppingMode != 0)
     
    620602    m_cSPS.setPicCropBottomOffset( m_cropBottom );
    621603  }
    622 #else
    623   m_cSPS.setPad           ( m_aiPad             );
    624 #endif
    625604  m_cSPS.setMaxCUWidth    ( g_uiMaxCUWidth      );
    626605  m_cSPS.setMaxCUHeight   ( g_uiMaxCUHeight     );
     
    629608  m_cSPS.setMaxTrDepth    ( 1                   );
    630609 
    631 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    632   m_cSPS.setMaxNumberOfReferencePictures(m_maxNumberOfReferencePictures);
    633   m_cSPS.setNumReorderFrames(m_numReorderFrames);
    634 #endif
    635610  m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize);
    636611  m_cSPS.setUsePCM        ( m_usePCM           );
     
    638613
    639614  m_cSPS.setUseALF        ( m_bUseALF           );
    640 #if LCU_SYNTAX_ALF
    641615  if(m_bUseALF)
    642616  {
    643617    m_cSPS.setUseALFCoefInSlice(m_bALFParamInSlice);
    644618  }
    645 #endif
    646619 
    647620#if RWTH_SDC_DLT_B0036
     
    657630  m_cSPS.setUseLossless   ( m_useLossless  );
    658631#endif
    659 #if !PIC_CROPPING
    660   m_cSPS.setUsePAD        ( m_bUsePAD           );
    661 #endif
    662632  m_cSPS.setUseLMChroma   ( m_bUseLMChroma           ); 
    663633 
     
    696666  m_cSPS.setBitDepth    ( g_uiBitDepth        );
    697667  m_cSPS.setBitIncrement( g_uiBitIncrement    );
    698 #if H0736_AVC_STYLE_QP_RANGE
    699668  m_cSPS.setQpBDOffsetY ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) );
    700669  m_cSPS.setQpBDOffsetC ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) );
    701 #endif
    702670
    703671  m_cSPS.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    704672  m_cSPS.setUseSAO( m_bUseSAO );
    705673
    706 #if !H0566_TLA
    707   if ( m_bTLayering )
    708   {
    709     Int iMaxTLayers = 1;
    710     for ( i = 1; ; i++)
    711     {
    712       iMaxTLayers = i;
    713       if ( (m_iGOPSize >> i) == 0 )
    714       {
    715         break;
    716       }
    717     }
    718  
    719     m_cSPS.setMaxTLayers( (UInt)iMaxTLayers );
    720 
    721     Bool bTemporalIdNestingFlag = true;
    722     for ( i = 0; i < m_cSPS.getMaxTLayers()-1; i++ )
    723     {
    724       if ( !m_abTLayerSwitchingFlag[i] )
    725       {
    726         bTemporalIdNestingFlag = false;
    727         break;
    728       }
    729     }
    730 
    731     m_cSPS.setTemporalIdNestingFlag( bTemporalIdNestingFlag );
    732   }
    733   else
    734   {
    735     m_cSPS.setMaxTLayers( 1 );
    736     m_cSPS.setTemporalIdNestingFlag( false );
    737   }
    738 #else
    739674  m_cSPS.setMaxTLayers( m_maxTempLayer );
    740675  m_cSPS.setTemporalIdNestingFlag( false );
    741 #endif
    742 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
    743676  for ( i = 0; i < m_cSPS.getMaxTLayers(); i++ )
    744677  {
     
    746679    m_cSPS.setNumReorderPics(m_numReorderPics[i], i);
    747680  }
    748 #endif
    749681  m_cSPS.setPCMBitDepthLuma (g_uiPCMBitDepthLuma);
    750682  m_cSPS.setPCMBitDepthChroma (g_uiPCMBitDepthChroma);
     
    753685  m_cSPS.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    754686  m_cSPS.setUniformSpacingIdr( m_iUniformSpacingIdr );
    755 #if !REMOVE_TILE_DEPENDENCE
    756   m_cSPS.setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );
    757 #endif
    758687  m_cSPS.setNumColumnsMinus1( m_iNumColumnsMinus1 );
    759688  m_cSPS.setNumRowsMinus1( m_iNumRowsMinus1 );
     
    827756  m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred );
    828757  m_cPPS.setSliceGranularity(m_iSliceGranularity);
    829 #if !H0566_TLA
    830   if ( m_cSPS.getTemporalIdNestingFlag() )
    831   {
    832     m_cPPS.setNumTLayerSwitchingFlags( 0 );
    833     for ( UInt i = 0; i < m_cSPS.getMaxTLayers() - 1; i++ )
    834     {
    835       m_cPPS.setTLayerSwitchingFlag( i, true );
    836     }
    837   }
    838   else
    839   {
    840     m_cPPS.setNumTLayerSwitchingFlags( m_cSPS.getMaxTLayers() - 1 );
    841     for ( UInt i = 0; i < m_cPPS.getNumTLayerSwitchingFlags(); i++ )
    842     {
    843       m_cPPS.setTLayerSwitchingFlag( i, m_abTLayerSwitchingFlag[i] );
    844     }
    845   }   
    846 #endif
    847758  Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
    848759
    849760#if LOSSLESS_CODING
    850 #if H0736_AVC_STYLE_QP_RANGE
    851761  Int lowestQP = - m_cSPS.getQpBDOffsetY();
    852 #else
    853   Int lowestQP = 0;
    854 #endif
    855762
    856763  if(getUseLossless())
     
    903810
    904811  m_cPPS.setEntropyCodingMode( 1 ); // In the PPS now, but also remains in slice header!
    905 #if !WPP_SIMPLIFICATION
    906   m_cPPS.setEntropyCodingSynchro(m_iWaveFrontSynchro);
    907   m_cPPS.setCabacIstateReset(m_iWaveFrontFlush != 0);
    908 #endif
    909812  m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams);
    910813  m_cPPS.setUseWP( m_bUseWeightPred );
    911814  m_cPPS.setWPBiPredIdc( m_uiBiPredIdc );
    912815  m_cPPS.setEnableTMVPFlag( m_bEnableTMVP );
    913 #if H0388
    914816  m_cPPS.setOutputFlagPresentFlag( false );
    915 #endif
    916 #if MULTIBITS_DATA_HIDING
    917817  m_cPPS.setSignHideFlag(getSignHideFlag());
    918818  m_cPPS.setTSIG(getTSIG());
    919 #endif
    920 #if DBL_CONTROL
    921819  m_cPPS.setDeblockingFilterControlPresent (m_DeblockingFilterControlPresent );
    922 #endif
    923 #if PARALLEL_MERGE
    924820  m_cPPS.setLog2ParallelMergeLevelMinus2      (LOG2_PARALLEL_MERGE_LEVEL_MINUS2);
    925 #endif
    926821#if CABAC_INIT_FLAG
    927822  m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
     
    1102997    m_cPPS.setColumnRowInfoPresent( m_iColumnRowInfoPresent );
    1103998    m_cPPS.setUniformSpacingIdr( m_iUniformSpacingIdr );
    1104 #if !REMOVE_TILE_DEPENDENCE
    1105     m_cPPS.setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr );
    1106 #endif
    1107999    m_cPPS.setNumColumnsMinus1( m_iNumColumnsMinus1 );
    11081000    m_cPPS.setNumRowsMinus1( m_iNumRowsMinus1 );
  • branches/HTM-5.1-dev0/source/Lib/TLibExtractor/TExtrTop.cpp

    r280 r294  
    7777  {
    7878     TComSPS cSPS;
    79 #if RPS_IN_SPS
    8079     TComRPSList cRPS;
    8180     cSPS.setRPSList( &cRPS );
    82 #endif
    8381#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
    8482#if VIDYO_VPS_INTEGRATION
  • branches/HTM-5.1-dev0/source/Lib/TLibVideoIO/TVideoIOYuv.cpp

    r56 r294  
    413413 * @return true for success, false in case of error
    414414 */
    415 #if PIC_CROPPING
    416415Bool TVideoIOYuv::write( TComPicYuv* pPicYuv, Int cropLeft, Int cropRight, Int cropTop, Int cropBottom )
    417 #else
    418 bool TVideoIOYuv::write( TComPicYuv* pPicYuv, Int aiPad[2] )
    419 #endif
    420416{
    421417  // compute actual YUV frame size excluding padding size
    422418  Int   iStride = pPicYuv->getStride();
    423 #if PIC_CROPPING
    424419  UInt  width  = pPicYuv->getWidth()  - cropLeft - cropRight;
    425420  UInt  height = pPicYuv->getHeight() - cropTop  - cropBottom;
    426 #else
    427   unsigned int width  = pPicYuv->getWidth() - aiPad[0];
    428   unsigned int height = pPicYuv->getHeight() - aiPad[1];
    429 #endif
    430421  bool is16bit = m_fileBitdepth > 8;
    431422  TComPicYuv *dstPicYuv = NULL;
     
    456447    dstPicYuv = pPicYuv;
    457448  }
    458 #if PIC_CROPPING
    459449  // location of upper left pel in a plane
    460450  Int planeOffset = 0; //cropLeft + cropTop * iStride;
    461451 
    462452  if (! writePlane(m_cHandle, dstPicYuv->getLumaAddr() + planeOffset, is16bit, iStride, width, height))
    463 #else
    464   if (! writePlane(m_cHandle, dstPicYuv->getLumaAddr(), is16bit, iStride, width, height))
    465 #endif
    466453  {
    467454    retval=false;
     
    472459  height >>= 1;
    473460  iStride >>= 1;
    474 #if PIC_CROPPING
    475461  cropLeft >>= 1;
    476462  cropRight >>= 1;
     
    479465
    480466  if (! writePlane(m_cHandle, dstPicYuv->getCbAddr() + planeOffset, is16bit, iStride, width, height))
    481 #else
    482   if (! writePlane(m_cHandle, dstPicYuv->getCbAddr(), is16bit, iStride, width, height))
    483 #endif
    484467  {
    485468    retval=false;
    486469    goto exit;
    487470  }
    488 #if PIC_CROPPING
    489471  if (! writePlane(m_cHandle, dstPicYuv->getCrAddr() + planeOffset, is16bit, iStride, width, height))
    490 #else
    491   if (! writePlane(m_cHandle, dstPicYuv->getCrAddr(), is16bit, iStride, width, height))
    492 #endif
    493472  {
    494473    retval=false;
  • branches/HTM-5.1-dev0/source/Lib/TLibVideoIO/TVideoIOYuv.h

    r56 r294  
    6969 
    7070  bool  read  ( TComPicYuv*   pPicYuv, Int aiPad[2], Bool bRewind = false );     ///< read  one YUV frame with padding parameter
    71 #if PIC_CROPPING
    7271  Bool  write( TComPicYuv*    pPicYuv, Int cropLeft=0, Int cropRight=0, Int cropTop=0, Int cropBottom=0 );
    73 #else
    74   bool  write ( TComPicYuv*   pPicYuv, Int aiPad[2] );     ///< write one YUV frame with padding parameter
    75 #endif
    7672 
    7773  bool  isEof ();                                           ///< check for end-of-file
Note: See TracChangeset for help on using the changeset viewer.