Changeset 655 in 3DVCSoftware


Ignore:
Timestamp:
23 Oct 2013, 23:01:30 (11 years ago)
Author:
tech
Message:

Merged 8.1-Cleanup@654

Location:
trunk
Files:
27 added
12 deleted
105 edited

Legend:

Unmodified
Added
Removed
  • trunk/cfg/3D-HEVC/fullCfg.cfg

    r622 r655  
    230230RCForceIntraQP                      : 0                # Rate control: force intra QP to be equal to initial QP
    231231
     232DepthMADPred                        : 0                # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view
     233TargetBitAssign                     : 0                # Manual assignment of target bit-rate
     234ViewWiseTargetBits                  : 950000 315000 358000      # View-wise target bit-rate setting
     235
     236#============ Rate Control URQ ======================
     237<<<<<<< .mine
     238#RateCtrl                         : 0                # 0: Disable rate control 1: Enable rate control with total target
     239#DepthMADPred                       : 0                # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view
     240#TargetBitAssign                    : 0                 # Manual assignment of target bit-rate
     241#ViewWiseTargetBits                 : 952 315 360       # View-wise target bit-rate setting
     242#TargetBitrate                       : 1500             # input target bitrate when RateCtrl is enable
     243#NumLCUInUnit                        : 1                # Number of LCU in an Unit. Fraction is not allowed
     244=======
     245#RateCtrl                           : 0                # 0: Disable rate control 1: Enable rate control with total target
     246#DepthMADPred                       : 0                # 0: Disable Depth based MAD prediction for extended view 1: Enable Depth based MAD prediction for extended view
     247#TargetBitAssign                    : 0                # Manual assignment of target bit-rate
     248#ViewWiseTargetBits                 : 952 315 360      # View-wise target bit-rate setting
     249#TargetBitrate                      : 1500             # input target bitrate when RateCtrl is enable
     250#NumLCUInUnit                       : 1                # Number of LCU in an Unit. Fraction is not allowed
     251>>>>>>> .r636
     252
    232253#========== multiview coding tools ==========
    233254IvMvPred                            : 1                # Inter-view motion prediction
  • trunk/cfg/HEVC/HM/encoder_intra_main.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/encoder_intra_main10.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main10
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/encoder_lowdelay_P_main.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/encoder_lowdelay_P_main10.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main10
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/encoder_lowdelay_main.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/encoder_lowdelay_main10.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main10
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/encoder_randomaccess_main.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/encoder_randomaccess_main10.cfg

    r608 r655  
    33ReconFile                     : rec.yuv
    44
    5 #======== Profile/Level ================
     5#======== Profile ================
    66Profile                       : main10
    7 Level                         : 6.2
    87
    98#======== Unit definition ================
  • trunk/cfg/HEVC/HM/per-sequence/BQMall.cfg

    r608 r655  
    77SourceHeight                  : 480         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 3.1
  • trunk/cfg/HEVC/HM/per-sequence/BQSquare.cfg

    r608 r655  
    77SourceHeight                  : 240         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 2.1
  • trunk/cfg/HEVC/HM/per-sequence/BQTerrace.cfg

    r608 r655  
    77SourceHeight                  : 1080        # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 4.1
  • trunk/cfg/HEVC/HM/per-sequence/BasketballDrill.cfg

    r608 r655  
    77SourceHeight                  : 480         # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 3.1
  • trunk/cfg/HEVC/HM/per-sequence/BasketballDrillText.cfg

    r608 r655  
    77SourceHeight                  : 480         # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 3.1
  • trunk/cfg/HEVC/HM/per-sequence/BasketballDrive.cfg

    r608 r655  
    77SourceHeight                  : 1080        # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 4.1
  • trunk/cfg/HEVC/HM/per-sequence/BasketballPass.cfg

    r608 r655  
    77SourceHeight                  : 240         # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 2.1
  • trunk/cfg/HEVC/HM/per-sequence/BlowingBubbles.cfg

    r608 r655  
    77SourceHeight                  : 240         # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 2.1
  • trunk/cfg/HEVC/HM/per-sequence/Cactus.cfg

    r608 r655  
    77SourceHeight                  : 1080        # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 4.1
  • trunk/cfg/HEVC/HM/per-sequence/ChinaSpeed.cfg

    r608 r655  
    77SourceHeight                  : 768         # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 3.1
  • trunk/cfg/HEVC/HM/per-sequence/FourPeople.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 4
  • trunk/cfg/HEVC/HM/per-sequence/Johnny.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 4
  • trunk/cfg/HEVC/HM/per-sequence/Kimono.cfg

    r608 r655  
    77SourceHeight                  : 1080        # Input  frame height
    88FramesToBeEncoded              : 240         # Number of frames to be coded
     9
     10Level                         : 4.0
  • trunk/cfg/HEVC/HM/per-sequence/KristenAndSara.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 4
  • trunk/cfg/HEVC/HM/per-sequence/NebutaFestival_10bit.cfg

    r608 r655  
    77SourceHeight                  : 1600        # Input  frame height
    88FramesToBeEncoded              : 300         # Number of frames to be coded
     9
     10Level                         : 5
  • trunk/cfg/HEVC/HM/per-sequence/ParkScene.cfg

    r608 r655  
    77SourceHeight                  : 1080        # Input  frame height
    88FramesToBeEncoded              : 240         # Number of frames to be coded
     9
     10Level                         : 4.0
  • trunk/cfg/HEVC/HM/per-sequence/PartyScene.cfg

    r608 r655  
    77SourceHeight                  : 480         # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 3.1
  • trunk/cfg/HEVC/HM/per-sequence/PeopleOnStreet.cfg

    r608 r655  
    77SourceHeight                  : 1600        # Input  frame height
    88FramesToBeEncoded              : 150         # Number of frames to be coded
     9
     10Level                         : 5
  • trunk/cfg/HEVC/HM/per-sequence/RaceHorses.cfg

    r608 r655  
    77SourceHeight                  : 240         # Input  frame height
    88FramesToBeEncoded              : 300         # Number of frames to be coded
     9
     10Level                         : 2
  • trunk/cfg/HEVC/HM/per-sequence/RaceHorsesC.cfg

    r608 r655  
    77SourceHeight                  : 480         # Input  frame height
    88FramesToBeEncoded              : 300         # Number of frames to be coded
     9
     10Level                         : 3
  • trunk/cfg/HEVC/HM/per-sequence/SlideEditing.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 300         # Number of frames to be coded
     9
     10Level                         : 3.1
  • trunk/cfg/HEVC/HM/per-sequence/SlideShow.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 500         # Number of frames to be coded
     9
     10Level                         : 3.1
  • trunk/cfg/HEVC/HM/per-sequence/SteamLocomotiveTrain_10bit.cfg

    r608 r655  
    77SourceHeight                  : 1600        # Input  frame height
    88FramesToBeEncoded              : 300         # Number of frames to be coded
     9
     10Level                         : 5
  • trunk/cfg/HEVC/HM/per-sequence/Traffic.cfg

    r608 r655  
    77SourceHeight                  : 1600        # Input  frame height
    88FramesToBeEncoded              : 150         # Number of frames to be coded
     9
     10Level                         : 5
  • trunk/cfg/HEVC/HM/per-sequence/Vidyo1.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 4
  • trunk/cfg/HEVC/HM/per-sequence/Vidyo3.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 4
  • trunk/cfg/HEVC/HM/per-sequence/Vidyo4.cfg

    r608 r655  
    77SourceHeight                  : 720         # Input  frame height
    88FramesToBeEncoded              : 600         # Number of frames to be coded
     9
     10Level                         : 4
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r622 r655  
    6060#endif
    6161{
    62   ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));
    6362#if H_MV
    6463  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1;
     
    148147
    149148  // main decoder loop
    150   Bool recon_opened = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
     149  Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
    151150#else
    152151#if H_3D
     
    176175#endif
    177176    AnnexBStats stats = AnnexBStats();
    178 #if !H_MV
    179     Bool bPreviousPictureDecoded = false;
    180 #endif
    181 
    182177    vector<uint8_t> nalUnit;
    183178    InputNALUnit nalu;
     
    246241#endif
    247242        }
    248 
    249        
    250243#else
    251244      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  )
    252245      {
    253         if(bPreviousPictureDecoded)
    254         {
    255           bNewPicture = true;
    256           bPreviousPictureDecoded = false;
    257         }
    258         else
    259         {
    260           bNewPicture = false;
    261         }
     246        bNewPicture = false;
    262247      }
    263248      else
     
    290275#endif
    291276        }
    292 #if !H_MV
    293         bPreviousPictureDecoded = true;
    294 #endif
    295277      }
    296278    }
     
    311293        TComPic* picLastCoded = m_ivPicLists.getPic( m_tDecTop[dI]->getLayerId(), pocLastPic );
    312294        assert( picLastCoded != NULL );       
    313 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    314295        picLastCoded->compressMotion(1);
    315 #else
    316         picLastCoded->compressMotion();         
    317 #endif
    318296      }
    319297    }
     
    325303      if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] )
    326304#else
    327       if ( m_pchReconFile && !recon_opened )
     305      if ( m_pchReconFile && !openedReconFile )
    328306#endif
    329307      {
     
    338316#else
    339317        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    340         recon_opened = true;
     318        openedReconFile = true;
    341319      }
    342320      if ( bNewPicture &&
     
    466444{
    467445  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    468   Int not_displayed = 0;
    469 
    470   while (iterPic != pcListPic->end())
    471   {
    472     TComPic* pcPic = *(iterPic);
    473 #if H_MV
    474     if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])
    475 #else
    476     if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay)
    477 #endif
    478     {
    479        not_displayed++;
    480     }
    481     iterPic++;
    482   }
    483   iterPic   = pcListPic->begin();
     446  Int numPicsNotYetDisplayed = 0;
    484447 
    485448  while (iterPic != pcListPic->end())
    486449  {
    487450    TComPic* pcPic = *(iterPic);
    488    
    489 #if H_MV
    490     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx]))
    491 #else
    492     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    493 #endif
    494     {
    495       // write to file
    496        not_displayed--;
     451#if H_MV
     452    if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])
     453#else
     454    if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay)
     455#endif
     456    {
     457      numPicsNotYetDisplayed++;
     458    }
     459    iterPic++;
     460  }
     461  iterPic   = pcListPic->begin();
     462  if (numPicsNotYetDisplayed>2)
     463  {
     464    iterPic++;
     465  }
     466 
     467  TComPic* pcPic = *(iterPic);
     468  if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding
     469  {
     470    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     471    endPic--;
     472    iterPic   = pcListPic->begin();
     473    while (iterPic != endPic)
     474    {
     475      TComPic* pcPicTop = *(iterPic);
     476      iterPic++;
     477      TComPic* pcPicBottom = *(iterPic);
     478     
     479#if H_MV
     480      if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
     481          && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx]<0)))
     482#else
     483      if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
     484          && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0)))
     485#endif
     486      {
     487        // write to file
     488        numPicsNotYetDisplayed = numPicsNotYetDisplayed-2;
    497489#if H_MV
    498490      if ( m_pchReconFiles[decIdx] )
    499491#else
    500       if ( m_pchReconFile )
    501 #endif
    502       {
    503         const Window &conf = pcPic->getConformanceWindow();
    504         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    505 #if H_MV
    506 #if H_MV5
     492        if ( m_pchReconFile )
     493#endif
     494        {
     495          const Window &conf = pcPicTop->getConformanceWindow();
     496          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     497
     498          const Bool isTff = pcPicTop->isTopField();
     499#if H_MV
    507500        assert( conf   .getScaledFlag() );
    508501        assert( defDisp.getScaledFlag() );
    509 #endif
     502        m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     503#else
     504          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     505#endif
     506                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     507                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     508                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     509                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     510        }
     511       
     512        // update POC of display order
     513#if H_MV
     514        m_pocLastDisplay[decIdx] = pcPic->getPOC();
     515#else
     516        m_iPOCLastDisplay = pcPicBottom->getPOC();
     517#endif
     518       
     519        // erase non-referenced picture in the reference picture list after display
     520        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     521        {
     522#if !DYN_REF_FREE
     523          pcPicTop->setReconMark(false);
     524         
     525          // mark it should be extended later
     526          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     527         
     528#else
     529          pcPicTop->destroy();
     530          pcListPic->erase( iterPic );
     531          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     532          continue;
     533#endif
     534        }
     535        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     536        {
     537#if !DYN_REF_FREE
     538          pcPicBottom->setReconMark(false);
     539         
     540          // mark it should be extended later
     541          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     542         
     543#else
     544          pcPicBottom->destroy();
     545          pcListPic->erase( iterPic );
     546          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     547          continue;
     548#endif
     549        }
     550        pcPicTop->setOutputMark(false);
     551        pcPicBottom->setOutputMark(false);
     552      }
     553    }
     554  }
     555  else if (!pcPic->isField()) //Frame Decoding
     556  {
     557    iterPic = pcListPic->begin();
     558    while (iterPic != pcListPic->end())
     559    {
     560      pcPic = *(iterPic);
     561
     562#if H_MV
     563      if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx]))
     564#else     
     565      if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
     566#endif
     567      {
     568        // write to file
     569        numPicsNotYetDisplayed--;
     570#if H_MV
     571      if ( m_pchReconFiles[decIdx] )
     572#else
     573        if ( m_pchReconFile )
     574#endif
     575        {
     576          const Window &conf = pcPic->getConformanceWindow();
     577          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     578#if H_MV
     579        assert( conf   .getScaledFlag() );
     580        assert( defDisp.getScaledFlag() );
    510581        m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    511582#else
    512         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    513 #endif
    514                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    515                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    516                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    517                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     583          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     584#endif
     585                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     586                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     587                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     588                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     589        }
     590       
     591        // update POC of display order
     592#if H_MV
     593        m_pocLastDisplay[decIdx] = pcPic->getPOC();
     594#else
     595        m_iPOCLastDisplay = pcPic->getPOC();
     596#endif
     597       
     598        // erase non-referenced picture in the reference picture list after display
     599        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     600        {
     601#if !DYN_REF_FREE
     602          pcPic->setReconMark(false);
     603         
     604          // mark it should be extended later
     605          pcPic->getPicYuvRec()->setBorderExtension( false );
     606         
     607#else
     608          pcPic->destroy();
     609          pcListPic->erase( iterPic );
     610          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     611          continue;
     612#endif
     613        }
     614        pcPic->setOutputMark(false);
    518615      }
    519616     
    520       // update POC of display order
    521 #if H_MV
    522       m_pocLastDisplay[decIdx] = pcPic->getPOC();
    523 #else
    524       m_iPOCLastDisplay = pcPic->getPOC();
    525 #endif
    526      
    527       // erase non-referenced picture in the reference picture list after display
    528       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    529       {
    530 #if !DYN_REF_FREE
    531         pcPic->setReconMark(false);
    532        
    533         // mark it should be extended later
    534         pcPic->getPicYuvRec()->setBorderExtension( false );
    535        
    536 #else
    537         pcPic->destroy();
    538         pcListPic->erase( iterPic );
    539         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    540         continue;
    541 #endif
    542       }
    543       pcPic->setOutputMark(false);
    544     }
    545    
    546     iterPic++;
    547   }
    548 }
    549 
     617      iterPic++;
     618    }
     619  }
     620}
    550621/** \param pcListPic list of pictures to be written to file
    551622    \todo            DYN_REF_FREE should be revised
     
    560631  {
    561632    return;
    562   } 
     633  }
    563634  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    564 
     635 
    565636  iterPic   = pcListPic->begin();
     637  TComPic* pcPic = *(iterPic);
    566638 
    567   while (iterPic != pcListPic->end())
    568   {
    569     TComPic* pcPic = *(iterPic);
    570 
    571     if ( pcPic->getOutputMark() )
    572     {
    573       // write to file
     639  if (pcPic->isField()) //Field Decoding
     640  {
     641    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     642    endPic--;
     643    TComPic *pcPicTop, *pcPicBottom = NULL;
     644    while (iterPic != endPic)
     645    {
     646      pcPicTop = *(iterPic);
     647      iterPic++;
     648      pcPicBottom = *(iterPic);
     649     
     650      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
     651      {
     652        // write to file
    574653#if H_MV
    575654      if ( m_pchReconFiles[decIdx] )
    576655#else
    577       if ( m_pchReconFile )
    578 #endif
    579       {
    580         const Window &conf = pcPic->getConformanceWindow();
    581         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    582 #if H_MV
    583 #if H_MV5
     656        if ( m_pchReconFile )
     657#endif
     658        {
     659          const Window &conf = pcPicTop->getConformanceWindow();
     660          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     661          const Bool isTff = pcPicTop->isTopField();
     662#if H_MV
    584663        assert( conf   .getScaledFlag() );
    585664        assert( defDisp.getScaledFlag() );
    586 #endif
     665        m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     666#else
     667          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     668#endif
     669                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     670                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     671                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     672                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     673        }
     674       
     675        // update POC of display order
     676#if H_MV
     677      m_pocLastDisplay[decIdx] = pcPic->getPOC();
     678#else
     679      m_iPOCLastDisplay = pcPicBottom->getPOC();
     680#endif       
     681        // erase non-referenced picture in the reference picture list after display
     682        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     683        {
     684#if !DYN_REF_FREE
     685          pcPicTop->setReconMark(false);
     686         
     687          // mark it should be extended later
     688          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     689         
     690#else
     691          pcPicTop->destroy();
     692          pcListPic->erase( iterPic );
     693          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     694          continue;
     695#endif
     696        }
     697        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     698        {
     699#if !DYN_REF_FREE
     700          pcPicBottom->setReconMark(false);
     701         
     702          // mark it should be extended later
     703          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     704         
     705#else
     706          pcPicBottom->destroy();
     707          pcListPic->erase( iterPic );
     708          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     709          continue;
     710#endif
     711        }
     712        pcPicTop->setOutputMark(false);
     713        pcPicBottom->setOutputMark(false);
     714       
     715#if !DYN_REF_FREE
     716        if(pcPicTop)
     717        {
     718          pcPicTop->destroy();
     719          delete pcPicTop;
     720          pcPicTop = NULL;
     721        }
     722#endif
     723      }
     724    }
     725    if(pcPicBottom)
     726    {
     727      pcPicBottom->destroy();
     728      delete pcPicBottom;
     729      pcPicBottom = NULL;
     730    }
     731  }
     732  else //Frame decoding
     733  {
     734    while (iterPic != pcListPic->end())
     735    {
     736      pcPic = *(iterPic);
     737     
     738      if ( pcPic->getOutputMark() )
     739      {
     740        // write to file
     741#if H_MV
     742      if ( m_pchReconFiles[decIdx] )
     743#else
     744        if ( m_pchReconFile )
     745#endif
     746        {
     747          const Window &conf = pcPic->getConformanceWindow();
     748          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     749#if H_MV
     750        assert( conf   .getScaledFlag() );
     751        assert( defDisp.getScaledFlag() );
    587752        m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    588753#else
    589         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    590 #endif
    591                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    592                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    593                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    594                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    595       }
    596      
    597       // update POC of display order
     754          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     755#endif
     756                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     757                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     758                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     759                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     760        }
     761       
     762        // update POC of display order
    598763#if H_MV
    599764      m_pocLastDisplay[decIdx] = pcPic->getPOC();
    600765#else
    601       m_iPOCLastDisplay = pcPic->getPOC();
    602 #endif
    603      
    604       // erase non-referenced picture in the reference picture list after display
    605       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    606       {
     766        m_iPOCLastDisplay = pcPic->getPOC();
     767#endif
     768       
     769        // erase non-referenced picture in the reference picture list after display
     770        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     771        {
    607772#if !DYN_REF_FREE
    608         pcPic->setReconMark(false);
    609        
    610         // mark it should be extended later
    611         pcPic->getPicYuvRec()->setBorderExtension( false );
    612        
    613 #else
    614         pcPic->destroy();
    615         pcListPic->erase( iterPic );
    616         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    617         continue;
    618 #endif
    619       }
    620       pcPic->setOutputMark(false);
    621     }
     773          pcPic->setReconMark(false);
     774         
     775          // mark it should be extended later
     776          pcPic->getPicYuvRec()->setBorderExtension( false );
     777         
     778#else
     779          pcPic->destroy();
     780          pcListPic->erase( iterPic );
     781          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     782          continue;
     783#endif
     784        }
     785        pcPic->setOutputMark(false);
     786      }
    622787#if !H_MV
    623788#if !DYN_REF_FREE
    624     if(pcPic)
    625     {
    626       pcPic->destroy();
    627       delete pcPic;
    628       pcPic = NULL;
    629     }
    630 #endif
    631 #endif
    632     iterPic++;
     789      if(pcPic)
     790      {
     791        pcPic->destroy();
     792        delete pcPic;
     793        pcPic = NULL;
     794      }
     795#endif   
     796#endif
     797      iterPic++;
     798    }
    633799  }
    634800#if H_MV
  • trunk/source/App/TAppDecoder/TAppDecTop.h

    r608 r655  
    7272#endif
    7373    // for output control
    74   Bool                            m_abDecFlag[ MAX_GOP ];         ///< decoded flag in one GOP
    7574#if H_MV
    7675  Int                             m_pocLastDisplay      [ MAX_NUM_LAYERS ]; ///< last POC in display order
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r622 r655  
    8282  m_codedPivotValue = NULL;
    8383  m_targetPivotValue = NULL;
     84
     85#if KWU_RC_MADPRED_E0227
     86  m_depthMADPred = 0;
     87#endif
    8488}
    8589
     
    224228    in>>entry.m_interViewRefPosL[1][i];
    225229  }
    226 #if !H_MV5
    227   if (entry.m_numActiveRefLayerPics > 0 )
    228   {
    229     in>>entry.m_collocatedRefLayerIdx;
    230   }
    231 #endif
    232230#endif
    233231  return in;
     
    369367  ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
    370368#if !H_3D
    371 #if H_MV5
    372369  ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask")   
    373 #else
    374   ("ScalabilityMask",       m_scalabilityMask    , 1                    , "Scalability Mask")   
    375 #endif
    376370#else
    377371  ("ScalabilityMask",       m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")   
    378372#endif 
    379373  ("DimensionIdLen",        m_dimensionIdLen     , cfg_dimensionLength  , "Number of bits used to store dimensions Id")
    380 #if H_MV5
    381374  ("ViewOrderIndex",        m_viewOrderIndex     , std::vector<Int>(1,0), "View Order Index per layer")
    382375  ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id per View Order Index")
    383 #else
    384   ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id")
    385 #endif
    386376#if H_3D
    387377  ("DepthFlag",             m_depthFlag          , std::vector<Int>(1,0), "Depth Flag")
     
    428418  ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
    429419
     420  //Field coding parameters
     421  ("FieldCoding", m_isField, false, "Signals if it's a field based coding")
     422  ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not")
     423 
    430424  // Profile and level
    431425  ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
     
    517511  ("IlluCompEnable",           m_abUseIC, std::vector<Bool>(2, true), "Enable illumination compensation")
    518512#endif
    519 #if LGE_INTER_SDC_E0156
     513#if H_3D_INTER_SDC
    520514  ("InterSDC",                 m_bDepthInterSDCFlag,        true, "Enable depth inter SDC")
    521515#endif
     
    594588  ( "InitialQP",           m_RCInitialQP,               0, "Rate control: initial QP" )
    595589  ( "RCForceIntraQP",      m_RCForceIntraQP,        false, "Rate control: force intra QP to be equal to initial QP" )
     590
     591#if KWU_RC_VIEWRC_E0227
     592  ("ViewWiseTargetBits, -vtbr" ,  m_viewTargetBits,  std::vector<Int>(1, 32), "View-wise target bit-rate setting")
     593  ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")
     594#endif
     595#if KWU_RC_MADPRED_E0227
     596  ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")
     597#endif
    596598#else
    597599  ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off")
    598600  ("TargetBitrate,-tbr", m_targetBitrate, 0, "Input target bitrate")
    599601  ("NumLCUInUnit,-nu", m_numLCUInUnit, 0, "Number of LCUs in an Unit")
    600 #endif
    601 
    602 #if H_MV5
     602
     603#if KWU_RC_VIEWRC_E0227
     604  ("ViewWiseTargetBits, -vtbr" ,  m_viewTargetBits,  std::vector<Int>(1, 32), "View-wise target bit-rate setting")
     605  ("TargetBitAssign, -ta", m_viewWiseRateCtrl, false, "View-wise rate control on/off")
     606#endif
     607#if KWU_RC_MADPRED_E0227
     608  ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")
     609#endif
     610#endif
     611
    603612#if H_MV
    604613  // VPS VUI
     
    617626  ("CtuBasedOffsetEnabledFlag"   , m_ctuBasedOffsetEnabledFlag   , std::vector< Bool >(1,0)  ,MAX_NUM_LAYERS       , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
    618627  ("MinHorizontalCtuOffsetPlus1" , m_minHorizontalCtuOffsetPlus1 , std::vector< Int  >(1,0)  ,MAX_NUM_LAYERS       , "MinHorizontalCtuOffsetPlus1  per direct reference for the N-th layer")
    619 #endif
    620628#endif
    621629
     
    762770    if( k == 0 )
    763771    {
    764 #if H_MV5
    765772      m_GOPListMvc[0][0].m_sliceType = 'I';
    766 #endif
    767773      for( Int i = 1; i < MAX_GOP + 1; i++ )
    768774      {
     
    810816  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
    811817
     818  if(m_isField)
     819  {
     820    //Frame height
     821    m_iSourceHeightOrg = m_iSourceHeight;
     822    //Field height
     823    m_iSourceHeight = m_iSourceHeight >> 1;
     824    //number of fields to encode
     825    m_framesToBeEncoded *= 2;
     826  }
     827 
    812828  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    813829  {
     
    928944        m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
    929945        m_iSourceHeight += m_confBottom;
     946        if ( m_isField )
     947        {
     948          m_iSourceHeightOrg += m_confBottom << 1;
     949          m_aiPad[1] = m_confBottom << 1;
     950        }
    930951      }
    931952      if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0)
     
    968989  // allocate slice-based dQP values
    969990#if H_MV
    970 #if H_MV5
    971991  xResizeVector( m_viewOrderIndex    );
    972992
     
    9881008#if H_3D
    9891009  xResizeVector( m_depthFlag );
    990 #endif
    991 #else
    992   xResizeVector( m_viewId    );
    993 #if H_3D
    994   xResizeVector( m_depthFlag );
    995 
    996   std::vector<Int> uniqueViewIds;
    997   for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    998   {   
    999     Bool isIn = false;
    1000     for ( Int i = 0 ; i < uniqueViewIds.size(); i++ )
    1001     {
    1002       isIn = isIn || ( m_viewId[ layer ] == uniqueViewIds[ i ] );
    1003     }
    1004     if ( !isIn )
    1005     {
    1006       uniqueViewIds.push_back( m_viewId[ layer ] );
    1007     }
    1008   }
    1009   m_iNumberOfViews = (Int) uniqueViewIds.size();
    1010 #endif
    1011 
    10121010#endif
    10131011  xResizeVector( m_fQP );
     
    12831281  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
    12841282 
    1285 #if H_MV5
    12861283#if H_3D
    12871284  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
     
    12981295
    12991296  m_dimIds.push_back( m_viewOrderIndex );   
    1300 #else
    1301 #if H_3D
    1302   xConfirmPara( m_scalabilityMask != 1 && m_scalabilityMask != 3, "Scalability Mask must be equal to 1 or 3. ");
    1303 #else
    1304   xConfirmPara( m_scalabilityMask != 1 , "Scalability Mask must be equal to 1. ");
    1305 #endif
    1306  
    1307   m_dimIds.push_back( m_viewId );
    1308   const Int viewDimPosition = 0;
    1309 #if H_3D
    1310   if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    1311     m_dimIds.push_back( m_depthFlag );
    1312 #endif
    1313 
    1314 #endif
    13151297  xConfirmPara(  m_dimensionIdLen.size() < m_dimIds.size(), "DimensionIdLen must be given for all dimensions. "   );   Int dimBitOffset[MAX_NUM_SCALABILITY_TYPES+1];
    13161298
     
    13291311  {   
    13301312    xConfirmPara( m_dimIds[j].size() < m_numberOfLayers,  "DimensionId must be given for all layers and all dimensions. ");   
    1331 #if H_MV5   
    13321313    xConfirmPara( (m_dimIds[j][0] != 0)                 , "DimensionId of layer 0 must be 0. " );
    1333 #else
    1334     xConfirmPara( ( j != viewDimPosition ) &&  (m_dimIds[j][0] != 0), "DimensionId of layer 0 must be 0. " );
    1335 #endif
    13361314    xConfirmPara( m_dimensionIdLen[j] < 1 || m_dimensionIdLen[j] > 8, "DimensionIdLen must be greater than 0 and less than 9 in all dimensions. " );
    13371315     
     
    13721350     xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    13731351
     1352#if !H_3D_FCO
    13741353     if ( numDiff  == 1 )
    13751354     {
    13761355       Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ];
    1377 #if H_MV5
    13781356       Bool shallBeButIsNotIncreasing = ( !inc  ) ;
    1379 #else
    1380        Bool shallBeButIsNotIncreasing = ( !inc && ( lastDiff != viewDimPosition ) ) ;
    1381 #endif
    13821357       if ( shallBeButIsNotIncreasing )
    13831358       {       
    13841359         printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);       
    13851360       }
    1386 #if H_MV5
    13871361       xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
    1388 #else
    1389        xConfirmPara( shallBeButIsNotIncreasing && ( lastDiff != viewDimPosition ),  "DimensionIds shall be increasing within one dimension. " );
    1390 #endif
    13911362     }
     1363#endif
    13921364   }
    13931365 }
    13941366
    1395 #if H_MV5
    13961367 /// ViewId
    13971368 xConfirmPara( m_viewId.size() != m_iNumberOfViews, "The number of ViewIds must be equal to the number of views." );
     
    13991370  /// Layer sets
    14001371  xConfirmPara( m_vpsNumLayerSets < 0 || m_vpsNumLayerSets > 1024, "VpsNumLayerSets must be greater than 0 and less than 1025. ") ;
    1401 #else
    1402   xConfirmPara( m_vpsNumLayerSets < 0 || m_vpsNumLayerSets > 1024, "VpsNumLayerSets must be greater than 0 and less than 1025") ;
    1403 #endif
    14041372  for( Int lsIdx = 0; lsIdx < m_vpsNumLayerSets; lsIdx++ )
    14051373  {
     
    17431711  Bool errorGOP=false;
    17441712  Int checkGOP=1;
    1745   Int numRefs = 1;
     1713  Int numRefs = m_isField ? 2 : 1;
    17461714  Int refList[MAX_NUM_REF_PICS+1];
    17471715  refList[0]=0;
     1716  if(m_isField)
     1717  {
     1718    refList[1] = 1;
     1719  }
    17481720  Bool isOK[MAX_GOP];
    17491721  for(Int i=0; i<MAX_GOP; i++)
     
    21572129    xConfirmPara( (numLCUInPic % m_numLCUInUnit) != 0, "total number of LCUs in a frame should be completely divided by NumLCUInUnit" );
    21582130
     2131#if !KWU_FIX_URQ
    21592132    m_iMaxDeltaQP       = MAX_DELTA_QP;
     2133#endif
    21602134    m_iMaxCuDQPDepth    = MAX_CUDQP_DEPTH;
    21612135  }
    21622136#endif
    2163 #if H_MV5
    21642137#if H_MV
    21652138  // VPS VUI
     
    21842157  }
    21852158#endif
    2186 #endif
    21872159
    21882160  xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagValue, "CUTransquantBypassFlagValue cannot be 1 when TransquantBypassEnableFlag is 0");
     
    22502222#endif
    22512223#if H_MV
    2252 #if H_MV5
    22532224  xPrintParaVector( "ViewIdVal"     , m_viewId );
    22542225  xPrintParaVector( "ViewOrderIndex", m_viewOrderIndex );
    2255 #else
    2256   xPrintParaVector( "ViewId", m_viewId );
    2257 #endif
    22582226#endif
    22592227#if H_3D
     
    22682236  printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
    22692237  printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     2238  if (m_isField)
     2239  {
     2240    printf("Frame/Field          : Field based coding\n");
     2241    printf("Field index          : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2242    if (m_isTopFieldFirst)
     2243    {
     2244      printf("Field Order            : Top field first\n");
     2245    }
     2246    else
     2247    {
     2248      printf("Field Order            : Bottom field first\n");
     2249    }
     2250  }
     2251  else
     2252  {
     2253    printf("Frame/Field                  : Frame based coding\n");
    22702254  printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2255  }
    22712256  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    22722257  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     
    22992284    printf("InitialQP                    : %d\n", m_RCInitialQP );
    23002285    printf("ForceIntraQP                 : %d\n", m_RCForceIntraQP );
     2286
     2287#if KWU_RC_MADPRED_E0227
     2288    printf("Depth based MAD prediction   : %d\n", m_depthMADPred);
     2289#endif
     2290#if KWU_RC_VIEWRC_E0227
     2291    printf("View-wise Rate control       : %d\n", m_viewWiseRateCtrl);
     2292    if(m_viewWiseRateCtrl)
     2293    {
     2294
     2295      printf("ViewWiseTargetBits           : ");
     2296      for (Int i = 0 ; i < m_iNumberOfViews ; i++)
     2297        printf("%d ", m_viewTargetBits[i]);
     2298      printf("\n");
     2299    }
     2300    else
     2301    {
     2302      printf("TargetBitrate                : %d\n", m_RCTargetBitrate );
     2303    }
     2304#endif
    23012305  }
    23022306#else
     
    23062310    printf("TargetBitrate                : %d\n", m_targetBitrate);
    23072311    printf("NumLCUInUnit                 : %d\n", m_numLCUInUnit);
     2312
     2313#if KWU_RC_MADPRED_E0227
     2314    printf("Depth based MAD prediction   : %d\n", m_depthMADPred);
     2315#endif
     2316#if KWU_RC_VIEWRC_E0227
     2317    printf("View-wise Rate control       : %d\n", m_viewWiseRateCtrl);
     2318    if(m_viewWiseRateCtrl)
     2319    {
     2320
     2321      printf("ViewWiseTargetBits           : ");
     2322      for (Int i = 0 ; i < m_iNumberOfViews ; i++)
     2323        printf("%d ", m_viewTargetBits[i]);
     2324      printf("\n");
     2325    }
     2326    else
     2327    {
     2328      printf("TargetBitrate                : %d\n", m_targetBitrate );
     2329    }
     2330#endif
    23082331  }
    23092332#endif
     
    24142437  printf("DLT:%d ", m_useDLT );
    24152438#endif
    2416 #if LGE_INTER_SDC_E0156
     2439#if H_3D_INTER_SDC
    24172440  printf( "interSDC: %d ", m_bDepthInterSDCFlag ? 1 : 0 );
    24182441#endif
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r622 r655  
    6969  std::vector<char*>     m_pchReconFileList;                  ///< output reconstruction file names
    7070  Int                    m_numberOfLayers;                    ///< number of Layers to Encode
    71 #if H_MV5
    7271  Int                    m_iNumberOfViews;                    ///< number of Layers that are views
    73 #else
    74 #if H_3D
    75   Int                    m_iNumberOfViews;                    ///< number of Layers that are views
    76 #endif
    77 #endif
    7872#else
    7973  Char*     m_pchReconFile;                                   ///< output reconstruction file
     
    8377  std::vector< std::vector<Int> > m_dimIds;                   ///< dimension ids ( pointers to m_viewId and m_depthFlag
    8478  std::vector<Int>       m_viewId;                            ///< view id
    85 #if H_MV5
    8679  std::vector<Int>       m_viewOrderIndex;                    ///< view order index 
    87 #endif
    8880#if H_3D
    8981  std::vector<Int>       m_depthFlag;                         ///< depth flag
     
    10698  std::vector< std::vector<Int> > m_dependencyTypes;          ///< Dependency types of direct reference layers
    10799
    108 #if H_MV5
    109100  // VPS VUI
    110101  Bool m_vpsVuiPresentFlag;
     
    122113  std::vector< std::vector<Bool > > m_ctuBasedOffsetEnabledFlag;
    123114  std::vector< std::vector<Int  > > m_minHorizontalCtuOffsetPlus1;
    124 #endif
    125115
    126116#if H_3D_IV_MERGE
     
    149139  UInt      m_FrameSkip;                                      ///< number of skipped frames from the beginning
    150140  Int       m_iSourceWidth;                                   ///< source width in pixel
    151   Int       m_iSourceHeight;                                  ///< source height in pixel
     141  Int       m_iSourceHeight;                                  ///< source height in pixel (when interlaced = field height)
     142 
     143  Int       m_iSourceHeightOrg;                               ///< original source height in pixel (when interlaced = frame height)
     144 
     145  bool      m_isField;                                        ///< enable field coding
     146  bool      m_isTopFieldFirst;
     147 
    152148  Int       m_conformanceMode;
    153149  Int       m_confLeft;
     
    367363  Int       m_RCInitialQP;                        ///< inital QP for rate control
    368364  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
     365
     366#if KWU_RC_VIEWRC_E0227
     367  vector<Int>     m_viewTargetBits;
     368  Bool      m_viewWiseRateCtrl;                              ///< Flag for using view-wise rate control
     369#endif
     370#if KWU_RC_MADPRED_E0227
     371  UInt       m_depthMADPred;
     372#endif
    369373#else
    370374  Bool      m_enableRateCtrl;                                   ///< Flag for using rate control algorithm
    371375  Int       m_targetBitrate;                                 ///< target bitrate
    372376  Int       m_numLCUInUnit;                                  ///< Total number of LCUs in a frame should be completely divided by the NumLCUInUnit
     377
     378#if KWU_RC_VIEWRC_E0227
     379  vector<Int>     m_viewTargetBits;
     380  Bool      m_viewWiseRateCtrl;                              ///< Flag for using view-wise rate control
     381#endif
     382#if KWU_RC_MADPRED_E0227
     383  UInt       m_depthMADPred;
     384#endif
    373385#endif
    374386  Int       m_useScalingListId;                               ///< using quantization matrix
     
    457469  Bool      m_bUsePC;                                         ///< flag for using Predictive Coding with QTL
    458470#endif
    459 #if LGE_INTER_SDC_E0156
     471#if H_3D_INTER_SDC
    460472  Bool m_bDepthInterSDCFlag;                                ///< flag for inter SDC of depth map coding
    461473#endif
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r622 r655  
    8888    vps.setTemporalNestingFlag(true);
    8989  }
    90 #if H_MV5
    9190  vps.setMaxLayersMinus1( m_numberOfLayers - 1);
    92 #else
    93   vps.setMaxLayers( m_numberOfLayers );
    94 #endif
    9591  for(Int i = 0; i < MAX_TLAYER; i++)
    9692  {
     
    124120  xSetDependencies( vps );
    125121  xSetProfileTierLevel     ( vps );
    126 #if H_MV5
    127122  xSetRepFormat            ( vps );
    128 #endif
    129123  xSetLayerSets            ( vps );
    130 #if H_MV5
    131124  xSetVPSVUI               ( vps );
    132 #endif
    133125#if H_3D
    134 #if !H_MV5
    135   vps.initViewIndex();
    136 #endif
    137126  xSetVPSExtension2        ( vps );
    138127  m_ivPicLists.setVPS      ( &vps );
     
    140129
    141130
    142 #if H_MV5
    143131  for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
    144 #else
    145   for(Int layer = 0; layer < m_numberOfLayers; layer++)
    146 #endif
    147132  {
    148133    m_frameRcvd                 .push_back(0);
     
    151136    m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv);
    152137    m_picYuvRec                 .push_back(new TComList<TComPicYuv*>) ;
    153 #if H_MV5   
    154138    m_ivPicLists.push_back( m_acTEncTopList[ layerIdInVps ]->getListPic()  );
    155139    TEncTop& m_cTEncTop = *m_acTEncTopList[ layerIdInVps ];  // It is not a member, but this name helps avoiding code duplication !!!
     
    160144    m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
    161145    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
    162 #else
    163     m_ivPicLists.push_back( m_acTEncTopList[ layer ]->getListPic()  );
    164     TEncTop& m_cTEncTop = *m_acTEncTopList[ layer ];  // It is not a member, but this name helps avoiding code duplication !!!
    165    
    166     m_cTEncTop.setLayerIdInVps                 ( layer );
    167     m_cTEncTop.setLayerId                      ( vps.getLayerIdInNuh( layer ) );   
    168     m_cTEncTop.setViewId                       ( vps.getViewId      ( layer ) );
    169 
    170 #endif
    171146#if H_3D
    172 #if H_MV5
    173147    Bool isDepth = ( vps.getDepthId     ( layerId ) != 0 ) ;
    174 #else
    175     Bool isDepth = ( vps.getDepthId     ( layer ) != 0 ) ;
    176     m_cTEncTop.setViewIndex                    ( vps.getViewIndex   ( layer ) );
    177 #endif
    178148    m_cTEncTop.setIsDepth                      ( isDepth );
    179149    //====== Camera Parameters =========
     
    201171    m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
    202172#endif // H_3D_VSO
    203 #if H_MV5
    204173#if H_3D_ARP
    205174    //====== Advanced Inter-view Residual Prediction =========
     
    209178#if H_3D_IC
    210179    m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 ? false : m_abUseIC[isDepth ? 1 : 0] );
    211 #endif
    212 #else
    213 #if H_3D_ARP
    214     //====== Advanced Inter-view Residual Prediction =========
    215     m_cTEncTop.setUseAdvRP                     ( ( isDepth || 0==layer ) ? 0 : m_uiUseAdvResPred );
    216     m_cTEncTop.setARPStepNum                   ( ( isDepth || 0==layer ) ? 1 : H_3D_ARP_WFNR     );
    217 #endif
    218 #if H_3D_IC
    219     m_cTEncTop.setUseIC                        ( vps.getViewIndex( layer ) == 0 ? false : m_abUseIC[isDepth ? 1 : 0] );
    220 #endif
    221180#endif
    222181  //========== Depth intra modes ==========
     
    232191#endif
    233192    //====== Depth Inter SDC =========
    234 #if LGE_INTER_SDC_E0156
     193#if H_3D_INTER_SDC
    235194    m_cTEncTop.setInterSDCEnable               ( isDepth ? m_bDepthInterSDCFlag    : false );
    236195#endif
     
    260219  m_cTEncTop.setGOPSize                      ( m_iGOPSize );
    261220#if H_MV
    262 #if H_MV5
    263221m_cTEncTop.setGopList                      ( m_GOPListMvc[layerIdInVps] );
    264222  m_cTEncTop.setExtraRPSs                    ( m_extraRPSsMvc[layerIdInVps] );
     
    269227  }
    270228#else
    271   m_cTEncTop.setGopList                      ( m_GOPListMvc[layer] );
    272   m_cTEncTop.setExtraRPSs                    ( m_extraRPSsMvc[layer] );
    273   for(Int i = 0; i < MAX_TLAYER; i++)
    274   {
    275     m_cTEncTop.setNumReorderPics             ( m_numReorderPicsMvc[layer][i], i );
    276     m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBufferingMvc[layer][i], i );
    277   }
    278 #endif
    279 #else
    280229  m_cTEncTop.setGopList                      ( m_GOPList );
    281230  m_cTEncTop.setExtraRPSs                    ( m_extraRPSs );
     
    291240  }
    292241#if H_MV
    293 #if H_MV5
    294242  m_cTEncTop.setQP                           ( m_iQP[layerIdInVps] );
    295243#else
    296   m_cTEncTop.setQP                           ( m_iQP[layer] );
    297 #endif
    298 #else
    299244  m_cTEncTop.setQP                           ( m_iQP );
    300245#endif
     
    303248
    304249#if H_MV
    305 #if H_MV5
    306250  m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayerMvc[layerIdInVps] );
    307251#else
    308   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayerMvc[layer] );
    309 #endif
    310 #else
    311252  m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayer );
    312253#endif
     
    317258  //====== Loop/Deblock Filter ========
    318259#if H_MV
    319 #if H_MV5
    320260  m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable[layerIdInVps]);
    321 #else
    322   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable[layer]);
    323 #endif
    324261#else
    325262  m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable       );
     
    351288
    352289#if H_MV
    353 #if H_MV5
    354290  if ((m_iMaxDeltaQP == 0 ) && (m_iQP[layerIdInVps] == lowestQP) && (m_useLossless == true))
    355 #else
    356   if ((m_iMaxDeltaQP == 0 ) && (m_iQP[layer] == lowestQP) && (m_useLossless == true))
    357 #endif
    358291#else
    359292  if ((m_iMaxDeltaQP == 0 ) && (m_iQP == lowestQP) && (m_useLossless == true))
     
    372305  m_cTEncTop.setUseLossless                  ( m_useLossless );
    373306#if H_MV
    374 #if H_MV5
    375307  m_cTEncTop.setdQPs                         ( m_aidQP[layerIdInVps]   );
    376 #else
    377   m_cTEncTop.setdQPs                         ( m_aidQP[layer]   );
    378 #endif
    379308#else
    380309  m_cTEncTop.setdQPs                         ( m_aidQP        );
     
    435364  m_cTEncTop.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    436365#if H_MV
    437 #if H_MV5
    438366  m_cTEncTop.setUseSAO ( m_bUseSAO[layerIdInVps] );
    439 #else
    440   m_cTEncTop.setUseSAO ( m_bUseSAO[layer] );
    441 #endif
    442367#else
    443368  m_cTEncTop.setUseSAO ( m_bUseSAO );
     
    512437  m_cTEncTop.setSignHideFlag(m_signHideFlag);
    513438#if RATE_CONTROL_LAMBDA_DOMAIN
    514   m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
     439#if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
     440  if(!m_cTEncTop.getIsDepth())    //only for texture
     441  {
     442    m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
     443  }
     444  else
     445  {
     446    m_cTEncTop.setUseRateCtrl         ( 0 );
     447  }
     448#else
     449    m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
     450#endif
     451#if !KWU_RC_VIEWRC_E0227
    515452  m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
     453#endif
    516454  m_cTEncTop.setKeepHierBit         ( m_RCKeepHierarchicalBit );
    517455  m_cTEncTop.setLCULevelRC          ( m_RCLCULevelRC );
     
    519457  m_cTEncTop.setInitialQP           ( m_RCInitialQP );
    520458  m_cTEncTop.setForceIntraQP        ( m_RCForceIntraQP );
    521 #else
    522   m_cTEncTop.setUseRateCtrl     ( m_enableRateCtrl);
    523   m_cTEncTop.setTargetBitrate   ( m_targetBitrate);
    524   m_cTEncTop.setNumLCUInUnit    ( m_numLCUInUnit);
     459
     460#if KWU_RC_MADPRED_E0227
     461  if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
     462  {
     463    m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred       : 0);
     464
     465    if(m_cTEncTop.getUseDepthMADPred())
     466    {
     467      m_cTEncTop.setCamParam(&m_cCameraData);
     468    }
     469  }
     470#endif
     471#if KWU_RC_VIEWRC_E0227
     472  if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
     473  {
     474    m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);
     475
     476    if(m_iNumberOfViews == 1)
     477    {
     478      if(m_viewWiseRateCtrl)
     479      {
     480        m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
     481      }
     482      else
     483      {
     484        m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
     485      }
     486    }
     487    else
     488    {
     489      if(m_viewWiseRateCtrl)
     490      {
     491        m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
     492      }
     493      else
     494      {
     495        if(m_iNumberOfViews == 2)
     496        {
     497          if(m_cTEncTop.getViewId() == 0)
     498          {
     499            m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*80)/100 );
     500          }
     501          else if(m_cTEncTop.getViewId() == 1)
     502          {
     503            m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*20)/100 );
     504          }
     505        }
     506        else if(m_iNumberOfViews == 3)
     507        {
     508          if(m_cTEncTop.getViewId() == 0)
     509          {
     510            m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*66)/100 );
     511          }
     512          else if(m_cTEncTop.getViewId() == 1)
     513          {
     514            m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*17)/100 );
     515          }
     516          else if(m_cTEncTop.getViewId() == 2)
     517          {
     518            m_cTEncTop.setTargetBitrate              ( (m_RCTargetBitrate*17)/100 );
     519          }
     520        }
     521        else
     522        {
     523          m_cTEncTop.setTargetBitrate              ( m_RCTargetBitrate );
     524        }
     525      }
     526    }
     527  }
     528#endif
     529#else
     530#if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
     531  if(!m_cTEncTop.getIsDepth())    //only for texture
     532  {
     533    m_cTEncTop.setUseRateCtrl         ( m_enableRateCtrl );
     534    m_cTEncTop.setTargetBitrate       ( m_targetBitrate );
     535    m_cTEncTop.setNumLCUInUnit        ( m_numLCUInUnit);
     536  }
     537  else
     538  {
     539    m_cTEncTop.setUseRateCtrl         ( 0 );
     540  }
     541#else
     542  m_cTEncTop.setUseRateCtrl         ( m_enableRateCtrl );
     543  m_cTEncTop.setTargetBitrate       ( m_targetBitrate );
     544  m_cTEncTop.setNumLCUInUnit        ( m_numLCUInUnit);
     545#endif
     546
     547 
     548#if KWU_RC_MADPRED_E0227
     549  if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
     550  {
     551    m_cTEncTop.setUseDepthMADPred(layerIdInVps ? m_depthMADPred       : 0);
     552
     553    if(m_cTEncTop.getUseDepthMADPred())
     554    {
     555      m_cTEncTop.setCamParam(&m_cCameraData);
     556    }
     557  }
     558#endif
     559
     560#if KWU_RC_VIEWRC_E0227
     561  if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
     562  {
     563    m_cTEncTop.setUseViewWiseRateCtrl(m_viewWiseRateCtrl);
     564    if(m_iNumberOfViews == 1)
     565    {
     566      if(m_viewWiseRateCtrl)
     567      {
     568        m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
     569      }
     570      else
     571      {
     572        m_cTEncTop.setTargetBitrate       ( m_targetBitrate );
     573      }
     574    }
     575    else
     576    {
     577      if(m_viewWiseRateCtrl)
     578      {
     579        m_cTEncTop.setTargetBitrate(m_viewTargetBits[layerIdInVps>>1]);
     580      }
     581      else
     582      {
     583        if(m_iNumberOfViews == 2)
     584        {
     585          if(m_cTEncTop.getViewId() == 0)
     586          {
     587            m_cTEncTop.setTargetBitrate              ( (m_targetBitrate*80)/100 );
     588          }
     589          else if(m_cTEncTop.getViewId() == 1)
     590          {
     591            m_cTEncTop.setTargetBitrate              ( (m_targetBitrate*20)/100 );
     592          }
     593        }
     594        else if(m_iNumberOfViews == 3)
     595        {
     596          if(m_cTEncTop.getViewId() == 0)
     597          {
     598            m_cTEncTop.setTargetBitrate              ( (m_targetBitrate*66)/100 );
     599          }
     600          else if(m_cTEncTop.getViewId() == 1)
     601          {
     602            m_cTEncTop.setTargetBitrate              ( (m_targetBitrate*17)/100 );
     603          }
     604          else if(m_cTEncTop.getViewId() == 2)
     605          {
     606            m_cTEncTop.setTargetBitrate              ( (m_targetBitrate*17)/100 );
     607          }
     608        }
     609        else
     610        {
     611          m_cTEncTop.setTargetBitrate              ( m_targetBitrate );
     612        }
     613      }
     614    }
     615  }
     616#endif
    525617#endif
    526618  m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
     
    664756}
    665757
    666 Void TAppEncTop::xInitLib()
     758Void TAppEncTop::xInitLib(Bool isFieldCoding)
    667759{
    668760#if H_MV
    669761  for(Int layer=0; layer<m_numberOfLayers; layer++)
    670762  {
    671     m_acTEncTopList[layer]->init( );
    672   }
    673 #else
    674   m_cTEncTop.init();
     763#if KWU_RC_MADPRED_E0227
     764    m_acTEncTopList[layer]->init( isFieldCoding, this );
     765#else
     766    m_acTEncTopList[layer]->init( isFieldCoding );
     767#endif
     768  }
     769#else
     770  m_cTEncTop.init( isFieldCoding );
    675771#endif
    676772}
     
    703799  xInitLibCfg();
    704800  xCreateLib();
    705   xInitLib();
     801  xInitLib(m_isField);
    706802 
    707803  // main encoder loop
     
    728824
    729825  // allocate original YUV buffer
     826  if( m_isField )
     827  {
     828    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     829  }
     830  else
     831  {
    730832  pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     833  }
    731834 
    732835#if H_MV
     
    789892      }
    790893    }
     894
     895#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ
     896    for(Int layer=0; layer < m_numberOfLayers; layer++ )
     897    {
     898      if(m_acTEncTopList[layer]->getUseRateCtrl()  && !m_acTEncTopList[layer]->getIsDepth())
     899      {
     900        m_acTEncTopList[layer]->getRateCtrl()->updateRCGOPStatus();
     901      }
     902    }
     903#endif
     904
    791905    gopSize = maxGopSize;
    792906  }
    793907  for(Int layer=0; layer < m_numberOfLayers; layer++ )
    794908  {
    795     m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded() );
     909    m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded(), m_isField );
    796910  }
    797911#else
     
    807921    m_iFrameRcvd++;
    808922
    809     bEos = (m_iFrameRcvd == m_framesToBeEncoded);
     923    bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
    810924
    811925    Bool flush = 0;
     
    820934
    821935    // call encoding function for one frame
     936    if ( m_isField )
     937    {
     938      m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst);
     939    }
     940    else
     941    {
    822942    m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
     943    }
    823944   
    824945    // write bistream to file if necessary
     
    830951  }
    831952
    832   m_cTEncTop.printSummary();
     953  m_cTEncTop.printSummary(m_isField);
    833954#endif
    834955
     
    9411062#endif
    9421063{
    943   Int i;
    944  
    945 #if H_MV
    946   if( iNumEncoded > 0 )
    947   {
    948     TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[layerId]->end();
    949 #else
    950   TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
    951   list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
    952 #endif
    953 
    954   for ( i = 0; i < iNumEncoded; i++ )
    955   {
    956     --iterPicYuvRec;
    957   }
    958  
    959   for ( i = 0; i < iNumEncoded; i++ )
    960   {
    961     TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
     1064  if (m_isField)
     1065  {
     1066    //Reinterlace fields
     1067    Int i;
     1068#if H_MV
     1069    if( iNumEncoded > 0 )
     1070    {
     1071      TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[layerId]->end();
     1072#else
     1073    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
     1074    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     1075#endif
     1076
     1077    for ( i = 0; i < iNumEncoded; i++ )
     1078    {
     1079      --iterPicYuvRec;
     1080    }
     1081
     1082    for ( i = 0; i < iNumEncoded/2; i++ )
     1083    {
     1084      TComPicYuv*  pcPicYuvRecTop  = *(iterPicYuvRec++);
     1085      TComPicYuv*  pcPicYuvRecBottom  = *(iterPicYuvRec++);
     1086
    9621087#if H_MV
    9631088      if (m_pchReconFileList[layerId])
    9641089      {
    965         m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom );
    966       }
    967     }
    968   }
     1090        m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confLeft, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst );
     1091      }
     1092    }
     1093  }
     1094
    9691095  if( ! accessUnits.empty() )
    9701096  {
     
    9721098    for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ )
    9731099    {
     1100      const vector<UInt>& stats = writeAnnexB(bitstreamFile, *aUIter);
     1101      rateStatsAccum(*aUIter, stats);
     1102    }
     1103  }
     1104#else
     1105      if (m_pchReconFile)
     1106      {
     1107        m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confLeft, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst );
     1108      }
     1109
     1110      const AccessUnit& auTop = *(iterBitstream++);
     1111      const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop);
     1112      rateStatsAccum(auTop, statsTop);
     1113
     1114      const AccessUnit& auBottom = *(iterBitstream++);
     1115      const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom);
     1116      rateStatsAccum(auBottom, statsBottom);
     1117    }
     1118#endif
     1119  }
     1120  else
     1121  {
     1122    Int i;
     1123#if H_MV
     1124    if( iNumEncoded > 0 )
     1125    {
     1126      TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[layerId]->end();
     1127#else
     1128    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
     1129    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     1130#endif
     1131
     1132    for ( i = 0; i < iNumEncoded; i++ )
     1133    {
     1134      --iterPicYuvRec;
     1135    }
     1136
     1137    for ( i = 0; i < iNumEncoded; i++ )
     1138    {
     1139      TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
     1140#if H_MV
     1141      if (m_pchReconFileList[layerId])
     1142      {
     1143        m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom );
     1144      }   
     1145    }
     1146  }
     1147  if( ! accessUnits.empty() )
     1148  {
     1149    list<AccessUnit>::iterator aUIter;
     1150    for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ )
     1151    {
    9741152      const vector<unsigned>& stats = writeAnnexB(bitstreamFile, *aUIter);
    9751153      rateStatsAccum(*aUIter, stats);
     
    9771155  }
    9781156#else
    979     if (m_pchReconFile)
    980     {
    981       m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom );
    982     }
    983 
    984     const AccessUnit& au = *(iterBitstream++);
    985     const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);
    986     rateStatsAccum(au, stats);
    987   }
    988 #endif
    989 }
    990 
     1157      if (m_pchReconFile)
     1158      {
     1159        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom );
     1160      }
     1161
     1162      const AccessUnit& au = *(iterBitstream++);
     1163      const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);
     1164      rateStatsAccum(au, stats);   
     1165    }
     1166#endif   
     1167  }
     1168}
     1169 
    9911170/**
    9921171 *
     
    11211300Void TAppEncTop::xSetDimensionIdAndLength( TComVPS& vps )
    11221301{   
    1123 #if H_MV5
    11241302  vps.setScalabilityMaskFlag( m_scalabilityMask );
    1125 #else
    1126   vps.setScalabilityMask( m_scalabilityMask );
    1127 #endif
    11281303  for( Int dim = 0; dim < m_dimIds.size(); dim++ )
    11291304  {
    11301305    vps.setDimensionIdLen( dim, m_dimensionIdLen[ dim ] );
    1131 #if H_MV5
    11321306    for( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
    1133 #else
    1134     for( Int layer = 0; layer < vps.getMaxLayers(); layer++ )
    1135 #endif
    11361307
    11371308    {       
     
    11401311  }
    11411312
    1142 #if H_MV5
    11431313  Int maxViewId = xGetMax( m_viewId );
    11441314
     
    11531323
    11541324  assert( m_iNumberOfViews == vps.getNumViews() );
    1155 #endif
    11561325}
    11571326
     
    11801349
    11811350  // Max temporal id for inter layer reference pictures + presence flag
    1182 #if H_MV5
    11831351  Bool maxTidRefPresentFlag = false;
    1184 #endif
    11851352  for ( Int refLayerIdInVps = 0; refLayerIdInVps < m_numberOfLayers; refLayerIdInVps++)
    11861353    {
     
    12031370    }
    12041371    vps.setMaxTidIlRefPicPlus1( refLayerIdInVps, maxTid + 1 );
    1205 #if H_MV5
    12061372    maxTidRefPresentFlag = maxTidRefPresentFlag || ( maxTid != 6 );   
    1207 #endif
    1208   }
    1209 
    1210 #if H_MV5
     1373  }
     1374
    12111375  vps.setMaxTidRefPresentFlag( maxTidRefPresentFlag );
    1212 #endif
    12131376  // Max one active ref layer flag
    12141377  Bool maxOneActiveRefLayerFlag = true; 
    1215 #if H_MV5
    12161378  for ( Int layerIdInVps = 1; layerIdInVps < m_numberOfLayers && maxOneActiveRefLayerFlag; layerIdInVps++)
    1217 #else
    1218   for ( Int currLayerIdInVps = 1; currLayerIdInVps < m_numberOfLayers && maxOneActiveRefLayerFlag; currLayerIdInVps++)
    1219 #endif
    12201379  {
    12211380    for( Int i = 0; i < ( getGOPSize() + 1) && maxOneActiveRefLayerFlag; i++ )
    12221381    {       
    1223 #if H_MV5
    12241382      GOPEntry ge =  m_GOPListMvc[layerIdInVps][ ( i < getGOPSize()  ? i : MAX_GOP ) ];
    1225 #else
    1226       GOPEntry ge =  m_GOPListMvc[currLayerIdInVps][ ( i < getGOPSize()  ? i : MAX_GOP ) ];
    1227 #endif
    12281383      maxOneActiveRefLayerFlag =  maxOneActiveRefLayerFlag && (ge.m_numActiveRefLayerPics <= 1);
    12291384    }           
     
    12331388 
    12341389 
    1235 #if H_MV5
    12361390  // All Ref layers active flag
    12371391  Bool allRefLayersActiveFlag = true;
     
    12491403  // Currently cross layer irap aligned is always true.   
    12501404  vps.setCrossLayerIrapAlignedFlag( true );
    1251 #endif
    12521405  vps.setRefLayers();
    12531406};
    12541407
    1255 #if H_MV5
    12561408GOPEntry* TAppEncTop::xGetGopEntry( Int layerIdInVps, Int poc )
    12571409{
     
    12681420  return geFound;
    12691421}
    1270 #endif
    12711422
    12721423Void TAppEncTop::xSetLayerIds( TComVPS& vps )
     
    13081459}
    13091460
    1310 #if H_MV5
    13111461
    13121462Void TAppEncTop::xSetRepFormat( TComVPS& vps )
     
    13331483  }
    13341484}
    1335 #endif
    13361485
    13371486Void TAppEncTop::xSetLayerSets( TComVPS& vps )
     
    13861535  }
    13871536}
    1388 #if H_MV5
    13891537
    13901538Void TAppEncTop::xSetVPSVUI( TComVPS& vps )
     
    14781626}
    14791627#endif
    1480 #endif
    14811628#if H_3D
    14821629Void TAppEncTop::xSetVPSExtension2( TComVPS& vps )
    14831630{
    1484 #if H_MV5
    14851631
    14861632  for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
    1487 #else
    1488   for ( Int layer = 0; layer < vps.getMaxLayers(); layer++ )
    1489 #endif
    14901633  {
    14911634    Bool isDepth      = ( vps.getDepthId( layer ) == 1 ) ;
     
    15171660    vps.setViewSynthesisPredFlag( layer, !isLayerZero && !isDepth && m_viewSynthesisPredFlag );         
    15181661#endif     
    1519 #if LGE_INTER_SDC_E0156
     1662#if H_3D_INTER_SDC
    15201663    vps.setInterSDCFlag( layer, !isLayerZero && isDepth && m_bDepthInterSDCFlag );
    15211664#endif
  • trunk/source/App/TAppEncoder/TAppEncTop.h

    r622 r655  
    5050#endif
    5151
     52#if KWU_RC_MADPRED_E0227
     53class TEncTop;
     54#endif
    5255//! \ingroup TAppEncoder
    5356//! \{
     
    9396  Void  xCreateLib        ();                               ///< create files & encoder class
    9497  Void  xInitLibCfg       ();                               ///< initialize internal variables
    95   Void  xInitLib          ();                               ///< initialize encoder class
     98  Void  xInitLib          (Bool isFieldCoding);             ///< initialize encoder class
    9699  Void  xDestroyLib       ();                               ///< destroy encoder class
    97100 
     
    121124  Void xSetLayerSets              ( TComVPS& vps );
    122125  Void xSetProfileTierLevel       ( TComVPS& vps );
    123 #if H_MV5
    124126  Void xSetRepFormat              ( TComVPS& vps );
    125127  Void xSetVPSVUI                 ( TComVPS& vps );
    126128  GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc );
    127 #endif
    128129  Int  xGetMax( std::vector<Int>& vec);
    129130#endif
  • trunk/source/Lib/TAppCommon/TAppComCamPara.cpp

    r608 r655  
    615615{
    616616  UInt uiFoundLine = -1;
    617 #if H_3D_FIX_REN_WARNING
    618617  if ( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) && xIsIn( m_aiSortedBaseViews, iView ))
    619 #else 
    620   if ( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) )
    621 #endif
    622618  {
    623619    AOT( m_aadCameraParameters[ uiFoundLine ].size() < 6 );
     
    635631    Int  iDummy;
    636632
    637 #if H_3D_FIX_REN_WARNING
    638633    if( !xGetLeftRightView( iView, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy ) ||
    639 #else
    640     if( !xGetLeftRightView( iView, m_aiViewsInCfgFile, iLeftView, iRightView, iDummy, iDummy ) ||
    641 #endif
    642634         xGetCameraDataRow( iLeftView,  uiFrame, uiLeftViewLine  )                             ||
    643635         xGetCameraDataRow( iRightView, uiFrame, uiRightViewLine )
    644636      )
    645637    {
    646 #if H_3D_FIX_REN_WARNING
    647638      std::cerr << "No left or no right base view next to view " << (Double)iView / m_dViewNumPrec << " for Frame " << uiFrame << " given in CameraParameterFile" << std::endl;
    648 #else
    649       std::cerr << "No Left or no Right View next to View " << (Double)iView / m_dViewNumPrec << " for Frame " << uiFrame << " given in CameraParameterFile" << std::endl;
    650 #endif
    651639      AOT(true);
    652640      exit( EXIT_FAILURE );
     
    13521340      }
    13531341    }
    1354 #if H_3D_FIX_REN_WARNING
     1342
    13551343    Bool bIgnoreFirst = true;     
    13561344    for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )
     
    13711359      std::cout << std::endl;
    13721360    }
    1373 #endif
    13741361
    13751362    Bool bInterpolateFirst = true;
     
    13901377        if ( bInterpolateFirst )
    13911378        {
    1392 #if H_3D_FIX_REN_WARNING                       
    13931379          std::cout << "Interpolating camera parameters      for virtual view(s): " ;
    1394 #else
    1395           std::cout << "Interpolating Camera Parameters for View(s) " ;
    1396 #endif
    13971380            bInterpolateFirst = false;
    13981381        }         
     
    14981481}
    14991482
    1500 #if H_3D_FIX_REN_WARNING
    15011483Bool
    15021484  TAppComCamPara::xIsIn( std::vector<Int>& rVec, Int iElem)
     
    15091491  return bFound;
    15101492}
    1511 #endif
    15121493
    15131494Int TAppComCamPara::getRelDistLeft( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx )
  • trunk/source/Lib/TAppCommon/TAppComCamPara.h

    r608 r655  
    125125  Bool  xGetLeftRightView         ( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx );
    126126  Void  xGetPrevAndNextBaseView   ( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum );
     127#if !KWU_RC_MADPRED_E0227
    127128  Void  xGetZNearZFar             ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar );
    128129  Void  xGetGeometryData          ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated );
     130#endif
    129131  Void  xSetupBaseViewsFromCoded  ();
    130132  Void  xSetupBaseViews           ( Char* pchBaseViewNumbers, UInt uiNumBaseViews );
    131 #if H_3D_FIX_REN_WARNING
    132133  Bool  xIsIn                     ( std::vector<Int>& rVec, Int iNumber);
    133 #endif
    134 
    135134
    136135  // functions for getting and setting scales and offsets
     
    220219  Int**               getCodedScale             ()  { return m_aaiCodedScale;           }
    221220  Int**               getCodedOffset            ()  { return m_aaiCodedOffset;          }
     221
     222#if KWU_RC_MADPRED_E0227
     223  Void  xGetZNearZFar             ( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar );
     224  Void  xGetGeometryData          ( Int dView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated );
     225#endif
    222226};
    223227
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r625 r655  
    6161#if H_MV
    6262#define NV_VERSION        "8.1"                 ///< Current software version
    63 #define HM_VERSION        "11.0"                ///<
     63#define HM_VERSION        "12.0"                ///<
    6464#else
    65 #define NV_VERSION        "11.0"                 ///< Current software version
     65#define NV_VERSION        "12.0"                 ///< Current software version
    6666#endif
    6767
     
    187187}
    188188
    189 #if H_MV5
    190189template <typename T>
    191190__inline T gCeilLog2( T val )
     
    196195  return ceilLog2;
    197196}
    198 #endif
    199197
    200198#define RemoveBitIncrement( exp ) ( exp >> ( g_bitDepthY - 8 ) )
  • trunk/source/Lib/TLibCommon/ContextTables.h

    r622 r655  
    112112#if H_3D_DIM_DMM
    113113#define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
    114 #if !SEC_DMM2_E0146_HHIFIX
    115 #define NUM_DMM2_DATA_CTX             1       ///< number of context models for DMM2 data
    116 #endif
    117114#define NUM_DMM3_DATA_CTX             1       ///< number of context models for DMM3 data
    118115#endif
     
    127124#endif
    128125
    129 #if LGE_INTER_SDC_E0156
     126#if H_3D_INTER_SDC
    130127#define NUM_INTER_SDC_FLAG_CTX        1      ///< number of context models for inter SDC flag
    131128#define NUM_INTER_SDC_SIGN_FLAG_CTX   1      ///< number of context models for sign of inter SDC residual
     
    390387#endif
    391388#if H_3D_DIM
    392 #if ZJU_DEPTH_INTRA_MODE_E0204
    393389static const UChar
    394390INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
     
    398394    {64, 0, CNU, CNU, 168, 109,   0, 0}
    399395};
    400 #else
    401 static const UChar
    402 INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
    403 {
    404   {0,  0,  64,   0, CNU,   0, CNU, 0},
    405   {0, 64,   0, CNU,   0, CNU,   0, 0},
    406   {64, 0, CNU,   0, CNU,   0,   0, 0}
    407 };
    408 #endif
     396
    409397static const UChar
    410398INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] =
     
    429417  { CNU },
    430418};
    431 #if !SEC_DMM2_E0146_HHIFIX
    432 static const UChar
    433 INIT_DMM2_DATA[3][NUM_DMM2_DATA_CTX] =
    434 {
    435   { CNU },
    436   { CNU },
    437   { CNU },
    438 };
    439 #endif
    440419static const UChar
    441420INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] =
     
    473452#endif
    474453
    475 #if LGE_INTER_SDC_E0156
     454#if H_3D_INTER_SDC
    476455static const UChar
    477456INIT_INTER_SDC_FLAG[3][NUM_INTER_SDC_FLAG_CTX] =
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r622 r655  
    120120    m_dmmWedgeTabIdx[i] = NULL;
    121121  }
    122 #if !SEC_DMM2_E0146_HHIFIX
    123   m_dmm2DeltaEnd    = NULL;
    124 #endif
    125122  m_dmm3IntraTabIdx = NULL;
    126123#endif
     
    153150  m_pbICFlag             = NULL;
    154151#endif
    155 #if LGE_INTER_SDC_E0156
     152#if H_3D_INTER_SDC
    156153  m_pbInterSDCFlag       = NULL;
    157154  for( Int i = 0; i < 4; i++ )
     
    274271      m_dmmWedgeTabIdx[i]    = (UInt*)xMalloc(UInt, uiNumPartition);
    275272    }
    276 #if !SEC_DMM2_E0146_HHIFIX
    277     m_dmm2DeltaEnd    = (Int* )xMalloc(Int,  uiNumPartition);
    278 #endif
    279273    m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition);
    280274#endif
     
    292286#endif
    293287#endif
    294 #if LGE_INTER_SDC_E0156
     288#if H_3D_INTER_SDC
    295289    m_pbInterSDCFlag     = (Bool*  )xMalloc(Bool,   uiNumPartition);
    296290    for( Int i = 0; i < 4; i++ )
     
    305299    m_acCUMvField[1].setNumPartition(uiNumPartition );
    306300  }
    307 #if LGE_INTER_SDC_E0156
     301#if H_3D_INTER_SDC
    308302  m_pucInterSDCMask     = (UChar*  )xMalloc(UChar,    g_uiMaxCUHeight*g_uiMaxCUWidth);
    309303#endif
     
    410404      if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }
    411405    }
    412 #if !SEC_DMM2_E0146_HHIFIX
    413     if ( m_dmm2DeltaEnd    ) { xFree( m_dmm2DeltaEnd    ); m_dmm2DeltaEnd    = NULL; }
    414 #endif
    415406    if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; }
    416407#endif
     
    428419#endif
    429420#endif   
    430 #if LGE_INTER_SDC_E0156
     421#if H_3D_INTER_SDC
    431422    if ( m_pbInterSDCFlag     ) { xFree(m_pbInterSDCFlag);      m_pbInterSDCFlag    = NULL; }
    432423    for(Int i = 0; i < 4; i++ )
     
    436427#endif
    437428  }
    438 #if LGE_INTER_SDC_E0156
     429#if H_3D_INTER_SDC
    439430  if ( m_pucInterSDCMask     ) { xFree(m_pucInterSDCMask);      m_pucInterSDCMask    = NULL; }
    440431#endif
     
    575566    m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui];
    576567#endif
    577 #if LGE_INTER_SDC_E0156
     568#if H_3D_INTER_SDC
    578569    m_pbInterSDCFlag[ui] = pcFrom->m_pbInterSDCFlag[ui];
    579570#endif
     
    631622      memset( m_dmmWedgeTabIdx[i] + firstElement, 0,                      numElements * sizeof( *m_dmmWedgeTabIdx[i] ) );
    632623    }
    633 #if !SEC_DMM2_E0146_HHIFIX
    634     memset( m_dmm2DeltaEnd      + firstElement, 0,                        numElements * sizeof( *m_dmm2DeltaEnd    ) );
    635 #endif
    636624    memset( m_dmm3IntraTabIdx   + firstElement, 0,                        numElements * sizeof( *m_dmm3IntraTabIdx ) );
    637625#endif
     
    649637#endif
    650638#endif
    651 #if LGE_INTER_SDC_E0156
     639#if H_3D_INTER_SDC
    652640    memset( m_pbInterSDCFlag   + firstElement,     0,                    numElements * sizeof( *m_pbInterSDCFlag ) );
    653641    for( Int i = 0; i < 4; i++ )
     
    811799        m_dmmWedgeTabIdx[i] [ui] = 0;
    812800      }
    813 #if !SEC_DMM2_E0146_HHIFIX
    814       m_dmm2DeltaEnd    [ui] = 0;
    815 #endif
    816801      m_dmm3IntraTabIdx [ui] = 0;
    817802#endif
     
    822807#endif
    823808#endif
    824 #if LGE_INTER_SDC_E0156
     809#if H_3D_INTER_SDC
    825810      m_pbInterSDCFlag[ui] = false;
    826811      for( Int i = 0; i < 4; i++ )
     
    925910    memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );
    926911  }
    927 #if !SEC_DMM2_E0146_HHIFIX
    928   memset( m_dmm2DeltaEnd   , 0, sizeof(Int ) * m_uiNumPartition );
    929 #endif
    930912  memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition );
    931913#endif
     
    943925#endif
    944926#endif
    945 #if LGE_INTER_SDC_E0156
     927#if H_3D_INTER_SDC
    946928  memset( m_pbInterSDCFlag,           0, sizeof( Bool ) * m_uiNumPartition );
    947929  for( Int i = 0; i < 4; i++ )
     
    1010992        m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui];
    1011993      }
    1012 #if !SEC_DMM2_E0146_HHIFIX
    1013       m_dmm2DeltaEnd    [ui] = pcCU->m_dmm2DeltaEnd   [uiPartOffset+ui];
    1014 #endif
    1015994      m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui];
    1016995#endif
     
    10211000#endif
    10221001#endif
    1023 #if LGE_INTER_SDC_E0156
     1002#if H_3D_INTER_SDC
    10241003      m_pbInterSDCFlag      [ui] = pcCU->m_pbInterSDCFlag    [ uiPartOffset + ui ];
    10251004      for( Int i = 0; i < 4; i++ )
     
    11671146    m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;
    11681147  }
    1169 #if !SEC_DMM2_E0146_HHIFIX
    1170   m_dmm2DeltaEnd    = pcCU->getDmm2DeltaEnd()    + uiPart;
    1171 #endif
    11721148  m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart;
    11731149#endif
     
    11851161#endif
    11861162#endif 
    1187 #if LGE_INTER_SDC_E0156
     1163#if H_3D_INTER_SDC
    11881164  m_pbInterSDCFlag          = pcCU->getInterSDCFlag()       + uiPart;
    11891165  for( Int i = 0; i < 4; i++ )
     
    13661342    memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition );
    13671343  }
    1368 #if !SEC_DMM2_E0146_HHIFIX
    1369   memcpy( m_dmm2DeltaEnd    + uiOffset, pcCU->getDmm2DeltaEnd()   , sizeof(Int ) * uiNumPartition );
    1370 #endif
    13711344  memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition );
    13721345#endif
     
    13841357#endif
    13851358#endif
    1386 #if LGE_INTER_SDC_E0156
     1359#if H_3D_INTER_SDC
    13871360  memcpy( m_pbInterSDCFlag  + uiOffset, pcCU->getInterSDCFlag(),      iSizeInBool  );
    13881361  for( Int i = 0; i < 4; i++ )
     
    14961469    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );
    14971470  }
    1498 #if !SEC_DMM2_E0146_HHIFIX
    1499   memcpy( rpcCU->getDmm2DeltaEnd()    + m_uiAbsIdxInLCU, m_dmm2DeltaEnd   , sizeof(Int ) * m_uiNumPartition );
    1500 #endif
    15011471  memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition );
    15021472#endif
     
    15141484#endif
    15151485#endif
    1516 #if LGE_INTER_SDC_E0156
     1486#if H_3D_INTER_SDC
    15171487  memcpy( rpcCU->getInterSDCFlag() + m_uiAbsIdxInLCU, m_pbInterSDCFlag,      iSizeInBool  );
    15181488  for( Int i = 0;i < 4; i++ )
     
    16121582    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart );
    16131583  }
    1614 #if !SEC_DMM2_E0146_HHIFIX
    1615   memcpy( rpcCU->getDmm2DeltaEnd()    + uiPartOffset, m_dmm2DeltaEnd   , sizeof(Int ) * uiQNumPart );
    1616 #endif
    16171584  memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart );
    16181585#endif
     
    16301597#endif
    16311598#endif
    1632 #if LGE_INTER_SDC_E0156
     1599#if H_3D_INTER_SDC
    16331600  memcpy( rpcCU->getInterSDCFlag() + uiPartOffset, m_pbInterSDCFlag,      iSizeInBool  );
    16341601  for( Int i = 0; i < 4; i++ )
     
    23512318#endif
    23522319
    2353 #if LGE_INTER_SDC_E0156
     2320#if H_3D_INTER_SDC
    23542321Void TComDataCU::setInterSDCFlagSubParts ( Bool bInterSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    23552322{
     
    26892656  // check prediction mode
    26902657  UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx ); 
    2691 #if LGE_SDC_REMOVE_DC_E0158
    26922658  if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )
    2693 #else
    2694   if( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )
    2695 #endif
    26962659    return true;
    26972660 
     
    35693532    UInt uiPartIdxCenter;
    35703533    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );   
     3534#if H_3D_FCO
     3535    TComPic * pcTexturePic = m_pcSlice->getTexturePic();
     3536    TComDataCU *pcTextureCU = 0;
     3537    if ( pcTexturePic )
     3538        pcTextureCU = pcTexturePic->getCU( getAddr() );
     3539#else
    35713540    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     3541#endif
    35723542 
     3543#if H_3D_FCO
     3544    if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     3545#else
    35733546    if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     3547#endif
    35743548    {
    35753549      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     
    48304804
    48314805  // use coldir.
    4832 #if H_MV5
    48334806  TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
    4834 #else
    4835 #if H_MV
    4836   TComPic *pColPic; 
    4837   if (getSlice()->getAltCollocatedIndicationFlag() )
    4838   {
    4839     pColPic = getSlice()->getPicFromRefPicSetInterLayer( getSlice()->getActiveMotionPredRefLayerId( getSlice()->getCollocatedRefLayerIdx() ));
    4840   }
    4841   else
    4842   {
    4843     pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx()); 
    4844   } 
    4845 #else
    4846   TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
    4847 #endif
    4848 #endif
    48494807  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    48504808  if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE)
     
    49964954                                        + ( iPartWidth/m_pcPic->getMinCUWidth()  )/2];
    49974955}
    4998 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    4999 Void TComDataCU::compressMV(int scale)
     4956#if H_3D
     4957Void TComDataCU::compressMV(Int scale)
    50004958#else
    50014959Void TComDataCU::compressMV()
    50024960#endif
    50034961{
    5004 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     4962#if H_3D
    50054963  Int scaleFactor = (4 / scale ) * AMVP_DECIMATION_FACTOR / m_unitSize;
    50064964#else
     
    55095467    xDeriveCenterIdx(uiPartIdx, uiPartIdxCenter );
    55105468
    5511     ///*** Derive bottom right neighbour position ***
    5512 #if !SEC_SIMPLIFIED_NBDV_E0142
    5513     Int iLCUIdxRBNb  = -1;   
    5514     Int iPartIdxRBNb = -1;
    5515     xDeriveRightBottomNbIdx(iLCUIdxRBNb, iPartIdxRBNb );
    5516 #endif
    5517 
    55185469    ///*** Search temporal candidate pictures for disparity vector ***
    55195470    const Int iNumCandPics = getPic()->getNumDdvCandPics();
     
    55335484      }
    55345485
    5535 #if !SEC_SIMPLIFIED_NBDV_E0142
    5536       // Check BR and Center       
    5537       for(Int curPosition = 0; curPosition < 2; curPosition++)
    5538       {
    5539 #endif
    5540         Bool bCheck = false;
    5541 #if !SEC_SIMPLIFIED_NBDV_E0142
    5542         if ( curPosition == 0 && iLCUIdxRBNb >= 0 )
    5543 #if MTK_NBDV_TN_FIX_E0172
    5544           bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, iLCUIdxRBNb, iPartIdxRBNb,  cColMv, iTargetViewIdx, iTStartViewIdx);
     5486      Bool bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
     5487
     5488      if( bCheck )
     5489      {
     5490        clipMv(cColMv);
     5491        pDInfo->m_acNBDV = cColMv;
     5492        pDInfo->m_aVIdxCan  = iTargetViewIdx;
     5493
     5494#if H_3D_NBDV_REF
     5495        TComPic* picDepth = NULL;   
     5496#if H_3D_FCO_VSP_DONBDV_E0163
     5497        picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5498        if ( picDepth->getPicYuvRec() != NULL  ) 
     5499        {
     5500          cColMv.setZero();
     5501        }
     5502        else // Go back with virtual depth
     5503        {
     5504          picDepth = getSlice()->getIvPic( true, iTargetViewIdx );
     5505        }
     5506
     5507        assert(picDepth != NULL);
    55455508#else
    5546           bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, iLCUIdxRBNb, iPartIdxRBNb,  cColMv, iTargetViewIdx, iTStartViewIdx);
    5547 #endif
    5548 
    5549         if (curPosition == 1 )
    5550 #endif
    5551 #if MTK_NBDV_TN_FIX_E0172
    5552           bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
    5553 #else
    5554           bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
    5555 #endif
    5556 
    5557         if( bCheck )
    5558         {
    5559           clipMv(cColMv);
    5560           pDInfo->m_acNBDV = cColMv;
    5561           pDInfo->m_aVIdxCan  = iTargetViewIdx;
    5562 
    5563 #if H_3D_NBDV_REF
    5564           TComPic* picDepth = NULL;         
    5565           picDepth = getSlice()->getIvPic( true, iTargetViewIdx );
    5566           assert(picDepth != NULL);
    5567           if (picDepth && bDepthRefine)
    5568             estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv );
    5569 
    5570           pDInfo->m_acDoNBDV  = cColMv;
     5509        picDepth = getSlice()->getIvPic( true, iTargetViewIdx );
     5510        assert(picDepth != NULL);
     5511#endif
     5512        if (picDepth && bDepthRefine)
     5513          estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv );
     5514
     5515        pDInfo->m_acDoNBDV  = cColMv;
    55715516#endif //H_3D_NBDV_REF
    5572           return true;
    5573         }
    5574 #if !SEC_SIMPLIFIED_NBDV_E0142
    5575       }
    5576 #endif
     5517        return true;
     5518      }
    55775519    }
    55785520  }
     
    55875529  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT
    55885530#if H_3D_NBDV_REF
    5589   , bDepthRefine
     5531    , bDepthRefine
    55905532#endif
    55915533    ) )
     
    55995541    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVE
    56005542#if H_3D_NBDV_REF
    5601   , bDepthRefine
    5602 #endif
    5603     ) )
     5543      , bDepthRefine
     5544#endif
     5545      ) )
    56045546      return true;
    56055547  }
    5606 
    5607 #if !SEC_SIMPLIFIED_NBDV_E0142
    5608   //// ******* Get disparity from above right block ******* /////
    5609   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true);
    5610   if(pcTmpCU != NULL )
    5611   {
    5612     bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    5613     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVERIGHT
    5614 #if H_3D_NBDV_REF
    5615   , bDepthRefine
    5616 #endif
    5617     ) )
    5618       return true;
    5619   }
    5620 
    5621   //// ******* Get disparity from below left block ******* /////
    5622   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true);
    5623   if( pcTmpCU != NULL )
    5624   {
    5625     bCheckMcpDv = true;
    5626     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFTBELOW
    5627 #if H_3D_NBDV_REF
    5628   , bDepthRefine
    5629 #endif
    5630     ) )
    5631       return true;
    5632   }
    5633 
    5634   //// ******* Get disparity from above left block ******* /////
    5635   pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true);
    5636   assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5637 
    5638   if( pcTmpCU != NULL )
    5639   {
    5640     bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1);
    5641     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVELEFT
    5642 #if H_3D_NBDV_REF
    5643   , bDepthRefine
    5644 #endif
    5645     ) )
    5646       return true;
    5647   }
    5648 #endif
    56495548
    56505549  //// ******* Search MCP blocks ******* /////
     
    56625561          pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ];
    56635562#if H_3D_NBDV_REF
     5563#if H_3D_FCO_VSP_DONBDV_E0163
     5564          TComPic* picDepth  = NULL;
     5565
     5566          picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5567          if ( picDepth->getPicYuvRec() != NULL ) 
     5568          {
     5569            cDispVec.setZero();
     5570          }
     5571          else // Go back with virtual depth
     5572          {
     5573            picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan );
     5574          }
     5575
     5576          assert(picDepth != NULL);
     5577#else
    56645578          TComPic* picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan );
    56655579          assert(picDepth!=NULL);
     5580#endif
    56665581
    56675582          if (picDepth && bDepthRefine)
     
    56795594  TComMv defaultDV(0, 0);
    56805595  pDInfo->m_acNBDV = defaultDV;
    5681 #if NBDV_DEFAULT_VIEWIDX_BUGFIX
     5596
    56825597  Int valid = 0;
    56835598  Int viewIndex = 0;
     
    57075622#if H_3D_NBDV_REF
    57085623    TComPic* picDepth = NULL;
     5624#if H_3D_FCO_VSP_DONBDV_E0163
     5625    picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5626    if ( picDepth->getPicYuvRec() != NULL ) 
     5627    {
     5628      defaultDV.setZero();
     5629    }
     5630    else // Go back with virtual depth
     5631    {
     5632      picDepth = getSlice()->getIvPic( true, viewIndex );
     5633    }
     5634
     5635    assert(picDepth != NULL);
     5636#else
    57095637    picDepth = getSlice()->getIvPic( true, viewIndex );
    57105638    assert(picDepth!=NULL);
    5711 
     5639#endif
    57125640    if (picDepth && bDepthRefine)
    57135641    {
     
    57175645#endif
    57185646  }
    5719 #else
    5720   pDInfo->m_aVIdxCan = 0;
    5721 #if H_3D_NBDV_REF
    5722   TComPic* picDepth = NULL;
    5723   picDepth = getSlice()->getIvPic( true, 0 );
    5724   assert(picDepth!=NULL);
    5725 
    5726   if (picDepth && bDepthRefine)
    5727   {
    5728     estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view
    5729   }
    5730   pDInfo->m_acDoNBDV = defaultDV;
    5731 #endif
    5732 #endif
    57335647  return false;
    57345648}
     
    57405654  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
    57415655 
    5742 #if NTT_DoNBDV_VECTOR_CLIP_E0141
    57435656  Int depthStartPosX = Clip3(0,   iPictureWidth - 1,  iBlkX + ((mv->getHor()+2)>>2));
    57445657  Int depthStartPosY = Clip3(0,   iPictureHeight - 1, iBlkY + ((mv->getVer()+2)>>2));
    57455658  Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2));
    57465659  Int depthEndPosY   = Clip3(0,   iPictureHeight - 1, iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2));
    5747 #else
    5748   Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + ((mv->getHor()+2)>>2));
    5749   Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + ((mv->getVer()+2)>>2));
    5750   Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2));
    5751   Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2));
    5752 #endif
    57535660
    57545661  Pel* depthTL  = pcBaseViewDepthPicYuv->getLumaAddr();
     
    58125719          TComPic* picDepth = NULL;
    58135720          assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC());         
     5721#if H_3D_FCO_VSP_DONBDV_E0163
     5722          picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5723          if ( picDepth->getPicYuvRec() != NULL ) 
     5724          {
     5725            cMvPred.setZero();
     5726          }
     5727          else// Go back with virtual depth
     5728          {
     5729            picDepth = getSlice()->getIvPic (true, refViewIdx );
     5730          }
     5731          assert(picDepth != NULL);
     5732#else
    58145733          picDepth   = getSlice()->getIvPic (true, refViewIdx );
    58155734          assert(picDepth != NULL);
    5816 
     5735#endif
    58175736          UInt uiPartIdx = 0;   //Notes from MTK: Please confirm that using 0 as partition index and partition address is correct for CU-level DoNBDV
    58185737          UInt uiPartAddr = 0;  //QC: confirmed
     
    58295748          assert( uiMvpDvPos < IDV_CANDS );
    58305749          paIDVInfo->m_acMvCand[iList][ uiMvpDvPos ] = TComMv( cMvPred.getIDVHor(), cMvPred.getIDVVer() );
    5831           //Notes from QC: DvMCP is implemented in a way that doesnE½t carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design.
     5750          //Notes from QC: DvMCP is implemented in a way that doesnot carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design.
    58325751          paIDVInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = cMvPred.getIDVVId();
    58335752          paIDVInfo->m_bAvailab[iList][ uiMvpDvPos ] = true;
     
    59015820}
    59025821#endif
    5903 #if MTK_NBDV_TN_FIX_E0172
     5822
    59045823Bool TComDataCU::xGetColDisMV( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
    5905 #else
    5906 Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
    5907 #endif
    59085824{
    59095825
     
    59215837    if(pColCU->getSlice()->isInterB())
    59225838    {
    5923         eColRefPicList = RefPicList(ilist);
     5839      eColRefPicList = RefPicList(ilist);
    59245840    }
    59255841
     
    59395855    else
    59405856    {
    5941 #if MTK_NBDV_TN_FIX_E0172
    59425857      if(getPic()->isTempIVRefValid(currCandPic, ilist,  iColRefIdx))
    59435858      {
    5944 #endif
    5945       rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartUnitIdx);
    5946       rcMv.setIDVFlag(0);
    5947       iTargetViewIdx  = iColRefViewIdx ;
    5948       iStartViewIdx   = iColViewIdx   ;
    5949       return true;   
    5950 #if MTK_NBDV_TN_FIX_E0172
    5951       }
    5952 #endif
     5859        rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartUnitIdx);
     5860        rcMv.setIDVFlag(0);
     5861        iTargetViewIdx  = iColRefViewIdx ;
     5862        iStartViewIdx   = iColViewIdx   ;
     5863        return true;   
     5864      }
    59535865    }
    59545866  }
     
    59575869}
    59585870#endif
    5959 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     5871#if  H_3D_FAST_TEXTURE_ENCODING
    59605872Void
    59615873TComDataCU::getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD)
     
    62426154  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
    62436155}
    6244 #if !SEC_DMM2_E0146_HHIFIX
    6245 Void  TComDataCU::setDmm2DeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth )
    6246 {
    6247   UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
    6248   for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm2DeltaEnd[uiAbsPartIdx+ui] = iDelta; }
    6249 }
    6250 #endif
    62516156Void  TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
    62526157{
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r622 r655  
    208208#if H_3D_DIM_DMM
    209209  UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE];
    210 #if !SEC_DMM2_E0146_HHIFIX
    211   Int*          m_dmm2DeltaEnd;
    212 #endif
    213210  UInt*         m_dmm3IntraTabIdx;
    214211#endif
     
    225222#endif
    226223#endif
    227 #if LGE_INTER_SDC_E0156
     224#if H_3D_INTER_SDC
    228225  Bool*         m_pbInterSDCFlag;
    229226  Int*          m_apSegmentInterDCOffset[4];
     
    489486#endif
    490487  );
    491 #if MTK_NBDV_TN_FIX_E0172
    492488  Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
    493 #else
    494   Bool          xGetColDisMV      ( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
    495 #endif
    496489  Bool          getDisMvpCandNBDV ( DisInfo* pDInfo
    497490#if H_3D_NBDV_REF
     
    505498#endif //H_3D_NBDV_REF
    506499#endif
    507 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     500#if  H_3D_FAST_TEXTURE_ENCODING
    508501  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
    509502#endif
     
    545538  Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
    546539
    547 #if !SEC_DMM2_E0146_HHIFIX
    548   Int*  getDmm2DeltaEnd               ()                      { return m_dmm2DeltaEnd;        }
    549   Int   getDmm2DeltaEnd               ( UInt uiIdx )          { return m_dmm2DeltaEnd[uiIdx]; }
    550   Void  setDmm2DeltaEnd               ( UInt uiIdx, Int iD )  { m_dmm2DeltaEnd[uiIdx] = iD;   }
    551   Void  setDmm2DeltaEndSubParts       ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth );
    552 #endif
    553 
    554540  UInt* getDmm3IntraTabIdx            ()                      { return m_dmm3IntraTabIdx;        }
    555541  UInt  getDmm3IntraTabIdx            ( UInt uiIdx )          { return m_dmm3IntraTabIdx[uiIdx]; }
     
    588574#endif
    589575#endif
    590 #if LGE_INTER_SDC_E0156
     576#if H_3D_INTER_SDC
    591577  Bool*         getInterSDCFlag     ()                        { return m_pbInterSDCFlag;               }
    592578  Bool          getInterSDCFlag     ( UInt uiIdx )            { return m_pbInterSDCFlag[uiIdx];        }
     
    626612  Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
    627613  Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
    628 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    629   Void          compressMV            (int scale);
     614#if H_3D
     615  Void          compressMV            ( Int scale );
    630616#else           
    631617  Void          compressMV            ();
  • trunk/source/Lib/TLibCommon/TComMv.h

    r622 r655  
    4040
    4141#include "CommonDef.h"
     42#include <cstdlib>
    4243
    4344//! \ingroup TLibCommon
  • trunk/source/Lib/TLibCommon/TComPattern.h

    r608 r655  
    102102  Bool              m_bICFlag;
    103103#endif
    104 #if LGE_INTER_SDC_E0156
     104#if H_3D_INTER_SDC
    105105  Bool              m_bSDCMRSADFlag;
    106106#endif
     
    119119  Void  setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; }
    120120#endif
    121 #if LGE_INTER_SDC_E0156
     121#if H_3D_INTER_SDC
    122122  Bool  getSDCMRSADFlag()         { return m_bSDCMRSADFlag; }
    123123  Void  setSDCMRSADFlag( Bool bSDCMRSADFlag )    { m_bSDCMRSADFlag = bSDCMRSADFlag; }
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r608 r655  
    5050, m_bUsedByCurr                           (false)
    5151, m_bIsLongTerm                           (false)
    52 , m_bIsUsedAsLongTerm                     (false)
    5352, m_apcPicSym                             (NULL)
    5453, m_pcPicYuvPred                          (NULL)
     
    118117  memcpy(m_numReorderPics, numReorderPics, MAX_TLAYER*sizeof(Int));
    119118
     119  /* initialize the texture to depth reference status */
     120#if H_3D_FCO
     121  for (int j=0; j<2; j++)
     122  {
     123      for (int i=0; i<MAX_NUM_REF; i++)
     124      {
     125          m_aiTexToDepRef[j][i] = -1;
     126      }
     127  }
     128#endif
     129
    120130  return;
    121131}
     
    146156  deleteSEIs(m_SEIs);
    147157}
    148 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    149 Void TComPic::compressMotion(int scale)
     158#if H_3D
     159Void TComPic::compressMotion(Int scale)
    150160#else
    151161Void TComPic::compressMotion()
     
    156166  {
    157167    TComDataCU* pcCU = pPicSym->getCU(uiCUAddr);
    158 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     168#if H_3D
    159169    pcCU->compressMV(scale);
    160170#else
     
    661671  return numDdvCandPics;
    662672}
    663 #endif
    664 #if MTK_NBDV_TN_FIX_E0172
     673
    665674Void TComPic::checkTemporalIVRef()
    666675{
     
    716725  return m_abTIVRINCurrRL[currCandPic][iColRefDir][iColRefIdx];
    717726}
    718 #endif
    719 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
     727
    720728Void TComPic::checkTextureRef(  )
    721729{
    722730  TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());
    723731  TComPic* pcTextPic = pcCurrSlice->getTexturePic();
     732#if H_3D_FCO
     733  if ( pcTextPic )
     734  {
     735#endif
     736
    724737  TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
    725738
     
    743756
    744757  }
     758#if H_3D_FCO
     759  }
     760#endif
     761
    745762}
    746763
  • trunk/source/Lib/TLibCommon/TComPic.h

    r608 r655  
    6161  Bool                  m_bUsedByCurr;            //  Used by current picture
    6262  Bool                  m_bIsLongTerm;            //  IS long term picture
    63   Bool                  m_bIsUsedAsLongTerm;      //  long term picture is used as reference before
    6463  TComPicSym*           m_apcPicSym;              //  Symbol
    6564 
     
    8382  Window                m_defaultDisplayWindow;
    8483
     84  bool                  m_isTop;
     85  bool                  m_isField;
     86 
    8587  std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink;
    8688
     
    104106  RefPicList  m_eRapRefList;
    105107  Int         m_iNumDdvCandPics;
    106 #endif
    107 #if MTK_NBDV_TN_FIX_E0172
    108108  Bool        m_abTIVRINCurrRL  [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists
    109 #endif
    110 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182 
    111109  Int         m_aiTexToDepRef  [2][MAX_NUM_REF];
    112110#endif
     
    186184  Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i;    }
    187185  Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer]; }
    188 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    189   Void          compressMotion(int scale);
     186#if H_3D
     187  Void          compressMotion(Int scale);
    190188#else   
    191189  Void          compressMotion();
     
    212210  TComPicYuv*   getYuvPicBufferForIndependentBoundaryProcessing()             {return m_pNDBFilterYuvTmp;}
    213211  std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter      (Int sliceID) { return m_vSliceCUDataLink[sliceID];}
     212
     213
     214  /* field coding parameters*/
     215
     216   Void              setTopField(bool b)                  {m_isTop = b;}
     217   bool              isTopField()                         {return m_isTop;}
     218   Void              setField(bool b)                     {m_isField = b;}
     219   bool              isField()                            {return m_isField;}
    214220
    215221#if H_MV
     
    224230  UInt          getRapRefIdx()                         {return m_uiRapRefIdx;       }
    225231  RefPicList    getRapRefList()                        {return m_eRapRefList;       }
    226 #endif
    227 #if MTK_NBDV_TN_FIX_E0172
    228   Void      checkTemporalIVRef();
    229   Bool      isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx);
    230 #endif
    231 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
    232   Void      checkTextureRef(  );
    233   Int       isTextRefValid(Int iTextRefDir, Int iTextRefIdx);
     232  Void          checkTemporalIVRef();
     233  Bool          isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx);
     234  Void          checkTextureRef(  );
     235  Int           isTextRefValid(Int iTextRefDir, Int iTextRefIdx);
    234236#endif
    235237  /** transfer ownership of seis to this picture */
  • trunk/source/Lib/TLibCommon/TComPicSym.cpp

    r608 r655  
    6161,m_uiNumAllocatedSlice (0)
    6262,m_apcTComDataCU (NULL)
    63 ,m_iTileBoundaryIndependenceIdr (0)
    6463,m_iNumColumnsMinus1 (0)
    6564,m_iNumRowsMinus1(0)
  • trunk/source/Lib/TLibCommon/TComPicSym.h

    r608 r655  
    9999  UInt          m_uiNumAllocatedSlice;
    100100  TComDataCU**  m_apcTComDataCU;        ///< array of CU data
    101  
    102   Int           m_iTileBoundaryIndependenceIdr;
     101   
    103102  Int           m_iNumColumnsMinus1;
    104103  Int           m_iNumRowsMinus1;
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r622 r655  
    3939#include "TComPrediction.h"
    4040
    41 #if SHARP_ILLUCOMP_REFINE_E0046
    42 #define IC_REG_COST_SHIFT 7
    43 #define IC_CONST_SHIFT 5
    44 #define IC_SHIFT_DIFF 12
    45 #endif
    46 
    4741//! \ingroup TLibCommon
    4842//! \{
     
    6963  if (m_pDepthBlock != NULL)
    7064      free(m_pDepthBlock);
    71 #if NTT_VSP_COMMON_E0207_E0208
    7265  m_cYuvDepthOnVsp.destroy();
    73 #endif
    7466#endif
    7567
     
    129121    m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    130122#endif
    131 #if NTT_VSP_COMMON_E0207_E0208
     123#if H_3D_VSP
    132124    m_cYuvDepthOnVsp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    133125#endif
     
    143135  }
    144136#if H_3D_IC
    145 #if SHARP_ILLUCOMP_REFINE_E0046
    146137  m_uiaShift[0] = 0;
    147138  for( Int i = 1; i < 64; i++ )
     
    149140    m_uiaShift[i] = ( (1 << 15) + i/2 ) / i;
    150141  }
    151 #else
    152   for( Int i = 1; i < 64; i++ )
    153   {
    154     m_uiaShift[i-1] = ( (1 << 15) + i/2 ) / i;
    155   }
    156 #endif
    157142#endif
    158143}
     
    456441        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
    457442      } break;
    458 #if !SEC_DMM2_E0146_HHIFIX
    459     case( DMM2_IDX ):
    460       {
    461         UInt uiTabIdx = 0;
    462         if( bFastEnc ) { uiTabIdx = pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ); }
    463         else
    464         {
    465           uiTabIdx = xPredWedgeFromIntra( pcCU, uiAbsPartIdx, iWidth, iHeight, pcCU->getDmm2DeltaEnd( uiAbsPartIdx ) );
    466           pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, uiAbsPartIdx, (pcCU->getDepth(0) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1)) );
    467         }
    468         dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);
    469       } break;
    470 #endif
    471443    case( DMM3_IDX ):
    472444      {
     
    709681#endif
    710682      , bICFlag );
    711 #if SHARP_ILLUCOMP_REFINE_E0046
    712683    bICFlag = bICFlag && (iWidth > 8);
    713 #endif
    714684    xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
    715685#if H_3D_ARP
     
    731701  // Get depth reference
    732702  Int       depthRefViewIdx = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
     703#if H_3D_FCO_VSP_DONBDV_E0163
     704  TComPic* pRefPicBaseDepth = 0;
     705  Bool     bIsCurrDepthCoded = false;
     706  pRefPicBaseDepth  = pcCU->getSlice()->getIvPic( true, pcCU->getSlice()->getViewIndex() );
     707  if ( pRefPicBaseDepth->getPicYuvRec() != NULL  )
     708  {
     709    bIsCurrDepthCoded = true;
     710  }
     711  else
     712  {
     713    pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
     714  }
     715#else
    733716  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
     717#endif
    734718  assert(pRefPicBaseDepth != NULL);
    735719  TComPicYuv* pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     
    752736  pcCU->clipMv(cDv);
    753737
    754 #if NTT_VSP_COMMON_E0207_E0208
     738#if H_3D_FCO_VSP_DONBDV_E0163
     739  if ( bIsCurrDepthCoded )
     740  {
     741      cDv.setZero();
     742  }
     743#endif
    755744  // fetch virtual depth map
    756 #if NTT_VSP_VECTOR_CLIP_E0208
    757745  pcBaseViewDepthPicYuv->extendPicBorder();
    758 #endif
    759746  xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp );
    760747  // sub-PU based compensation
    761748  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    762749  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    763 #else
    764   UInt uiAbsPartIdx = pcCU->getZorderIdxInCU();
    765   Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    766   Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    767   xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cDv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    768   xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cDv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    769 #endif
    770 
    771750}
    772751#endif
     
    984963  if ( yFrac == 0 )
    985964  {
    986 #if MTK_CLIPPING_ALIGN_IC_E0168
     965#if H_3D_IC
    987966    m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac,       !bi || bICFlag
    988967#else
     
    996975  else if ( xFrac == 0 )
    997976  {
    998 #if MTK_CLIPPING_ALIGN_IC_E0168
     977#if H_3D_IC
    999978    m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi || bICFlag
    1000979#else
     
    1019998#endif
    1020999      );
    1021 #if MTK_CLIPPING_ALIGN_IC_E0168
     1000#if H_3D_IC
    10221001    m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height,              yFrac, false, !bi || bICFlag
    10231002#else
     
    10331012  if( bICFlag )
    10341013  {
    1035 #if SHARP_ILLUCOMP_REFINE_E0046
    10361014    Int a, b, i, j;
    10371015    const Int iShift = IC_CONST_SHIFT;
    10381016
    10391017    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_LUMA );
    1040 #else
    1041     Int a, b, iShift, i, j;
    1042 
    1043     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_LUMA );
    1044 #endif
    10451018
    10461019
     
    10491022      for ( j = 0; j < width; j++ )
    10501023      {
    1051 #if !MTK_CLIPPING_ALIGN_IC_E0168
    1052         if( bi )
    1053         {
    1054           Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY;
    1055           dst[j] = ( ( a*dst[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1 << iIFshift ) - IF_INTERNAL_OFFS;
    1056         }
    1057         else
    1058 #endif
    10591024          dst[j] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, ( ( a*dst[j] ) >> iShift ) + b );
    10601025      }
    10611026      dst += dstStride;
    10621027    }
    1063 #if MTK_CLIPPING_ALIGN_IC_E0168
     1028
    10641029    if(bi)
    10651030    {
     
    10761041      }
    10771042    }
    1078 #endif
    10791043  }
    10801044#endif
     
    11271091  if ( yFrac == 0 )
    11281092  {
    1129 #if MTK_CLIPPING_ALIGN_IC_E0168
     1093#if H_3D_IC
    11301094    m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag
    11311095#else
     
    11361100#endif
    11371101    );   
    1138 #if MTK_CLIPPING_ALIGN_IC_E0168
     1102#if H_3D_IC
    11391103    m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag
    11401104#else
     
    11481112  else if ( xFrac == 0 )
    11491113  {
    1150 #if MTK_CLIPPING_ALIGN_IC_E0168
     1114#if H_3D_IC
    11511115    m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag
    11521116#else
     
    11571121#endif
    11581122    );
    1159 #if MTK_CLIPPING_ALIGN_IC_E0168
     1123#if H_3D_IC
    11601124    m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag
    11611125#else
     
    11741138#endif 
    11751139      );
    1176 #if MTK_CLIPPING_ALIGN_IC_E0168
     1140#if H_3D_IC
    11771141    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight  , yFrac, false, !bi || bICFlag
    11781142#else
     
    11891153#endif
    11901154      );
    1191 #if MTK_CLIPPING_ALIGN_IC_E0168
     1155#if H_3D_IC
    11921156    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight  , yFrac, false, !bi || bICFlag
    11931157#else
     
    12031167  if( bICFlag )
    12041168  {
    1205 #if SHARP_ILLUCOMP_REFINE_E0046
    12061169    Int a, b, i, j;
    12071170    const Int iShift = IC_CONST_SHIFT;
    12081171    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb
    1209 #else
    1210     Int a, b, iShift, i, j;
    1211     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_U ); // Cb
    1212 #endif
    12131172    for ( i = 0; i < cxHeight; i++ )
    12141173    {
    12151174      for ( j = 0; j < cxWidth; j++ )
    12161175      {
    1217 #if !MTK_CLIPPING_ALIGN_IC_E0168
    1218         if( bi )
    1219         {
    1220           Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;
    1221           dstCb[j] = ( ( a*dstCb[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS;
    1222         }
    1223         else
    1224 #endif
    12251176          dstCb[j] = Clip3(  0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCb[j] ) >> iShift ) + b );
    12261177      }
    12271178      dstCb += dstStride;
    12281179    }
    1229 #if SHARP_ILLUCOMP_REFINE_E0046
    12301180    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_V ); // Cr
    1231 #else
    1232     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_V ); // Cr
    1233 #endif
    12341181    for ( i = 0; i < cxHeight; i++ )
    12351182    {
    12361183      for ( j = 0; j < cxWidth; j++ )
    12371184      {
    1238 #if !MTK_CLIPPING_ALIGN_IC_E0168
    1239         if( bi )
    1240         {
    1241           Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;
    1242           dstCr[j] = ( ( a*dstCr[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS;
    1243         }
    1244         else
    1245 #endif
    12461185          dstCr[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCr[j] ) >> iShift ) + b );
    12471186      }
    12481187      dstCr += dstStride;
    12491188    }
    1250 #if MTK_CLIPPING_ALIGN_IC_E0168
     1189
    12511190    if(bi)
    12521191    {
     
    12681207      }
    12691208    }
    1270 #endif
    12711209  }
    12721210#endif
     
    13231261  Int k, l, bottomLeft, topRight;
    13241262  Int horPred;
    1325   Int leftColumn[MAX_CU_SIZE], topRow[MAX_CU_SIZE], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];
     1263  Int leftColumn[MAX_CU_SIZE+1], topRow[MAX_CU_SIZE+1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];
    13261264  UInt blkSize = width;
    13271265  UInt offset2D = width;
     
    14171355}
    14181356
    1419 #if !SHARP_ILLUCOMP_REFINE_E0046
    1420 /** Function for counting leading number of zeros/ones
    1421  * \param x input value
    1422  \ This function counts leading number of zeros for positive numbers and
    1423  \ leading number of ones for negative numbers. This can be implemented in
    1424  \ single instructure cycle on many processors.
    1425  */
    1426 
    1427 Short CountLeadingZerosOnes (Short x)
    1428 {
    1429   Short clz;
    1430   Short i;
    1431 
    1432   if(x == 0)
    1433   {
    1434     clz = 0;
    1435   }
    1436   else
    1437   {
    1438     if (x == -1)
    1439     {
    1440       clz = 15;
    1441     }
    1442     else
    1443     {
    1444       if(x < 0)
    1445       {
    1446         x = ~x;
    1447       }
    1448       clz = 15;
    1449       for(i = 0;i < 15;++i)
    1450       {
    1451         if(x)
    1452         {
    1453           clz --;
    1454         }
    1455         x = x >> 1;
    1456       }
    1457     }
    1458   }
    1459   return clz;
    1460 }
    1461 #endif
    14621357
    14631358/** Function for deriving LM illumination compensation.
    14641359 */
    1465 #if SHARP_ILLUCOMP_REFINE_E0046
    14661360Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType )
    1467 #else
    1468 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType )
    1469 #endif
    14701361{
    14711362  TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec();
     
    14951386
    14961387  Int x = 0, y = 0, xx = 0, xy = 0;
    1497 #if SHARP_ILLUCOMP_REFINE_E0046
    14981388  Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12);
    1499 #endif
    15001389
    15011390  if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 )
     
    15191408    }
    15201409
    1521 #if SHARP_ILLUCOMP_REFINE_E0046
    15221410    for( j = 0; j < uiWidth; j+=2 )
    1523 #else
    1524     for( j = 0; j < uiWidth; j++ )
    1525 #endif
    15261411    {
    15271412      x += pRef[j];
    15281413      y += pRec[j];
    1529 #if SHARP_ILLUCOMP_REFINE_E0046
    15301414      xx += (pRef[j] * pRef[j])>>precShift;
    15311415      xy += (pRef[j] * pRec[j])>>precShift;
    1532 #else
    1533       xx += pRef[j] * pRef[j];
    1534       xy += pRef[j] * pRec[j];
    1535 #endif
    1536     }
    1537 #if SHARP_ILLUCOMP_REFINE_E0046
     1416    }
    15381417    iCountShift += g_aucConvertToBit[ uiWidth ] + 1;
    1539 #else
    1540     iCountShift += g_aucConvertToBit[ uiWidth ] + 2;
    1541 #endif
    15421418  }
    15431419
     
    15631439    }
    15641440
    1565 #if SHARP_ILLUCOMP_REFINE_E0046
    15661441    for( i = 0; i < uiHeight; i+=2 )
    1567 #else
    1568     for( i = 0; i < uiHeight; i++ )
    1569 #endif
    15701442    {
    15711443      x += pRef[0];
    15721444      y += pRec[0];
    1573 #if SHARP_ILLUCOMP_REFINE_E0046
     1445
    15741446      xx += (pRef[0] * pRef[0])>>precShift;
    15751447      xy += (pRef[0] * pRec[0])>>precShift;
     
    15771449      pRef += iRefStride*2;
    15781450      pRec += iRecStride*2;
    1579 #else
    1580       xx += pRef[0] * pRef[0];
    1581       xy += pRef[0] * pRec[0];
    1582 
    1583       pRef += iRefStride;
    1584       pRec += iRecStride;
    1585 #endif
    1586     }
    1587 #if SHARP_ILLUCOMP_REFINE_E0046
     1451    }
    15881452    iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 1 );
    1589 #else
    1590     iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 2 );
    1591 #endif
    1592   }
    1593 
    1594 #if SHARP_ILLUCOMP_REFINE_E0046
     1453  }
     1454
    15951455  xy += xx >> IC_REG_COST_SHIFT;
    15961456  xx += xx >> IC_REG_COST_SHIFT;
     
    15991459  const Int iShift = IC_CONST_SHIFT;
    16001460  {
    1601 #else
    1602   Int iTempShift = ( ( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC ) + g_aucConvertToBit[ uiWidth ] + 3 - 15;
    1603 
    1604   if( iTempShift > 0 )
    1605   {
    1606     x  = ( x +  ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1607     y  = ( y +  ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1608     xx = ( xx + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1609     xy = ( xy + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1610     iCountShift -= iTempShift;
    1611   }
    1612 
    1613   iShift = 13;
    1614 
    1615   if( iCountShift == 0 )
    1616   {
    1617     a = 1;
    1618     b = 0;
    1619     iShift = 0;
    1620   }
    1621   else
    1622   {
    1623     Int a1 = ( xy << iCountShift ) - y * x;
    1624     Int a2 = ( xx << iCountShift ) - x * x;             
    1625 #endif
    16261461    {
    16271462      const Int iShiftA2 = 6;
    1628 #if !SHARP_ILLUCOMP_REFINE_E0046
    1629       const Int iShiftA1 = 15;
    1630 #endif
    16311463      const Int iAccuracyShift = 15;
    16321464
     
    16361468      Int a2s = a2;
    16371469
    1638 #if SHARP_ILLUCOMP_REFINE_E0046
    16391470      a1 = Clip3(0, 2*a2, a1);
    16401471      iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2;
    16411472      iScaleShiftA1 = iScaleShiftA2 - IC_SHIFT_DIFF;
    1642 #else
    1643       iScaleShiftA1 = GetMSB( abs( a1 ) ) - iShiftA1;
    1644       iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 
    1645 #endif
    16461473
    16471474      if( iScaleShiftA1 < 0 )
     
    16621489      a1s = a1 >> iScaleShiftA1;
    16631490
    1664 #if SHARP_ILLUCOMP_REFINE_E0046
    16651491      a = a1s * m_uiaShift[ a2s ];
    16661492      a = a >> iScaleShiftA;
    1667 #else
    1668       if (a2s >= 1)
    1669       {
    1670         a = a1s * m_uiaShift[ a2s - 1];
    1671       }
    1672       else
    1673       {
    1674         a = 0;
    1675       }
    1676 
    1677       if( iScaleShiftA < 0 )
    1678       {
    1679         a = a << -iScaleShiftA;
    1680       }
    1681       else
    1682       {
    1683         a = a >> iScaleShiftA;
    1684       }
    1685 
    1686       a = Clip3( -( 1 << 15 ), ( 1 << 15 ) - 1, a );
    1687 
    1688       Int minA = -(1 << (6));
    1689       Int maxA = (1 << 6) - 1;
    1690       if( a <= maxA && a >= minA )
    1691       {
    1692         // do nothing
    1693       }
    1694       else
    1695       {
    1696         Short n = CountLeadingZerosOnes( a );
    1697         a = a >> (9-n);
    1698         iShift -= (9-n);
    1699       }
    1700 #endif
    17011493      b = (  y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift;
    17021494    }
     
    17061498
    17071499#if H_3D_VSP
    1708 
    1709 #if NTT_VSP_COMMON_E0207_E0208
    17101500// not fully support iRatioTxtPerDepth* != 1
    17111501Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
     
    17151505
    17161506  Int refDepStride = picRefDepth->getStride();
    1717 
    1718 #if NTT_VSP_VECTOR_CLIP_E0208
    17191507
    17201508  Int refDepOffset  = ( (mv->getHor()+2) >> 2 ) + ( (mv->getVer()+2) >> 2 ) * refDepStride;
     
    17361524  refDepth += refDepOffset;
    17371525
    1738 #else // NTT_VSP_VECTOR_CLIP_E0208
    1739 
    1740   Int widthDepth = picRefDepth->getWidth();
    1741   Int heightDepth = picRefDepth->getHeight();
    1742   Int posX, posY;
    1743   cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
    1744   posX /= ratioTxtPerDepthX; // texture position -> depth postion
    1745   posY /= ratioTxtPerDepthY;
    1746  
    1747   posX = Clip3(0, widthDepth-width,   posX + ((mv->getHor()+2)>>2));
    1748   posY = Clip3(0, heightDepth-height, posY + ((mv->getVer()+2)>>2));
    1749  
    1750   Pel *refDepth  = picRefDepth->getLumaAddr() + posX + posY * refDepStride;
    1751 
    1752 #endif // NTT_VSP_VECTOR_CLIP_E0208
    1753 
    17541526  Int depStride = yuvDepth->getStride();
    17551527  Pel *depth = yuvDepth->getLumaAddr();
    1756 
    1757 #if NTT_VSP_ADAPTIVE_SPLIT_E0207
    17581528
    17591529  if( width<8 || height<8 )
     
    18941664  }
    18951665
    1896 #else // NTT_VSP_ADAPTIVE_SPLIT_E0207
    1897 
    1898   Int rightOffset = nTxtPerDepthX - 1;
    1899   Int depStrideBlock = depStride * nTxtPerDepthY;
    1900   Int refDepStrideBlock = refDepStride * nTxtPerDepthY;
    1901   Pel *refDepthTop = refDepth;
    1902   Pel *refDepthBot = refDepthTop + (nTxtPerDepthY-1)*refDepStride;
    1903 
    1904   for( Int y=0; y<height; y+= nTxtPerDepthY )
    1905   {
    1906     for( Int x=0; x<width; x+=nTxtPerDepthX )
    1907     {
    1908       Pel maxDepth = refDepthTop[x] > refDepthBot[x] ? refDepthTop[x] : refDepthBot[x];
    1909 
    1910       if( maxDepth < refDepthTop[x+rightOffset] )
    1911       {
    1912         maxDepth = refDepthTop[x+rightOffset];
    1913       }
    1914       if( maxDepth < refDepthBot[x+rightOffset] )
    1915       {
    1916         maxDepth = refDepthBot[x+rightOffset];
    1917       }
    1918 
    1919       depth[x] = maxDepth;
    1920 
    1921     }
    1922     refDepthTop += refDepStrideBlock;
    1923     refDepthBot += refDepStrideBlock;
    1924     depth       += depStrideBlock;
    1925   }
    1926 
    1927 #endif // NTT_VSP_ADAPTIVE_SPLIT_E0207
     1666
    19281667}
    19291668
     
    19431682  Pel *dst    = yuvDst->getLumaAddr(partAddr);
    19441683  Pel *depth  = yuvDepth->getLumaAddr();
    1945  
    1946 #if !(NTT_VSP_DC_BUGFIX_E0208)
    1947   Int widthLuma = picRef->getWidth();
    1948   Int posX, posY;
    1949   cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
    1950 #endif
    19511684
    19521685#if H_3D_VSP_BLOCKSIZE == 1
     
    20211754      Int xFrac = disparity & 0x3;
    20221755
    2023 #if NTT_VSP_DC_BUGFIX_E0208
    2024 
    20251756      dv.setHor( disparity );
    20261757      cu->clipMv( dv );
     
    20381769      assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
    20391770      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
    2040 
    2041 #else // NTT_VSP_DC_BUGFIX_E0208
    2042 
    2043       for( Int j=0; j < nTxtPerDepthX; j++ )
    2044       {
    2045         Int refOffset = xTxt+j + (disparity >> 2);
    2046 #if H_3D_VSP_CONSTRAINED
    2047         if(refOffset<minRelativePos || refOffset>maxRelativePos)
    2048         {
    2049           xFrac = 0;
    2050         }
    2051         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2052 #endif
    2053         Int absX  = posX + refOffset;
    2054 
    2055         if (xFrac == 0)
    2056         {
    2057           absX = Clip3(0, widthLuma-1, absX);
    2058         }
    2059         else
    2060         {
    2061           absX = Clip3(4, widthLuma-5, absX);
    2062         }
    2063 
    2064         refOffset = absX - posX;
    2065         assert( ref[refOffset] >= 0 && ref[refOffset] <= 255 );
    2066        
    2067         m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
    2068       }
    2069 
    2070 #endif // NTT_VSP_DC_BUGFIX_E0208
    2071 
    20721771    }
    20731772    ref   += refStrideBlock;
     
    21011800  Pel *depth  = yuvDepth->getLumaAddr();
    21021801
    2103 #if !(NTT_VSP_DC_BUGFIX_E0208)
    2104   Int widthChroma = picRef->getWidth() >> 1;
    2105   Int posX, posY;
    2106   cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
    2107   posX >>= 1;
    2108   posY >>= 1;
    2109 #endif
    2110  
    21111802#if H_3D_VSP_BLOCKSIZE == 1
    21121803#if H_3D_VSP_CONSTRAINED
     
    21731864      Int xFrac = disparity & 0x7;
    21741865     
    2175 #if NTT_VSP_DC_BUGFIX_E0208
    2176 
    21771866      dv.setHor( disparity );
    21781867      cu->clipMv( dv );
     
    21931882      m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
    21941883      m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
    2195 
    2196 #else // NTT_VSP_DC_BUGFIX_E0208
    2197      
    2198       for( Int j=0; j < nTxtPerDepthX; j++ )
    2199       {
    2200         Int refOffset = xTxt+j + (disparity >> 3);
    2201 #if H_3D_VSP_CONSTRAINED
    2202         if(refOffset<minRelativePos || refOffset>maxRelativePos)
    2203         {
    2204           xFrac = 0;
    2205         }
    2206         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2207 #endif
    2208         Int absX  = posX + refOffset;
    2209 
    2210         if (xFrac == 0)
    2211         {
    2212           absX = Clip3(0, widthChroma-1, absX);
    2213         }
    2214         else
    2215         {
    2216           absX = Clip3(4, widthChroma-5, absX);
    2217         }
    2218 
    2219         refOffset = absX - posX;
    2220         assert( refCb[refOffset] >= 0 && refCb[refOffset] <= 255 );
    2221         assert( refCr[refOffset] >= 0 && refCr[refOffset] <= 255 );
    2222 
    2223         m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
    2224         m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
    2225       }
    2226 
    2227 #endif // NTT_VSP_DC_BUGFIX_E0208
    22281884    }
    22291885    refCb += refStrideBlock;
     
    22331889    depth += depStrideBlock;
    22341890  }
    2235 
    2236 }
    2237 #else // NTT_VSP_COMMON_E0207_E0208
    2238 
    2239 // Input:
    2240 // refPic: Ref picture. Full picture, with padding
    2241 // posX, posY:     PU position, texture
    2242 // sizeX, sizeY: PU size
    2243 // partAddr: z-order index
    2244 // dv: disparity vector. derived from neighboring blocks
    2245 //
    2246 // Output: dstPic, PU predictor 64x64
    2247 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr,Int posX, Int posY
    2248                                             , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi )
    2249 {
    2250   Int widthLuma;
    2251   Int heightLuma;
    2252 
    2253   if (isDepth)
    2254   {
    2255     widthLuma   =  pPicBaseDepth->getWidth();
    2256     heightLuma  =  pPicBaseDepth->getHeight();
    2257   }
    2258   else
    2259   {
    2260     widthLuma   =  refPic->getWidth();
    2261     heightLuma  =  refPic->getHeight();
    2262   }
    2263 
    2264 #if H_3D_VSP_BLOCKSIZE != 1
    2265   Int widthDepth  = pPicBaseDepth->getWidth();
    2266   Int heightDepth = pPicBaseDepth->getHeight();
    2267 #endif
    2268 
    2269 #if H_3D_VSP_CONSTRAINED
    2270   Int widthDepth  = pPicBaseDepth->getWidth();
    2271   Int heightDepth = pPicBaseDepth->getHeight();
    2272 #endif
    2273 
    2274   Int nTxtPerDepthX = widthLuma  / ( pPicBaseDepth->getWidth() );  // texture pixel # per depth pixel
    2275   Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() );
    2276 
    2277   Int refStride = refPic->getStride();
    2278   Int dstStride = dstPic->getStride();
    2279   Int depStride =  pPicBaseDepth->getStride();
    2280   Int depthPosX = Clip3(0,   widthLuma - sizeX,  (posX/nTxtPerDepthX) + ((dv->getHor()+2)>>2));
    2281   Int depthPosY = Clip3(0,   heightLuma- sizeY,  (posY/nTxtPerDepthY) + ((dv->getVer()+2)>>2));
    2282   Pel *ref    = refPic->getLumaAddr() + posX + posY * refStride;
    2283   Pel *dst    = dstPic->getLumaAddr(partAddr);
    2284   Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;
    2285 
    2286 #if H_3D_VSP_BLOCKSIZE != 1
    2287 #if H_3D_VSP_BLOCKSIZE == 2
    2288   Int  dW = sizeX>>1;
    2289   Int  dH = sizeY>>1;
    2290 #endif
    2291 #if H_3D_VSP_BLOCKSIZE == 4
    2292   Int  dW = sizeX>>2;
    2293   Int  dH = sizeY>>2;
    2294 #endif
    2295   {
    2296     Pel* depthi = depth;
    2297     for (Int j = 0; j < dH; j++)
    2298     {
    2299       for (Int i = 0; i < dW; i++)
    2300       {
    2301         Pel* depthTmp;
    2302 #if H_3D_VSP_BLOCKSIZE == 2
    2303         if (depthPosX + (i<<1) < widthDepth)
    2304           depthTmp = depthi + (i << 1);
    2305         else
    2306           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2307 #endif
    2308 #if H_3D_VSP_BLOCKSIZE == 4
    2309         if (depthPosX + (i<<2) < widthDepth)
    2310           depthTmp = depthi + (i << 2);
    2311         else
    2312           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2313 #endif
    2314         Int maxV = 0;
    2315         for (Int blockj = 0; blockj < H_3D_VSP_BLOCKSIZE; blockj+=(H_3D_VSP_BLOCKSIZE-1))
    2316         {
    2317           Int iX = 0;
    2318           for (Int blocki = 0; blocki < H_3D_VSP_BLOCKSIZE; blocki+=(H_3D_VSP_BLOCKSIZE-1))
    2319           {
    2320             if (maxV < depthTmp[iX])
    2321               maxV = depthTmp[iX];
    2322 #if H_3D_VSP_BLOCKSIZE == 2
    2323             if (depthPosX + (i<<1) + blocki < widthDepth - 1)
    2324 #else // H_3D_VSP_BLOCKSIZE == 4
    2325             if (depthPosX + (i<<2) + blocki < widthDepth - 1)
    2326 #endif
    2327               iX = (H_3D_VSP_BLOCKSIZE-1);
    2328           }
    2329 #if H_3D_VSP_BLOCKSIZE == 2
    2330           if (depthPosY + (j<<1) + blockj < heightDepth - 1)
    2331 #else // H_3D_VSP_BLOCKSIZE == 4
    2332           if (depthPosY + (j<<2) + blockj < heightDepth - 1)
    2333 #endif
    2334             depthTmp += depStride * (H_3D_VSP_BLOCKSIZE-1);
    2335         }
    2336         m_pDepthBlock[i+j*dW] = maxV;
    2337       } // end of i < dW
    2338 #if H_3D_VSP_BLOCKSIZE == 2
    2339       if (depthPosY + ((j+1)<<1) < heightDepth)
    2340         depthi += (depStride << 1);
    2341       else
    2342         depthi  = depth + (heightDepth-depthPosY-1)*depStride;
    2343 #endif
    2344 #if H_3D_VSP_BLOCKSIZE == 4
    2345       if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
    2346         depthi += (depStride << 2);
    2347       else
    2348         depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
    2349 #endif
    2350     }
    2351   }
    2352 #endif // H_3D_VSP_BLOCKSIZE != 1
    2353 
    2354 #if H_3D_VSP_BLOCKSIZE == 1
    2355 #if H_3D_VSP_CONSTRAINED
    2356   //get LUT based horizontal reference range
    2357   Int range = xGetConstrainedSize(sizeX, sizeY);
    2358 
    2359   // The minimum depth value
    2360   Int minRelativePos = MAX_INT;
    2361   Int maxRelativePos = MIN_INT;
    2362 
    2363   Pel* depthTemp, *depthInitial=depth;
    2364   for (Int yTxt = 0; yTxt < sizeY; yTxt++)
    2365   {
    2366     for (Int xTxt = 0; xTxt < sizeX; xTxt++)
    2367     {
    2368       if (depthPosX+xTxt < widthDepth)
    2369         depthTemp = depthInitial + xTxt;
    2370       else
    2371         depthTemp = depthInitial + (widthDepth - depthPosX - 1);
    2372 
    2373       Int disparity = pShiftLUT[ *depthTemp ]; // << iShiftPrec;
    2374       Int disparityInt = disparity >> 2;
    2375 
    2376       if( disparity <= 0)
    2377       {
    2378         if (minRelativePos > disparityInt+xTxt)
    2379             minRelativePos = disparityInt+xTxt;
    2380       }
    2381       else
    2382       {
    2383         if (maxRelativePos < disparityInt+xTxt)
    2384             maxRelativePos = disparityInt+xTxt;
    2385       }
    2386     }
    2387     if (depthPosY+yTxt < heightDepth)
    2388       depthInitial = depthInitial + depStride;
    2389   }
    2390 
    2391   Int disparity_tmp = pShiftLUT[ *depth ]; // << iShiftPrec;
    2392   if (disparity_tmp <= 0)
    2393     maxRelativePos = minRelativePos + range -1 ;
    2394   else
    2395     minRelativePos = maxRelativePos - range +1 ;
    2396 #endif
    2397 #endif // H_3D_VSP_BLOCKSIZE == 1
    2398 
    2399 #if H_3D_VSP_BLOCKSIZE != 1
    2400   Int yDepth = 0;
    2401 #endif
    2402   for ( Int yTxt = 0; yTxt < sizeY; yTxt += nTxtPerDepthY )
    2403   {
    2404     for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth++ )
    2405     {
    2406       Pel repDepth = 0; // to store the depth value used for warping
    2407 #if H_3D_VSP_BLOCKSIZE == 1
    2408       repDepth = depth[xDepth];
    2409 #endif
    2410 #if H_3D_VSP_BLOCKSIZE == 2
    2411       repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW];
    2412 #endif
    2413 #if H_3D_VSP_BLOCKSIZE == 4
    2414       repDepth = m_pDepthBlock[(xTxt>>2) + (yTxt>>2)*dW];
    2415 #endif
    2416 
    2417       assert( repDepth >= 0 && repDepth <= 255 );
    2418       Int disparity = pShiftLUT[ repDepth ]; // remove << iShiftPrec ??
    2419       Int refOffset = xTxt + (disparity >> 2);
    2420       Int xFrac = disparity & 0x3;
    2421 #if H_3D_VSP_CONSTRAINED
    2422       if(refOffset<minRelativePos || refOffset>maxRelativePos)
    2423         xFrac = 0;
    2424       refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2425 #endif
    2426       Int absX  = posX + refOffset;
    2427 
    2428       if (xFrac == 0)
    2429         absX = Clip3(0, widthLuma-1, absX);
    2430       else
    2431         absX = Clip3(4, widthLuma-5, absX);
    2432 
    2433       refOffset = absX - posX;
    2434 
    2435       assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
    2436       m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi );
    2437     }
    2438     ref   += refStride*nTxtPerDepthY;
    2439     dst   += dstStride*nTxtPerDepthY;
    2440     depth += depStride;
    2441 #if H_3D_VSP_BLOCKSIZE != 1
    2442     yDepth++;
    2443 #endif
    2444 
    2445   }
    2446 }
    2447 
    2448 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv*dv, UInt partAddr, Int posX, Int posY
    2449                                                , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi)
    2450 {
    2451   Int refStride = refPic->getCStride();
    2452   Int dstStride = dstPic->getCStride();
    2453   Int depStride = pPicBaseDepth->getStride();
    2454 
    2455   Int widthChroma, heightChroma;
    2456   if( isDepth)
    2457   {
    2458      widthChroma   = pPicBaseDepth->getWidth()>>1;
    2459      heightChroma  = pPicBaseDepth->getHeight()>>1;
    2460   }
    2461   else
    2462   {
    2463      widthChroma   = refPic->getWidth()>>1;
    2464      heightChroma  = refPic->getHeight()>>1;
    2465   }
    2466 
    2467   // Below is only for Texture chroma component
    2468 
    2469   Int widthDepth  = pPicBaseDepth->getWidth();
    2470   Int heightDepth = pPicBaseDepth->getHeight();
    2471 
    2472   Int nTxtPerDepthX, nTxtPerDepthY;  // Number of texture samples per one depth sample
    2473   Int nDepthPerTxtX, nDepthPerTxtY;  // Number of depth samples per one texture sample
    2474 
    2475   Int depthPosX;  // Starting position in depth image
    2476   Int depthPosY;
    2477 
    2478   if ( widthChroma > widthDepth )
    2479   {
    2480     nTxtPerDepthX = widthChroma / widthDepth;
    2481     nDepthPerTxtX = 1;
    2482     depthPosX = posX / nTxtPerDepthX + ((dv->getHor()+2)>>2);
    2483   }
    2484   else
    2485   {
    2486     nTxtPerDepthX = 1;
    2487     nDepthPerTxtX = widthDepth / widthChroma;
    2488     depthPosX = posX * nDepthPerTxtX + ((dv->getHor()+2)>>2);
    2489   }
    2490   depthPosX = Clip3(0, widthDepth - (sizeX<<1), depthPosX);
    2491   if ( heightChroma > heightDepth )
    2492   {
    2493     nTxtPerDepthY = heightChroma / heightDepth;
    2494     nDepthPerTxtY = 1;
    2495     depthPosY = posY / nTxtPerDepthY + ((dv->getVer()+2)>>2);
    2496   }
    2497   else
    2498   {
    2499     nTxtPerDepthY = 1;
    2500     nDepthPerTxtY = heightDepth / heightChroma;
    2501     depthPosY = posY * nDepthPerTxtY + ((dv->getVer()+2)>>2);
    2502   }
    2503   depthPosY = Clip3(0, heightDepth - (sizeY<<1), depthPosY);
    2504 
    2505   Pel *refCb  = refPic->getCbAddr() + posX + posY * refStride;
    2506   Pel *refCr  = refPic->getCrAddr() + posX + posY * refStride;
    2507   Pel *dstCb  = dstPic->getCbAddr(partAddr);
    2508   Pel *dstCr  = dstPic->getCrAddr(partAddr);
    2509   Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;  // move the pointer to the current depth pixel position
    2510 
    2511   Int refStrideBlock = refStride * nTxtPerDepthY;
    2512   Int dstStrideBlock = dstStride * nTxtPerDepthY;
    2513   Int depStrideBlock = depStride * nDepthPerTxtY;
    2514 
    2515   if ( widthChroma > widthDepth ) // We assume
    2516   {
    2517     assert( heightChroma > heightDepth );
    2518     printf("This branch should never been reached.\n");
    2519     exit(0);
    2520   }
    2521   else
    2522   {
    2523 #if H_3D_VSP_BLOCKSIZE == 1
    2524   Int  dW = sizeX;
    2525   Int  dH = sizeY;
    2526   Int  sW = 2; // search window size
    2527   Int  sH = 2;
    2528 #endif
    2529 #if H_3D_VSP_BLOCKSIZE == 2
    2530   Int  dW = sizeX;
    2531   Int  dH = sizeY;
    2532   Int  sW = 2; // search window size
    2533   Int  sH = 2;
    2534 #endif
    2535 #if H_3D_VSP_BLOCKSIZE == 4
    2536   Int  dW = sizeX>>1;
    2537   Int  dH = sizeY>>1;
    2538   Int  sW = 4; // search window size
    2539   Int  sH = 4;
    2540 #endif
    2541 
    2542   {
    2543     Pel* depthi = depth;
    2544     for (Int j = 0; j < dH; j++)
    2545     {
    2546       for (Int i = 0; i < dW; i++)
    2547       {
    2548         Pel* depthTmp;
    2549 #if H_3D_VSP_BLOCKSIZE == 1
    2550         depthTmp = depthi + (i << 1);
    2551 #endif
    2552 #if H_3D_VSP_BLOCKSIZE == 2
    2553         if (depthPosX + (i<<1) < widthDepth)
    2554           depthTmp = depthi + (i << 1);
    2555         else
    2556           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2557 #endif
    2558 #if H_3D_VSP_BLOCKSIZE == 4
    2559         if (depthPosX + (i<<2) < widthDepth)
    2560           depthTmp = depthi + (i << 2);
    2561         else
    2562           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2563 #endif
    2564         Int maxV = 0;
    2565         for (Int blockj = 0; blockj < sH; blockj+=(sH-1))
    2566         {
    2567           Int iX = 0;
    2568           for (Int blocki = 0; blocki < sW; blocki+=(sW-1))
    2569           {
    2570             if (maxV < depthTmp[iX])
    2571               maxV = depthTmp[iX];
    2572             if (depthPosX + i*sW + blocki < widthDepth - 1)
    2573                 iX = (sW-1);
    2574           }
    2575           if (depthPosY + j*sH + blockj < heightDepth - 1)
    2576                 depthTmp += depStride * (sH-1);
    2577         }
    2578         m_pDepthBlock[i+j*dW] = maxV;
    2579       } // end of i < dW
    2580 #if H_3D_VSP_BLOCKSIZE == 1
    2581       if (depthPosY + ((j+1)<<1) < heightDepth)
    2582         depthi += (depStride << 1);
    2583       else
    2584         depthi  = depth + (heightDepth-1)*depStride;
    2585 #endif
    2586 #if H_3D_VSP_BLOCKSIZE == 2
    2587       if (depthPosY + ((j+1)<<1) < heightDepth)
    2588         depthi += (depStride << 1);
    2589       else
    2590         depthi  = depth + (heightDepth-depthPosY-1)*depStride;
    2591 #endif
    2592 #if H_3D_VSP_BLOCKSIZE == 4
    2593       if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
    2594         depthi += (depStride << 2);
    2595       else
    2596         depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
    2597 #endif
    2598     }
    2599   }
    2600 
    2601 
    2602 #if H_3D_VSP_BLOCKSIZE == 1
    2603 #if H_3D_VSP_CONSTRAINED
    2604   //get LUT based horizontal reference range
    2605   Int range = xGetConstrainedSize(sizeX, sizeY, false);
    2606 
    2607   // The minimum depth value
    2608   Int minRelativePos = MAX_INT;
    2609   Int maxRelativePos = MIN_INT;
    2610 
    2611   Int depthTmp;
    2612   for (Int yTxt=0; yTxt<sizeY; yTxt++)
    2613   {
    2614     for (Int xTxt=0; xTxt<sizeX; xTxt++)
    2615     {
    2616       depthTmp = m_pDepthBlock[xTxt+yTxt*dW];
    2617       Int disparity = pShiftLUT[ depthTmp ]; // << iShiftPrec;
    2618       Int disparityInt = disparity >> 3;//in chroma resolution
    2619 
    2620       if (disparityInt < 0)
    2621       {
    2622         if (minRelativePos > disparityInt+xTxt)
    2623             minRelativePos = disparityInt+xTxt;
    2624       }
    2625       else
    2626       {
    2627         if (maxRelativePos < disparityInt+xTxt)
    2628             maxRelativePos = disparityInt+xTxt;
    2629       }
    2630     }
    2631   }
    2632 
    2633   depthTmp = m_pDepthBlock[0];
    2634   Int disparity_tmp = pShiftLUT[ depthTmp ]; // << iShiftPrec;
    2635   if ( disparity_tmp < 0 )
    2636     maxRelativePos = minRelativePos + range - 1;
    2637   else
    2638     minRelativePos = maxRelativePos - range + 1;
    2639 
    2640 #endif // H_3D_VSP_CONSTRAINED
    2641 #endif // H_3D_VSP_BLOCKSIZE == 1
    2642 
    2643     // (sizeX, sizeY) is Chroma block size
    2644     for ( Int yTxt = 0, yDepth = 0; yTxt < sizeY; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY )
    2645     {
    2646       for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX )
    2647       {
    2648         Pel repDepth = 0; // to store the depth value used for warping
    2649 #if H_3D_VSP_BLOCKSIZE == 1
    2650         repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW];
    2651 #endif
    2652 #if H_3D_VSP_BLOCKSIZE == 2
    2653         repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW];
    2654 #endif
    2655 #if H_3D_VSP_BLOCKSIZE == 4
    2656         repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW];
    2657 #endif
    2658 
    2659       // calculate the offset in the reference picture
    2660         Int disparity = pShiftLUT[ repDepth ]; // Remove << iShiftPrec;
    2661         Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image
    2662         Int xFrac = disparity & 0x7;
    2663 #if H_3D_VSP_CONSTRAINED
    2664         if(refOffset < minRelativePos || refOffset > maxRelativePos)
    2665           xFrac = 0;
    2666         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2667 #endif
    2668         Int absX  = posX + refOffset;
    2669 
    2670         if (xFrac == 0)
    2671           absX = Clip3(0, widthChroma-1, absX);
    2672         else
    2673           absX = Clip3(4, widthChroma-5, absX);
    2674 
    2675         refOffset = absX - posX;
    2676 
    2677         assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 );
    2678         assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
    2679         m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
    2680         m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
    2681       }
    2682       refCb += refStrideBlock;
    2683       refCr += refStrideBlock;
    2684       dstCb += dstStrideBlock;
    2685       dstCr += dstStrideBlock;
    2686       depth += depStrideBlock;
    2687     }
    2688   }
    2689 
    2690 }
    2691 
    2692 #endif // NTT_VSP_COMMON_E0207_E0208
     1891}
     1892
    26931893
    26941894#if H_3D_VSP_CONSTRAINED
     
    27681968
    27691969#if H_3D_DIM_DMM
    2770 #if !SEC_DMM2_E0146_HHIFIX
    2771 UInt TComPrediction::xPredWedgeFromIntra( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd )
    2772 {
    2773   UInt uiThisBlockSize = uiWidth;
    2774 
    2775   TComDataCU* pcTempCU;
    2776   UInt        uiTempPartIdx;
    2777   // 1st: try continue above wedgelet
    2778   pcTempCU = pcCU->getPUAbove( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx );
    2779   if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) )
    2780   {
    2781     UInt dimType =  getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );
    2782     if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )
    2783     {
    2784       // get offset between current and reference block
    2785       UInt uiOffsetX = 0, uiOffsetY = 0;
    2786       xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY );
    2787 
    2788       // get reference wedgelet
    2789       WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])];
    2790       TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) );
    2791 
    2792       // find wedgelet, if direction is suitable for continue wedge
    2793       if( pcRefWedgelet->checkPredDirAbovePossible( uiThisBlockSize, uiOffsetX ) )
    2794       {
    2795         UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;
    2796         pcRefWedgelet->getPredDirStartEndAbove( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetX, iDeltaEnd );
    2797         return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );
    2798       }
    2799     }
    2800   }
    2801 
    2802   // 2nd: try continue left wedglelet
    2803   pcTempCU = pcCU->getPULeft( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx );
    2804   if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) )
    2805   {
    2806     UInt dimType = getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );
    2807     if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )
    2808     {
    2809       // get offset between current and reference block
    2810       UInt uiOffsetX = 0, uiOffsetY = 0;
    2811       xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY );
    2812 
    2813       // get reference wedgelet
    2814       WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])];
    2815       TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) );
    2816 
    2817       // find wedgelet, if direction is suitable for continue wedge
    2818       if( pcRefWedgelet->checkPredDirLeftPossible( uiThisBlockSize, uiOffsetY ) )
    2819       {
    2820         UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;
    2821         pcRefWedgelet->getPredDirStartEndLeft( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetY, iDeltaEnd );
    2822         return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );
    2823       }
    2824     }
    2825   }
    2826 
    2827   // 3rd: (default) make wedglet from intra dir and max slope point
    2828   Int iSlopeX = 0, iSlopeY = 0;
    2829   UInt uiStartPosX = 0, uiStartPosY = 0;
    2830   if( xGetWedgeIntraDirPredData( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY ) )
    2831   {
    2832     UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;
    2833     xGetWedgeIntraDirStartEnd( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, iDeltaEnd );
    2834     return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );
    2835   }
    2836 
    2837   return 0;
    2838 }
    2839 #endif
    2840 
    28411970UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx )
    28421971{
     
    28471976  Int           uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
    28481977
    2849 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    28501978  assert( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 );
    28511979  return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx);
    2852 #else
    2853   if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ) { return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx); }
    2854   else                                                     { return g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])].at(intraTabIdx).getPatternIdx(); }
    2855 #endif
    28561980}
    28571981
     
    28751999  }
    28762000
    2877 #if SCU_HS_DMM4_REMOVE_DIV_E0242
    2878   Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;
    2879   iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2;
    2880 #else
    2881   iDC /= (uiWidth*uiHeight);
    2882 #endif
     2001  Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;   //
     2002  iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2;        //  iDC /= (uiWidth*uiHeight);
     2003
    28832004  piRefBlkY = cTempYuv.getLumaAddr();
    28842005
     
    29072028  }
    29082029}
    2909 
    2910 #if !SEC_DMM2_E0146_HHIFIX
    2911 Void TComPrediction::xGetBlockOffset( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY )
    2912 {
    2913   ruiOffsetX = 0;
    2914   ruiOffsetY = 0;
    2915 
    2916   // get offset between current and above/left block
    2917   UInt uiThisOriginX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
    2918   UInt uiThisOriginY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    2919 
    2920   UInt uiNumPartInRefCU = pcRefCU->getTotalNumPart();
    2921   UInt uiMaxDepthRefCU = 0;
    2922   while( uiNumPartInRefCU > 1 )
    2923   {
    2924     uiNumPartInRefCU >>= 2;
    2925     uiMaxDepthRefCU++;
    2926   }
    2927 
    2928   UInt uiDepthRefPU = (pcRefCU->getDepth(uiRefAbsPartIdx)) + (pcRefCU->getPartitionSize(uiRefAbsPartIdx) == SIZE_2Nx2N ? 0 : 1);
    2929   UInt uiShifts = (uiMaxDepthRefCU - uiDepthRefPU)*2;
    2930   UInt uiRefBlockOriginPartIdx = (uiRefAbsPartIdx>>uiShifts)<<uiShifts;
    2931 
    2932   UInt uiRefOriginX = pcRefCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ];
    2933   UInt uiRefOriginY = pcRefCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ];
    2934 
    2935   if( (uiThisOriginX - uiRefOriginX) > 0 ) { ruiOffsetX = (UInt)(uiThisOriginX - uiRefOriginX); }
    2936   if( (uiThisOriginY - uiRefOriginY) > 0 ) { ruiOffsetY = (UInt)(uiThisOriginY - uiRefOriginY); }
    2937 }
    2938 
    2939 Bool TComPrediction::xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY )
    2940 {
    2941   riSlopeX = 0, riSlopeY = 0, ruiStartPosX = 0, ruiStartPosY = 0;
    2942 
    2943   // 1st step: get wedge start point (max. slope)
    2944   Int* piSource = pcCU->getPattern()->getAdiOrgBuf( uiBlockSize, uiBlockSize, m_piYuvExt );
    2945   Int iSourceStride = ( uiBlockSize<<1 ) + 1;
    2946 
    2947   UInt uiSlopeMaxAbove = 0, uiPosSlopeMaxAbove = 0;
    2948   for( UInt uiPosHor = 0; uiPosHor < (uiBlockSize-1); uiPosHor++ )
    2949   {
    2950     if( abs( piSource[uiPosHor+1] - piSource[uiPosHor] ) > uiSlopeMaxAbove )
    2951     {
    2952       uiSlopeMaxAbove = abs( piSource[uiPosHor+1] - piSource[uiPosHor] );
    2953       uiPosSlopeMaxAbove = uiPosHor;
    2954     }
    2955   }
    2956 
    2957   UInt uiSlopeMaxLeft = 0, uiPosSlopeMaxLeft = 0;
    2958   for( UInt uiPosVer = 0; uiPosVer < (uiBlockSize-1); uiPosVer++ )
    2959   {
    2960     if( abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] ) > uiSlopeMaxLeft )
    2961     {
    2962       uiSlopeMaxLeft = abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] );
    2963       uiPosSlopeMaxLeft = uiPosVer;
    2964     }
    2965   }
    2966 
    2967   if( uiSlopeMaxAbove == 0 && uiSlopeMaxLeft == 0 )
    2968   {
    2969     return false;
    2970   }
    2971 
    2972   ruiStartPosX = ( uiSlopeMaxAbove >  uiSlopeMaxLeft  ) ? uiPosSlopeMaxAbove : 0;
    2973   ruiStartPosY = ( uiSlopeMaxLeft  >= uiSlopeMaxAbove ) ? uiPosSlopeMaxLeft  : 0;
    2974 
    2975   // 2nd step: derive wedge direction
    2976   Int uiPreds[3] = {-1, -1, -1};
    2977   Int iMode = -1;
    2978   Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 
    2979 
    2980   UInt uiDirMode = 0;
    2981   if( iMode >= 0 ) { iPredNum = iMode; }
    2982   if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; }
    2983   if( iPredNum == 2 ) { uiDirMode = uiPreds[1]; }
    2984 
    2985   if( uiDirMode < 2 ) { return false; } // no planar & DC
    2986 
    2987   Bool modeHor       = (uiDirMode < 18);
    2988   Bool modeVer       = !modeHor;
    2989   Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0;
    2990   Int absAng         = abs(intraPredAngle);
    2991   Int signAng        = intraPredAngle < 0 ? -1 : 1;
    2992   Int angTable[9]    = {0,2,5,9,13,17,21,26,32};
    2993   absAng             = angTable[absAng];
    2994   intraPredAngle     = signAng * absAng;
    2995 
    2996   // 3rd step: set slope for direction
    2997   if( modeHor )
    2998   {
    2999     riSlopeX = ( intraPredAngle > 0 ) ?            -32 :              32;
    3000     riSlopeY = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle;
    3001   }
    3002   else if( modeVer )
    3003   {
    3004     riSlopeX = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle;
    3005     riSlopeY = ( intraPredAngle > 0 ) ?            -32 :              32;
    3006   }
    3007 
    3008   return true;
    3009 }
    3010 
    3011 Void TComPrediction::xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd )
    3012 {
    3013   ruhXs = 0;
    3014   ruhYs = 0;
    3015   ruhXe = 0;
    3016   ruhYe = 0;
    3017 
    3018   // scaling of start pos and block size to wedge resolution
    3019   UInt uiScaledStartPosX = 0;
    3020   UInt uiScaledStartPosY = 0;
    3021   UInt uiScaledBlockSize = 0;
    3022   WedgeResolution eWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiBlockSize]];
    3023   switch( eWedgeRes )
    3024   {
    3025   case( DOUBLE_PEL ): { uiScaledStartPosX = (uiPMSPosX>>1); uiScaledStartPosY = (uiPMSPosY>>1); uiScaledBlockSize = (uiBlockSize>>1); break; }
    3026   case(   FULL_PEL ): { uiScaledStartPosX =  uiPMSPosX;     uiScaledStartPosY =  uiPMSPosY;     uiScaledBlockSize =  uiBlockSize;     break; }
    3027   case(   HALF_PEL ): { uiScaledStartPosX = (uiPMSPosX<<1); uiScaledStartPosY = (uiPMSPosY<<1); uiScaledBlockSize = (uiBlockSize<<1); break; }
    3028   }
    3029   Int iMaxPos = (Int)uiScaledBlockSize - 1;
    3030 
    3031   // case above
    3032   if( uiScaledStartPosX > 0 && uiScaledStartPosY == 0 )
    3033   {
    3034     ruhXs = (UChar)uiScaledStartPosX;
    3035     ruhYs = 0;
    3036 
    3037     if( iDeltaY == 0 )
    3038     {
    3039       if( iDeltaX < 0 )
    3040       {
    3041         ruhXe = 0;
    3042         ruhYe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos );
    3043         return;
    3044       }
    3045       else
    3046       {
    3047         ruhXe = (UChar)iMaxPos;
    3048         ruhYe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos );
    3049         std::swap( ruhXs, ruhXe );
    3050         std::swap( ruhYs, ruhYe );
    3051         return;
    3052       }
    3053     }
    3054 
    3055     // regular case
    3056     Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) );
    3057 
    3058     if( iVirtualEndX < 0 )
    3059     {
    3060       Int iYe = roftoi( (Double)(0 - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) + iDeltaEnd;
    3061       if( iYe < (Int)uiScaledBlockSize )
    3062       {
    3063         ruhXe = 0;
    3064         ruhYe = (UChar)std::max( iYe, 0 );
    3065         return;
    3066       }
    3067       else
    3068       {
    3069         ruhXe = (UChar)std::min( (iYe - iMaxPos), iMaxPos );
    3070         ruhYe = (UChar)iMaxPos;
    3071         return;
    3072       }
    3073     }
    3074     else if( iVirtualEndX > iMaxPos )
    3075     {
    3076       Int iYe = roftoi( (Double)(iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd;
    3077       if( iYe < (Int)uiScaledBlockSize )
    3078       {
    3079         ruhXe = (UChar)iMaxPos;
    3080         ruhYe = (UChar)std::max( iYe, 0 );
    3081         std::swap( ruhXs, ruhXe );
    3082         std::swap( ruhYs, ruhYe );
    3083         return;
    3084       }
    3085       else
    3086       {
    3087         ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 );
    3088         ruhYe = (UChar)iMaxPos;
    3089         return;
    3090       }
    3091     }
    3092     else
    3093     {
    3094       Int iXe = iVirtualEndX + iDeltaEnd;
    3095       if( iXe < 0 )
    3096       {
    3097         ruhXe = 0;
    3098         ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 );
    3099         return;
    3100       }
    3101       else if( iXe > iMaxPos )
    3102       {
    3103         ruhXe = (UChar)iMaxPos;
    3104         ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 );
    3105         std::swap( ruhXs, ruhXe );
    3106         std::swap( ruhYs, ruhYe );
    3107         return;
    3108       }
    3109       else
    3110       {
    3111         ruhXe = (UChar)iXe;
    3112         ruhYe = (UChar)iMaxPos;
    3113         return;
    3114       }
    3115     }
    3116   }
    3117 
    3118   // case left
    3119   if( uiScaledStartPosY > 0 && uiScaledStartPosX == 0 )
    3120   {
    3121     ruhXs = 0;
    3122     ruhYs = (UChar)uiScaledStartPosY;
    3123 
    3124     if( iDeltaX == 0 )
    3125     {
    3126       if( iDeltaY < 0 )
    3127       {
    3128         ruhXe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos );
    3129         ruhYe = 0;
    3130         std::swap( ruhXs, ruhXe );
    3131         std::swap( ruhYs, ruhYe );
    3132         return;
    3133       }
    3134       else
    3135       {
    3136         ruhXe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos );
    3137         ruhYe = (UChar)iMaxPos;
    3138         return;
    3139       }
    3140     }
    3141 
    3142     // regular case
    3143     Int iVirtualEndY = (Int)ruhYs + roftoi( (Double)iMaxPos * ((Double)iDeltaY / (Double)iDeltaX) );
    3144 
    3145     if( iVirtualEndY < 0 )
    3146     {
    3147       Int iXe = roftoi( (Double)(0 - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) - iDeltaEnd;
    3148       if( iXe < (Int)uiScaledBlockSize )
    3149       {
    3150         ruhXe = (UChar)std::max( iXe, 0 );
    3151         ruhYe = 0;
    3152         std::swap( ruhXs, ruhXe );
    3153         std::swap( ruhYs, ruhYe );
    3154         return;
    3155       }
    3156       else
    3157       {
    3158         ruhXe = (UChar)iMaxPos;
    3159         ruhYe = (UChar)std::min( (iXe - iMaxPos), iMaxPos );
    3160         std::swap( ruhXs, ruhXe );
    3161         std::swap( ruhYs, ruhYe );
    3162         return;
    3163       }
    3164     }
    3165     else if( iVirtualEndY > (uiScaledBlockSize-1) )
    3166     {
    3167       Int iXe = roftoi( (Double)((Int)(uiScaledBlockSize-1) - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) + iDeltaEnd;
    3168       if( iXe < (Int)uiScaledBlockSize )
    3169       {
    3170         ruhXe = (UChar)std::max( iXe, 0 );
    3171         ruhYe = (UChar)(uiScaledBlockSize-1);
    3172         return;
    3173       }
    3174       else
    3175       {
    3176         ruhXe = (UChar)iMaxPos;
    3177         ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 );
    3178         std::swap( ruhXs, ruhXe );
    3179         std::swap( ruhYs, ruhYe );
    3180         return;
    3181       }
    3182     }
    3183     else
    3184     {
    3185       Int iYe = iVirtualEndY - iDeltaEnd;
    3186       if( iYe < 0 )
    3187       {
    3188         ruhXe = (UChar)std::max( (iMaxPos + iYe), 0 );
    3189         ruhYe = 0;
    3190         std::swap( ruhXs, ruhXe );
    3191         std::swap( ruhYs, ruhYe );
    3192         return;
    3193       }
    3194       else if( iYe > iMaxPos )
    3195       {
    3196         ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 );
    3197         ruhYe = (UChar)iMaxPos;
    3198         return;
    3199       }
    3200       else
    3201       {
    3202         ruhXe = (UChar)iMaxPos;
    3203         ruhYe = (UChar)iYe;
    3204         std::swap( ruhXs, ruhXe );
    3205         std::swap( ruhYs, ruhYe );
    3206         return;
    3207       }
    3208     }
    3209   }
    3210 
    3211   // case origin
    3212   if( uiScaledStartPosX == 0 && uiScaledStartPosY == 0 )
    3213   {
    3214     if( iDeltaX*iDeltaY < 0 )
    3215     {
    3216       return;
    3217     }
    3218 
    3219     ruhXs = 0;
    3220     ruhYs = 0;
    3221 
    3222     if( iDeltaY == 0 )
    3223     {
    3224       ruhXe = (UChar)iMaxPos;
    3225       ruhYe = 0;
    3226       std::swap( ruhXs, ruhXe );
    3227       std::swap( ruhYs, ruhYe );
    3228       return;
    3229     }
    3230 
    3231     if( iDeltaX == 0 )
    3232     {
    3233       ruhXe = 0;
    3234       ruhYe = (UChar)iMaxPos;
    3235       return;
    3236     }
    3237 
    3238     Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) );
    3239 
    3240     if( iVirtualEndX > iMaxPos )
    3241     {
    3242       Int iYe = roftoi( (Double)((Int)iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd;
    3243       if( iYe < (Int)uiScaledBlockSize )
    3244       {
    3245         ruhXe = (UChar)(uiScaledBlockSize-1);
    3246         ruhYe = (UChar)std::max( iYe, 0 );
    3247         std::swap( ruhXs, ruhXe );
    3248         std::swap( ruhYs, ruhYe );
    3249         return;
    3250       }
    3251       else
    3252       {
    3253         ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 );
    3254         ruhYe = (UChar)(uiScaledBlockSize-1);
    3255         return;
    3256       }
    3257     }
    3258     else
    3259     {
    3260       Int iXe = iVirtualEndX + iDeltaEnd;
    3261       if( iXe < 0 )
    3262       {
    3263         ruhXe = 0;
    3264         ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 );
    3265         return;
    3266       }
    3267       else if( iXe > iMaxPos )
    3268       {
    3269         ruhXe = (UChar)(uiScaledBlockSize-1);
    3270         ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 );
    3271         std::swap( ruhXs, ruhXe );
    3272         std::swap( ruhYs, ruhYe );
    3273         return;
    3274       }
    3275       else
    3276       {
    3277         ruhXe = (UChar)iXe;
    3278         ruhYe = (UChar)(uiScaledBlockSize-1);
    3279         return;
    3280       }
    3281     }
    3282   }
    3283 }
    3284 
    3285 UInt TComPrediction::xGetWedgePatternIdx( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe )
    3286 {
    3287   WedgeRefList* pcWedgeRefList = &g_dmmWedgeRefLists[(g_aucConvertToBit[uiBlockSize])];
    3288   for( UInt uiIdx = 0; uiIdx < pcWedgeRefList->size(); uiIdx++ )
    3289   {
    3290     TComWedgeRef* pcTestWedgeRef = &(pcWedgeRefList->at(uiIdx));
    3291     if( pcTestWedgeRef->getStartX() == uhXs && pcTestWedgeRef->getStartY() == uhYs && pcTestWedgeRef->getEndX() == uhXe && pcTestWedgeRef->getEndY() == uhYe )
    3292     {
    3293       return pcTestWedgeRef->getRefIdx();
    3294     }
    3295   }
    3296   return 0;
    3297 }
    3298 #endif
    3299 #endif
     2030#endif
     2031
    33002032#if H_3D_DIM_RBC
    33012033Void TComPrediction::xDeltaDCQuantScaleUp( TComDataCU* pcCU, Pel& rDeltaDC )
     
    33272059#if H_3D_DIM_SDC
    33282060Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
    3329 #if KWU_SDC_SIMPLE_DC_E0117
    33302061                                         ,UInt uiIntraMode
    33312062                                         ,Bool orgDC
    3332 #endif
    33332063                                        )
    33342064{
     
    33382068  memset(iSumPix, 0, sizeof(Int)*2);
    33392069 
    3340 #if KWU_SDC_SIMPLE_DC_E0117
    33412070  if (orgDC == false)
    33422071  {
     
    33642093    return;
    33652094  }
    3366 #endif
    33672095
    33682096  Int subSamplePix;
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r622 r655  
    7676  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
    7777#if H_3D_IC
    78 #if SHARP_ILLUCOMP_REFINE_E0046
    7978  UInt   m_uiaShift[ 64 ];       // Table for multiplication to substitue of division operation
    80 #else
    81   UInt   m_uiaShift[ 63 ];       // Table for multiplication to substitue of division operation
    82 #endif
    8379#endif
    8480
     
    8884  Int  xGetConstrainedSize(Int nPbW, Int nPbH, Bool bLuma = true);
    8985#endif
    90 #if NTT_VSP_COMMON_E0207_E0208
    9186  TComYuv   m_cYuvDepthOnVsp;
    92 #endif
    9387#endif
    9488
     
    126120
    127121#if H_3D_VSP
    128 #if NTT_VSP_COMMON_E0207_E0208
    129122  Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int txtPerDepthX=1, Int txtPerDepthY=1 );
    130123  Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
    131124  Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
    132 #else
    133   Void xPredInterLumaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi );
    134   Void xPredInterChromaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi );
    135 #endif
    136125#endif
    137126
     
    140129  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    141130#if H_3D_IC
    142 #if SHARP_ILLUCOMP_REFINE_E0046
    143131  Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType );
    144 #else
    145   Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType );
    146 #endif
    147132#endif
    148133  Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
     
    154139  Void xAssignBiSegDCs          ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel   valDC1, Pel   valDC2 );
    155140#if H_3D_DIM_DMM
    156 #if !SEC_DMM2_E0146_HHIFIX
    157   UInt xPredWedgeFromIntra      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd = 0 );
    158 #endif
    159141  UInt xPredWedgeFromTex        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx );
    160142  Void xPredContourFromTex      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );
    161 
    162143  Void xCopyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
    163 
    164 #if !SEC_DMM2_E0146_HHIFIX
    165   Void xGetBlockOffset          ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY );
    166   Bool xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY );
    167   Void xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd = 0 );
    168   UInt xGetWedgePatternIdx      ( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe );
    169 #endif
    170144#endif
    171145#if H_3D_DIM_RBC
     
    196170#if H_3D_DIM_SDC
    197171  Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
    198 #if KWU_SDC_SIMPLE_DC_E0117
    199172                                    ,UInt uiIntraMode
    200173                                    ,Bool orgDC=false
    201 #endif
    202174    );
    203175#endif
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r622 r655  
    484484}
    485485
    486 #if SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     486#if H_3D_FAST_DEPTH_INTRA
    487487
    488488UInt TComRdCost::calcVAR (Pel* pi0, Int stride, Int width, Int height, Int cuDepth)
     
    542542  cDtParam.bUseIC       = false;
    543543#endif
    544 #if LGE_INTER_SDC_E0156
     544#if H_3D_INTER_SDC
    545545  cDtParam.bUseSDCMRSAD = false;
    546546#endif
     
    605605    dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight);
    606606  }
    607 #if H_3D_FIX_UINT_WARNING
     607
    608608  return (UInt) dist;
    609 #else
    610   return dist;
    611 #endif
    612 
    613 }
    614 #endif
    615 
    616 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     609}
     610#endif
     611
     612#if (RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT) || KWU_RC_MADPRED_E0227
    617613UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height )
    618614{
     
    652648  }
    653649#endif
    654 #if LGE_INTER_SDC_E0156
     650#if H_3D_INTER_SDC
    655651  if( pcDtParam->bUseSDCMRSAD )
    656652  {
     
    692688  }
    693689#endif
    694 #if LGE_INTER_SDC_E0156
     690#if H_3D_INTER_SDC
    695691  if( pcDtParam->bUseSDCMRSAD )
    696692  {
     
    735731  }
    736732#endif
    737 #if LGE_INTER_SDC_E0156
     733#if H_3D_INTER_SDC
    738734  if( pcDtParam->bUseSDCMRSAD )
    739735  {
     
    782778  }
    783779#endif
    784 #if LGE_INTER_SDC_E0156
     780#if H_3D_INTER_SDC
    785781  if( pcDtParam->bUseSDCMRSAD )
    786782  {
     
    838834  }
    839835#endif
    840 #if LGE_INTER_SDC_E0156
     836#if H_3D_INTER_SDC
    841837  if( pcDtParam->bUseSDCMRSAD )
    842838  {
     
    886882  }
    887883#endif
    888 #if LGE_INTER_SDC_E0156
     884#if H_3D_INTER_SDC
    889885  if( pcDtParam->bUseSDCMRSAD )
    890886  {
     
    944940  }
    945941#endif
    946 #if LGE_INTER_SDC_E0156
     942#if H_3D_INTER_SDC
    947943  if( pcDtParam->bUseSDCMRSAD )
    948944  {
     
    10161012  }
    10171013#endif
    1018 #if LGE_INTER_SDC_E0156
     1014#if H_3D_INTER_SDC
    10191015  if( pcDtParam->bUseSDCMRSAD )
    10201016  {
     
    10811077  }
    10821078#endif
    1083 #if LGE_INTER_SDC_E0156
     1079#if H_3D_INTER_SDC
    10841080  if( pcDtParam->bUseSDCMRSAD )
    10851081  {
     
    11851181  }
    11861182#endif
    1187 #if LGE_INTER_SDC_E0156
     1183#if H_3D_INTER_SDC
    11881184  if( pcDtParam->bUseSDCMRSAD )
    11891185  {
     
    12611257#endif
    12621258
    1263 #if H_3D_IC || LGE_INTER_SDC_E0156
     1259#if H_3D_IC || H_3D_INTER_SDC
    12641260UInt TComRdCost::xGetSADic( DistParam* pcDtParam )
    12651261{
     
    35133509  }
    35143510#endif
    3515 #if LGE_INTER_SDC_E0156
     3511#if H_3D_INTER_SDC
    35163512  if( pcDtParam->bUseSDCMRSAD )
    35173513  {
     
    36163612}
    36173613
    3618 #if H_3D_IC || LGE_INTER_SDC_E0156
     3614#if H_3D_IC || H_3D_INTER_SDC
    36193615UInt TComRdCost::xGetHADsic( DistParam* pcDtParam )
    36203616{
  • trunk/source/Lib/TLibCommon/TComRdCost.h

    r622 r655  
    9494  Bool  bUseIC;
    9595#endif
    96 #if LGE_INTER_SDC_E0156
     96#if H_3D_INTER_SDC
    9797  Bool  bUseSDCMRSAD;
    9898#endif
     
    136136    iStrideVir = 0;
    137137#endif
    138 #if LGE_INTER_SDC_E0156
     138#if H_3D_INTER_SDC
    139139    bUseSDCMRSAD = false;
    140140#endif
     
    148148private:
    149149  // for distortion
    150   Int                     m_iBlkWidth;
    151   Int                     m_iBlkHeight;
    152150 
    153151#if AMP_SAD
     
    235233  UInt    calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight );
    236234 
    237 #if SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     235#if H_3D_FAST_DEPTH_INTRA
    238236  UInt    calcVAR(Pel* pi0, Int stride, Int width, Int height, Int cuDepth);
    239237#endif 
     
    283281  static UInt xGetSSE64         ( DistParam* pcDtParam );
    284282  static UInt xGetSSE16N        ( DistParam* pcDtParam );
    285 #if H_3D_IC || LGE_INTER_SDC_E0156
     283#if H_3D_IC || H_3D_INTER_SDC
    286284  static UInt xGetSADic         ( DistParam* pcDtParam );
    287285  static UInt xGetSAD4ic        ( DistParam* pcDtParam );
     
    311309
    312310#if AMP_SAD
    313 #if H_3D_IC || LGE_INTER_SDC_E0156
     311#if H_3D_IC || H_3D_INTER_SDC
    314312  static UInt xGetSAD12ic       ( DistParam* pcDtParam );
    315313  static UInt xGetSAD24ic       ( DistParam* pcDtParam );
     
    322320#endif
    323321
    324 #if H_3D_IC || LGE_INTER_SDC_E0156
     322#if H_3D_IC || H_3D_INTER_SDC
    325323  static UInt xGetHADsic          ( DistParam* pcDtParam );
    326324#endif
     
    343341#endif
    344342
    345 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     343#if (RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT) || KWU_RC_MADPRED_E0227
    346344  UInt   getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height );
    347345#endif
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r622 r655  
    5555  ::memset( g_aucConvertToBit,   -1, sizeof( g_aucConvertToBit ) );
    5656  c=0;
    57   for ( i=4; i<MAX_CU_SIZE; i*=2 )
     57  for ( i=4; i<=MAX_CU_SIZE; i*=2 )
    5858  {
    5959    g_aucConvertToBit[ i ] = c;
    6060    c++;
    6161  }
    62   g_aucConvertToBit[ i ] = c;
    6362 
    6463  c=2;
     
    292291
    293292#if FAST_UDI_USE_MPM
    294 const UChar g_aucIntraModeNumFast[7] =
     293const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] =
    295294{
    296295  3,  //   2x2
     
    299298  3,  //  16x16   
    300299  3,  //  32x32   
    301   3,  //  64x64   
    302   3   // 128x128 
     300  3   //  64x64   
    303301};
    304302#else // FAST_UDI_USE_MPM
    305 const UChar g_aucIntraModeNumFast[7] =
     303const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] =
    306304{
    307305  3,  //   2x2
     
    310308  4,  //  16x16   33
    311309  4,  //  32x32   33
    312   5,  //  64x64   33
    313   4   // 128x128  33
     310  5   //  64x64   33
    314311};
    315312#endif // FAST_UDI_USE_MPM
     
    347344{ //2x2   4x4   8x8 16x16 32x32 64x64
    348345     0,    7,   10,   11,   11,   13 };
    349 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
     346
    350347const UChar g_dmm3IntraTabIdxBits[6] =
    351348{ //2x2   4x4   8x8 16x16 32x32 64x64
    352349     0,    4,    7,    8,    8,    0 };
    353 #else
    354 const UChar g_dmm3IntraTabIdxBits[6] =
    355 { //2x2   4x4   8x8 16x16 32x32 64x64
    356      0,    6,    9,    9,    9,    0 };
    357 #endif
    358350
    359351extern std::vector< std::vector<TComWedgelet> >   g_dmmWedgeLists;
     
    614606std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    615607
    616 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    617608Void initWedgeLists( Bool initNodeList )
    618 #else
    619 Void initWedgeLists( Bool initRefinements )
    620 #endif
    621609{
    622610  if( !g_dmmWedgeLists.empty() ) return;
     
    631619    g_dmmWedgeRefLists.push_back( acWedgeRefList );
    632620
    633 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    634621    if( initNodeList )
    635622    {
    636 #endif
    637     // create WedgeNodeList
    638     std::vector<TComWedgeNode> acWedgeNodeList;
    639     for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ )
    640     {
    641       if( acWedgeList[uiPos].getIsCoarse() )
    642       {
    643         TComWedgeNode cWedgeNode;
    644         cWedgeNode.setPatternIdx( uiPos );
    645 
    646 #if !LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    647         if( initRefinements )
     623      // create WedgeNodeList
     624      std::vector<TComWedgeNode> acWedgeNodeList;
     625      for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ )
     626      {
     627        if( acWedgeList[uiPos].getIsCoarse() )
    648628        {
    649 #endif
     629          TComWedgeNode cWedgeNode;
     630          cWedgeNode.setPatternIdx( uiPos );
     631
    650632          UInt uiRefPos = 0;
    651633          for( Int iOffS = -1; iOffS <= 1; iOffS++ )
     
    674656              {
    675657                if( iSx == (Int)acWedgeRefList[k].getStartX() &&
    676                     iSy == (Int)acWedgeRefList[k].getStartY() &&
    677                     iEx == (Int)acWedgeRefList[k].getEndX()   &&
    678                     iEy == (Int)acWedgeRefList[k].getEndY()      )
     658                  iSy == (Int)acWedgeRefList[k].getStartY() &&
     659                  iEx == (Int)acWedgeRefList[k].getEndX()   &&
     660                  iEy == (Int)acWedgeRefList[k].getEndY()      )
    679661                {
    680662                  if( acWedgeRefList[k].getRefIdx() != cWedgeNode.getPatternIdx() )
     
    694676            }
    695677          }
    696 #if !LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
     678          acWedgeNodeList.push_back( cWedgeNode );
    697679        }
    698 #endif
    699         acWedgeNodeList.push_back( cWedgeNode );
    700       }
    701     }
    702     g_dmmWedgeNodeLists.push_back( acWedgeNodeList );
    703 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    704   }
    705 #endif
    706   }
    707   return;
     680      }
     681      g_dmmWedgeNodeLists.push_back( acWedgeNodeList );
     682    }
     683  }
    708684}
    709685
  • trunk/source/Lib/TLibCommon/TComRom.h

    r622 r655  
    5656// ====================================================================================================================
    5757
    58 #define     MAX_CU_DEPTH            7                           // log2(LCUSize)
     58#define     MAX_CU_DEPTH            6                           // log2(LCUSize)
    5959#define     MAX_CU_SIZE             (1<<(MAX_CU_DEPTH))         // maximum allowable size of CU
    6060#define     MIN_PU_SIZE             4
     
    136136// ====================================================================================================================
    137137
    138 extern const UChar  g_aucIntraModeNumFast[7];
     138extern const UChar  g_aucIntraModeNumFast[ MAX_CU_DEPTH ];
    139139
    140140// ====================================================================================================================
     
    174174extern       std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    175175
    176 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    177176Void initWedgeLists( Bool initNodeList = false );
    178 #else
    179 Void initWedgeLists( Bool initRefinements = false );
    180 #endif
    181177Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes );
    182178Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList );
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r622 r655  
    101101, m_enableTMVPFlag                ( true )
    102102#if H_MV
    103 #if H_MV5
    104103, m_refPicSetInterLayer0           ( NULL )
    105104, m_refPicSetInterLayer1           ( NULL )
    106 #else
    107 , m_refPicSetInterLayer           ( NULL )
    108 #endif
    109105, m_layerId                       (0)
    110106, m_viewId                        (0)
    111 #if H_MV5
    112107, m_viewIndex                     (0)
    113 #endif
    114108#if H_3D
    115 #if !H_MV5
    116 , m_viewIndex                     (0)
    117 #endif
    118109, m_isDepth                       (false)
    119110#endif
    120 #if H_MV5
    121111, m_pocResetFlag                  (false)
    122 #endif
    123112, m_discardableFlag               (false)
    124113, m_interLayerPredEnabledFlag     (false)
    125114, m_numInterLayerRefPicsMinus1    (0)
    126 #if !H_MV5
    127 , m_interLayerSamplePredOnlyFlag  (false)
    128 , m_altCollocatedIndicationFlag   (0)
    129 , m_collocatedRefLayerIdx         (0)
    130 #endif
    131115#if H_3D_IC
    132116, m_bApplyIC                      ( false )
     
    164148  for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
    165149  {
    166 #if H_MV5
    167150   m_interLayerPredLayerIdc[ i ] = i;
    168 #else
    169    m_interLayerPredLayerIdc[ i ] = 0;
    170 #endif
    171151  }
    172152#endif
     
    322302  if (!pocHasMsb)
    323303  {
    324     poc = poc % pocCycle;
     304    poc = poc & (pocCycle - 1);
    325305  }
    326306 
     
    333313      if (!pocHasMsb)
    334314      {
    335         picPoc = picPoc % pocCycle;
     315        picPoc = picPoc & (pocCycle - 1);
    336316      }
    337317     
     
    387367  }
    388368}
    389 #if H_MV5
    390369#if !H_MV
    391370#if FIX1071
     
    472451  {
    473452    // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
    474     // “ If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    475     // “ Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     453    // ?If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     454    // ?Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    476455    if (getRapPicFlag())
    477456    {
     
    730709}
    731710#endif
    732 #else
     711Int TComSlice::getNumRpsCurrTempList()
     712{
     713  Int numRpsCurrTempList = 0;
     714
     715  if (m_eSliceType == I_SLICE)
     716  {
     717    return 0;
     718  }
     719  for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
     720  {
     721    if(m_pcRPS->getUsed(i))
     722    {
     723      numRpsCurrTempList++;
     724    }
     725  }
    733726#if H_MV
    734 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer , Bool checkNumPocTotalCurr)
    735 #else
    736 #if FIX1071
    737 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
    738 #else
    739 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
    740 #endif
    741 #endif
    742 {
    743 #if FIX1071
    744   if (!checkNumPocTotalCurr)
    745 #endif
    746   {
    747     if (m_eSliceType == I_SLICE)
    748     {
    749       ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    750       ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    751      
    752       return;
    753     }
    754    
    755 #if !H_MV
    756     m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    757     m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    758 #endif
    759   }
    760 
    761   TComPic*  pcRefPic= NULL;
    762   TComPic*  RefPicSetStCurr0[16];
    763   TComPic*  RefPicSetStCurr1[16];
    764   TComPic*  RefPicSetLtCurr[16];
    765   UInt NumPocStCurr0 = 0;
    766   UInt NumPocStCurr1 = 0;
    767   UInt NumPocLtCurr = 0;
    768   Int i;
    769 
    770   for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
    771   {
    772     if(m_pcRPS->getUsed(i))
    773     {
    774       pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
    775       pcRefPic->setIsLongTerm(0);
    776       pcRefPic->getPicYuvRec()->extendPicBorder();
    777       RefPicSetStCurr0[NumPocStCurr0] = pcRefPic;
    778       NumPocStCurr0++;
    779       pcRefPic->setCheckLTMSBPresent(false); 
    780     }
    781   }
    782  
    783   for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
    784   {
    785     if(m_pcRPS->getUsed(i))
    786     {
    787       pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
    788       pcRefPic->setIsLongTerm(0);
    789       pcRefPic->getPicYuvRec()->extendPicBorder();
    790       RefPicSetStCurr1[NumPocStCurr1] = pcRefPic;
    791       NumPocStCurr1++;
    792       pcRefPic->setCheckLTMSBPresent(false); 
    793     }
    794   }
    795  
    796   for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
    797   {
    798     if(m_pcRPS->getUsed(i))
    799     {
    800       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    801       pcRefPic->setIsLongTerm(1);
    802       pcRefPic->getPicYuvRec()->extendPicBorder();
    803       RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
    804       NumPocLtCurr++;
    805     }
    806     if(pcRefPic==NULL)
    807     {
    808       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    809     }
    810     pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
    811   }
    812 
    813   // ref_pic_list_init
    814   TComPic*  rpsCurrList0[MAX_NUM_REF+1];
    815   TComPic*  rpsCurrList1[MAX_NUM_REF+1];
    816 #if H_MV
    817   Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    818   assert( numPocInterCurr == 0 || getInterRefEnabledInRPLFlag() );
    819   Int numPocTotalCurr = numPocInterCurr + getNumActiveRefLayerPics( );
    820   assert( numPocTotalCurr == getNumRpsCurrTempList() );
    821 #else
    822   Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    823 #endif
    824 #if FIX1071
    825   if (checkNumPocTotalCurr)
    826   {
    827     // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
    828 #if H_MV
    829     // – If nuh_layer_id is equal to 0 and the current picture is a BLA picture or a CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    830     // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    831     if ( getRapPicFlag() && m_layerId == 0 )
    832 #else
    833     // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    834     // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    835     if (getRapPicFlag())
    836 #endif
    837     {
    838       assert(numPocTotalCurr == 0);
    839     }
    840 
    841     if (m_eSliceType == I_SLICE)
    842     {
    843       ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    844       ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    845      
    846       return;
    847     }
    848    
    849     assert(numPocTotalCurr > 0);
    850    
    851     m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    852     m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    853   }
    854 #endif
    855 
    856   Int cIdx = 0;
    857 #if H_MV
    858   if ( getInterRefEnabledInRPLFlag() )
    859   { 
    860 #endif
    861   for ( i=0; i<NumPocStCurr0; i++, cIdx++)
    862   {
    863     rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
    864   }
    865   for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    866   {
    867     rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
    868   }
    869   for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
    870   {
    871     rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
    872   }
    873 #if H_MV
    874   }
    875   for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
    876     {
    877     assert( cIdx < MAX_NUM_REF );   
    878       rpsCurrList0[cIdx] = refPicSetInterLayer[i];
    879     }
    880 #endif
    881   assert(cIdx == numPocTotalCurr);
    882 
    883   if (m_eSliceType==B_SLICE)
    884   {
    885     cIdx = 0;
    886 #if H_MV
    887     if ( getInterRefEnabledInRPLFlag() )
    888     { 
    889 #endif
    890     for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    891     {
    892       rpsCurrList1[cIdx] = RefPicSetStCurr1[i];
    893     }
    894     for ( i=0; i<NumPocStCurr0; i++, cIdx++)
    895     {
    896       rpsCurrList1[cIdx] = RefPicSetStCurr0[i];
    897     }
    898     for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
    899     {
    900       rpsCurrList1[cIdx] = RefPicSetLtCurr[i];
    901     }
    902 #if H_MV
    903     }
    904     for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
    905       {
    906       assert( cIdx < MAX_NUM_REF );   
    907         rpsCurrList1[cIdx] = refPicSetInterLayer[i];
    908       }
    909 #endif
    910     assert(cIdx == numPocTotalCurr);
    911   }
    912 
    913   ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));
    914 
    915 #if H_MV
    916   Int numPocSt = NumPocStCurr0 + NumPocStCurr1;
    917   assert(  getInterRefEnabledInRPLFlag( ) || numPocSt == 0 );
    918 
    919   for (Int li = 0; li < 2; li++)
    920   {
    921     if ( m_eSliceType == P_SLICE && li == 1 )
    922     {
    923       m_aiNumRefIdx[1] = 0;
    924       ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));
    925     }
    926     else
    927     {
    928       for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[ li ] - 1 ); rIdx ++)
    929       {
    930         Bool listModified             =                m_RefPicListModification.getRefPicListModificationFlagL( li );
    931         Int orgIdx                    = listModified ? m_RefPicListModification.getRefPicSetIdxL(li, rIdx) : (rIdx % numPocTotalCurr);
    932 
    933         m_apcRefPicList    [li][rIdx] = ( li == 0 )  ? rpsCurrList0[ orgIdx  ] : rpsCurrList1[ orgIdx  ];
    934         m_bIsUsedAsLongTerm[li][rIdx] = ( orgIdx >= numPocSt ) ;
    935       }
    936     }
    937   }
    938 #else
    939   for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++)
    940   {
    941     cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr;
    942     assert(cIdx >= 0 && cIdx < numPocTotalCurr);
    943     m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ];
    944     m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
    945   }
    946   if ( m_eSliceType != B_SLICE )
    947   {
    948     m_aiNumRefIdx[1] = 0;
    949     ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));
    950   }
    951   else
    952   {
    953     for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++)
    954     {
    955       cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr;
    956       assert(cIdx >= 0 && cIdx < numPocTotalCurr);
    957       m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ];
    958       m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
    959     }
    960   }
    961 #endif
    962 }
    963 
    964 #endif
    965 Int TComSlice::getNumRpsCurrTempList()
    966 {
    967   Int numRpsCurrTempList = 0;
    968 
    969   if (m_eSliceType == I_SLICE)
    970   {
    971     return 0;
    972   }
    973   for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
    974   {
    975     if(m_pcRPS->getUsed(i))
    976     {
    977       numRpsCurrTempList++;
    978     }
    979   }
    980 #if H_MV
    981 #if !H_MV5
    982   assert( ( numRpsCurrTempList == 0 ) || getInterRefEnabledInRPLFlag() );
    983 #endif
    984727  numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics();
    985728#endif
     
    1063806}
    1064807
    1065 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)
     808Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic)
    1066809{
    1067810  for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++)
     
    1089832  {
    1090833    pocCRA = getPOC();
    1091     prevRAPisBLA = false;
     834    associatedIRAPType = getNalUnitType();
    1092835  }
    1093836  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
    1094837  {
    1095838    pocCRA = getPOC();
    1096     prevRAPisBLA = false;
     839    associatedIRAPType = getNalUnitType();
    1097840  }
    1098841  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     
    1101844  {
    1102845    pocCRA = getPOC();
    1103     prevRAPisBLA = true;
     846    associatedIRAPType = getNalUnitType();
    1104847  }
    1105848}
     
    1126869{
    1127870  TComPic*                 rpcPic;
     871  setAssociatedIRAPPOC(pocCRA);
    1128872  Int pocCurr = getPOC();
    1129873
     
    12951039#if H_MV
    12961040  // Additional slice header syntax elements
    1297 #if H_MV5
    12981041  m_pocResetFlag               = pSrc->m_pocResetFlag;
    1299 #endif
    13001042  m_discardableFlag            = pSrc->m_discardableFlag;
    13011043  m_interLayerPredEnabledFlag  = pSrc->m_interLayerPredEnabledFlag;
     
    13061048    m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ];
    13071049  }
    1308 #if !H_MV5
    1309   m_interLayerSamplePredOnlyFlag = pSrc->m_interLayerSamplePredOnlyFlag;
    1310   m_altCollocatedIndicationFlag  = pSrc->m_altCollocatedIndicationFlag ;   
    1311   m_collocatedRefLayerIdx        = pSrc->m_collocatedRefLayerIdx       ;
    1312   m_numActiveMotionPredRefLayers = pSrc->m_numActiveMotionPredRefLayers;
    1313 
    1314   for (Int layer = 0; layer < MAX_NUM_LAYER_IDS; layer++)
    1315   {   
    1316     m_interLayerPredLayerIdc[layer] = pSrc->m_interLayerPredLayerIdc[layer];
    1317   }
    1318 #endif
    13191050#endif
    13201051#if H_3D_IC
     
    13241055}
    13251056
    1326 Int TComSlice::m_prevPOC = 0;
     1057Int TComSlice::m_prevTid0POC = 0;
    13271058
    13281059/** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag.
     
    13791110}
    13801111
     1112
     1113Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic)
     1114{
     1115  TComPic* rpcPic;
     1116
     1117  Int nalUnitType = this->getNalUnitType();
     1118
     1119  // When a picture is a leading picture, it shall be a RADL or RASL picture.
     1120  if(this->getAssociatedIRAPPOC() > this->getPOC())
     1121  {
     1122    // Do not check IRAP pictures since they may get a POC lower than their associated IRAP
     1123    if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP ||
     1124       nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23)
     1125    {
     1126      assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1127             nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R ||
     1128             nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1129             nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R);
     1130    }
     1131  }
     1132
     1133  // When a picture is a trailing picture, it shall not be a RADL or RASL picture.
     1134  if(this->getAssociatedIRAPPOC() < this->getPOC())
     1135  {
     1136    assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N &&
     1137           nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R &&
     1138           nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N &&
     1139           nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R);
     1140  }
     1141
     1142  // No RASL pictures shall be present in the bitstream that are associated
     1143  // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP.
     1144  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1145     nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1146  {
     1147    assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL &&
     1148           this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP);
     1149  }
     1150
     1151  // No RASL pictures shall be present in the bitstream that are associated with
     1152  // an IDR picture.
     1153  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1154     nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1155  {
     1156    assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP   &&
     1157           this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL);
     1158  }
     1159
     1160  // No RADL pictures shall be present in the bitstream that are associated with
     1161  // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated
     1162  // with an IDR picture having nal_unit_type equal to IDR_N_LP.
     1163  if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1164     nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)
     1165  {
     1166    assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP   &&
     1167           this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP);
     1168  }
     1169
     1170  // loop through all pictures in the reference picture buffer
     1171  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
     1172  while ( iterPic != rcListPic.end())
     1173  {
     1174    rpcPic = *(iterPic++);
     1175    if (rpcPic->getPOC() == this->getPOC())
     1176    {
     1177      continue;
     1178    }
     1179
     1180    // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture
     1181    // in decoding order shall precede the IRAP picture in output order.
     1182    // (Note that any picture following in output order would be present in the DPB)
     1183    if(rpcPic->getSlice(0)->getPicOutputFlag() == 1)
     1184    {
     1185      if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP    ||
     1186         nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP    ||
     1187         nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL  ||
     1188         nalUnitType == NAL_UNIT_CODED_SLICE_CRA         ||
     1189         nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP    ||
     1190         nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL)
     1191      {
     1192        assert(rpcPic->getPOC() < this->getPOC());
     1193      }
     1194    }
     1195
     1196    // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture
     1197    // in decoding order shall precede any RADL picture associated with the IRAP
     1198    // picture in output order.
     1199    if(rpcPic->getSlice(0)->getPicOutputFlag() == 1)
     1200    {
     1201      if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1202          nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R))
     1203      {
     1204        // rpcPic precedes the IRAP in decoding order
     1205        if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC())
     1206        {
     1207          // rpcPic must not be the IRAP picture
     1208          if(this->getAssociatedIRAPPOC() != rpcPic->getPOC())
     1209          {
     1210            assert(rpcPic->getPOC() < this->getPOC());
     1211          }
     1212        }
     1213      }
     1214    }
     1215
     1216    // When a picture is a leading picture, it shall precede, in decoding order,
     1217    // all trailing pictures that are associated with the same IRAP picture.
     1218    if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1219       nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R ||
     1220       nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1221       nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)
     1222    {
     1223      if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC())
     1224      {
     1225        // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB
     1226        // rpcPic would violate the constraint if it was a trailing picture
     1227        assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC());
     1228      }
     1229    }
     1230
     1231    // Any RASL picture associated with a CRA or BLA picture shall precede any
     1232    // RADL picture associated with the CRA or BLA picture in output order
     1233    if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1234       nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1235    {
     1236      if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP   ||
     1237          this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP   ||
     1238          this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ||
     1239          this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA)       &&
     1240          this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC())
     1241      {
     1242        if(rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N ||
     1243           rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R)
     1244        {
     1245          assert(rpcPic->getPOC() > this->getPOC());
     1246        }
     1247      }
     1248    }
     1249
     1250    // Any RASL picture associated with a CRA picture shall follow, in output
     1251    // order, any IRAP picture that precedes the CRA picture in decoding order.
     1252    if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1253       nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1254    {
     1255      if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA)
     1256      {
     1257        if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() &&
     1258           (rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP   ||
     1259            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP   ||
     1260            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ||
     1261            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP   ||
     1262            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
     1263            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA))
     1264        {
     1265          assert(this->getPOC() > rpcPic->getSlice(0)->getPOC());
     1266        }
     1267      }
     1268    }
     1269  }
     1270}
     1271
     1272
     1273
    13811274/** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet.
    13821275*/
     
    13851278  TComPic* rpcPic;
    13861279  Int i, isReference;
     1280
     1281  checkLeadingPictureRestrictions(rcListPic);
    13871282
    13881283  // loop through all pictures in the reference picture buffer
     
    14211316      else
    14221317      {
    1423         if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()))
     1318        Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1319        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
     1320        Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
     1321        if(rpcPic->getIsLongTerm() && curPoc == refPoc)
    14241322        {
    14251323          isReference = 1;
     
    14811379      else
    14821380      {
    1483         if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
     1381        Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1382        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
     1383        Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
     1384        if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced())
    14841385        {
    14851386          isAvailable = 1;
     
    15001401        if (!pReferencePictureSet->getCheckLTMSBPresent(i))
    15011402        {
    1502           curPoc = curPoc % pocCycle;
    1503           refPoc = refPoc % pocCycle;
     1403          curPoc = curPoc & (pocCycle - 1);
     1404          refPoc = refPoc & (pocCycle - 1);
    15041405        }
    15051406       
     
    17811682: m_VPSId                     (  0)
    17821683, m_uiMaxTLayers              (  1)
    1783 #if H_MV5
    17841684#if H_MV
    17851685, m_uiMaxLayersMinus1         (  0)
    1786 #else
    1787 , m_uiMaxLayers               (  1)
    1788 #endif
    17891686#else
    17901687, m_uiMaxLayers               (  1)
     
    18001697, m_hrdOpSetIdx               (NULL)
    18011698, m_cprmsPresentFlag          (NULL)
    1802 #if H_MV5
    18031699#if H_MV
    18041700, m_vpsVUI                 (  NULL )
    1805 #endif
    18061701#endif
    18071702{
     
    18481743
    18491744  m_avcBaseLayerFlag = false;
    1850 #if H_MV5
    18511745  m_vpsVuiOffset     = 0;
    1852 #endif
    18531746  m_splittingFlag    = false;
    18541747 
    18551748  for( Int i = 0; i < MAX_NUM_SCALABILITY_TYPES; i++ )
    18561749  {
    1857 #if H_MV5
    18581750    m_scalabilityMaskFlag[i] = false;
    1859 #else
    1860     m_scalabilityMask[i] = false;
    1861 #endif
    18621751    m_dimensionIdLen [i]  = -1;
    18631752  }
     
    18851774    m_layerIdInNuh      [i] = ( i == 0 ) ? 0 : -1;
    18861775    m_numDirectRefLayers[i] = 0;
    1887 #if H_MV5
    18881776    m_maxTidIlRefPicPlus1[i] = 7;
    18891777    m_vpsRepFormatIdx    [i] = 0;
    18901778    m_repFormat          [i] = NULL;
    18911779    m_viewIdVal          [i] = 0;
    1892 #else
    1893     m_maxTidIlRefPicPlus1[i] = -1;
    1894 #endif
    18951780
    18961781#if H_3D
     
    19351820#endif
    19361821  }
    1937 #if H_MV5
    19381822  m_vpsVUI = new TComVPSVUI;
    1939 #endif
    19401823#if H_3D
    19411824  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
     
    19501833    m_depthRefinementFlag  [ i ] = false;
    19511834#endif
    1952 #if LGE_INTER_SDC_E0156
     1835#if H_3D_INTER_SDC
    19531836    m_bInterSDCFlag        [ i ] = false;
    19541837#endif
     
    19631846  if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
    19641847  if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
    1965 #if H_MV5
    19661848#if H_MV
    19671849  if ( m_vpsVUI          != NULL )     delete m_vpsVUI;
     
    19831865#endif
    19841866  }
    1985 #endif
    1986 #else
    1987 #if H_3D_DIM_DLT
    1988   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
    1989   {
    1990     if ( m_iDepthValue2Idx[i] != 0 )
    1991     {
    1992        xFree( m_iDepthValue2Idx[i] );
    1993        m_iDepthValue2Idx[i] = 0;
    1994     }
    1995 
    1996     if ( m_iIdx2DepthValue[i] != 0 )
    1997     {
    1998       xFree( m_iIdx2DepthValue[i] );
    1999       m_iIdx2DepthValue[i] = 0;
    2000 
    2001     }
    2002   }
    2003 #endif
    20041867#endif
    20051868}
     
    20721935Bool TComVPS::checkVPSExtensionSyntax()
    20731936{
    2074 #if H_MV5
    20751937  for( Int layer = 1; layer <= getMaxLayersMinus1(); layer++ )
    2076 #else
    2077   for( Int layer = 1; layer < getMaxLayers(); layer++ )
    2078 #endif
    20791938  {
    20801939    // check layer_id_in_nuh constraint
     
    20921951{
    20931952  assert( scalType >= 0 && scalType <= MAX_NUM_SCALABILITY_TYPES );
    2094 #if H_MV5
    20951953  assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMaskFlag( scalType ) );
    2096 #else
    2097   assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMask( scalType ) );
    2098 #endif
    20991954  Int scalIdx = 0;
    21001955  for( Int curScalType = 0; curScalType < scalType; curScalType++ )
    21011956  {
    2102 #if H_MV5
    21031957    scalIdx += ( getScalabilityMaskFlag( curScalType ) ? 1 : 0 );
    2104 #else
    2105     scalIdx += ( getScalabilityMask( curScalType ) ? 1 : 0 );
    2106 #endif
    21071958
    21081959  }
     
    21101961  return scalIdx;
    21111962}
    2112 #if H_MV5
    21131963Void TComVPS::setScalabilityMaskFlag( UInt val )
    21141964{
     
    21181968  }
    21191969}
    2120 #else
    2121 Void TComVPS::setScalabilityMask( UInt val )
    2122 {
    2123   for ( Int scalType = 0; scalType < MAX_NUM_SCALABILITY_TYPES; scalType++ )
    2124     setScalabilityMask( scalType, ( val & (1 << scalType ) ) != 0 );
    2125 }
    2126 
    2127 #endif
    2128 
    2129 #if H_MV5
     1970
    21301971Void TComVPS::setRefLayers()
    21311972{
     
    21762017}
    21772018#endif // H_3D
    2178 #else
    2179 Void TComVPS::setRefLayers()
    2180 {
    2181   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
    2182   {
    2183     m_numSamplePredRefLayers[ i ] = 0;
    2184     m_numMotionPredRefLayers[ i ] = 0;
    2185     m_numDirectRefLayers[ i ] = 0;
    2186     for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) {
    2187       m_samplePredEnabledFlag[ i ][ j ] = 0;
    2188       m_motionPredEnabledFlag[ i ][ j ] = 0;
    2189       m_refLayerId[ i ][ j ] = 0;
    2190       m_samplePredRefLayerId[ i ][ j ] = 0;
    2191       m_motionPredRefLayerId[ i ][ j ] = 0;
    2192     }
    2193   }
    2194 
    2195   for( Int i = 1; i  <= getMaxLayers()- 1; i++ )
    2196   {
    2197     for( Int j = 0; j < i; j++ )
    2198     {
    2199       if( getDirectDependencyFlag(i,j) )
    2200       {
    2201         m_refLayerId[ i ][m_numDirectRefLayers[ i ]++ ] = getLayerIdInNuh( j );
    2202 
    2203         m_samplePredEnabledFlag [ i ][ j ]  = ( (   getDirectDependencyType( i , j ) + 1 ) & 1 ) == 1;
    2204         m_numSamplePredRefLayers[ i ]      += m_samplePredEnabledFlag [ i ][ j ] ? 1 : 0;
    2205         m_motionPredEnabledFlag [ i ][ j ]  = ( ( ( getDirectDependencyType( i , j ) + 1 ) & 2 ) >> 1 ) == 1;
    2206         m_numMotionPredRefLayers[ i ]      += m_motionPredEnabledFlag  [ i][ j ] ? 1 : 0;
    2207       }
    2208     }
    2209   }
    2210 
    2211   for( Int i = 1, mIdx = 0, sIdx = 0; i <= getMaxLayers()- 1; i++ )
    2212   {   
    2213     for( Int j = 0 ; j < i; j++ )
    2214     {
    2215       if( m_motionPredEnabledFlag[ i ][ j ] )
    2216       {
    2217         m_motionPredRefLayerId[ i ][ mIdx++ ] = getLayerIdInNuh( j );
    2218       }
    2219      
    2220       if( m_samplePredEnabledFlag[ i ][ j ] )
    2221       {
    2222         m_samplePredRefLayerId[ i ][ sIdx++ ] = getLayerIdInNuh( j );
    2223       }
    2224     }
    2225   }
    2226 }
    2227 
    2228 Int TComVPS::getRefLayerId( Int layerIdInVps, Int idx )
    2229 {
    2230   assert( idx >= 0 && idx < m_numDirectRefLayers[layerIdInVps] );     
    2231   Int layerIdInNuh = m_refLayerId[ layerIdInVps ][ idx ];   
    2232   assert ( layerIdInNuh >= 0 );
    2233   return layerIdInNuh;
    2234 }
    2235 
    2236 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType )
    2237 {
    2238   return getScalabilityMask( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0;
    2239 }
    2240 
    2241 #if H_3D
    2242 Void TComVPS::initViewIndex()
    2243 {
    2244   Int viewIdList   [ MAX_NUM_LAYERS ]; // ed. should be changed to MAX_VIEW_ID
    2245   Int viewIndexList[ MAX_NUM_LAYERS ];
    2246   Int numViewIds = 0;
    2247 
    2248   for ( Int i = 0 ; i  <  m_uiMaxLayers; i++ )
    2249   {     
    2250     Int currViewId = getViewId( i );
    2251 
    2252     Bool viewIdInListFlag = false;
    2253     for ( Int j = 0; j < numViewIds; j ++ )
    2254     {
    2255       viewIdInListFlag  = viewIdInListFlag || ( currViewId  == viewIdList[ j ]  );
    2256     }
    2257 
    2258     if ( !viewIdInListFlag )
    2259     {
    2260       viewIdList   [ numViewIds ] = currViewId;
    2261       viewIndexList[ currViewId ] = numViewIds;
    2262 
    2263       numViewIds++;
    2264     } 
    2265 
    2266     m_viewIndex[ i ] = viewIndexList[ currViewId ];
    2267   }
    2268 }
    2269 
    2270 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag )
    2271 {
    2272   Int foundlayerId = -1;
    2273 
    2274   for (Int layer = 0 ; layer < m_uiMaxLayers; layer++ )
    2275   {
    2276     if( ( getViewIndex( layer ) == viewIndex ) && ( getDepthId( layer ) == ( depthFlag ? 1 : 0 ) )  )
    2277     {
    2278       foundlayerId = layer;
    2279       break;
    2280     }
    2281   }
    2282   assert( foundlayerId != -1 );
    2283 
    2284   return getLayerIdInNuh( foundlayerId );
    2285 }
    2286 
    2287 #endif // H_3D
    2288 
    2289 Int TComVPS::xCeilLog2( Int val )
    2290 {
    2291   assert( val > 0 );
    2292   Int ceilLog2 = 0;
    2293   while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
    2294   return ceilLog2;
    2295 }
    2296 
    2297 #endif // H_MV5
    22982019
    22992020
     
    23362057  return numLayersInIdList;
    23372058}
    2338 #if H_MV5
    23392059Int TComVPS::getNumViews()
    23402060{
     
    23662086  return dependentFlag;
    23672087}
    2368 #endif
    23692088#endif // H_MV
    23702089
     
    24172136, m_vuiParameters             ()
    24182137#if H_MV
    2419 #if H_MV5
    24202138, m_pcVPS                     ( NULL )
    24212139, m_spsInferScalingListFlag   ( false )
     
    24232141, m_updateRepFormatFlag       ( true )
    24242142, m_interViewMvVertConstraintFlag (false)
    2425 #else
    2426 , m_interViewMvVertConstraintFlag (false)
    2427 , m_numIlpRestrictedRefLayers ( 0 )
    2428 #endif
    24292143#endif
    24302144#if H_3D
     
    24412155  ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
    24422156  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
    2443 #if !H_MV5
    2444 #if H_MV
    2445   for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
    2446   {
    2447     m_minSpatialSegmentOffsetPlus1[ i ] = 0;
    2448     m_ctuBasedOffsetEnabledFlag   [ i ] = false;
    2449     m_minHorizontalCtuOffsetPlus1 [ i ] = 0;
    2450   }
    2451 #endif
    2452 #endif
    24532157}
    24542158
     
    26032307, m_listsModificationPresentFlag(  0)
    26042308, m_numExtraSliceHeaderBits(0)
    2605 #if H_MV5
    26062309#if H_MV
    26072310, m_ppsInferScalingListFlag(false)
    26082311, m_ppsScalingListRefLayerId(0)
    26092312#endif
    2610 #endif
    26112313{
    26122314  m_scalingList = new TComScalingList;
     
    26282330}
    26292331
    2630 #if H_MV5
    26312332#if H_MV
    26322333Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr )
     
    26792380  }
    26802381}
    2681 #endif
    26822382#endif
    26832383#if H_3D
     
    29082608TComScalingList::TComScalingList()
    29092609{
    2910   m_useTransformSkip = false;
    29112610  init();
    29122611}
     
    29502649
    29512650#if H_MV
    2952 #if H_MV5
    29532651Void TComSlice::createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 )
    29542652{
     
    29822680  }
    29832681}
    2984 #else
    2985 Void TComSlice::createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer )
    2986 {
    2987   refPicSetInterLayer.clear();
    2988 
    2989   for( Int i = 0; i < getNumActiveRefLayerPics(); i++ )
    2990   {
    2991     Int layerIdRef = getRefPicLayerId( i );
    2992     TComPic* picRef = ivPicLists->getPic( layerIdRef, getPOC() ) ;
    2993     assert ( picRef != 0 );
    2994 
    2995     picRef->getPicYuvRec()->extendPicBorder();
    2996     picRef->setIsLongTerm( true );       
    2997     picRef->getSlice(0)->setReferenced( true );       
    2998 
    2999     // Consider to check here:
    3000     // "If the current picture is a RADL picture, there shall be no entry in the RefPicSetInterLayer that is a RASL picture. "
    3001     refPicSetInterLayer.push_back( picRef );
    3002   }
    3003 }
    3004 #endif
    3005 
    3006 #if H_MV5
     2682
    30072683Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 )
    30082684{
     
    30192695
    30202696}
    3021 #else
    3022 Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer )
    3023 {
    3024   // Mark as shortterm
    3025   for ( Int i = 0; i < refPicSetInterLayer.size(); i++ )
    3026   {
    3027     refPicSetInterLayer[i]->setIsLongTerm( false );
    3028   }
    3029 }
    3030 
    3031 #endif
    30322697Void TComSlice::markIvRefPicsAsUnused( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc )
    30332698{
     
    30352700  if (targetDecLayerIdSet.size() == 0 )   
    30362701  {
    3037 #if H_MV5
    30382702    for ( Int layerIdInVps = 0; layerIdInVps <= vps->getMaxLayersMinus1(); layerIdInVps++ )
    3039 #else
    3040     for ( Int layerIdInVps = 0; layerIdInVps < vps->getMaxLayers(); layerIdInVps++ )
    3041 #endif
    30422703    {
    30432704      targetDecLayerIdSet.push_back( vps->getLayerIdInNuh( layerIdInVps ) );
     
    30682729          if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ j ] ) )
    30692730          {
    3070 #if H_MV5
    30712731            for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdSet[ j ] ); k++ )
    30722732            {
    30732733              if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdSet[ j ],  k  ) )
    3074 #else
    3075             Int targetDecLayerIdinVPS = vpsSlice->getLayerIdInVps( targetDecLayerIdSet[ j ] );
    3076             for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdinVPS ); k++ )
    3077             {
    3078               if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdinVPS,  k  ) )
    3079 #endif
    30802734              {
    30812735                remainingInterLayerReferencesFlag = true;
     
    30932747}
    30942748
    3095 #if H_MV5
    30962749Void TComSlice::printRefPicList()
    3097 #else
    3098 Void TComSlice::xPrintRefPicList()
    3099 #endif
    31002750
    31012751  for ( Int li = 0; li < 2; li++)
     
    31102760  }
    31112761}
    3112 #if !H_MV5
    3113 Int TComSlice::xCeilLog2( Int val )
    3114 {
    3115   assert( val > 0 );
    3116   Int ceilLog2 = 0;
    3117   while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
    3118   return ceilLog2;
    3119 }
    3120 #endif
    31212762
    31222763Void TComSlice::markCurrPic( TComPic* currPic )
     
    31332774}
    31342775
    3135 #if H_MV5
    31362776Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1 )
    31372777{
     
    31582798  return pcPic;
    31592799}
    3160 #else
    3161 Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer )
    3162 {
    3163   m_refPicSetInterLayer = refPicSetInterLayer;
    3164 }
    3165 
    3166 TComPic* TComSlice::getPicFromRefPicSetInterLayer( Int layerId )
    3167 {
    3168   assert( m_refPicSetInterLayer != 0 );
    3169   assert( (*m_refPicSetInterLayer).size() == getNumActiveRefLayerPics() );
    3170   TComPic* pcPic = NULL;
    3171   for ( Int i = 0; i < getNumActiveRefLayerPics(); i++ )
    3172   {
    3173     if ((*m_refPicSetInterLayer)[ i ]->getLayerId() == layerId)
    3174     {
    3175       pcPic = (*m_refPicSetInterLayer)[ i ];
    3176     }
    3177   }
    3178   assert(pcPic != NULL);
    3179   return pcPic;
    3180 }
    3181 #endif
    31822800Int TComSlice::getNumActiveRefLayerPics()
    31832801{
    31842802  Int numActiveRefLayerPics;
    31852803
    3186 #if H_MV5
    31872804  if( getLayerId() == 0 || getVPS()->getNumDirectRefLayers( getLayerId() ) ==  0 )
    31882805  {
     
    31982815  }
    31992816  else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
    3200 #else
    3201   if( getLayerId() == 0 || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) ==  0 || !getInterLayerPredEnabledFlag() )
    3202   {
    3203     numActiveRefLayerPics = 0;
    3204   }
    3205   else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 1 )
    3206 #endif
    32072817  {
    32082818    numActiveRefLayerPics = 1;
     
    32172827Int TComSlice::getRefPicLayerId( Int i )
    32182828{
    3219 #if H_MV5
    32202829  return getVPS()->getRefLayerId( getLayerId(), getInterLayerPredLayerIdc( i ) );
    3221 #else
    3222   return getVPS()->getRefLayerId( getLayerIdInVps(), getInterLayerPredLayerIdc( i ) );
    3223 #endif
    3224 }
    3225 
    3226 #if !H_MV5
    3227 Void TComSlice::setActiveMotionPredRefLayers()
    3228 {
    3229   Int j = 0;
    3230   for( Int i = 0; i < getNumActiveRefLayerPics(); i++)
    3231   {
    3232     if( getVPS()->getMotionPredEnabledFlag( getLayerIdInVps(), getInterLayerPredLayerIdc( i ))  )
    3233     {
    3234       m_activeMotionPredRefLayerId[ j++ ] = getVPS()->getRefLayerId( getLayerIdInVps(), i );
    3235     }
    3236   }
    3237   m_numActiveMotionPredRefLayers = j;
    3238 
    3239   // Consider incorporating bitstream conformance tests on derived variables here.
    3240 }
    3241 
    3242 Bool TComSlice::getInterRefEnabledInRPLFlag()
    3243 {
    3244   Bool interRefEnabledInRPLFlag;
    3245   if ( getVPS()->getNumSamplePredRefLayers( getLayerIdInVps() ) > 0 && getNumActiveRefLayerPics() > 0 )
    3246   {
    3247     interRefEnabledInRPLFlag = !getInterLayerSamplePredOnlyFlag();
    3248   }
    3249   else
    3250   {
    3251     interRefEnabledInRPLFlag = 1;
    3252   }
    3253   return interRefEnabledInRPLFlag;
    3254 }
    3255 #endif
     2830}
     2831
    32562832#if H_3D_ARP
    32572833Void TComSlice::setARPStepNum()                                 
     
    35313107}
    35323108
    3533 #if H_MV5
    35343109#if H_MV
    35353110Void TComScalingList::inferFrom( TComScalingList* srcScLi )
     
    35453120  }
    35463121}
    3547 #endif
    35483122#endif
    35493123/** initialization process of quantization matrix array
     
    36363210, m_ppsMap(MAX_NUM_PPS)
    36373211, m_activeVPSId(-1)
    3638 #if H_MV5
    36393212#if !H_MV
    36403213, m_activeSPSId(-1)
     
    36493222  }
    36503223#endif
    3651 #else
    3652 , m_activeSPSId(-1)
    3653 , m_activePPSId(-1)
    3654 {
    3655 #endif
    36563224}
    36573225
     
    36633231//! activate a SPS from a active parameter sets SEI message
    36643232//! \returns true, if activation is successful
    3665 #if H_MV5
    36663233#if H_MV
    36673234Bool ParameterSetManager::activateSPSWithSEI(Int spsId, Int layerId )
     
    36693236Bool ParameterSetManager::activateSPSWithSEI(Int spsId)
    36703237#endif
    3671 #else
    3672 Bool ParameterSetManager::activateSPSWithSEI(Int spsId)
    3673 #endif
    36743238{
    36753239  TComSPS *sps = m_spsMap.getPS(spsId);
     
    36803244    {
    36813245      m_activeVPSId = vpsId;
    3682 #if !H_MV5
    3683       m_activeSPSId = spsId;
    3684 #else
    36853246#if H_MV
    36863247      m_activeSPSId[ layerId ] = spsId;
     
    36883249      m_activeSPSId = spsId;
    36893250#endif
    3690 #endif
    36913251      return true;
    36923252    }
     
    37053265//! activate a PPS and depending on isIDR parameter also SPS and VPS
    37063266//! \returns true, if activation is successful
    3707 #if H_MV5
    37083267#if H_MV
    37093268Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP, Int layerId )
     
    37423301        m_activeSPSId[ layerId ] = spsId;
    37433302#else
    3744         m_activePPSId = ppsId;
    3745         m_activeVPSId = vpsId;
    3746         m_activeSPSId = spsId;
    3747 #endif
    3748 #else
    3749 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP)
    3750 {
    3751   TComPPS *pps = m_ppsMap.getPS(ppsId);
    3752   if (pps)
    3753   {
    3754     Int spsId = pps->getSPSId();
    3755 #if H_MV
    3756     // active parameter sets per layer should be used here
    3757 #else
    3758     if (!isIRAP && (spsId != m_activeSPSId))
    3759     {
    3760       printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
    3761       return false;
    3762     }
    3763 #endif
    3764     TComSPS *sps = m_spsMap.getPS(spsId);
    3765     if (sps)
    3766     {
    3767       Int vpsId = sps->getVPSId();
    3768       if (!isIRAP && (vpsId != m_activeVPSId))
    3769       {
    3770         printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
    3771         return false;
    3772       }
    3773       if (m_vpsMap.getPS(vpsId))
    3774       {
    37753303        m_activePPSId = ppsId;
    37763304        m_activeVPSId = vpsId;
     
    38283356//! \}
    38293357
    3830 #if H_MV5
    38313358#if H_MV
    38323359TComVPSVUI::TComVPSVUI()
     
    38613388}
    38623389#endif
    3863 #endif
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r622 r655  
    155155  Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
    156156  Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
    157   Bool     getUseTransformSkip    ()                                     { return m_useTransformSkip; }     
    158   Void     setUseTransformSkip    (Bool b)                               { m_useTransformSkip = b;    }
    159157  Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
    160158  Bool     checkPredMode                  (UInt sizeId, UInt listId);
     
    169167  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
    170168  Bool     xParseScalingList              (Char* pchFile);
    171 #if H_MV5
    172169#if H_MV
    173170  Void     inferFrom                      ( TComScalingList* srcScLi );
    174 #endif
    175171#endif
    176172
     
    184180  UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
    185181  Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix
    186   Bool     m_useTransformSkip;                                                      //!< transform skipping flag for setting default scaling matrix for 4x4
    187182};
    188183
     
    407402};
    408403
    409 #if H_MV5
    410404#if H_MV
    411405class TComVPSVUI
     
    502496};
    503497#endif
    504 #endif
    505498
    506499class TComVPS
     
    510503  UInt        m_uiMaxTLayers;
    511504
    512 #if H_MV5
    513505#if H_MV
    514506  UInt        m_uiMaxLayersMinus1;
    515 #else
    516   UInt        m_uiMaxLayers;
    517 #endif
    518507#else
    519508  UInt        m_uiMaxLayers;
     
    551540  /// VPS EXTENSION SYNTAX ELEMENTS
    552541  Bool        m_avcBaseLayerFlag;
    553 #if H_MV5
    554542  Int         m_vpsVuiOffset;
    555 #endif
    556543  Bool        m_splittingFlag;
    557 #if H_MV5
    558544  Bool        m_scalabilityMaskFlag          [MAX_NUM_SCALABILITY_TYPES];
    559 #else
    560   Bool        m_scalabilityMask          [MAX_NUM_SCALABILITY_TYPES];
    561 #endif
    562545  Int         m_dimensionIdLen           [MAX_NUM_SCALABILITY_TYPES];
    563546  Bool        m_vpsNuhLayerIdPresentFlag;
    564547  Int         m_layerIdInNuh             [MAX_NUM_LAYER_IDS];
    565548  Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 
    566 #if H_MV5
    567549  Int         m_viewIdLenMinus1;
    568550  Int         m_viewIdVal                [MAX_NUM_LAYERS];
    569 #endif
    570551  Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
    571 #if H_MV5
    572552  Bool        m_maxTidRefPresentFlag;
    573 #endif
    574553  Int         m_maxTidIlRefPicPlus1      [MAX_NUM_LAYERS];
    575 #if H_MV5
    576554  Bool        m_allRefLayersActiveFlag;
    577 #endif
    578555  Int         m_vpsNumberLayerSetsMinus1;
    579556  Int         m_vpsNumProfileTierLevelMinus1;   
     
    586563  Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
    587564  Int         m_profileLevelTierIdx      [MAX_VPS_OUTPUTLAYER_SETS ];
    588 #if H_MV5
    589565  Bool        m_repFormatIdxPresentFlag;
    590566  Int         m_vpsNumRepFormatsMinus1;
    591567  Int         m_vpsRepFormatIdx          [MAX_NUM_LAYERS];
    592568  TComRepFormat* m_repFormat             [MAX_NUM_LAYERS];
    593 #endif
    594569  Bool        m_maxOneActiveRefLayerFlag;       
    595 #if H_MV5
    596570  Bool        m_crossLayerIrapAlignedFlag;
    597 #endif
    598571  Int         m_directDepTypeLenMinus2;         
    599 #if H_MV5
    600572  Bool        m_vpsVuiPresentFlag;
    601573  TComVPSVUI* m_vpsVUI;
    602 #endif
    603574  Int         m_directDependencyType     [MAX_NUM_LAYERS] [MAX_NUM_LAYERS];
    604575
     
    616587  Bool        m_motionPredEnabledFlag    [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    617588  Int         m_motionPredRefLayerId     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    618 #if H_MV5
    619589  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
    620 #else
    621 #if H_3D
    622   Int         m_viewIndex                [MAX_NUM_LAYERS   ];
    623 #endif
    624 
    625   Int         xCeilLog2       ( Int val );
    626 #endif
    627590  Int         xGetDimBitOffset( Int j );
    628591 
     
    653616  Bool        m_ivMvScalingFlag;
    654617#endif
    655 #if LGE_INTER_SDC_E0156
     618#if H_3D_INTER_SDC
    656619  Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
    657620#endif
     
    681644  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
    682645 
    683 #if H_MV5
    684646#if H_MV   
    685647  UInt    getMaxLayersMinus1()                { return m_uiMaxLayersMinus1;  };
     
    689651  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
    690652#endif
    691 #else
    692   UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
    693   Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
    694 #endif
    695653
    696654  Bool    getTemporalNestingFlag   ()         { return m_bTemporalIdNestingFlag;   }
     
    735693  Bool    getAvcBaseLayerFlag()                                            { return m_avcBaseLayerFlag; }
    736694
    737 #if H_MV5
    738695  Void    setVpsVuiOffset( Int  val )                                      { m_vpsVuiOffset = val; }
    739696  Int     getVpsVuiOffset(  )                                              { return m_vpsVuiOffset; }
    740 #endif
    741697
    742698  Void    setSplittingFlag( Bool val )                                     { m_splittingFlag = val;  }
    743699  Bool    getSplittingFlag()                                               { return m_splittingFlag; }
    744700
    745 #if H_MV5
    746701  Void    setScalabilityMaskFlag( UInt val );
    747702  Void    setScalabilityMaskFlag( Int scalType, Bool val )                     { m_scalabilityMaskFlag[scalType] = val;  }
    748703  Bool    getScalabilityMaskFlag( Int scalType )                               { return m_scalabilityMaskFlag[scalType]; }
    749 #else
    750   Void    setScalabilityMask( UInt val );
    751 
    752   Void    setScalabilityMask( Int scalType, Bool val )              { m_scalabilityMask[scalType] = val;  }
    753   Bool    getScalabilityMask( Int scalType )                        { return m_scalabilityMask[scalType]; }
    754 #endif
    755704  Int     getNumScalabilityTypes( );
    756705
     
    769718  Int     getDimensionId( Int layerIdInVps, Int scalIdx )                  { return m_dimensionId[layerIdInVps][scalIdx]; }
    770719
    771 #if H_MV5
    772720  Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; }
    773721  Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; }
     
    775723  Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; }
    776724  Int     getViewIdVal( Int viewOrderIndex )                               { return m_viewIdVal[viewOrderIndex]; }
    777 #endif
    778725  Void    setDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Bool val ) { m_directDependencyFlag[depLayeridInVps][refLayeridInVps] = val;  }
    779726  Bool    getDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps )           { return m_directDependencyFlag[depLayeridInVps][refLayeridInVps]; }
    780727
    781 #if H_MV5
    782728  Void    setMaxTidRefPresentFlag( Bool flag )                             { m_maxTidRefPresentFlag = flag; }
    783729  Bool    getMaxTidRefPresentFlag(  )                                      { return m_maxTidRefPresentFlag; }
    784 #endif
    785730  Void    setMaxTidIlRefPicPlus1( Int layerIdInVps, Int val )              { m_maxTidIlRefPicPlus1[ layerIdInVps ] = val;  }
    786731  Int     getMaxTidIlRefPicPlus1( Int layerIdInVps )                       { return m_maxTidIlRefPicPlus1[ layerIdInVps ]; }
    787 #if H_MV5
    788732  Void    setAllRefLayersActiveFlag( Bool flag )                           { m_allRefLayersActiveFlag = flag; }
    789733  Bool    getAllRefLayersActiveFlag(  )                                    { return m_allRefLayersActiveFlag; }
    790 #endif
    791734  Void    setVpsNumberLayerSetsMinus1( Int val )                           { m_vpsNumberLayerSetsMinus1 = val;  }
    792735  Int     getVpsNumberLayerSetsMinus1( )                                   { return m_vpsNumberLayerSetsMinus1; }
     
    819762  Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; }
    820763
    821 #if H_MV5
    822764  Void    setRepFormatIdxPresentFlag( Bool flag )                          { m_repFormatIdxPresentFlag = flag; }
    823765  Bool    getRepFormatIdxPresentFlag(  )                                   { return m_repFormatIdxPresentFlag; }
     
    831773  Void    setRepFormat( Int i, TComRepFormat* val )                        { m_repFormat[i] = val;  }
    832774  TComRepFormat* getRepFormat( Int i )                                     { return m_repFormat[i]; }
    833 #endif
    834775  Void    setMaxOneActiveRefLayerFlag( Bool flag)                          { m_maxOneActiveRefLayerFlag = flag; }
    835776  Bool    getMaxOneActiveRefLayerFlag( )                                   { return m_maxOneActiveRefLayerFlag; }
    836 #if H_MV5
    837777  Void    setCrossLayerIrapAlignedFlag( Bool flag )                        { m_crossLayerIrapAlignedFlag = flag; }
    838778  Bool    getCrossLayerIrapAlignedFlag(  )                                 { return m_crossLayerIrapAlignedFlag; }
    839 #endif
    840779  Void    setDirectDepTypeLenMinus2( Int val)                              { m_directDepTypeLenMinus2 = val; }
    841780  Int     getDirectDepTypeLenMinus2( )                                     { return m_directDepTypeLenMinus2; }
     
    843782  Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; }
    844783  Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps)   { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; }
    845 #if H_MV5 
    846784  Void    setVpsVuiPresentFlag( Bool flag )                                { m_vpsVuiPresentFlag = flag; }
    847785  Bool    getVpsVuiPresentFlag(  )                                         { return m_vpsVuiPresentFlag; }
    848786
    849787  TComVPSVUI* getVPSVUI(  )                                                { return m_vpsVUI;  }
    850 #endif
    851788  // VPS EXTENSION SEMANTICS VARIABLES
    852789  Void    setLayerIdInVps( Int layerIdInNuh, Int val )                     { m_layerIdInVps[layerIdInNuh] = val;  }
     
    854791
    855792  Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType );
    856 #if H_MV5
    857793  Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( getLayerIdInVps( layerIdInNuh) )]; }
    858 #else
    859   Int     getViewId  ( Int layerIdInVps )                                  { return getScalabilityId( layerIdInVps, VIEW_ID  ); }
    860 
    861 #endif
    862794  Void    setRefLayers();
    863795
    864 #if H_MV5
    865796  Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }   
    866797  Int     getNumViews();
     
    868799  Int     getNumDirectRefLayers( Int layerIdInNuh )                        { return m_numDirectRefLayers[ layerIdInNuh ];  };                               
    869800  Int     getRefLayerId        ( Int layerIdInNuh, Int idx );;
    870 #else
    871   Int     getNumDirectRefLayers( Int layerIdInVps )          { return m_numDirectRefLayers[ layerIdInVps ];  };                               
    872   Int     getRefLayerId        ( Int layerIdInVps, Int idx );;
    873  
    874   Int     getNumSamplePredRefLayers( Int layerIdInVps )          { return m_numSamplePredRefLayers[layerIdInVps]; }
    875   Bool    getSamplePredEnabledFlag ( Int layerIdInVps, Int idx ) { return m_samplePredEnabledFlag [layerIdInVps][idx]; }
    876   Int     getSamplePredRefLayerId  ( Int layerIdInVps, Int idx ) { return m_samplePredRefLayerId  [layerIdInVps][idx]; }
    877 
    878   Int     getNumMotionPredRefLayers( Int layerIdInVps )          { return m_numMotionPredRefLayers[layerIdInVps]; }
    879   Bool    getMotionPredEnabledFlag ( Int layerIdInVps, Int idx ) { return m_motionPredEnabledFlag [layerIdInVps][idx]; }
    880   Int     getMotionPredRefLayerId  ( Int layerIdInVps, Int idx ) { return m_motionPredRefLayerId  [layerIdInVps][idx]; }
    881 #endif 
    882801  Bool    checkVPSExtensionSyntax();
    883802  Int     scalTypeToScalIdx   ( ScalabilityType scalType );
    884803
    885   #if H_MV5
    886804Int     getProfileLevelTierIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
    887 #else
    888   Int     getProfileLevelTierIdxLen() { return xCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
    889 #endif
    890805
    891806  Int     getNumLayersInIdList              ( Int lsIdx );;
     
    895810  Int     inferLastDimsionIdLenMinus1();
    896811
    897 #if H_MV5
    898812  // helpers
    899813  Bool    getInDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Int depth = 0 );
    900 #endif
    901814  /// VPS EXTENSION 2 SYNTAX ELEMENTS
    902815#if H_3D 
    903 #if H_MV5
    904816  Int     getDepthId      ( Int layerIdInNuh)                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }
    905 #else
    906   Void    initViewIndex();
    907   Int     getViewIndex    ( Int layerIdInVps )                             { return m_viewIndex[ layerIdInVps ]; }   
    908   Int     getDepthId      ( Int layerIdInVps )                             { return getScalabilityId( layerIdInVps, DEPTH_ID ); }
    909 #endif
    910817  Int     getLayerIdInNuh( Int viewIndex, Bool depthFlag );   
    911818
     
    943850  Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
    944851  Void    setIvMvScalingFlag   ( Bool b )                 { m_ivMvScalingFlag = b;    } 
    945 #if LGE_INTER_SDC_E0156
     852#if H_3D_INTER_SDC
    946853  Bool    getInterSDCFlag      ( Int layerIdInVps )           { return m_bInterSDCFlag[layerIdInVps]; }
    947854  Void    setInterSDCFlag      ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }
     
    960867  Int           m_winTopOffset;
    961868  Int           m_winBottomOffset;
    962 #if H_MV5
    963869#if H_MV
    964870  Bool          m_scaledFlag;
    965 #endif
    966871#endif
    967872public:
     
    972877  , m_winTopOffset      (0)
    973878  , m_winBottomOffset   (0)
    974 #if H_MV5
    975879#if H_MV
    976880  , m_scaledFlag(true)
    977 #endif
    978881#endif
    979882  { }
     
    990893  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
    991894
    992 #if H_MV5
    993895#if H_MV
    994896  Void          setScaledFlag(Bool flag)          { m_scaledFlag = flag;  }
     
    1005907    }
    1006908  }
    1007 #endif
    1008909#endif
    1009910  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
     
    1054955  TComHRD m_hrdParameters;
    1055956  TimingInfo m_timingInfo;
    1056 #if !H_MV5
    1057 #if H_MV
    1058   Bool m_tileBoundariesAlignedFlag;
    1059 #endif
    1060 #endif
    1061957
    1062958public:
     
    1091987    ,m_log2MaxMvLengthHorizontal(15)
    1092988    ,m_log2MaxMvLengthVertical(15)
    1093 #if !H_MV5
    1094 #if H_MV
    1095     ,m_tileBoundariesAlignedFlag(true)
    1096 #endif
    1097 #endif
    1098989  {}
    1099990
     
    11911082  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
    11921083  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    1193 #if !H_MV5
    1194 #if H_MV
    1195 Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; }
    1196   Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; }
    1197 #endif
    1198 #endif
    11991084
    12001085};
     
    12811166  TComPTL     m_pcPTL;
    12821167#if H_MV
    1283 #if H_MV5
    12841168  TComVPS*    m_pcVPS;
    12851169  // SPS
     
    12871171  Int         m_spsScalingListRefLayerId;
    12881172  Bool        m_updateRepFormatFlag;
    1289 #endif
    12901173  // SPS Extension
    12911174  Bool        m_interViewMvVertConstraintFlag;
    1292 #if !H_MV5
    1293   Int         m_numIlpRestrictedRefLayers        ;
    1294   Int         m_minSpatialSegmentOffsetPlus1[MAX_NUM_LAYERS];
    1295   Bool        m_ctuBasedOffsetEnabledFlag   [MAX_NUM_LAYERS];
    1296   Int         m_minHorizontalCtuOffsetPlus1 [MAX_NUM_LAYERS];
    1297 #endif
    12981175#endif
    12991176#if H_3D
     
    14321309  TComPTL* getPTL()     { return &m_pcPTL; }
    14331310#if H_MV
    1434 #if H_MV5
    14351311  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
    14361312  TComVPS*  getVPS          () { return m_pcVPS; }
     
    14441320  Void setUpdateRepFormatFlag( Bool flag )     { m_updateRepFormatFlag = flag; }
    14451321  Bool getUpdateRepFormatFlag(  )              { return m_updateRepFormatFlag; }
    1446 #endif
    14471322  // SPS Extension
    14481323  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
    14491324  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
    1450 #if H_MV5
    14511325  // Inference
    14521326  Void inferRepFormat( TComVPS* vps, Int layerIdCurr );
    14531327
    14541328  Void inferScalingList( TComSPS* spsSrc );
    1455 #else
    1456   Void setNumIlpRestrictedRefLayers   ( Int val )        { m_numIlpRestrictedRefLayers         = val;}
    1457   Int  getNumIlpRestrictedRefLayers   ( )                { return m_numIlpRestrictedRefLayers        ;}
    1458  
    1459   Void setMinSpatialSegmentOffsetPlus1( Int i, Int val ) { m_minSpatialSegmentOffsetPlus1[ i ] = val;}
    1460   Int  getMinSpatialSegmentOffsetPlus1( Int i )          { return m_minSpatialSegmentOffsetPlus1[ i ];}
    1461  
    1462   Void setCtuBasedOffsetEnabledFlag   ( Int i, Bool flag ) { m_ctuBasedOffsetEnabledFlag   [ i ] = flag;}
    1463   Bool getCtuBasedOffsetEnabledFlag   ( Int i )            { return m_ctuBasedOffsetEnabledFlag   [ i ];}
    1464 
    1465   Void setMinHorizontalCtuOffsetPlus1 ( Int i, Int val )   { m_minHorizontalCtuOffsetPlus1 [ i ] = val;}
    1466   Int  getMinHorizontalCtuOffsetPlus1 ( Int i )            { return m_minHorizontalCtuOffsetPlus1 [ i ];}
    1467 
    1468 #endif
    14691329#endif
    14701330#if H_3D_QTLPC
     
    15821442  Int m_numExtraSliceHeaderBits;
    15831443
    1584 #if H_MV5
    15851444#if H_MV
    15861445  Int  m_layerId;
    15871446  Bool m_ppsInferScalingListFlag;
    15881447  Int  m_ppsScalingListRefLayerId;
    1589 #endif
    15901448#endif
    15911449public:
     
    17101568  Bool getSliceHeaderExtensionPresentFlag   ()                    { return m_sliceHeaderExtensionPresentFlag; }
    17111569  Void setSliceHeaderExtensionPresentFlag   (Bool val)            { m_sliceHeaderExtensionPresentFlag = val; }
    1712 #if H_MV5
    17131570#if H_MV
    17141571  Void setLayerId( Int  val ) { m_layerId = val; }
     
    17201577  Void setPpsScalingListRefLayerId( Int  val ) { m_ppsScalingListRefLayerId = val; }
    17211578  Int  getPpsScalingListRefLayerId(  ) { return m_ppsScalingListRefLayerId; }
    1722 #endif
    17231579#endif
    17241580};
     
    17541610  Bool        m_PicOutputFlag;        ///< pic_output_flag
    17551611  Int         m_iPOC;
    1756 #if H_MV5
    17571612#if H_MV
    17581613  Int         m_iPOCBeforeReset;
    17591614#endif
    1760 #endif
    17611615  Int         m_iLastIDR;
    1762   static Int  m_prevPOC;
     1616  Int         m_iAssociatedIRAP;
     1617  NalUnitType m_iAssociatedIRAPType;
     1618  static Int  m_prevTid0POC;
    17631619  TComReferencePictureSet *m_pcRPS;
    17641620  TComReferencePictureSet m_LocalRPS;
     
    18531709  Bool       m_enableTMVPFlag;
    18541710#if H_MV
    1855 #if H_MV5
    18561711  std::vector<TComPic*>* m_refPicSetInterLayer0;
    18571712  std::vector<TComPic*>* m_refPicSetInterLayer1;
     
    18621717  Bool       m_isDepth;
    18631718#endif
    1864 #else
    1865   std::vector<TComPic*>* m_refPicSetInterLayer;
    1866   Int        m_layerId;
    1867   Int        m_viewId;
    1868 #if H_3D
    1869   Int        m_viewIndex;
    1870   Bool       m_isDepth;
    1871 #endif
    1872 #endif
    18731719
    18741720// Additional slice header syntax elements
    1875 #if H_MV5
    18761721  Bool       m_pocResetFlag;
    1877 #endif
    18781722  Bool       m_discardableFlag;
    18791723  Bool       m_interLayerPredEnabledFlag;
    18801724  Int        m_numInterLayerRefPicsMinus1;
    18811725  Int        m_interLayerPredLayerIdc       [MAX_NUM_LAYERS];
    1882 #if !H_MV5
    1883   Bool       m_interLayerSamplePredOnlyFlag;
    1884   Bool       m_altCollocatedIndicationFlag;
    1885   Int        m_collocatedRefLayerIdx;
    1886 // Additional slice header semantics variables
    1887   Int        m_numActiveMotionPredRefLayers;
    1888   Int        m_activeMotionPredRefLayerId   [ MAX_NUM_LAYER_IDS ];
    1889 
    1890 #endif
    18911726  Int        m_aaiCodedScale [2][MAX_NUM_LAYERS];
    18921727  Int        m_aaiCodedOffset[2][MAX_NUM_LAYERS];
     
    19401775  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
    19411776  Int       getRPSidx          () { return m_iBDidx; }
    1942   Int       getPrevPOC      ()                          { return  m_prevPOC;       }
     1777  Int       getPrevTid0POC      ()                        { return  m_prevTid0POC;       }
    19431778  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
    19441779  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
    19451780  Int       getLastIDR()                                  { return m_iLastIDR; }
     1781  Void      setAssociatedIRAPPOC(Int iAssociatedIRAPPOC)             { m_iAssociatedIRAP = iAssociatedIRAPPOC; }
     1782  Int       getAssociatedIRAPPOC()                        { return m_iAssociatedIRAP; }
     1783  Void      setAssociatedIRAPType(NalUnitType associatedIRAPType)    { m_iAssociatedIRAPType = associatedIRAPType; }
     1784  NalUnitType getAssociatedIRAPType()                        { return m_iAssociatedIRAPType; }
    19461785  SliceType getSliceType    ()                          { return  m_eSliceType;         }
    19471786  Int       getPOC          ()                          { return  m_iPOC;           }
     
    19881827  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
    19891828  Bool      getIsUsedAsLongTerm (Int i, Int j)                  { return m_bIsUsedAsLongTerm[i][j]; }
     1829  Void      setIsUsedAsLongTerm (Int i, Int j, Bool value)      { m_bIsUsedAsLongTerm[i][j] = value; }
    19901830  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
    19911831  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
     
    19941834  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
    19951835  Bool      isReferenced()                                      { return m_bRefenced; }
    1996   Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
     1836  Bool      isReferenceNalu()                                   { return ((getNalUnitType() <= NAL_UNIT_RESERVED_VCL_R15) && (getNalUnitType()%2 != 0)) || ((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL23) ); }
     1837  Void      setPOC              ( Int i )                       { m_iPOC              = i; if ((getTLayer()==0) && (isReferenceNalu() && (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) {m_prevTid0POC=i;} }
    19971838  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
    19981839  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
     
    20001841  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    20011842  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
    2002   Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
     1843  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
    20031844  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
    20041845  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
     
    20221863 
    20231864#if H_MV
    2024 #if H_MV5
    20251865  Void      setPocBeforeReset   ( Int i )                       { m_iPOCBeforeReset = i; }
    20261866  Int       getPocBeforeReset   ( )                             { return m_iPOCBeforeReset; }
    2027 #endif
    20281867  Int       getRefLayerId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefLayerIdList[e][iRefIdx]; }
    20291868  Void      setRefLayerId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefLayerIdList[e][iRefIdx] = i; }
    2030 #if H_MV5
    20311869  Void      getTempRefPicLists   ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1,                                     
    20321870                                   std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int& numPocTotalCurr, Bool checkNumPocTotalCurr = false );
    20331871
    20341872  Void      setRefPicList        ( std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int numPocTotalCurr, Bool checkNumPocTotalCurr = false );
    2035 #else
    2036   Void      setRefPicList       ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet , Bool checkNumPocTotalCurr = false );
    2037 #endif
    20381873#else
    20391874#if FIX1071
     
    20821917  Void setTLayerInfo( UInt uiTLayer );
    20831918  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum );
     1919  Void checkLeadingPictureRestrictions( TComList<TComPic*>& rcListPic );
    20841920  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
    20851921#if H_MV
    2086 #if !H_MV5
    2087   Void createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer );
    2088   static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer );
    2089 #else
    20901922  Void createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 );
    20911923  static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 );
    2092 #endif
    20931924  static Void markCurrPic                 ( TComPic* currPic );;
    20941925  static Void markIvRefPicsAsUnused       ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc  );
    2095 #if H_MV5
    20961926  Void        printRefPicList();
    2097 #else
    2098   Void        xPrintRefPicList();
    2099 #endif
    21001927#endif
    21011928  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
     
    21842011  Void      setViewId             ( Int viewId )     { m_viewId = viewId;   }
    21852012  Int       getViewId             ()                 { return m_viewId;     }
    2186 #if H_MV5
    21872013  Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
    21882014  Int       getViewIndex          ()                 { return m_viewIndex;     }
    2189 #endif
    21902015#if H_3D
    21912016#if H_3D_TMVP
     
    21932018  Void      setAlterRefIdx          ( RefPicList e, Int i ) { m_aiAlterRefIdx[e]    = i;      }
    21942019  Int       getAlterRefIdx          ( RefPicList e )        { return  m_aiAlterRefIdx[e];     }
    2195 #endif
    2196 #if !H_MV5
    2197   Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
    2198   Int       getViewIndex          ()                 { return m_viewIndex;     }
    21992020#endif
    22002021  Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
     
    22192040// Additional slice header syntax elements
    22202041
    2221 #if H_MV5
    22222042  Void setPocResetFlag( Bool flag ) { m_pocResetFlag = flag; }
    22232043  Bool getPocResetFlag(  ) { return m_pocResetFlag; }
    2224 #endif
    22252044
    22262045Void setDiscardableFlag( Bool flag ) { m_discardableFlag = flag; }
     
    22362055Int  getInterLayerPredLayerIdc( Int i ) { return m_interLayerPredLayerIdc[i]; }
    22372056
    2238 #if H_MV5
    22392057  // Additional variables derived in slice header semantics
    22402058  Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
     
    22502068  Void     setRefPicSetInterLayer       ( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1);
    22512069  TComPic* getPicFromRefPicSetInterLayer( Int setIdc, Int layerId );
    2252 #else
    2253 Void setInterLayerSamplePredOnlyFlag( Bool flag ) { m_interLayerSamplePredOnlyFlag = flag; }
    2254 Bool getInterLayerSamplePredOnlyFlag(  ) { return m_interLayerSamplePredOnlyFlag; }
    2255 
    2256 Void setAltCollocatedIndicationFlag( Bool flag ) { m_altCollocatedIndicationFlag = flag; }
    2257 Bool getAltCollocatedIndicationFlag(  ) { return m_altCollocatedIndicationFlag; }
    2258 
    2259 Void setCollocatedRefLayerIdx( Int  val ) { m_collocatedRefLayerIdx = val; }
    2260 Int  getCollocatedRefLayerIdx(  ) { return m_collocatedRefLayerIdx; }
    2261 
    2262 // Additional variables derived in slice header semantics
    2263 Int  getNumInterLayerRefPicsMinus1Len( ) { return xCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerIdInVps() )); }
    2264 Int  getInterLayerPredLayerIdcLen    ( ) { return xCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerIdInVps() )); }
    2265 
    2266 Int  getNumActiveRefLayerPics( );
    2267 Int  getRefPicLayerId               ( Int i );
    2268 
    2269 Void setActiveMotionPredRefLayers   ( );
    2270 
    2271 Int  getNumActiveMotionPredRefLayers(  )      { return m_numActiveMotionPredRefLayers; }
    2272 Int  getActiveMotionPredRefLayerId  ( Int i ) { return m_activeMotionPredRefLayerId[i]; }
    2273 
    2274 Bool getInterRefEnabledInRPLFlag( );
    2275 
    2276 Void     setRefPicSetInterLayer       ( std::vector<TComPic*>* m_refPicSetInterLayer );
    2277 TComPic* getPicFromRefPicSetInterLayer( Int layerId );
    2278 
    2279 #endif
    22802070#endif
    22812071protected:
     
    22842074TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
    22852075#if H_MV
    2286 #if !H_MV5
    2287   Int       xCeilLog2( Int val );
    2288 #endif
    22892076  TComPic*  xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId ); 
    22902077#endif
     
    23682155  //! activate a SPS from a active parameter sets SEI message
    23692156  //! \returns true, if activation is successful
    2370 #if !H_MV5
    2371   Bool activateSPSWithSEI(Int SPSId);
    2372 
    2373   //! activate a PPS and depending on isIDR parameter also SPS and VPS
    2374   //! \returns true, if activation is successful
    2375   Bool activatePPS(Int ppsId, Bool isIRAP);
    2376 
    2377   TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
    2378   TComSPS* getActiveSPS(){ return m_spsMap.getPS(m_activeSPSId); };
    2379   TComPPS* getActivePPS(){ return m_ppsMap.getPS(m_activePPSId); };
    2380 
    2381 protected:
    2382  
    2383   ParameterSetMap<TComVPS> m_vpsMap;
    2384   ParameterSetMap<TComSPS> m_spsMap;
    2385   ParameterSetMap<TComPPS> m_ppsMap;
    2386 
    2387   Int m_activeVPSId;
    2388   Int m_activeSPSId;
    2389   Int m_activePPSId;
    2390 #else
    23912157#if H_MV
    23922158  Bool activateSPSWithSEI(Int SPSId, Int layerId );
     
    24262192#endif
    24272193
    2428 #endif
    24292194};
    24302195
  • trunk/source/Lib/TLibCommon/TComWedgelet.cpp

    r622 r655  
    175175}
    176176
    177 #if !SEC_DMM2_E0146_HHIFIX
    178 Bool TComWedgelet::checkPredDirAbovePossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset )
    179 {
    180   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    181   UInt uiContDStartEndMax = 0;
    182   UInt uiContDStartEndOffset = 0;
    183   switch( eContDWedgeRes )
    184   {
    185   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    186   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    187   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    188   }
    189 
    190   if( m_uhOri == 2 || m_uhOri == 3 || m_uhOri == 4 )
    191   {
    192     UInt uiThisStartEndMax = 0;
    193     switch( m_eWedgeRes )
    194     {
    195     case( DOUBLE_PEL ): { uiThisStartEndMax = (m_uiWidth>>1); break; }
    196     case(   FULL_PEL ): { uiThisStartEndMax =  m_uiWidth;     break; }
    197     case(   HALF_PEL ): { uiThisStartEndMax = (m_uiWidth<<1); break; }
    198     }
    199 
    200     UChar uhStartX = m_uhXs;
    201     UChar uhStartY = m_uhYs;
    202     UChar uhEndX   = m_uhXe;
    203     UChar uhEndY   = m_uhYe;
    204 
    205     if( 2 == m_uhOri )
    206     {
    207       std::swap( uhStartX, uhEndX );
    208       std::swap( uhStartY, uhEndY );
    209     }
    210 
    211     UInt uiScaledEndX = (UInt)uhEndX;
    212     Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    213     if( iDeltaRes > 0 ) { uiScaledEndX <<=  iDeltaRes; }
    214     if( iDeltaRes < 0 ) { uiScaledEndX >>= -iDeltaRes; }
    215 
    216     if( ((UInt)uhEndY == (uiThisStartEndMax-1)) && ((uiScaledEndX-uiContDStartEndOffset) > 0 && (uiScaledEndX-uiContDStartEndOffset) < (uiContDStartEndMax-1)) )
    217     {
    218       return true;
    219     }
    220   }
    221 
    222   return false;
    223 }
    224 
    225 Bool TComWedgelet::checkPredDirLeftPossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset )
    226 {
    227   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    228   UInt uiContDStartEndMax = 0;
    229   UInt uiContDStartEndOffset = 0;
    230   switch( eContDWedgeRes )
    231   {
    232   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    233   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    234   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    235   }
    236 
    237   if( m_uhOri == 1 || m_uhOri == 2 || m_uhOri == 5 )
    238   {
    239     UInt uiThisStartEndMax = 0;
    240     switch( m_eWedgeRes )
    241     {
    242     case( DOUBLE_PEL ): { uiThisStartEndMax = (m_uiHeight>>1); break; }
    243     case(   FULL_PEL ): { uiThisStartEndMax =  m_uiHeight;     break; }
    244     case(   HALF_PEL ): { uiThisStartEndMax = (m_uiHeight<<1); break; }
    245     }
    246 
    247     UChar uhStartX = m_uhXs;
    248     UChar uhStartY = m_uhYs;
    249     UChar uhEndX   = m_uhXe;
    250     UChar uhEndY   = m_uhYe;
    251 
    252     if( 1 == m_uhOri || 5 == m_uhOri )
    253     {
    254       std::swap( uhStartX, uhEndX );
    255       std::swap( uhStartY, uhEndY );
    256     }
    257 
    258     UInt uiScaledEndY = (UInt)uhEndY;
    259     Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    260     if( iDeltaRes > 0 ) { uiScaledEndY <<=  iDeltaRes; }
    261     if( iDeltaRes < 0 ) { uiScaledEndY >>= -iDeltaRes; }
    262 
    263     if( ((UInt)uhEndX == (uiThisStartEndMax-1)) && ((uiScaledEndY-uiContDStartEndOffset) > 0 && (uiScaledEndY-uiContDStartEndOffset) < (uiContDStartEndMax-1)) )
    264     {
    265       return true;
    266     }
    267   }
    268 
    269   return false;
    270 }
    271 
    272 Void TComWedgelet::getPredDirStartEndAbove( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd )
    273 {
    274   ruhXs = 0;
    275   ruhYs = 0;
    276   ruhXe = 0;
    277   ruhYe = 0;
    278 
    279   // get start/end of reference (=this) wedgelet
    280   UInt uiRefStartX = (UInt)getStartX();
    281   UInt uiRefStartY = (UInt)getStartY();
    282   UInt uiRefEndX   = (UInt)getEndX();
    283   UInt uiRefEndY   = (UInt)getEndY();
    284 
    285   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    286   UInt uiContDStartEndMax = 0;
    287   UInt uiContDStartEndOffset = 0;
    288   switch( eContDWedgeRes )
    289   {
    290   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    291   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    292   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    293   }
    294   Int iContDMaxPos = (Int)uiContDStartEndMax - 1;
    295 
    296   // swap if start/end if line orientation is not from top to bottom
    297   if( 2 == (UInt)getOri() )
    298   {
    299     std::swap( uiRefStartX, uiRefEndX );
    300     std::swap( uiRefStartY, uiRefEndY );
    301   }
    302 
    303   // calc slopes
    304   Int iA_DeltaX = (Int)uiRefEndX - (Int)uiRefStartX;
    305   Int iA_DeltaY = (Int)uiRefEndY - (Int)uiRefStartY;
    306 
    307   // get aligned end x value of ref wedge
    308   UInt uiScaledRefEndX = uiRefEndX;
    309   Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    310   if( iDeltaRes > 0 ) { uiScaledRefEndX <<=  iDeltaRes; }
    311   if( iDeltaRes < 0 ) { uiScaledRefEndX >>= -iDeltaRes; }
    312 
    313   assert( uiScaledRefEndX >= uiContDStartEndOffset );
    314   Int iAlignedRefEndX = (Int)uiScaledRefEndX - (Int)uiContDStartEndOffset;
    315 
    316   // special for straight vertical wedge
    317   if( iA_DeltaX == 0 )
    318   {
    319     ruhXs = (UChar)iAlignedRefEndX;
    320     ruhYs = 0;
    321 
    322     Int iXe = iAlignedRefEndX + iDeltaEnd;
    323     if( iXe < 0 )
    324     {
    325       ruhXe = 0;
    326       ruhYe = (UChar)min( max( (iContDMaxPos + iXe), 0 ), iContDMaxPos );
    327 
    328       return;
    329     }
    330     else if( iXe > iContDMaxPos )
    331     {
    332       ruhXe = (UChar)iContDMaxPos;
    333       ruhYe = (UChar)min( max( (iContDMaxPos - (iXe - iContDMaxPos)), 0 ), iContDMaxPos );
    334 
    335       std::swap( ruhXs, ruhXe );
    336       std::swap( ruhYs, ruhYe );
    337       return;
    338     }
    339     else
    340     {
    341       ruhXe = (UChar)iXe;
    342       ruhYe = (UChar)iContDMaxPos;
    343 
    344       return;
    345     }
    346   }
    347 
    348   // special for straight horizontal short bottom line
    349   if( iA_DeltaY == 0 )
    350   {
    351     switch( (UInt)getOri() )
    352     {
    353     case( 2 ):
    354       {
    355         ruhXs = (UChar)(iAlignedRefEndX-1);
    356         ruhYs = 0;
    357         ruhXe = 0;
    358         ruhYe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos );
    359 
    360         return;
    361       }
    362     case( 3 ):
    363       {
    364         ruhXs = (UChar)(iAlignedRefEndX+1);
    365         ruhYs = 0;
    366         ruhXe = (UChar)iContDMaxPos;
    367         ruhYe = (UChar)min( max( -iDeltaEnd, 0 ), iContDMaxPos );
    368 
    369         std::swap( ruhXs, ruhXe );
    370         std::swap( ruhYs, ruhYe );
    371         return;
    372       }
    373     default:
    374       {
    375         assert( 0 );
    376         return;
    377       }
    378     }
    379   }
    380 
    381   // set start point depending on slope
    382   if( abs( iA_DeltaX ) >= abs( iA_DeltaY ) ) { if( iA_DeltaX < 0 ) { ruhXs = (UChar)(iAlignedRefEndX-1); ruhYs = 0; }
    383                                                 if( iA_DeltaX > 0 ) { ruhXs = (UChar)(iAlignedRefEndX+1); ruhYs = 0; } }
    384   else                                                             { ruhXs = (UChar)(iAlignedRefEndX);   ruhYs = 0;   }
    385 
    386   // calc end point and determine orientation
    387   Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iContDMaxPos * ((Double)iA_DeltaX / (Double)iA_DeltaY) );
    388 
    389   if( iVirtualEndX < 0 )
    390   {
    391     Int iYe = roftoi( (Double)(0 - (Int)ruhXs) * ((Double)iA_DeltaY / (Double)iA_DeltaX) ) + iDeltaEnd;
    392     if( iYe < (Int)uiContDStartEndMax )
    393     {
    394       ruhXe = 0;
    395       ruhYe = (UChar)max( iYe, 0 );
    396 
    397       return;
    398     }
    399     else
    400     {
    401       ruhXe = (UChar)min( (iYe - iContDMaxPos), iContDMaxPos );
    402       ruhYe = (UChar)iContDMaxPos;
    403 
    404       return;
    405     }
    406   }
    407   else if( iVirtualEndX > iContDMaxPos )
    408   {
    409     Int iYe = roftoi( (Double)(iContDMaxPos - (Int)ruhXs) * ((Double)iA_DeltaY / (Double)iA_DeltaX) ) - iDeltaEnd;
    410     if( iYe < (Int)uiContDStartEndMax )
    411     {
    412       ruhXe = (UChar)iContDMaxPos;
    413       ruhYe = (UChar)max( iYe, 0 );
    414 
    415       std::swap( ruhXs, ruhXe );
    416       std::swap( ruhYs, ruhYe );
    417       return;
    418     }
    419     else
    420     {
    421       ruhXe = (UChar)max( (iContDMaxPos - (iYe - iContDMaxPos)), 0 );
    422       ruhYe = (UChar)iContDMaxPos;
    423 
    424       return;
    425     }
    426   }
    427   else
    428   {
    429     Int iXe = iVirtualEndX + iDeltaEnd;
    430     if( iXe < 0 )
    431     {
    432       ruhXe = 0;
    433       ruhYe = (UChar)max( (iContDMaxPos + iXe), 0 );
    434 
    435       return;
    436     }
    437     else if( iXe > iContDMaxPos )
    438     {
    439       ruhXe = (UChar)iContDMaxPos;
    440       ruhYe = (UChar)max( (iContDMaxPos - (iXe - iContDMaxPos)), 0 );
    441 
    442       std::swap( ruhXs, ruhXe );
    443       std::swap( ruhYs, ruhYe );
    444       return;
    445     }
    446     else
    447     {
    448       ruhXe = (UChar)iXe;
    449       ruhYe = (UChar)iContDMaxPos;
    450 
    451       return;
    452     }
    453   }
    454 }
    455 
    456 Void TComWedgelet::getPredDirStartEndLeft( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd )
    457 {
    458   ruhXs = 0;
    459   ruhYs = 0;
    460   ruhXe = 0;
    461   ruhYe = 0;
    462 
    463   // get start/end of reference (=this) wedgelet
    464   UInt uiRefStartX = (UInt)getStartX();
    465   UInt uiRefStartY = (UInt)getStartY();
    466   UInt uiRefEndX   = (UInt)getEndX();
    467   UInt uiRefEndY   = (UInt)getEndY();
    468 
    469   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    470   UInt uiContDStartEndMax = 0;
    471   UInt uiContDStartEndOffset = 0;
    472   switch( eContDWedgeRes )
    473   {
    474   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    475   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    476   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    477   }
    478   Int iContDMaxPos = (Int)uiContDStartEndMax - 1;
    479 
    480   // swap if start/end if line orientation is not from left to right
    481   if( 1 == (UInt)getOri() || 5 == (UInt)getOri() )
    482   {
    483     std::swap( uiRefStartX, uiRefEndX );
    484     std::swap( uiRefStartY, uiRefEndY );
    485   }
    486 
    487   Int iL_DeltaX = (Int)uiRefEndX - (Int)uiRefStartX;
    488   Int iL_DeltaY = (Int)uiRefEndY - (Int)uiRefStartY;
    489 
    490   UInt uiScaledRefEndY = uiRefEndY;
    491   Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    492   if( iDeltaRes > 0 ) { uiScaledRefEndY <<=  iDeltaRes; }
    493   if( iDeltaRes < 0 ) { uiScaledRefEndY >>= -iDeltaRes; }
    494 
    495   assert( uiScaledRefEndY >= uiContDStartEndOffset );
    496   Int iAlignedRefEndY = (Int)uiScaledRefEndY - (Int)uiContDStartEndOffset;
    497 
    498   // special for straight horizontal wedge
    499   if( iL_DeltaY == 0 )
    500   {
    501     ruhXs = 0;
    502     ruhYs = (UChar)iAlignedRefEndY;
    503 
    504     Int iYe = iAlignedRefEndY - iDeltaEnd;
    505     if( iYe < 0 )
    506     {
    507       ruhXe = (UChar)min( max( (iContDMaxPos + iYe), 0 ), iContDMaxPos );
    508       ruhYe = 0;
    509 
    510       std::swap( ruhXs, ruhXe );
    511       std::swap( ruhYs, ruhYe );
    512       return;
    513     }
    514     else if( iYe > iContDMaxPos )
    515     {
    516       ruhXe = (UChar)min( max( (iContDMaxPos - (iYe - iContDMaxPos)), 0 ), iContDMaxPos );
    517       ruhYe = (UChar)iContDMaxPos;
    518 
    519       return;
    520     }
    521     else
    522     {
    523       ruhXe = (UChar)iContDMaxPos;
    524       ruhYe = (UChar)iYe;
    525 
    526       std::swap( ruhXs, ruhXe );
    527       std::swap( ruhYs, ruhYe );
    528       return;
    529     }
    530   }
    531 
    532   // special for straight vertical short right line
    533   if( iL_DeltaX == 0 )
    534   {
    535     switch( (UInt)getOri() )
    536     {
    537     case( 1 ):
    538       {
    539         ruhXs = 0;
    540         ruhYs = (UChar)(iAlignedRefEndY+1);
    541         ruhXe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos );
    542         ruhYe = (UChar)iContDMaxPos;
    543 
    544         return;
    545       }
    546     case( 2 ):
    547       {
    548         ruhXs = 0;
    549         ruhYs = (UChar)(iAlignedRefEndY-1);
    550         ruhXe = (UChar)min( max( -iDeltaEnd, 0 ), iContDMaxPos );
    551         ruhYe = 0;
    552 
    553         std::swap( ruhXs, ruhXe );
    554         std::swap( ruhYs, ruhYe );
    555         return;
    556       }
    557     default:
    558       {
    559         assert( 0 );
    560         return;
    561       }
    562     }
    563   }
    564 
    565   // set start point depending on slope
    566   if( abs( iL_DeltaY ) >= abs( iL_DeltaX ) ) { if( iL_DeltaY < 0 ) { ruhYs = (UChar)(iAlignedRefEndY-1); ruhXs = 0; }
    567                                                if( iL_DeltaY > 0 ) { ruhYs = (UChar)(iAlignedRefEndY+1); ruhXs = 0; } }
    568   else                                       {                       ruhYs = (UChar)(iAlignedRefEndY);   ruhXs = 0;   }
    569 
    570   // calc end point and determine orientation
    571   Int iVirtualEndY = (Int)ruhYs + roftoi( (Double)iContDMaxPos * ((Double)iL_DeltaY / (Double)iL_DeltaX) );
    572 
    573   if( iVirtualEndY < 0 )
    574   {
    575     Int iXe = roftoi( (Double)(0 - (Int)ruhYs ) * ((Double)iL_DeltaX / (Double)iL_DeltaY) ) - iDeltaEnd;
    576     if( iXe < (Int)uiContDStartEndMax )
    577     {
    578       ruhXe = (UChar)max( iXe, 0 );
    579       ruhYe = 0;
    580 
    581       std::swap( ruhXs, ruhXe );
    582       std::swap( ruhYs, ruhYe );
    583       return;
    584     }
    585     else
    586     {
    587       ruhXe = (UChar)iContDMaxPos;
    588       ruhYe = (UChar)min( (iXe - iContDMaxPos), iContDMaxPos );
    589 
    590       std::swap( ruhXs, ruhXe );
    591       std::swap( ruhYs, ruhYe );
    592       return;
    593     }
    594   }
    595   else if( iVirtualEndY > iContDMaxPos )
    596   {
    597     Int iXe = roftoi( (Double)(iContDMaxPos - (Int)ruhYs ) * ((Double)iL_DeltaX / (Double)iL_DeltaY) ) + iDeltaEnd;
    598     if( iXe < (Int)uiContDStartEndMax )
    599     {
    600       ruhXe = (UChar)max( iXe, 0 );
    601       ruhYe = (UChar)iContDMaxPos;
    602 
    603       return;
    604     }
    605     else
    606     {
    607       ruhXe = (UChar)iContDMaxPos;
    608       ruhYe = (UChar)max( (iContDMaxPos - (iXe - iContDMaxPos)), 0 );
    609 
    610       std::swap( ruhXs, ruhXe );
    611       std::swap( ruhYs, ruhYe );
    612       return;
    613     }
    614   }
    615   else
    616   {
    617     Int iYe = iVirtualEndY - iDeltaEnd;
    618     if( iYe < 0 )
    619     {
    620       ruhXe = (UChar)max( (iContDMaxPos + iYe), 0 );
    621       ruhYe = 0;
    622 
    623       std::swap( ruhXs, ruhXe );
    624       std::swap( ruhYs, ruhYe );
    625       return;
    626     }
    627     else if( iYe > iContDMaxPos )
    628     {
    629       ruhXe = (UChar)max( (iContDMaxPos - (iYe - iContDMaxPos)), 0 );
    630       ruhYe = (UChar)iContDMaxPos;
    631 
    632       return;
    633     }
    634     else
    635     {
    636       ruhXe = (UChar)iContDMaxPos;
    637       ruhYe = (UChar)iYe;
    638 
    639       std::swap( ruhXs, ruhXe );
    640       std::swap( ruhYs, ruhYe );
    641       return;
    642     }
    643   }
    644 }
    645 #endif
    646 
    647177Void TComWedgelet::xGenerateWedgePattern()
    648178{
  • trunk/source/Lib/TLibCommon/TComWedgelet.h

    r622 r655  
    5050enum DIM_IDX
    5151{
    52 #if SEC_DMM2_E0146_HHIFIX
    5352  DMM1_IDX = 0,
    5453  DMM3_IDX = 1,
    5554  DMM4_IDX = 2,
    5655  RBC_IDX  = 3
    57 #else
    58   DMM1_IDX = 0,
    59   DMM2_IDX = 3,
    60   DMM3_IDX = 1,
    61   DMM4_IDX = 2,
    62   RBC_IDX  = 4
    63 #endif
    6456};
    65 #if SEC_DMM2_E0146_HHIFIX
     57
    6658#define DMM_NUM_TYPE   3
    67 #else
    68 #define DMM_NUM_TYPE   4
    69 #endif
    7059#define RBC_NUM_TYPE   1
    7160#define DIM_NUM_TYPE   (DMM_NUM_TYPE+RBC_NUM_TYPE)
     
    8675#define DMM_NO_WEDGEINDEX       MAX_UINT
    8776#define DMM_NUM_WEDGE_REFINES   8
    88 #if !SEC_DMM2_E0146_HHIFIX
    89 #define DMM2_DELTAEND_MAX       4
    90 #endif
    9177#define DMM3_SIMPLIFY_TR        1
    9278
     
    151137  Bool  checkInvIdentical( Bool* pbRefPattern );
    152138
    153 #if !SEC_DMM2_E0146_HHIFIX
    154   // functions for DMM2 prediction
    155   Bool  checkPredDirAbovePossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett );
    156   Bool  checkPredDirLeftPossible ( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett );
    157   Void  getPredDirStartEndAbove( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd );
    158   Void  getPredDirStartEndLeft ( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd );
    159 #endif
    160139};  // END CLASS DEFINITION TComWedgelet
    161140
  • trunk/source/Lib/TLibCommon/TComWeightPrediction.h

    r608 r655  
    5353class TComWeightPrediction
    5454{
    55   wpScalingParam  m_wp0[3], m_wp1[3];
    56 
    5755public:
    5856  TComWeightPrediction();
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r622 r655  
    9292                                              // QC_CU_NBDV_D0181
    9393                                              // SEC_DEFAULT_DV_D0112
    94                                               // MTK_DVMCP_FIX_E0172               1 // fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172
     94                                              // MTK_DVMCP_FIX_E0172       fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172
     95                                              // SEC_SIMPLIFIED_NBDV_E0142 Simplified NBDV, JCT3V-E0142 and JCT3V-E0190
     96                                              // MTK_NBDV_TN_FIX_E0172     fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172
     97                                              // MTK_TEXTURE_MRGCAND_BUGFIX_E0182  Bug fix for TEXTURE MERGING CANDIDATE     , JCT3V-E0182
    9598#define H_3D_ARP                          1   // Advanced residual prediction (ARP), JCT3V-D0177
    9699#define H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
    97100                                              // Unifying rounding offset, for IC part, JCT3V-D0135
    98101                                              // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     102                                              // SHARP_ILLUCOMP_REFINE_E0046
     103                                              // MTK_CLIPPING_ALIGN_IC_E0168       // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
    99104
    100105#if H_3D_NBDV
     
    103108                                              // MERL_D0166: Reference view selection in NBDV & Bi-VSP
    104109                                              // MERL_C0152: Basic VSP
     110                                              // NBDV_DEFAULT_VIEWIDX_BUGFIX Bug fix for invalid default view index for NBDV
     111                                              // NTT_DoNBDV_VECTOR_CLIP_E0141 disparity vector clipping in DoNBDV, JCT3V-E0141 and JCT3V-E0209
     112
    105113#endif
    106114
     
    112120                                              // LG_D0092: Multiple VSP candidate allowed
    113121                                              // MTK_VSP_FIX_ALIGN_WD_E0172
     122                                              // NTT_VSP_ADAPTIVE_SPLIT_E0207 adaptive sub-PU partitioning in VSP, JCT3V-E0207
     123                                              // NTT_VSP_DC_BUGFIX_E0208 bugfix for sub-PU based DC in VSP, JCT3V-E0208
     124                                              // NTT_VSP_COMMON_E0207_E0208 common part of JCT3V-E0207 and JCT3V-E0208
    114125#define H_3D_IV_MERGE                     1   // Inter-view motion merge candidate
    115126                                              // HHI_INTER_VIEW_MOTION_PRED
     
    139150                                              // FIX_SDC_ENC_RD_WVSO_D0163
    140151                                              // MTK_SAMPLE_BASED_SDC_D0110
    141 
    142 
    143 
    144 /////////////////////////////////////////////////////////////////////////////////////////
    145 ///////////////////////////////////   HTM-8.0 INTEGRATIONS //////////////////////////////
    146 /////////////////////////////////////////////////////////////////////////////////////////
    147 
    148 #define SHARP_ILLUCOMP_REFINE_E0046       1
    149 #define MTK_FAST_TEXTURE_ENCODING_E0173   1   // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173
    150 #define MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170            1   // Progressive MV Compression, JCT3V-E0170
    151 #define LGE_INTER_SDC_E0156               1   // Enable inter SDC for depth coding
    152 
    153 #if H_3D_IC
    154 #define MTK_CLIPPING_ALIGN_IC_E0168       1   // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
    155 #endif
    156 
    157 #if H_3D_NBDV
    158 #define NBDV_DEFAULT_VIEWIDX_BUGFIX       1  // Bug fix for invalid default view index for NBDV
    159 #define MTK_RVS_BUGFIX_E0172              1  // Bug fix for issues caused by reference view selection, JCT3V-E0172
    160 #define MTK_TEXTURE_MRGCAND_BUGFIX_E0182  1  // Bug fix for TEXTURE MERGING CANDIDATE     , JCT3V-E0182
    161 
    162 #if MTK_RVS_BUGFIX_E0172
    163 #define MTK_DIVMC_FIX_E0172               1 // fix the issue of derivation of disparity inter-view merge candidate, issue 5 in JCT3V-E0172
    164 #define MTK_NBDV_TN_FIX_E0172             1 // fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172
    165 #endif // MTK_RVS_BUGFIX_E0172
    166 
    167 #if H_3D_NBDV_REF
    168 #define NTT_DoNBDV_VECTOR_CLIP_E0141      1   // disparity vector clipping in DoNBDV, JCT3V-E0141 and JCT3V-E0209
    169 #define SEC_SIMPLIFIED_NBDV_E0142         1   // Simplified NBDV, JCT3V-E0142 and JCT3V-E0190
    170 #endif
    171 #endif // H_3D_NBDV
    172 
     152                                              // SEC_DMM2_E0146_HHIFIX Removal of DMM2 from DMMs
     153                                              // ZJU_DEPTH_INTRA_MODE_E0204 Simplified Binarization for depth_intra_mode
     154                                              // KWU_SDC_SIMPLE_DC_E0117 Simplified DC calculation for SDC
     155                                              // SCU_HS_DMM4_REMOVE_DIV_E0242 DMM4 Division Removal
     156                                              // LGE_SDC_REMOVE_DC_E0158 Removal of DC mode from SDC
     157                                              // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1   Removal of overlap between DMM3 and DMM1
     158
     159#define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
     160                                              // LGE_INTER_SDC_E0156  Enable inter SDC for depth coding
     161#define H_3D_FCO                          0   // Flexible coding order for 3D
     162
     163
     164
     165// OTHERS
     166                                              // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170
     167#define H_3D_REN_MAX_DEV_OUT              0   // Output maximal possible shift deviation
     168#define H_3D_FAST_TEXTURE_ENCODING        1   // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173
     169                                              // MTK_FAST_TEXTURE_ENCODING_E0173
    173170#if H_3D_DIM
    174 #define SEC_DMM2_E0146_HHIFIX             1   // Removal of DMM2 from DMMs
    175 #define ZJU_DEPTH_INTRA_MODE_E0204        1   // Simplified Binarization for depth_intra_mode
    176 #define KWU_SDC_SIMPLE_DC_E0117           1   // Simplified DC calculation for SDC
    177 #define SCU_HS_DMM4_REMOVE_DIV_E0242      1   // DMM4 Division Removal
    178 #define SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX     1   // Fast DMM and RBC Mode Selection
    179 #endif
    180 
    181 #if H_3D_VSP
    182 #define NTT_VSP_COMMON_E0207_E0208        1 // common part of JCT3V-E0207 and JCT3V-E0208
    183 #if NTT_VSP_COMMON_E0207_E0208
    184 #define NTT_VSP_DC_BUGFIX_E0208           1 // bugfix for sub-PU based DC in VSP, JCT3V-E0208
    185 #define NTT_VSP_VECTOR_CLIP_E0208         1 // disparity vector clipping on fetching depth map in VSP, JCT3V-E0208
    186 #define NTT_VSP_ADAPTIVE_SPLIT_E0207      1 // adaptive sub-PU partitioning in VSP, JCT3V-E0207
    187 #endif
    188 #endif
    189 
    190 #define H_3D_REN_MAX_DEV_OUT              0  // Output maximal possible shift deviation
    191 
    192 /// FIXES
    193 #define H_3D_FIX_BVSP                     1  // DV from NBDV instead of DoNBDV should be used
    194 #define H_3D_FIX_TICKET_036               1  // fix for ticket #36
    195 #define H_3D_FIX_REN                      1  // fix of erroneous inpainting for renderer
    196 #define H_3D_FIX_REN_WARNING              1  // fix of warning related to camera parameter precision
    197 
    198 #define H_3D_FIX_UINT_WARNING             1  // explicit in VSD
     171#define H_3D_FAST_DEPTH_INTRA             1   // Fast DMM and RBC Mode Selection
     172                                              // SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     173#endif
     174
     175
     176// Rate Control
     177#define KWU_FIX_URQ                       1
     178#define KWU_RC_VIEWRC_E0227               0  ///< JCT3V-E0227, view-wise target bitrate allocation
     179#define KWU_RC_MADPRED_E0227              0  ///< JCT3V-E0227, inter-view MAD prediction
     180
    199181#endif // H_3D
    200182
    201183
    202 /////////////////////////////////////////////////////////////////////////////////////////
    203 ///////////////////////////////////   HTM-8.1 INTEGRATIONS //////////////////////////////
    204 /////////////////////////////////////////////////////////////////////////////////////////
    205 
    206 // Please put HTM-8.1 Integration defines here, when possible
    207 
    208 
    209 /// FIXES
    210 #if H_MV
    211 #define H_MV_FIX_LID_PIC_HASH_SEI_T40                      1   // Fix wrong layer_id in decoded picture hash SEI
    212 #define H_MV5                                              1   // Update to MV-HEVC 5 HLS
    213 #endif
     184
    214185/////////////////////////////////////////////////////////////////////////////////////////
    215186///////////////////////////////////   DERIVED DEFINES /////////////////////////////////// 
     
    223194#define H_3D_VSO_RM_ASSERTIONS            0   // Output VSO assertions
    224195#define H_3D_VSO_SYNTH_DIST_OUT           0   // Output of synthesized view distortion instead of depth distortion in encoder output
    225 
    226196#define H_3D_VSO_FIX                      0   // This fix should be enabled after verification
    227 
    228 #endif
    229 ////   ****** Neighbouring block-based Disparity Vector  *********
     197#endif
     198
     199////   ****** neighbouring block-based disparity vector  *********
    230200#if H_3D_NBDV
    231 #if SEC_SIMPLIFIED_NBDV_E0142
    232201#define DVFROM_LEFT                       0
    233202#define DVFROM_ABOVE                      1
    234203#define IDV_CANDS                         2
    235 #else
    236 #define DVFROM_LEFTBELOW                  0
    237 #define DVFROM_LEFT                       1
    238 #define DVFROM_ABOVERIGHT                 2
    239 #define DVFROM_ABOVE                      3
    240 #define DVFROM_ABOVELEFT                  4
    241 #define IDV_CANDS                         5
    242 #endif
    243204#endif
    244205
     
    247208#define H_3D_ARP_WFNR                     3
    248209#endif
     210
    249211///// ***** DEPTH INTRA MODES *********
    250212#if H_3D_DIM
     
    256218                                              // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
    257219                                              // LG_ZEROINTRADEPTHRESI_A0087
    258 #if H_3D_DIM_SDC
    259 #define LGE_SDC_REMOVE_DC_E0158           1   // Removal of DC mode from SDC
    260 #endif
    261 #if H_3D_DIM_DMM
    262 #define LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1   // Removal of overlap between DMM3 and DMM1
    263 #endif
    264 #endif
    265 
     220#endif
    266221///// ***** VIEW SYNTHESIS PREDICTION *********
    267222#if H_3D_VSP
     
    273228#endif
    274229
     230#endif
     231
     232///// ***** ILLUMATION COMPENSATION *********
     233#if H_3D_IC
     234#define IC_REG_COST_SHIFT                 7
     235#define IC_CONST_SHIFT                    5
     236#define IC_SHIFT_DIFF                     12
     237#endif
     238
     239///// ***** FCO *********
     240#if H_3D_FCO
     241#define H_3D_FCO_VSP_DONBDV_E0163               1   // Adaptive depth reference for flexible coding order
     242#else
     243#define H_3D_FCO_VSP_DONBDV_E0163               0   // Adaptive depth reference for flexible coding order
    275244#endif
    276245
     
    300269#define TICKET_1090_FIX                             1
    301270
     271#if KWU_FIX_URQ
     272#if RATE_CONTROL_LAMBDA_DOMAIN
    302273#define RC_FIX                                      1  /// suggested fix for M0036
    303274#define RATE_CONTROL_INTRA                          1  ///< JCTVC-M0257, rate control for intra
     275#endif
     276#else
     277#define RC_FIX                                      1  /// suggested fix for M0036
     278#define RATE_CONTROL_INTRA                          1  ///< JCTVC-M0257, rate control for intra
     279#endif
     280
    304281
    305282#define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
     
    484461
    485462#if H_3D_VSO_DIST_INT
    486 #if H_3D_FIX_TICKET_036
    487463typedef       Int64            Dist;       ///< RDO distortion
    488 #else
    489 typedef       Int              Dist;       ///< RDO distortion
    490 #endif
    491464typedef       Int64            Dist64;
    492465#define       RDO_DIST_MIN     MIN_INT
     
    793766  enum ScalabilityType
    794767  {
    795 #if H_MV5
    796768#if H_3D
    797769    DEPTH_ID = 0,   
    798770#endif   
    799771    VIEW_ORDER_INDEX  = 1,
    800 #else
    801     VIEW_ID  = 0,
    802 #if H_3D
    803     DEPTH_ID = 1,   
    804 #endif   
    805 #endif
    806772  };
    807773#endif
  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r608 r655  
    315315
    316316  /* restore primary bitstream for sei_message */
     317  getBitstream()->deleteFifo();
    317318  delete getBitstream();
    318319  setBitstream(bs);
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r622 r655  
    5858  if (length < 10)
    5959  {
    60     fprintf( g_hTrace, "%-50s u(%d)  : %d\n", pSymbolName, length, rValue );
     60    fprintf( g_hTrace, "%-50s u(%d)  : %u\n", pSymbolName, length, rValue );
    6161  }
    6262  else
    6363  {
    64     fprintf( g_hTrace, "%-50s u(%d) : %d\n", pSymbolName, length, rValue );
     64    fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue );
    6565  }
    6666  fflush ( g_hTrace );
     
    7777#endif
    7878  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    79   fprintf( g_hTrace, "%-50s ue(v) : %d\n", pSymbolName, rValue );
     79  fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue );
    8080  fflush ( g_hTrace );
    8181}
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r622 r655  
    330330    }
    331331  }
    332 #if H_MV5
    333332#if H_MV
    334333  if ( pcPPS->getLayerId() > 0 )
     
    344343  { 
    345344#endif
    346 #endif
    347345  READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
    348346  if(pcPPS->getScalingListPresentFlag ())
     
    350348    parseScalingList( pcPPS->getScalingList() );
    351349  }
    352 #if H_MV5
    353 #if H_MV
    354   }
    355 #endif
     350#if H_MV
     351  }
    356352#endif
    357353
     
    430426  {
    431427    Window &defDisp = pcVUI->getDefaultDisplayWindow();
    432 #if !H_MV5
    433     READ_UVLC(   uiCode, "def_disp_win_left_offset" );                defDisp.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
    434     READ_UVLC(   uiCode, "def_disp_win_right_offset" );               defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
    435     READ_UVLC(   uiCode, "def_disp_win_top_offset" );                 defDisp.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
    436     READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
    437 #else
    438428#if H_MV
    439429    defDisp.setScaledFlag( false );
     
    448438    READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
    449439#endif
    450 #endif
    451440  }
    452441  TimingInfo *timingInfo = pcVUI->getTimingInfo();
     
    471460  {
    472461    READ_FLAG(   uiCode, "tiles_fixed_structure_flag");               pcVUI->setTilesFixedStructureFlag(uiCode);
    473 #if !H_MV5
    474 #if H_MV
    475     if ( pcSPS->getLayerId() > 0 )
    476     {
    477       READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 );
    478     }
    479 #endif
    480 #endif
    481462    READ_FLAG(   uiCode, "motion_vectors_over_pic_boundaries_flag");  pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode);
    482463    READ_FLAG(   uiCode, "restricted_ref_pic_lists_flag");            pcVUI->setRestrictedRefPicListsFlag(uiCode);
     
    597578  READ_UVLC(     uiCode, "sps_seq_parameter_set_id" );           pcSPS->setSPSId( uiCode );
    598579  assert(uiCode <= 15);
    599 #if H_MV5
    600580#if H_MV
    601581  if ( pcSPS->getLayerId() > 0 )
     
    606586  if ( pcSPS->getUpdateRepFormatFlag() )
    607587  {
    608 #endif
    609588#endif
    610589  READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
     
    619598  READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
    620599  READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
    621 #if H_MV5
    622 #if H_MV
    623   }
    624 #endif
     600#if H_MV
     601  }
    625602#endif
    626603  READ_FLAG(     uiCode, "conformance_window_flag");
     
    628605  {
    629606    Window &conf = pcSPS->getConformanceWindow();
    630 #if H_MV5
    631607#if H_MV
    632608    // Needs to be scaled later, when ChromaFormatIdc is known.
     
    642618    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    643619#endif
    644 #else
    645     READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    646     READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    647     READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    648     READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    649 #endif
    650   }
    651 
    652 #if H_MV5
     620  }
     621
    653622#if H_MV
    654623  if ( pcSPS->getUpdateRepFormatFlag() )
    655624  {
    656 #endif
    657625#endif
    658626  READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
     
    665633  pcSPS->setBitDepthC( uiCode + 8 );
    666634  pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
    667 #if H_MV5
    668 #if H_MV
    669   }
    670 #endif
     635#if H_MV
     636  }
    671637#endif
    672638
     
    692658    pcSPS->setNumReorderPics(uiCode, i);
    693659#if H_MV
    694 #if H_MV5
    695660    READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]");
    696 #else
    697     READ_UVLC ( uiCode, "sps_max_latency_increase[i]");
    698 #endif
    699661#else
    700662    READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
     
    736698  if(pcSPS->getScalingListFlag())
    737699  {
    738 #if H_MV5
    739700#if H_MV
    740701    if ( pcSPS->getLayerId() > 0 )
     
    750711    {   
    751712#endif
    752 #endif
    753713    READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" );                 pcSPS->setScalingListPresentFlag ( uiCode );
    754714    if(pcSPS->getScalingListPresentFlag ())
     
    756716      parseScalingList( pcSPS->getScalingList() );
    757717    }
    758 #if H_MV5
    759 #if H_MV
    760     }
    761 #endif
     718#if H_MV
     719    }
    762720#endif
    763721  }
     
    814772  if (uiCode)
    815773  {
    816 #if !H_MV5
    817 #if !H_MV
    818     while ( xMoreRbspData() )
    819     {
    820       READ_FLAG( uiCode, "sps_extension_data_flag");
    821     }
    822 #else
    823     READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
    824     ////   sps_extension_vui_parameters( )
    825     if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )
    826     { 
    827       READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode );
    828       for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ )
    829       { 
    830         READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode );
    831         if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 )
    832         { 
    833           READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 );
    834           if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) ) 
    835           {
    836             READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode );
    837           }
    838         } 
    839       } 
    840     }
    841 
    842 #if H_3D_QTLPC
    843     if( depthFlag )
    844     {
    845       READ_FLAG( uiCode, "use_qtl_flag" );
    846       pcSPS->setUseQTL( uiCode );
    847       READ_FLAG( uiCode, "use_pc_flag" );
    848       pcSPS->setUsePC( uiCode );
    849     }
    850 #endif
    851     ////   sps_extension_vui_parameters( ) END
    852     READ_UVLC( uiCode, "sps_shvc_reserved_zero_idc" );
    853     READ_FLAG( uiCode, "sps_extension2_flag");
    854     if ( uiCode )
    855     {
    856 #if !H_3D
    857       while ( xMoreRbspData() )
    858       {
    859         READ_FLAG( uiCode, "sps_extension_data_flag");
    860       }
    861 #else
    862      
    863       UInt uiCamParPrecision = 0;
    864       Bool bCamParSlice      = false;
    865       if ( !depthFlag )
    866       {     
    867         READ_UVLC( uiCamParPrecision, "cp_precision" );
    868         READ_FLAG( uiCode, "cp_in_slice_header_flag" );    bCamParSlice = ( uiCode == 1 );
    869         if( !bCamParSlice )
    870         {       
    871           for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )
    872           {
    873             Int iCode;
    874             READ_SVLC( iCode, "cp_scale" );                m_aaiTempScale  [ uiBaseIndex ][ viewIndex ]   = iCode;
    875             READ_SVLC( iCode, "cp_off" );                  m_aaiTempOffset [ uiBaseIndex ][ viewIndex ]   = iCode;
    876             READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale  [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ];
    877             READ_SVLC( iCode, "cp_inv_off_plus_off" );     m_aaiTempOffset [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ];
    878           }
    879         }
    880       }
    881       pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset );
    882       READ_FLAG( uiCode, "sps_extension3_flag");
    883       if ( uiCode )
    884       {
    885         while ( xMoreRbspData() )
    886         {
    887           READ_FLAG( uiCode, "sps_extension_data_flag");
    888         }
    889       }
    890 #endif // !H_3D
    891     }
    892 #endif // !H_MV
    893   }
    894 }
    895 #else
    896774#if H_MV
    897775    parseSPSExtension( pcSPS );
     
    918796  }
    919797}
    920 #endif
    921 #if H_MV5
     798
     799#if H_MV
    922800Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS )
    923801{
     
    972850  READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
    973851#if H_MV
    974 #if H_MV5
    975852  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayersMinus1( uiCode  );
    976 #else
    977   READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayers( uiCode + 1 );
    978 #endif
    979853#else
    980854  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
     
    1061935  if (uiCode)
    1062936  {
    1063 #if !H_MV5
    1064 #if H_MV
    1065     m_pcBitstream->readOutTrailingBits();
    1066 
    1067     READ_FLAG( uiCode, "avc_base_layer_flag" );                     pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false );
    1068     READ_FLAG( uiCode, "splitting_flag" );                          pcVPS->setSplittingFlag( uiCode == 1 ? true : false );
    1069 
    1070     for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ )
    1071     {
    1072       READ_FLAG( uiCode,  "scalability_mask[i]" );                  pcVPS->setScalabilityMask( sIdx, uiCode == 1 ? true : false );     
    1073     }
    1074 
    1075     for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )
    1076     {
    1077         READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" );       pcVPS->setDimensionIdLen( sIdx, uiCode + 1 );
    1078     }
    1079 
    1080     if ( pcVPS->getSplittingFlag() )
    1081       {
    1082       pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1, pcVPS->inferLastDimsionIdLenMinus1() );       
    1083       }
    1084 
    1085     READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" );           pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false );
    1086 
    1087     for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
    1088     {
    1089       if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( i > 0 ) )
    1090       {
    1091         READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" );                pcVPS->setLayerIdInNuh( i, uiCode );
    1092       }
    1093       else
    1094       {
    1095         pcVPS->setLayerIdInNuh( i, i );;
    1096     }
    1097 
    1098       pcVPS->setLayerIdInVps( pcVPS->getLayerIdInNuh( i ), i );
    1099    
    1100       for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ )
    1101     {
    1102         if ( !pcVPS->getSplittingFlag() )
    1103       {
    1104           READ_CODE( pcVPS->getDimensionIdLen( j ), uiCode, "dimension_id[i][j]" );  pcVPS->setDimensionId( i, j, uiCode );
    1105         }
    1106         else
    1107         {
    1108           pcVPS->setDimensionId( i, j, pcVPS->inferDimensionId( i, j)  );
    1109         }
    1110       }
    1111     }
    1112 
    1113 
    1114     for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
    1115     {
    1116       for( Int j = 0; j < i; j++ )
    1117       {
    1118         READ_FLAG( uiCode, "direct_dependency_flag[i][j]" );             pcVPS->setDirectDependencyFlag( i, j, uiCode );
    1119       }
    1120     }
    1121 
    1122     for( Int i = 0; i < pcVPS->getMaxLayers() - 1; i++ )
    1123     {
    1124       READ_CODE( 3, uiCode,       "max_tid_il_ref_pics_plus1[i]" );      pcVPS->setMaxTidIlRefPicPlus1( i , uiCode );
    1125     }
    1126 
    1127     READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1"      );  pcVPS->setVpsNumberLayerSetsMinus1    ( uiCode );
    1128     READ_CODE( 6,  uiCode, "vps_num_profile_tier_level_minus1" );  pcVPS->setVpsNumProfileTierLevelMinus1( uiCode );
    1129 
    1130     for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
    1131     {
    1132       READ_FLAG(  uiCode, "vps_profile_present_flag[i]" );    pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 );
    1133       if( !pcVPS->getVpsProfilePresentFlag( i ) )
    1134       {
    1135         READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode );
    1136       }
    1137       parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1);
    1138       if( !pcVPS->getVpsProfilePresentFlag( i ) )
    1139       {
    1140         TComPTL temp = *pcVPS->getPTL( i );
    1141         *pcVPS->getPTL( i ) = *pcVPS->getPTL( pcVPS->getProfileRefMinus1( i ) + 1 );
    1142         pcVPS->getPTL( i )->copyLevelFrom( &temp );
    1143       }
    1144     }
    1145 
    1146     Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1;
    1147 
    1148     READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); pcVPS->setMoreOutputLayerSetsThanDefaultFlag( uiCode == 1 );
    1149 
    1150     if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )
    1151     {
    1152       READ_CODE( 10, uiCode, "num_add_output_layer_sets_minus1"      ); pcVPS->setNumAddOutputLayerSetsMinus1( uiCode );
    1153       numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1);
    1154     }
    1155 
    1156     if( numOutputLayerSets > 1)
    1157     {
    1158       READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); pcVPS->setDefaultOneTargetOutputLayerFlag(  uiCode == 1);
    1159     } 
    1160 
    1161     for( Int i = 1; i < numOutputLayerSets; i++ )
    1162     {
    1163       if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )
    1164       {       
    1165         READ_UVLC( uiCode,      "output_layer_set_idx_minus1[i]" ); pcVPS->setOutputLayerSetIdxMinus1( i, uiCode );
    1166         for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ )
    1167         {
    1168           READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( i, j, uiCode == 1 );
    1169         }       
    1170       }
    1171       if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
    1172       {     
    1173         READ_CODE( pcVPS->getProfileLevelTierIdxLen(), uiCode,"profile_level_tier_idx[ i ]" );   pcVPS->setProfileLevelTierIdx( i , uiCode );
    1174       }
    1175     }
    1176 
    1177     READ_FLAG( uiCode , "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag( uiCode == 1 );
    1178     READ_UVLC( uiCode,  "direct_dep_type_len_minus2"); pcVPS->setDirectDepTypeLenMinus2 ( uiCode );
    1179 
    1180     for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
    1181     {
    1182       for( Int j = 0; j < i; j++ )
    1183       {
    1184         if (pcVPS->getDirectDependencyFlag( i, j) )
    1185         {       
    1186           READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2,  uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode);
    1187         }
    1188       }
    1189     }
    1190 
    1191     READ_FLAG ( uiCode,                    "vps_shvc_reserved_zero_flag" );
    1192 
    1193 #if H_3D   
    1194     READ_FLAG( uiCode,  "vps_extension2_flag" );
    1195     if (uiCode)
    1196     {
    1197       m_pcBitstream->readOutTrailingBits();
    1198 
    1199       for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
    1200       {
    1201 
    1202 #if H_3D_ARP
    1203         pcVPS->setUseAdvRP  ( i, 0 );
    1204         pcVPS->setARPStepNum( i, 1 );
    1205 #endif 
    1206         if ( i != 0 )
    1207         {
    1208           if( !( pcVPS->getDepthId( i ) == 1 ) )
    1209           {
    1210 #if H_3D_IV_MERGE
    1211                 READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
    1212 #endif
    1213 #if H_3D_ARP
    1214                 READ_FLAG( uiCode, "iv_res_pred_flag[i]"  );  pcVPS->setUseAdvRP  ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 );
    1215 
    1216 #endif
    1217 #if H_3D_NBDV_REF
    1218                 READ_FLAG( uiCode, "depth_refinement_flag[i]");    pcVPS->setDepthRefinementFlag  ( i, uiCode == 1 ? true : false );
    1219 #endif
    1220 #if H_3D_VSP
    1221                 READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );
    1222 #endif
    1223           }
    1224           else
    1225           {
    1226 
    1227             READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
    1228             //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false );
    1229 #if H_3D_DIM_DLT
    1230             if( pcVPS->getVpsDepthModesFlag( i ) )
    1231             {
    1232               READ_FLAG( uiCode, "dlt_flag[i]" );                       pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false );
    1233             }
    1234             if( pcVPS->getUseDLTFlag( i ) )
    1235             {
    1236               // decode mapping
    1237               UInt uiNumDepthValues;
    1238               // parse number of values in DLT
    1239               READ_UVLC(uiNumDepthValues, "num_depth_values_in_dlt[i]");
    1240 
    1241               // parse actual DLT values
    1242               Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int));
    1243               for(Int d=0; d<uiNumDepthValues; d++)
    1244               {
    1245                 READ_UVLC(uiCode, "dlt_depth_value[i][d]");
    1246                 aiIdx2DepthValue[d] = (Int)uiCode;
    1247               }
    1248 
    1249               pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
    1250 
    1251               // clean memory
    1252               free(aiIdx2DepthValue);
    1253             }
    1254 #endif
    1255 #if LGE_INTER_SDC_E0156
    1256             READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
    1257 #endif
    1258           }
    1259         }
    1260       }
    1261       READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false );
    1262     }
    1263 #endif
    1264     pcVPS->checkVPSExtensionSyntax();
    1265 
    1266     pcVPS->setRefLayers();
    1267 
    1268 #else
    1269     while ( xMoreRbspData() )
    1270     {
    1271       READ_FLAG( uiCode, "vps_extension_data_flag");
    1272     }
    1273 #endif   
    1274   }
    1275 
    1276 #if H_3D
    1277   pcVPS->initViewIndex();
    1278 #endif
    1279   return;
    1280 }
    1281 #else
    1282937#if H_MV
    1283938    m_pcBitstream->readOutTrailingBits();
     
    1305960#endif
    1306961  }
    1307 }
    1308 #endif
    1309 
    1310 #if H_MV5
     962  return;
     963}
     964
    1311965#if H_MV
    1312966Void TDecCavlc::parseVPSExtension( TComVPS* pcVPS )
     
    16401294        }
    16411295#endif
    1642 #if LGE_INTER_SDC_E0156
     1296#if H_3D_INTER_SDC
    16431297            READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
    16441298#endif
     
    16481302  READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false );
    16491303}
    1650 #endif
    16511304#endif
    16521305
     
    16801333#if H_MV
    16811334  vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId());
    1682 #if H_MV5
    16831335  assert( vps != NULL );
    16841336 
     
    16921344  rpcSlice->setIsDepth  ( vps->getDepthId  ( rpcSlice->getLayerId() ) == 1 );
    16931345#endif
    1694 #else
    1695   assert(vps!=0);
    1696   rpcSlice->setVPS(vps);     
    1697   rpcSlice->setViewId   ( vps->getViewId   ( rpcSlice->getLayerIdInVps() )      );
    1698 #if H_3D 
    1699   rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerIdInVps() )      ); 
    1700   rpcSlice->setIsDepth  ( vps->getDepthId  ( rpcSlice->getLayerIdInVps() ) == 1 );
    1701 #endif
    1702 #endif
    17031346#endif
    17041347  rpcSlice->setSPS(sps);
     
    17471390  {
    17481391#if H_MV   
    1749 #if H_MV5
    17501392    Int esb = 0; //Don't use i, otherwise will shadow something below
    17511393    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     
    17621404
    17631405    for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)   
    1764 #else
    1765     if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
    1766     {
    1767       READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 );
    1768     }
    1769 
    1770     for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)   
    1771 #endif
    17721406#else
    17731407    for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     
    18081442      READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); 
    18091443      Int iPOClsb = uiCode;
    1810       Int iPrevPOC = rpcSlice->getPrevPOC();
     1444      Int iPrevPOC = rpcSlice->getPrevTid0POC();
    18111445      Int iMaxPOClsb = 1<< sps->getBitsForPOC();
    1812       Int iPrevPOClsb = iPrevPOC%iMaxPOClsb;
     1446      Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1);
    18131447      Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb;
    18141448      Int iPOCmsb;
     
    18331467      }
    18341468      rpcSlice->setPOC              (iPOCmsb+iPOClsb);
    1835 #if H_MV5
    18361469#if H_MV
    18371470      if ( rpcSlice->getPocResetFlag() ) 
     
    18411474
    18421475      }     
    1843 #endif
    18441476#endif
    18451477      TComReferencePictureSet* rps;
     
    19411573            rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt);
    19421574            rps->setCheckLTMSBPresent(j,false); 
     1575           
     1576            // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present
     1577            if( j == offset+(numOfLtrp-numLtrpInSPS)-1 )
     1578            {
     1579              deltaPocMSBCycleLT = 0;
     1580            }
    19431581          }
    19441582          prevDeltaMSB = deltaPocMSBCycleLT;
     
    19701608    }
    19711609#if H_MV
    1972 #if H_MV5
    19731610    Int layerId       = rpcSlice->getLayerId();
    19741611    if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )    {   
     
    19891626      } 
    19901627    }
    1991 #else
    1992     Int layerIdInVps       = rpcSlice->getLayerIdInVps();
    1993     if( rpcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )
    1994     {   
    1995       READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 );
    1996       if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerIdInVps ) > 1 )
    1997       {           
    1998         if( !vps->getMaxOneActiveRefLayerFlag()) 
    1999         {
    2000           READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode );
    2001         }
    2002         for( Int i = 0; i < rpcSlice->getNumActiveRefLayerPics(); i++ )   
    2003         {
    2004           READ_CODE( rpcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); rpcSlice->setInterLayerPredLayerIdc( i, uiCode );
    2005         }
    2006       } 
    2007     }
    2008 
    2009     rpcSlice->setActiveMotionPredRefLayers( );
    2010 
    2011     if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0  &&  rpcSlice->getNumActiveRefLayerPics() > 0 )
    2012     {
    2013       READ_FLAG( uiCode, "inter_layer_sample_pred_only_flag" ); rpcSlice->setInterLayerSamplePredOnlyFlag( uiCode == 1 );
    2014     }
    2015 #endif
    20161628#endif
    20171629    if(sps->getUseSAO())
     
    21551767    if ( rpcSlice->getEnableTMVPFlag() )
    21561768    {
    2157 #if !H_MV5
    2158 #if H_MV
    2159       if( rpcSlice->getLayerId() > 0 && rpcSlice->getNumActiveMotionPredRefLayers() > 0 )
    2160       {
    2161         READ_FLAG( uiCode, "alt_collocated_indication_flag" ); rpcSlice->setAltCollocatedIndicationFlag( uiCode == 1 );
    2162       }
    2163 
    2164       if( rpcSlice->getAltCollocatedIndicationFlag() && rpcSlice->getNumActiveMotionPredRefLayers() > 1 )
    2165       {         
    2166         READ_UVLC( uiCode, "collocated_ref_layer_idx" ); rpcSlice->setCollocatedRefLayerIdx( uiCode );
    2167       }     
    2168       else
    2169       {
    2170 #endif
    2171 #endif
    21721769      if ( rpcSlice->getSliceType() == B_SLICE )
    21731770      {
     
    21911788        rpcSlice->setColRefIdx(0);
    21921789      }
    2193 #if !H_MV5
    2194 #if H_MV
    2195       }
    2196 #endif
    2197 #endif
    21981790    }
    21991791    if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) )
     
    26512243}
    26522244#endif
    2653 #if LGE_INTER_SDC_E0156
     2245#if H_3D_INTER_SDC
    26542246Void TDecCavlc::parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    26552247{
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r622 r655  
    7676  Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
    7777  Void  parseVPS            ( TComVPS* pcVPS );
    78 #if H_MV5
    7978#if H_MV
    8079  Void  parseVPSExtension   ( TComVPS* pcVPS );
     
    8685  Void  parseSPSExtension   ( TComSPS* pcSPS ); 
    8786#endif
    88 #endif
    8987#if H_3D
    90 #if H_MV5
    9188  Void  parseVPSExtension2  ( TComVPS* pcVPS );
    9289  Void  parseSPSExtension2  ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
    93 #endif
    9490  Void  parseSPS            ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
    9591#else
     
    117113  Void  parseICFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    118114#endif
    119 #if LGE_INTER_SDC_E0156
     115#if H_3D_INTER_SDC
    120116  Void  parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    121117  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r622 r655  
    458458  m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth ); 
    459459#endif 
    460 #if LGE_INTER_SDC_E0156
     460#if H_3D_INTER_SDC
    461461  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
    462462#endif
     
    525525  {
    526526    case MODE_INTER:
    527 #if LGE_INTER_SDC_E0156
     527#if H_3D_INTER_SDC
    528528      if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) )
    529529      {
     
    534534#endif
    535535      xReconInter( m_ppcCU[uiDepth], uiDepth );
    536 #if LGE_INTER_SDC_E0156
     536#if H_3D_INTER_SDC
    537537      }
    538538#endif
     
    578578}
    579579
    580 #if LGE_INTER_SDC_E0156
     580#if H_3D_INTER_SDC
    581581Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    582582{
     
    895895  // get DC prediction for each segment
    896896  Pel apDCPredValues[2];
    897 #if KWU_SDC_SIMPLE_DC_E0117
    898897  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);
    899 #else
    900   m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride);
    901 #endif
    902898 
    903899  // reconstruct residual based on mask + DC residuals
  • trunk/source/Lib/TLibDecoder/TDecCu.h

    r608 r655  
    118118  Void xReconIntraSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    119119#endif
    120 #if LGE_INTER_SDC_E0156
     120#if H_3D_INTER_SDC
    121121  Void xReconInterSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    122122#endif
  • trunk/source/Lib/TLibDecoder/TDecEntropy.cpp

    r622 r655  
    650650#endif
    651651 
    652 #if LGE_INTER_SDC_E0156
     652#if H_3D_INTER_SDC
    653653  if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
    654654  {
     
    683683}
    684684
    685 #if LGE_INTER_SDC_E0156
     685#if H_3D_INTER_SDC
    686686Void TDecEntropy::decodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    687687{
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r608 r655  
    9191  virtual Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9292#endif
    93 #if LGE_INTER_SDC_E0156
     93#if H_3D_INTER_SDC
    9494  virtual Void parseInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9595  virtual Void parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0;
     
    170170  Void decodeICFlag            ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    171171#endif
    172 #if LGE_INTER_SDC_E0156
     172#if H_3D_INTER_SDC
    173173  Void decodeInterSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    174174  Void decodeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
  • trunk/source/Lib/TLibDecoder/TDecGop.cpp

    r608 r655  
    158158    rpcPic->setNumDdvCandPics(rpcPic->getDisCandRefPictures(iColPoc));
    159159  }
    160 #endif
    161 #if MTK_NBDV_TN_FIX_E0172
     160
    162161  if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
    163162  {
    164163    rpcPic->checkTemporalIVRef();
    165164  }
    166 #endif
    167 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
     165
    168166  if(pcSlice->getIsDepth())
    169167  {
     
    226224    rpcPic->destroyNonDBFilterInfo();
    227225  }
    228 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     226#if H_3D
    229227  rpcPic->compressMotion(2);
    230228#endif
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r622 r655  
    8989#if H_3D_DIM_DMM
    9090, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    91 #if !SEC_DMM2_E0146_HHIFIX
    92 , m_cDmm2DataSCModel          ( 1,             1,               NUM_DMM2_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    93 #endif
    9491, m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    9592#endif
     
    10299#endif
    103100#endif
    104 #if LGE_INTER_SDC_E0156
     101#if H_3D_INTER_SDC
    105102, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    106103, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
     
    179176#if H_3D_DIM_DMM
    180177  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
    181 #if !SEC_DMM2_E0146_HHIFIX
    182   m_cDmm2DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM2_DATA );
    183 #endif
    184178  m_cDmm3DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM3_DATA );
    185179#endif
     
    192186#endif
    193187#endif
    194 #if LGE_INTER_SDC_E0156
     188#if H_3D_INTER_SDC
    195189  m_cInterSDCFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    196190  m_cInterSDCResidualSCModel.initBuffer   ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     
    255249#if H_3D_DIM_DMM
    256250  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
    257 #if !SEC_DMM2_E0146_HHIFIX
    258   m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
    259 #endif
    260251  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
    261252#endif
     
    268259#endif
    269260#endif
    270 #if LGE_INTER_SDC_E0156
     261#if H_3D_INTER_SDC
    271262  m_cInterSDCFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    272263  m_cInterSDCResidualSCModel.initBuffer   ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     
    444435  ruiTabIdx = uiIdx;
    445436}
    446 #if !SEC_DMM2_E0146_HHIFIX
    447 Void TDecSbac::xParseDmm2Offset( Int& riOffset )
    448 {
    449   Int iDeltaEnd = 0;
    450   if( DMM2_DELTAEND_MAX > 0 )
    451   {
    452     UInt uiFlag = 0;
    453     m_pcTDecBinIf->decodeBin( uiFlag, m_cDmm2DataSCModel.get(0, 0, 0) );
    454 
    455     if( uiFlag )
    456     {
    457       UInt uiAbsValMinus1;
    458       UInt uiSymbol;
    459       m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1  = uiSymbol;
    460       m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1 |= uiSymbol << 1;
    461       iDeltaEnd = uiAbsValMinus1 + 1;
    462       UInt uiSign;
    463       m_pcTDecBinIf->decodeBinEP( uiSign );
    464       if( uiSign )
    465       {
    466         iDeltaEnd = -iDeltaEnd;
    467       }
    468     }
    469   }
    470   riOffset = iDeltaEnd;
    471 }
    472 #endif
     437
    473438Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit )
    474439{
     
    11751140      pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
    11761141    } break;
    1177 #if !SEC_DMM2_E0146_HHIFIX
    1178   case( DMM2_IDX ):
    1179     {
    1180       Int iOffset = 0;
    1181       xParseDmm2Offset( iOffset );
    1182       pcCU->setDmm2DeltaEndSubParts( iOffset, absPartIdx, depth );
    1183     } break;
    1184 #endif
    11851142  case( DMM3_IDX ):
    11861143    {
     
    12501207  if( puIdx == 2 )
    12511208  {
    1252 #if !LGE_SDC_REMOVE_DC_E0158
    1253     while( binNum < 2 && symbol )
    1254 #endif
    12551209    {
    12561210      ctxDepthMode = puIdx*3 + binNum;
     
    12601214    }
    12611215         if( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;}
    1262 #if LGE_SDC_REMOVE_DC_E0158
    12631216    else if( modeCode == 1 ) { dir = 0;          sdcFlag = 0;}
    1264 #else
    1265     else if( modeCode == 2 ) { dir = 0;          sdcFlag = 0;}
    1266     else if( modeCode == 3 ) { dir =     DC_IDX; sdcFlag = 1;}
    1267 #endif
    12681217  }
    12691218  else if( puIdx == 0 )
     
    12831232  else
    12841233  {
    1285 #if ZJU_DEPTH_INTRA_MODE_E0204
    1286       UInt maxBinNum = 0;
    1287       m_pcTDecBinIf->decodeBinEP(symbol);
    1288       if( symbol == 1 )
    1289       {
    1290           maxBinNum = 3;
    1291       }
    1292       else
    1293       {
    1294           maxBinNum = 2;
    1295           symbol = 1;
    1296       }
    1297       while( binNum<maxBinNum && symbol )
    1298       {
    1299           ctxDepthMode = puIdx*3 + ( binNum >= 2 ? 2 : binNum );
    1300           m_pcTDecBinIf->decodeBin(symbol,m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode));
    1301           modeCode = (modeCode<<1)+symbol;
    1302           binNum++;
    1303       }
    1304       if( maxBinNum == 3 )
    1305       {
    1306           if ( modeCode == 0 )       { dir =  PLANAR_IDX;             sdcFlag = 1;}
    1307           else if ( modeCode == 2 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    1308           else if ( modeCode == 6 )  { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
    1309           else if ( modeCode == 7 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
    1310       }
    1311       else
    1312       {
    1313           if ( modeCode == 0 )       { dir = 5;                       sdcFlag = 0;}
    1314           else if ( modeCode == 2 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
    1315           else if ( modeCode == 3 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
    1316       }
    1317 #else
    1318     ctxDepthMode = puIdx*3 ;
    1319     m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
    1320     modeCode = (modeCode<<1) + symbol;
    1321     if( !symbol )
    1322     {
    1323       ctxDepthMode = puIdx*3 + 1;
    1324       m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
    1325       modeCode = (modeCode<<1) + symbol;
    1326       if( symbol )
    1327       {
    1328         ctxDepthMode = puIdx*3 + 2;
    1329         m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
    1330         modeCode = (modeCode<<1) + symbol;
    1331       }
     1234    UInt maxBinNum = 0;
     1235    m_pcTDecBinIf->decodeBinEP(symbol);
     1236    if( symbol == 1 )
     1237    {
     1238      maxBinNum = 3;
    13321239    }
    13331240    else
    13341241    {
    1335       ctxDepthMode = puIdx*3 + 1;
    1336       m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
    1337       modeCode = (modeCode<<1) + symbol;
    1338       if( !symbol )
    1339       {
    1340         ctxDepthMode = puIdx*3 + 2;
    1341         m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
    1342         modeCode = (modeCode<<1) + symbol;
    1343       }
    1344       else
    1345       {
    1346         binNum = 0;
    1347 #if LGE_SDC_REMOVE_DC_E0158
    1348 #if !SEC_DMM2_E0146_HHIFIX
    1349         while( symbol && binNum < 2 )
    1350 #endif
    1351 #else
    1352 #if SEC_DMM2_E0146_HHIFIX
    1353         while( symbol && binNum < 2 )
    1354 #else
    1355         while( symbol && binNum < 3 )
    1356 #endif
    1357 #endif
    1358         {
    1359           ctxDepthMode = puIdx*3 + 2;
    1360           m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
    1361           modeCode = (modeCode<<1) + symbol;
    1362           binNum++;
    1363         }
    1364       }
    1365     }
    1366          if( modeCode == 0  ) { dir =  PLANAR_IDX;             sdcFlag = 1;}
    1367     else if( modeCode == 2  ) { dir = 5;                       sdcFlag = 0;}
    1368     else if( modeCode == 3  ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
    1369     else if( modeCode == 4  ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
    1370     else if( modeCode == 5  ) { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
    1371     else if( modeCode == 6  ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
    1372 #if LGE_SDC_REMOVE_DC_E0158
    1373 #if SEC_DMM2_E0146_HHIFIX
    1374     else if( modeCode == 7 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    1375 #else
    1376     else if( modeCode == 14 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    1377     else if( modeCode == 15 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;}
    1378 #endif
    1379 #else
    1380     else if( modeCode == 14 ) { dir =      DC_IDX;             sdcFlag = 1;}
    1381 #if SEC_DMM2_E0146_HHIFIX
    1382     else if( modeCode == 15 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    1383 #else
    1384     else if( modeCode == 30 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    1385     else if( modeCode == 31 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;}
    1386 #endif
    1387 #endif
    1388 #endif
     1242      maxBinNum = 2;
     1243      symbol = 1;
     1244    }
     1245    while( binNum<maxBinNum && symbol )
     1246    {
     1247      ctxDepthMode = puIdx*3 + ( binNum >= 2 ? 2 : binNum );
     1248      m_pcTDecBinIf->decodeBin(symbol,m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode));
     1249      modeCode = (modeCode<<1)+symbol;
     1250      binNum++;
     1251    }
     1252    if( maxBinNum == 3 )
     1253    {
     1254      if ( modeCode == 0 )       { dir =  PLANAR_IDX;             sdcFlag = 1;}
     1255      else if ( modeCode == 2 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
     1256      else if ( modeCode == 6 )  { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
     1257      else if ( modeCode == 7 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
     1258    }
     1259    else
     1260    {
     1261      if ( modeCode == 0 )       { dir = 5;                       sdcFlag = 0;}
     1262      else if ( modeCode == 2 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
     1263      else if ( modeCode == 3 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
     1264    }
    13891265  }
    13901266  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
     
    23382214#endif
    23392215
    2340 #if LGE_INTER_SDC_E0156
     2216#if H_3D_INTER_SDC
    23412217Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    23422218{
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r622 r655  
    102102#if H_3D_DIM_DMM
    103103  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
    104 #if !SEC_DMM2_E0146_HHIFIX
    105   Void  xParseDmm2Offset     ( Int& riOffset );
    106 #endif
    107104  Void  xParseDmm3WedgeIdx   ( UInt& ruiIntraIdx, Int iNumBit );
    108105#endif
     
    114111#endif
    115112#endif
    116 #if LGE_INTER_SDC_E0156
     113#if H_3D_INTER_SDC
    117114  Void  parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    118115  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
     
    216213#if H_3D_DIM_DMM
    217214  ContextModel3DBuffer m_cDmm1DataSCModel;
    218 #if !SEC_DMM2_E0146_HHIFIX
    219   ContextModel3DBuffer m_cDmm2DataSCModel;
    220 #endif
    221215  ContextModel3DBuffer m_cDmm3DataSCModel;
    222216#endif
     
    229223#endif
    230224#endif
    231 #if LGE_INTER_SDC_E0156
     225#if H_3D_INTER_SDC
    232226  ContextModel3DBuffer m_cInterSDCFlagSCModel;
    233227  ContextModel3DBuffer m_cInterSDCResidualSCModel;
  • trunk/source/Lib/TLibDecoder/TDecSlice.h

    r608 r655  
    6565  TDecEntropy*    m_pcEntropyDecoder;
    6666  TDecCu*         m_pcCuDecoder;
    67   UInt            m_uiCurrSliceIdx;
    6867
    6968  TDecSbac*       m_pcBufferSbacDecoders;   ///< line to store temporary contexts, one per column of tiles.
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r622 r655  
    347347#endif
    348348#endif
     349  m_associatedIRAPType = NAL_UNIT_INVALID;
    349350  m_pocCRA = 0;
    350   m_prevRAPisBLA = false;
    351351  m_pocRandomAccess = MAX_INT; 
    352352  m_prevPOC                = MAX_INT;
    353353  m_bFirstSliceInPicture    = true;
    354354  m_bFirstSliceInSequence   = true;
     355  m_prevSliceSkipped = false;
     356  m_skippedPOC = 0;
    355357#if H_MV
    356358  m_layerId = 0;
     
    436438  Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window();
    437439
    438 #if H_MV5
    439440#if H_MV
    440441    assert( conformanceWindow   .getScaledFlag() );
    441442    assert( defaultDisplayWindow.getScaledFlag() );
    442 #endif
    443443#endif
    444444  for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++)
     
    518518  m_cCuDecoder.destroy();       
    519519#if H_MV
    520 #if H_MV5
    521520  TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 
    522 #else
    523   TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
    524 #endif
    525521  TComSlice::markCurrPic( pcPic );
    526522  TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc );
     
    591587  assert (sps != 0);
    592588
    593 #if H_MV5
    594589#if H_MV
    595590  TComVPS* vps = m_parameterSetManagerDecoder.getVPS(sps->getVPSId());
     
    599594  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    600595#endif
    601 #else
    602   if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    603 #endif
    604596  {
    605597    printf ("Parameter set activation failed!");
     
    627619  m_apcSlicePilot->setSPS(sps);
    628620#if H_MV
    629 #if H_MV5
    630621  m_apcSlicePilot->setVPS(vps); 
    631622  sps->inferRepFormat  ( vps , m_layerId );
    632623  sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) );
    633 #else
    634   m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() );
    635 #endif
    636624#endif
    637625  pps->setSPS(sps);
     
    695683
    696684#if H_MV
    697 #if H_MV5
    698685  m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer0, &m_refPicSetInterLayer1 );
    699 #else
    700   m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer );
    701 #endif
    702686  m_apcSlicePilot->setLayerId( nalu.m_layerId );
    703687#endif
    704688  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
     689
     690  // set POC for dependent slices in skipped pictures
     691  if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped)
     692  {
     693    m_apcSlicePilot->setPOC(m_skippedPOC);
     694  }
     695
     696  m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA);
     697  m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType);
    705698
    706699#if H_MV 
    707700  TComVPS* vps     = m_apcSlicePilot->getVPS();
    708 #if H_MV5
    709701  Int layerId  = nalu.m_layerId;   
    710702  setViewId   ( vps->getViewId   ( layerId )      ); 
     
    714706  m_ivPicLists->setVPS( vps );
    715707#endif
    716 #else
    717   Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 
    718   setViewId   ( vps->getViewId   ( layerIdInVps )      ); 
    719 #if H_3D
    720   setViewIndex( vps->getViewIndex( layerIdInVps )      ); 
    721   setIsDepth  ( vps->getDepthId  ( layerIdInVps ) == 1 ); 
    722   m_ivPicLists->setVPS( vps );
    723 #endif
    724 #endif
    725708#endif
    726709    // Skip pictures due to random access
    727710    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
    728711    {
     712    m_prevSliceSkipped = true;
     713    m_skippedPOC = m_apcSlicePilot->getPOC();
    729714      return false;
    730715    }
     
    732717    if (isSkipPictureForBLA(iPOCLastDisplay))
    733718    {
     719    m_prevSliceSkipped = true;
     720    m_skippedPOC = m_apcSlicePilot->getPOC();
    734721      return false;
    735722    }
     723
     724  // clear previous slice skipped flag
     725  m_prevSliceSkipped = false;
    736726
    737727  //we should only get a different poc for a new picture (with CTU address==0)
     
    763753#endif
    764754  // actual decoding starts here
    765 #if H_MV5
    766755#if H_MV
    767756   // This part needs further testing !
     
    771760   }
    772761#endif
    773 #endif
    774762  xActivateParameterSets();
    775763
     
    791779    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    792780#if H_MV
    793 #if H_MV5
    794781    m_apcSlicePilot->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 );
    795 #else
    796     m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
    797 #endif
    798782#endif
    799783    //  Get a new picture buffer
    800784    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
    801785
     786    Bool isField = false;
     787    Bool isTff = false;
     788   
     789    if(!m_SEIs.empty())
     790    {
     791      // Check if any new Picture Timing SEI has arrived
     792      SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING);
     793      if (pictureTimingSEIs.size()>0)
     794      {
     795        SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin());
     796        isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2);
     797        isTff =  (pictureTiming->m_picStruct == 1);
     798      }
     799    }
     800   
     801    //Set Field/Frame coding mode
     802    m_pcPic->setField(isField);
     803    m_pcPic->setTopField(isTff);
     804   
    802805    // transfer any SEI messages that have been received to the picture
    803806    pcPic->setSEIs(m_SEIs);
     
    938941  if (bNextSlice)
    939942  {
    940     pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic );
     943    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic );
    941944    // Set reference list
    942945#if H_MV   
    943 #if H_MV5
    944946    std::vector< TComPic* > tempRefPicLists[2];
    945947    std::vector< Bool     > usedAsLongTerm [2];
     
    948950    pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr);
    949951    pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true );
    950 #else
    951     pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true );   
    952 #endif
    953952#if H_3D_ARP
    954953    pcSlice->setARPStepNum();
     
    978977#if H_3D
    979978    pcSlice->setIvPicLists( m_ivPicLists );         
    980 #if H_3D_IV_MERGE   
     979#if H_3D_IV_MERGE
     980#if H_3D_FCO
     981    //assert( !getIsDepth() );
     982#else
    981983    assert( !getIsDepth() || ( pcSlice->getTexturePic() != 0 ) );
     984#endif
    982985#endif   
    983986#endif
     
    10371040      pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList()  );
    10381041    }
    1039     pcSlice->getScalingList()->setUseTransformSkip(pcSlice->getPPS()->getUseTransformSkip());
    10401042    if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag())
    10411043    {
     
    10841086  TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
    10851087  assert( vps != 0 );
    1086 #if H_MV5
    10871088  m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( m_layerId ), ( vps->getDepthId( m_layerId ) == 1 ) );
    10881089#else
    1089   Int layerIdInVPS = vps->getLayerIdInVps( m_layerId );
    1090   m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( layerIdInVPS ), ( vps->getDepthId( layerIdInVPS ) == 1 ) );
    1091 #endif
    1092 #else
    10931090  m_cEntropyDecoder.decodeSPS( sps );
    10941091#endif
     
    10991096{
    11001097  TComPPS* pps = new TComPPS();
    1101 #if H_MV5
    11021098#if H_MV
    11031099  pps->setLayerId( getLayerId() );
    1104 #endif
    11051100#endif
    11061101  m_cEntropyDecoder.decodePPS( pps );
     
    11121107  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    11131108  {
    1114 #if H_MV5
    11151109#if H_MV
    11161110    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) );
     
    11181112    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
    11191113#endif
    1120 #else
    1121     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 
    1122 #endif
    11231114  }
    11241115  else
    11251116  {
    1126 #if H_MV5
    11271117#if H_MV
    11281118    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) );
     
    11301120    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
    11311121#endif
    1132 #else
    1133     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
    1134 #endif
    11351122    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
    11361123    if (activeParamSets.size()>0)
     
    11391126      m_parameterSetManagerDecoder.applyPrefetchedPS();
    11401127      assert(seiAps->activeSeqParamSetId.size()>0);
    1141 #if H_MV5
    11421128#if H_MV
    11431129      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0], m_layerId ))
    1144 #else
    1145       if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
    1146 #endif
    11471130#else
    11481131      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
     
    12211204Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay)
    12221205{
    1223   if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     1206  if ((m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL) &&
     1207       m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    12241208  {
    12251209    iPOCLastDisplay++;
     
    13061290}
    13071291
    1308 #if H_MV5
    13091292Void TDecTop::xResetPocInPicBuffer()
    13101293{
     
    13241307}
    13251308#endif
    1326 #endif
    13271309//! \}
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r622 r655  
    176176  Int                     m_iMaxRefPicNum;
    177177 
     178  NalUnitType             m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture
    178179  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
    179   Bool                    m_prevRAPisBLA;      ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture
    180180  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
    181181
     
    211211  Bool                    m_bFirstSliceInPicture;
    212212  Bool                    m_bFirstSliceInSequence;
     213  Bool                    m_prevSliceSkipped;
     214  Int                     m_skippedPOC;
     215
    213216#if H_MV
    214217  // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer 
     
    216219  Int                     m_viewId;
    217220  TComPicLists*           m_ivPicLists;
    218 #if H_MV5
    219221  std::vector<TComPic*>   m_refPicSetInterLayer0;
    220222  std::vector<TComPic*>   m_refPicSetInterLayer1;
    221 #else
    222   std::vector<TComPic*>   m_refPicSetInterLayer;
    223 #endif
    224223#if H_3D
    225224  Int                     m_viewIndex;
     
    279278  TComPic*  xGetPic( Int layerId, Int poc );
    280279  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); 
    281 #if H_MV5
    282280  Void      xResetPocInPicBuffer();
    283 #endif
    284281#else
    285282  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
  • trunk/source/Lib/TLibEncoder/TEncAnalyze.cpp

    r608 r655  
    5252TEncAnalyze             m_gcAnalyzeP;
    5353TEncAnalyze             m_gcAnalyzeB;
     54
     55TEncAnalyze             m_gcAnalyzeAll_in;
    5456#endif
    5557
  • trunk/source/Lib/TLibEncoder/TEncAnalyze.h

    r608 r655  
    116116  }
    117117 
     118  Void    printOutInterlaced ( Char cDelim, Double bits )
     119  {
     120    Double dFps     =   m_dFrmRate; //--CFG_KDY
     121    Double dScale   = dFps / 1000 / (Double)m_uiNumPic;
     122   
     123    printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
     124    //printf( "\t------------ "  " ----------"   " -------- "  " -------- "  " --------\n" );
     125    printf( "\t %8d    %c"          "%12.4lf  "    "%8.4lf  "   "%8.4lf  "    "%8.4lf\n",
     126           getNumPic(), cDelim,
     127           bits * dScale,
     128           getPsnrY() / (Double)getNumPic(),
     129           getPsnrU() / (Double)getNumPic(),
     130           getPsnrV() / (Double)getNumPic() );
     131  }
     132 
     133  Void    printSummaryOutInterlaced (Int bits)
     134  {
     135    FILE* pFile = fopen ("summaryTotal.txt", "at");
     136    Double dFps     =   m_dFrmRate; //--CFG_KDY
     137    Double dScale   = dFps / 1000 / (Double)m_uiNumPic;
     138   
     139    fprintf(pFile, "%f\t %f\t %f\t %f\n", bits * dScale,
     140            getPsnrY() / (Double)getNumPic(),
     141            getPsnrU() / (Double)getNumPic(),
     142            getPsnrV() / (Double)getNumPic() );
     143    fclose(pFile);
     144  }
     145 
     146 
    118147  Void    printSummary(Char ch)
    119148  {
     
    155184extern TEncAnalyze             m_gcAnalyzeP;
    156185extern TEncAnalyze             m_gcAnalyzeB;
     186
     187extern TEncAnalyze             m_gcAnalyzeAll_in;
    157188#endif
    158189
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r622 r655  
    229229    }
    230230  }
    231 #if H_MV5
    232231#if H_MV
    233232  if ( pcPPS->getLayerId() > 0 )
     
    243242  { 
    244243#endif 
    245 #endif
    246244  WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0,                          "pps_scaling_list_data_present_flag" );
    247245  if( pcPPS->getScalingListPresentFlag() )
     
    252250    codeScalingList( m_pcSlice->getScalingList() );
    253251  }
    254 #if H_MV5
    255252#if H_MV
    256253  }
    257 #endif
    258254#endif
    259255  WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
     
    339335  {
    340336    WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(),             "tiles_fixed_structure_flag");
    341 #if !H_MV5
    342 #if H_MV
    343     if ( pcSPS->getLayerId() > 0 )
    344     {
    345       WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
    346     }
    347 #endif
    348 #endif
    349337    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
    350338    WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
     
    451439#endif
    452440  WRITE_UVLC( pcSPS->getSPSId (),                   "sps_seq_parameter_set_id" );
    453 #if H_MV5
    454441#if H_MV
    455442  if ( pcSPS->getLayerId() > 0 )
     
    460447  if ( pcSPS->getUpdateRepFormatFlag() )
    461448  {
    462 #endif
    463449#endif
    464450  WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
     
    472458  WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
    473459  WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
    474 #if H_MV5
    475460#if H_MV
    476461  }
    477 #endif
    478462#endif
    479463  Window conf = pcSPS->getConformanceWindow();
     
    487471    WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" );
    488472  }
    489 #if H_MV5
    490473#if H_MV
    491474  if ( pcSPS->getUpdateRepFormatFlag() )
    492475  {
    493476#endif
    494 #endif
    495477  WRITE_UVLC( pcSPS->getBitDepthY() - 8,             "bit_depth_luma_minus8" );
    496478  WRITE_UVLC( pcSPS->getBitDepthC() - 8,             "bit_depth_chroma_minus8" );
    497 #if H_MV5
    498479#if H_MV
    499480  }
    500 #endif
    501481#endif
    502482  WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
     
    525505  if(pcSPS->getScalingListFlag())
    526506  {
    527 #if H_MV5
    528507#if H_MV
    529508    if ( pcSPS->getLayerId() > 0 )
     
    539518    {   
    540519#endif
    541 #endif
    542520    WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0,                          "sps_scaling_list_data_present_flag" );
    543521    if(pcSPS->getScalingListPresentFlag())
     
    548526      codeScalingList( m_pcSlice->getScalingList() );
    549527    }
    550 #if H_MV5
    551528#if H_MV
    552529    }
    553 #endif
    554530#endif
    555531  }
     
    598574  }
    599575
    600 #if !H_MV5
    601 #if H_MV
    602   WRITE_FLAG( 1, "sps_extension_flag" );
    603   WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
    604   ////   sps_extension_vui_parameters( )
    605   if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )
    606   { 
    607     WRITE_UVLC( pcSPS->getNumIlpRestrictedRefLayers( ),           "num_ilp_restricted_ref_layers" );
    608     for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ )
    609     { 
    610       WRITE_UVLC( pcSPS->getMinSpatialSegmentOffsetPlus1( i ),    "min_spatial_segment_offset_plus1" );
    611       if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 )
    612       { 
    613         WRITE_FLAG( pcSPS->getCtuBasedOffsetEnabledFlag( i ),      "ctu_based_offset_enabled_flag[ i ]");
    614         if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) ) 
    615         {
    616           WRITE_UVLC( pcSPS->getMinHorizontalCtuOffsetPlus1( i ), "min_horizontal_ctu_offset_plus1[ i ]");
    617         }
    618       } 
    619     } 
    620   }
    621 #if H_3D_QTLPC
    622   if( depthFlag )
    623   {
    624     WRITE_FLAG( pcSPS->getUseQTL() ? 1 : 0, "use_qtl_flag");
    625     WRITE_FLAG( pcSPS->getUsePC()  ? 1 : 0, "use_pc_flag");
    626   }
    627 #endif
    628   ////   sps_extension_vui_parameters( ) END
    629   WRITE_UVLC( 0, "sps_shvc_reserved_zero_idc" );
    630 #if !H_3D
    631   WRITE_FLAG( 0, "sps_extension2_flag" );
    632 #else
    633   WRITE_FLAG( 1, "sps_extension2_flag"  );
    634   if (!depthFlag )
    635   {
    636     WRITE_UVLC( pcSPS->getCamParPrecision(), "cp_precision" );
    637     WRITE_FLAG( pcSPS->hasCamParInSliceHeader() ? 1 : 0, "cp_in_slice_header_flag" );
    638     if( !pcSPS->hasCamParInSliceHeader() )
    639     {
    640       for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ )
    641       {
    642         WRITE_SVLC( pcSPS->getCodedScale    ()[ uiIndex ],                                      "cp_scale" );
    643         WRITE_SVLC( pcSPS->getCodedOffset   ()[ uiIndex ],                                      "cp_off" );
    644         WRITE_SVLC( pcSPS->getInvCodedScale ()[ uiIndex ] + pcSPS->getCodedScale ()[ uiIndex ], "cp_inv_scale_plus_scale" );
    645         WRITE_SVLC( pcSPS->getInvCodedOffset()[ uiIndex ] + pcSPS->getCodedOffset()[ uiIndex ], "cp_inv_off_plus_off" );
    646       }
    647     }
    648   }
    649 
    650   WRITE_FLAG( 0, "sps_extension3_flag" );
    651 #endif
    652 #else
    653   WRITE_FLAG( 0, "sps_extension_flag" );
    654 #endif
    655 }
    656 #else
    657576#if !H_MV
    658577  WRITE_FLAG( 0, "sps_extension_flag" );
     
    706625}
    707626#endif
    708 #endif
    709627
    710628Void TEncCavlc::codeVPS( TComVPS* pcVPS )
     
    713631  WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
    714632#if H_MV
    715 #if H_MV5
    716633  WRITE_CODE( pcVPS->getMaxLayersMinus1(),       6,        "vps_max_layers_minus1" );
    717 #else
    718   WRITE_CODE( pcVPS->getMaxLayers() - 1,            6,        "vps_max_layers_minus1" );
    719 #endif
    720634#else
    721635  WRITE_CODE( 0,                                    6,        "vps_reserved_zero_6bits" );
     
    800714    }
    801715  }
    802 #if !H_MV5
    803 #if H_MV
    804   WRITE_FLAG( 1,                                             "vps_extension_flag" );
    805 
    806   m_pcBitIf->writeAlignOne();                       
    807 
    808   WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0,          "avc_base_layer_flag" );
    809   WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0,             "splitting_flag" );
    810  
    811   for( Int type = 0; type < MAX_NUM_SCALABILITY_TYPES; type++ )
    812   {
    813     WRITE_FLAG( pcVPS->getScalabilityMask( type ) ? 1 : 0,   "scalability_mask[i]" );
    814   }
    815 
    816   for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )
    817   {
    818     WRITE_CODE( pcVPS->getDimensionIdLen( sIdx ) - 1 , 3,    "dimension_id_len_minus1[j]");   
    819   }
    820 
    821   if ( pcVPS->getSplittingFlag() )
    822   { // Ignore old dimension id length
    823     pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1 ,pcVPS->inferLastDimsionIdLenMinus1() + 1 );       
    824   }   
    825 
    826 
    827   WRITE_FLAG( pcVPS->getVpsNuhLayerIdPresentFlag() ? 1 : 0,  "vps_nuh_layer_id_present_flag");
    828 
    829   for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
    830   {
    831     if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( i > 0 ) )
    832     {     
    833       WRITE_CODE( pcVPS->getLayerIdInNuh( i ), 6,          "layer_id_in_nuh[i]");
    834   }
    835     else
    836     {
    837       assert( pcVPS->getLayerIdInNuh( i ) == i );
    838   }
    839 
    840     assert(  pcVPS->getLayerIdInVps( pcVPS->getLayerIdInNuh( i ) ) == i );
    841 
    842     for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ )
    843   {
    844       if ( !pcVPS->getSplittingFlag() )
    845     {
    846         WRITE_CODE( pcVPS->getDimensionId( i, j ), pcVPS->getDimensionIdLen( j ), "dimension_id[i][j]");     
    847       }
    848       else
    849       {
    850         assert( pcVPS->getDimensionId( i, j ) ==  pcVPS->inferDimensionId( i, j )  );
    851       }
    852     }
    853   }
    854 
    855   for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
    856   {
    857     for( Int j = 0; j < i; j++ )
    858     {
    859       WRITE_FLAG( pcVPS->getDirectDependencyFlag( i, j ),    "direct_dependency_flag[i][j]" );
    860     }
    861   }
    862 
    863   for( Int i = 0; i < pcVPS->getMaxLayers() - 1; i++ )
    864   {
    865     WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3,       "max_tid_il_ref_pics_plus1[i]" );
    866   }
    867 
    868   WRITE_CODE( pcVPS->getVpsNumberLayerSetsMinus1( )    , 10,    "vps_number_layer_sets_minus1"      );
    869   WRITE_CODE( pcVPS->getVpsNumProfileTierLevelMinus1( ), 6,     "vps_num_profile_tier_level_minus1" );
    870 
    871   for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
    872   {
    873     WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( i ) ? 1 : 0, "vps_profile_present_flag[i]" );
    874     if( !pcVPS->getVpsProfilePresentFlag( i ) )
    875     {   
    876       WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );
    877     }
    878     codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
    879   }
    880 
    881   Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1;
    882 
    883   WRITE_FLAG( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ? 1 : 0, "more_output_layer_sets_than_default_flag" );
    884 
    885   if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )
    886   {
    887     WRITE_CODE( pcVPS->getNumAddOutputLayerSetsMinus1( )    , 10,    "num_add_output_layer_sets_minus1"      );
    888     numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1 );
    889   }
    890 
    891   if( numOutputLayerSets > 1)
    892   {
    893     WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );
    894   } 
    895 
    896   for( Int i = 1; i < numOutputLayerSets; i++ )
    897   {
    898     if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )
    899     {     
    900       WRITE_UVLC( pcVPS->getOutputLayerSetIdxMinus1( i ),      "output_layer_set_idx_minus1[i]" );
    901       for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1 ; j++ )
    902       {
    903         WRITE_FLAG( pcVPS->getOutputLayerFlag( i, j) ? 1 : 0, "output_layer_flag" );
    904       }     
    905     }
    906     if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
    907     {     
    908       WRITE_CODE( pcVPS->getProfileLevelTierIdx( i ), pcVPS->getProfileLevelTierIdxLen() ,"profile_level_tier_idx[ i ]" );   
    909     }
    910   }
    911 
    912   WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
    913   WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ),         "direct_dep_type_len_minus2");
    914 
    915     for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
    916     {
    917       for( Int j = 0; j < i; j++ )
    918       {
    919         if (pcVPS->getDirectDependencyFlag( i, j) )
    920         {       
    921           assert ( pcVPS->getDirectDependencyType( i, j ) != -1 );
    922           WRITE_CODE( pcVPS->getDirectDependencyType( i, j ),pcVPS->getDirectDepTypeLenMinus2( ) + 2,  "direct_dependency_type[i][j]" );
    923         }
    924       }
    925     }
    926 
    927     WRITE_FLAG ( 0,                    "vps_shvc_reserved_zero_flag" );
    928 
    929 #if H_3D
    930   WRITE_FLAG( 1,                                             "vps_extension2_flag" );
    931   m_pcBitIf->writeAlignOne();     
    932   for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
    933   {
    934     if (i!= 0)
    935     {
    936       if ( !( pcVPS->getDepthId( i ) == 1 ) )
    937       {
    938 #if H_3D_IV_MERGE
    939         WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
    940 #endif
    941 #if H_3D_ARP
    942         WRITE_FLAG( pcVPS->getUseAdvRP             ( i ) ? 1 : 0,  "iv_res_pred_flag[i]"  );
    943 #endif
    944 #if H_3D_NBDV_REF
    945         WRITE_FLAG( pcVPS->getDepthRefinementFlag  ( i ) ? 1 : 0 , "depth_refinement_flag[i]");
    946 #endif
    947 #if H_3D_VSP
    948         WRITE_FLAG( pcVPS->getViewSynthesisPredFlag( i ) ? 1 : 0 , "view_synthesis_pred_flag[i]");
    949 #endif
    950       }         
    951       else
    952       {
    953         WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 ,          "vps_depth_modes_flag[i]" );
    954         //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     );
    955 #if H_3D_DIM_DLT
    956         if( pcVPS->getVpsDepthModesFlag( i ) )
    957         {
    958           WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );
    959         }
    960         if( pcVPS->getUseDLTFlag( i ) )
    961         {
    962           // code mapping
    963           WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_depth_values_in_dlt[i]");
    964           for(Int d=0; d<pcVPS->getNumDepthValues(i); d++)
    965           {
    966             WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" );
    967           }
    968         }       
    969 #endif
    970 #if LGE_INTER_SDC_E0156
    971         WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
    972 #endif
    973       }
    974     } 
    975   }
    976   WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
    977 #else
    978   WRITE_FLAG( 0,                                             "vps_extension2_flag" );
    979 #endif
    980 #else
    981   WRITE_FLAG( 0,                     "vps_extension_flag" );
    982 #endif
    983  
    984   //future extensions here..
    985  
    986   return;
    987 }
    988 #else
    989716#if H_MV
    990717  WRITE_FLAG( 1,                     "vps_extension_flag" );
     
    1003730#endif
    1004731  //future extensions here..
    1005 }
    1006 
    1007 #endif
    1008 
    1009 
    1010 #if H_MV5
     732
     733  return;
     734}
     735
     736
     737
    1011738#if H_MV
    1012739Void TEncCavlc::codeVPSExtension( TComVPS *pcVPS )
     
    13091036        }       
    13101037#endif
    1311 #if LGE_INTER_SDC_E0156
     1038#if H_3D_INTER_SDC
    13121039        WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
    13131040#endif
     
    13191046#endif
    13201047}
    1321 #endif
    13221048#endif
    13231049
     
    13701096  {
    13711097#if H_MV   
    1372 #if H_MV5
    13731098    Int esb = 0;  //Don't use i, otherwise will shadow something below
    13741099    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     
    13851110
    13861111    for (; esb < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)   
    1387 #else
    1388     if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
    1389     {
    1390       WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
    1391     }
    1392 
    1393     for (Int i = 1; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)   
    1394 #endif
    13951112#else
    13961113    for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     
    14151132    if( !pcSlice->getIdrPicFlag() )
    14161133    {
    1417       Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
     1134      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
    14181135      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
    14191136      TComReferencePictureSet* rps = pcSlice->getRPS();
     
    15301247    }
    15311248#if H_MV
    1532 #if H_MV5
    15331249    Int layerId = pcSlice->getLayerId();
    15341250    if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
     
    15501266      } 
    15511267    }
    1552 #else
    1553     Int layerIdInVps       = pcSlice->getLayerIdInVps();
    1554     if( pcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )
    1555     {   
    1556       WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" );
    1557       if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerIdInVps ) > 1 )
    1558       {           
    1559         if( !vps->getMaxOneActiveRefLayerFlag()) 
    1560         {
    1561           WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" );
    1562         }
    1563         for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )   
    1564         {
    1565           WRITE_CODE( pcSlice->getInterLayerPredLayerIdc( i ), pcSlice->getInterLayerPredLayerIdcLen( ), "inter_layer_pred_layer_idc" );
    1566         }
    1567       } 
    1568     }
    1569 
    1570     if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0  &&  pcSlice->getNumActiveRefLayerPics() > 0 )
    1571     {
    1572       WRITE_FLAG( pcSlice->getInterLayerSamplePredOnlyFlag( ) ? 1 : 0 , "inter_layer_sample_pred_only_flag" );
    1573     }
    1574 
    1575 #endif
    15761268#endif
    15771269    if(pcSlice->getSPS()->getUseSAO())
     
    16781370    if ( pcSlice->getEnableTMVPFlag() )
    16791371    {
    1680 #if !H_MV5
    1681 #if H_MV
    1682       if( pcSlice->getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 )
    1683       {
    1684         WRITE_FLAG( pcSlice->getAltCollocatedIndicationFlag( ) ? 1 : 0 , "alt_collocated_indication_flag" );
    1685       }
    1686       if( pcSlice->getAltCollocatedIndicationFlag() && pcSlice->getNumActiveMotionPredRefLayers() > 1 )
    1687       {         
    1688         WRITE_UVLC( pcSlice->getCollocatedRefLayerIdx( ), "collocated_ref_layer_idx" );
    1689       }     
    1690       else
    1691       {
    1692 #endif
    1693 #endif
    16941372      if ( pcSlice->getSliceType() == B_SLICE )
    16951373      {
     
    17041382      }
    17051383    }
    1706 #if !H_MV5
    1707 #if H_MV
    1708     }
    1709 #endif
    1710 #endif
    17111384    if ( (pcSlice->getPPS()->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pcSlice->getPPS()->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) )
    17121385    {
     
    22561929{
    22571930  // Bool state = true, state2 = false;
    2258   Int lsb = ltrpPOC % (1<<pcSlice->getSPS()->getBitsForPOC());
     1931  Int lsb = ltrpPOC & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
    22591932  for (Int k = 0; k < pcSlice->getSPS()->getNumLongTermRefPicSPS(); k++)
    22601933  {
     
    22821955}
    22831956
    2284 #if LGE_INTER_SDC_E0156
     1957#if H_3D_INTER_SDC
    22851958Void TEncCavlc::codeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    22861959{
  • trunk/source/Lib/TLibEncoder/TEncCavlc.h

    r622 r655  
    8484  UInt  getCoeffCost          ()                { return  m_uiCoeffCost;  }
    8585  Void  codeVPS                 ( TComVPS* pcVPS );
    86 #if H_MV5
    8786#if H_MV
    8887  Void  codeVPSExtension       ( TComVPS *pcVPS );
     
    9089  Void  codeVPSVUI             ( TComVPS* pcVPS );
    9190#endif
    92 #endif
    9391  Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
    94 #if H_MV5
    9592#if H_MV
    9693  Void  codeSPSExtension        ( TComSPS* pcSPS );
    9794#endif
    98 #endif
    9995#if H_3D
    100 #if H_MV5
    10196  Void  codeVPSExtension2       ( TComVPS* pcVPS );
    10297  Void  codeSPSExtension2       ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag  );
    103 #endif
    10498  Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
    10599#else
     
    133127  Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    134128#endif
    135 #if LGE_INTER_SDC_E0156
     129#if H_3D_INTER_SDC
    136130  Void codeInterSDCFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    137131  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r622 r655  
    7777  Int m_interLayerPredLayerIdc [MAX_NUM_REF_PICS];
    7878  Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 
    79 #if !H_MV5
    80   Int m_collocatedRefLayerIdx;
    81 #endif
    8279#endif
    8380  GOPEntry()
     
    9794#if H_MV
    9895  , m_numActiveRefLayerPics(0)
    99 #if !H_MV5
    100   , m_collocatedRefLayerIdx(-1)
    101 #endif
    10296#endif
    10397  {
     
    310304  Int       m_RCInitialQP;
    311305  Bool      m_RCForceIntraQP;
     306
     307#if KWU_RC_MADPRED_E0227
     308  UInt       m_depthMADPred;
     309#endif
     310#if KWU_RC_VIEWRC_E0227
     311  Bool      m_bViewWiseRateCtrl;
     312#endif
    312313#else
    313314  Bool      m_enableRateCtrl;                                ///< Flag for using rate control algorithm
    314315  Int       m_targetBitrate;                                 ///< target bitrate
    315316  Int       m_numLCUInUnit;                                  ///< Total number of LCUs in a frame should be divided by the NumLCUInUnit
     317
     318#if KWU_RC_MADPRED_E0227
     319  UInt       m_depthMADPred;
     320#endif
     321#if KWU_RC_VIEWRC_E0227
     322  Bool      m_bViewWiseRateCtrl;
     323#endif
    316324#endif
    317325  Bool      m_TransquantBypassEnableFlag;                     ///< transquant_bypass_enable_flag setting in PPS.
     
    361369  Int       m_layerIdInVps;
    362370  Int       m_viewId;
    363 #if H_MV5
    364371  Int       m_viewIndex;
    365 #endif
    366372#endif
    367373
    368374#if H_3D
    369 #if !H_MV5
    370   Int       m_viewIndex;
    371 #endif
    372375  Bool      m_isDepth;
    373376
     
    403406  Bool      m_bUseIC;
    404407#endif
    405 #if LGE_INTER_SDC_E0156
     408#if H_3D_INTER_SDC
    406409  bool      m_bInterSDC;
    407410#endif
     
    426429  , m_layerIdInVps(-1)
    427430  , m_viewId(-1)
    428 #if H_MV5
    429431  , m_viewIndex(-1)
    430 #endif
    431432#if H_3D
    432 #if !H_MV5
    433   , m_viewIndex(-1)
    434 #endif
    435433  , m_isDepth(false)
    436434  , m_bUseVSO(false)
     
    465463  Void      setViewId                        ( Int viewId  )      { m_viewId  = viewId;  }
    466464  Int       getViewId                        ()                   { return m_viewId;    }
    467 #if H_MV5
    468465  Void      setViewIndex                     ( Int viewIndex  )   { m_viewIndex  = viewIndex;  }
    469466  Int       getViewIndex                     ()                   { return m_viewIndex;    }
    470 #endif
    471467#if H_3D
    472 #if !H_MV5
    473   Void      setViewIndex                     ( Int viewIndex  )   { m_viewIndex  = viewIndex;  }
    474   Int       getViewIndex                     ()                   { return m_viewIndex;    }
    475 #endif
    476468  Void      setIsDepth                       ( Bool isDepth )   { m_isDepth = isDepth; }
    477469  Bool      getIsDepth                       ()                 { return m_isDepth; }
     
    514506  Bool       getUseIC                       ()               { return m_bUseIC; }
    515507#endif
    516 #if LGE_INTER_SDC_E0156
     508#if H_3D_INTER_SDC
    517509  Void       setInterSDCEnable              ( Bool bVal )    { m_bInterSDC = bVal; }
    518510  Bool       getInterSDCEnable              ()               { return m_bInterSDC; }
     
    826818  Bool      getForceIntraQP        ()              { return m_RCForceIntraQP;        }
    827819  Void      setForceIntraQP        ( Bool b )      { m_RCForceIntraQP = b;           }
     820
     821#if KWU_RC_MADPRED_E0227
     822  UInt      getUseDepthMADPred    ()                { return m_depthMADPred;        }
     823  Void      setUseDepthMADPred    (UInt b)          { m_depthMADPred    = b;        }
     824#endif
     825#if KWU_RC_VIEWRC_E0227
     826  Bool      getUseViewWiseRateCtrl    ()                { return m_bViewWiseRateCtrl;        }
     827  Void      setUseViewWiseRateCtrl    (Bool b)          { m_bViewWiseRateCtrl    = b;        }
     828#endif
    828829#else
    829830  Bool      getUseRateCtrl    ()                { return m_enableRateCtrl;    }
     
    833834  Int       getNumLCUInUnit   ()                { return m_numLCUInUnit;      }
    834835  Void      setNumLCUInUnit   (Int numLCUs)     { m_numLCUInUnit   = numLCUs; }
     836
     837#if KWU_RC_MADPRED_E0227
     838  UInt      getUseDepthMADPred    ()                { return m_depthMADPred;        }
     839  Void      setUseDepthMADPred    (UInt b)          { m_depthMADPred    = b;        }
     840#endif
     841#if KWU_RC_VIEWRC_E0227
     842  Bool      getUseViewWiseRateCtrl    ()                { return m_bViewWiseRateCtrl;        }
     843  Void      setUseViewWiseRateCtrl    (Bool b)          { m_bViewWiseRateCtrl    = b;        }
     844#endif
    835845#endif
    836846  Bool      getTransquantBypassEnableFlag()           { return m_TransquantBypassEnableFlag; }
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r622 r655  
    103103 
    104104  m_bEncodeDQP = false;
    105 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     105#if RATE_CONTROL_LAMBDA_DOMAIN
     106#if !M0036_RC_IMPROVEMENT
    106107  m_LCUPredictionSAD = 0;
    107108  m_addSADDepth      = 0;
    108109  m_temporalSAD      = 0;
     110#endif
     111#if M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     112  m_LCUPredictionSAD = 0;
     113  m_addSADDepth      = 0;
     114  m_temporalSAD      = 0;
     115  m_spatialSAD       = 0;
     116#endif
     117#endif
     118#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_RC_MADPRED_E0227
     119  m_LCUPredictionSAD = 0;
     120  m_addSADDepth      = 0;
     121  m_temporalSAD      = 0;
     122  m_spatialSAD       = 0;
    109123#endif
    110124
     
    256270  m_ppcTempCU[0]->initCU( rpcCU->getPic(), rpcCU->getAddr() );
    257271
    258 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     272#if RATE_CONTROL_LAMBDA_DOMAIN
     273#if !M0036_RC_IMPROVEMENT
    259274  m_addSADDepth      = 0;
    260275  m_LCUPredictionSAD = 0;
    261276  m_temporalSAD      = 0;
     277#endif
     278#if M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     279  m_LCUPredictionSAD = 0;
     280  m_addSADDepth      = 0;
     281  m_temporalSAD      = 0;
     282  m_spatialSAD       = 0;
     283#endif
     284#endif
     285#if KWU_RC_MADPRED_E0227
     286  m_LCUPredictionSAD = 0;
     287  m_addSADDepth      = 0;
     288  m_temporalSAD      = 0;
     289  m_spatialSAD       = 0;
    262290#endif
    263291
     
    404432
    405433  // variables for fast encoder decision
    406   Bool    bEarlySkip  = false;
    407   Bool    bTrySplit    = true;
    408   Double  fRD_Skip    = MAX_DOUBLE;
     434#if H_3D_QTLPC 
     435  Bool    bTrySplit     = true;
     436  Bool    bTrySplitDQP  = true;
     437#endif
    409438
    410439  // variable for Early CU determination
     
    415444  Bool earlyDetectionSkipMode = false;
    416445
    417   Bool    bTrySplitDQP  = true;
    418446#if H_3D_VSP
    419447  DisInfo DvInfo;
     
    425453#endif
    426454#endif
    427   static  Double  afCost[ MAX_CU_DEPTH ];
    428   static  Int      aiNum [ MAX_CU_DEPTH ];
    429 
    430   if ( rpcBestCU->getAddr() == 0 )
    431   {
    432     ::memset( afCost, 0, sizeof( afCost ) );
    433     ::memset( aiNum,  0, sizeof( aiNum  ) );
    434   }
    435 
    436455  Bool bBoundary = false;
    437456  UInt uiLPelX   = rpcBestCU->getCUPelX();
     
    489508  if(!bSliceEnd && !bSliceStart && bInsidePicture )
    490509  {
    491 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     510#if  H_3D_FAST_TEXTURE_ENCODING
    492511    Bool bIVFMerge = false;
    493512    Int  iIVFMaxD = 0;
     
    501520      }
    502521      // variables for fast encoder decision
    503       bEarlySkip  = false;
     522#if H_3D_QTLPC
    504523      bTrySplit    = true;
    505       fRD_Skip    = MAX_DOUBLE;
     524#endif
    506525
    507526      rpcTempCU->initEstData( uiDepth, iQP );
     
    560579        }
    561580      }
    562 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     581#if  H_3D_FAST_TEXTURE_ENCODING
    563582      if(rpcTempCU->getSlice()->getViewIndex() && !rpcTempCU->getSlice()->getIsDepth())
    564583      {
     
    584603          rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
    585604#endif
    586 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     605#if  H_3D_FAST_TEXTURE_ENCODING
    587606          xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD );  rpcTempCU->initEstData( uiDepth, iQP );//by Competition for inter_2Nx2N
    588607#else
     
    598617#endif
    599618        xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N
    600 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     619#if  H_3D_FAST_TEXTURE_ENCODING
    601620        bFMD = bIVFMerge && rpcBestCU->isSkipped(0);
    602621#endif
     
    605624        rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    606625#endif
    607         // fast encoder decision for early skip
    608         if ( m_pcEncCfg->getUseFastEnc() )
    609         {
    610           Int iIdx = g_aucConvertToBit[ rpcBestCU->getWidth(0) ];
    611           if ( aiNum [ iIdx ] > 5 && fRD_Skip < EARLY_SKIP_THRES*afCost[ iIdx ]/aiNum[ iIdx ] )
    612           {
    613             bEarlySkip = true;
    614             bTrySplit  = false;
    615           }
    616         }
    617626
    618627        if(!m_pcEncCfg->getUseEarlySkipDetection())
    619628        {
    620629          // 2Nx2N, NxN
    621           if ( !bEarlySkip )
    622           {
    623630#if H_3D_IC
    624631            rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
    625632#endif
    626 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     633#if  H_3D_FAST_TEXTURE_ENCODING
    627634            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD );  rpcTempCU->initEstData( uiDepth, iQP );
    628635#else
     
    636643              doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
    637644            }
    638           }
    639645        }
    640646#if H_3D_IC
     
    643649      }
    644650
    645 #if H_3D_QTLPC
     651#if H_3D_QTLPC     
    646652      if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL())
    647653      {
    648654        bTrySplitDQP = bTrySplit;
    649655      }
    650       else
    651       {
    652 #endif
    653         if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
    654         {
    655           if(iQP == iBaseQP)
    656           {
    657             bTrySplitDQP = bTrySplit;
    658           }
    659         }
    660         else
    661         {
    662           bTrySplitDQP = bTrySplit;
    663         }
    664 #if H_3D_QTLPC
    665       }
    666656#endif
    667657      if (isAddLowestQP && (iQP == lowestQP))
     
    678668    }
    679669#endif
     670#if RATE_CONTROL_LAMBDA_DOMAIN && M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     671    if ( uiDepth <= m_addSADDepth )
     672    {
     673      m_LCUPredictionSAD += m_temporalSAD;
     674      m_addSADDepth = uiDepth;
     675    }
     676#endif
     677#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_RC_MADPRED_E0227
     678if ( uiDepth <= m_addSADDepth )
     679{
     680  m_LCUPredictionSAD += m_temporalSAD;
     681  m_addSADDepth = uiDepth;
     682}
     683#endif
     684#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ
     685    if(m_pcEncCfg->getUseRateCtrl())
     686    {
     687      Int qp = m_pcRateCtrl->getUnitQP();
     688      iMinQP  = Clip3( MIN_QP, MAX_QP, qp);
     689      iMaxQP  = Clip3( MIN_QP, MAX_QP, qp);
     690    }
     691#endif
    680692
    681693#if H_3D_DIM_ENC
     
    700712        {
    701713          // 2Nx2N, NxN
    702           if ( !bEarlySkip )
    703           {
    704714            if(!( (rpcBestCU->getWidth(0)==8) && (rpcBestCU->getHeight(0)==8) ))
    705715            {
     
    710720                )
    711721              {
    712 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     722#if  H_3D_FAST_TEXTURE_ENCODING
    713723                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN, bFMD  );
    714724#else
     
    721731              }
    722732            }
    723           }
    724733
    725734          // 2NxN, Nx2N
     
    730739            )
    731740          {
    732 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     741#if  H_3D_FAST_TEXTURE_ENCODING
    733742            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N, bFMD  );
    734743#else
     
    750759            )
    751760          {
    752 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     761#if  H_3D_FAST_TEXTURE_ENCODING
    753762            xCheckRDCostInter      ( rpcBestCU, rpcTempCU, SIZE_2NxN, bFMD  );
    754763#else
     
    789798                )
    790799              {
    791 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     800#if  H_3D_FAST_TEXTURE_ENCODING
    792801                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFMD );
    793802#else
     
    809818                )
    810819              {
    811 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     820#if  H_3D_FAST_TEXTURE_ENCODING
    812821                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFMD );
    813822#else
     
    833842                )
    834843              {
    835 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     844#if  H_3D_FAST_TEXTURE_ENCODING
    836845                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, bFMD, true );
    837846#else
     
    853862                )
    854863              {
    855 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     864#if  H_3D_FAST_TEXTURE_ENCODING
    856865                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, bFMD, true );
    857866#else
     
    879888                )
    880889              {
    881 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     890#if  H_3D_FAST_TEXTURE_ENCODING
    882891                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFMD );
    883892#else
     
    899908                )
    900909              {
    901 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     910#if  H_3D_FAST_TEXTURE_ENCODING
    902911                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFMD );
    903912#else
     
    919928                )
    920929              {
    921 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     930#if  H_3D_FAST_TEXTURE_ENCODING
    922931                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, bFMD, true );
    923932#else
     
    939948                )
    940949              {
    941 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     950#if  H_3D_FAST_TEXTURE_ENCODING
    942951                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, bFMD, true );
    943952#else
     
    990999#endif
    9911000        }
    992 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     1001#if  H_3D_FAST_TEXTURE_ENCODING
    9931002        if(!bFMD)
    9941003        {
    9951004#endif
    9961005        // do normal intra modes
    997 #if H_3D_DIM_ENC
    998         if ( !bEarlySkip || ( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() ) )
    999 #else
    1000         if ( !bEarlySkip )
    1001 #endif
    1002         {
     1006       
    10031007          // speedup for inter frames
    10041008          if( rpcBestCU->getSlice()->getSliceType() == I_SLICE ||
     
    10121016          {
    10131017            xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     1018
     1019#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     1020            if ( uiDepth <= m_addSADDepth )
     1021            {
     1022              m_LCUPredictionSAD += m_spatialSAD;
     1023              m_addSADDepth = uiDepth;
     1024            }
     1025#endif
     1026#if RATE_CONTROL_LAMBDA_DOMAIN && M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     1027            if ( uiDepth <= m_addSADDepth )
     1028            {
     1029              m_LCUPredictionSAD += m_spatialSAD;
     1030              m_addSADDepth = uiDepth;
     1031            }
     1032#endif
     1033
     1034#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_RC_MADPRED_E0227
     1035            if ( uiDepth <= m_addSADDepth )
     1036            {
     1037              m_LCUPredictionSAD += m_spatialSAD;
     1038              m_addSADDepth = uiDepth;
     1039            }
     1040#endif
    10141041            rpcTempCU->initEstData( uiDepth, iQP );
    10151042            if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
     
    10291056            }
    10301057          }
    1031         }
    1032 
    10331058        // test PCM
    10341059        if(pcPic->getSlice(0)->getSPS()->getUsePCM()
     
    10491074          }
    10501075        }
    1051 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     1076#if  H_3D_FAST_TEXTURE_ENCODING
    10521077        }
    10531078#endif
     
    10741099    rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );
    10751100
    1076     // accumulate statistics for early skip
    1077     if ( m_pcEncCfg->getUseFastEnc() )
    1078     {
    1079       if ( rpcBestCU->isSkipped(0) )
    1080       {
    1081         Int iIdx = g_aucConvertToBit[ rpcBestCU->getWidth(0) ];
    1082         afCost[ iIdx ] += rpcBestCU->getTotalCost();
    1083         aiNum [ iIdx ] ++;
    1084       }
    1085     }
    1086 
    10871101    // Early CU determination
    10881102    if( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->isSkipped(0) )
     
    10941108      bSubBranch = true;
    10951109    }
    1096 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     1110#if  H_3D_FAST_TEXTURE_ENCODING
    10971111    if(rpcBestCU->getSlice()->getViewIndex() && !rpcBestCU->getSlice()->getIsDepth() && (uiDepth >=iIVFMaxD) && rpcBestCU->isSkipped(0))
    10981112    {
     
    11681182
    11691183    // further split
     1184#if H_3D_QTLPC
    11701185    if( bSubBranch && bTrySplitDQP && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )
     1186#else
     1187    if( bSubBranch && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )
     1188#endif
    11711189    {
    11721190#if H_3D_VSO // M9
     
    15801598  m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
    15811599#endif
    1582 #if LGE_INTER_SDC_E0156
     1600#if H_3D_INTER_SDC
    15831601  m_pcEntropyCoder->encodeInterSDCFlag( pcCU, uiAbsPartIdx, false );
    15841602#endif
     
    18751893
    18761894          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
    1877 #if LGE_INTER_SDC_E0156
     1895#if H_3D_INTER_SDC
    18781896          TComDataCU *rpcTempCUPre = rpcTempCU;
    18791897#endif
     
    18811899          xCheckDQP( rpcTempCU );
    18821900          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    1883 #if LGE_INTER_SDC_E0156
     1901#if H_3D_INTER_SDC
    18841902          if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
    18851903          {
     
    19171935      if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
    19181936      {
    1919 #if LGE_INTER_SDC_E0156
     1937#if H_3D_INTER_SDC
    19201938        if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) )
    19211939        {
     
    19261944#endif
    19271945        bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
    1928 #if LGE_INTER_SDC_E0156
     1946#if H_3D_INTER_SDC
    19291947        }
    19301948#endif
     
    19711989
    19721990#if AMP_MRG
    1973 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     1991#if  H_3D_FAST_TEXTURE_ENCODING
    19741992Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFMD, Bool bUseMRG)
    19751993#else
     
    19801998#endif
    19811999{
    1982 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     2000#if  H_3D_FAST_TEXTURE_ENCODING
    19832001  if(!(bFMD && (ePartSize == SIZE_2Nx2N)))  //have  motion estimation or merge check
    19842002  {
     
    20572075#if AMP_MRG
    20582076  rpcTempCU->setMergeAMP (true);
    2059 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     2077#if  H_3D_FAST_TEXTURE_ENCODING
    20602078  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bFMD, false, bUseMRG );
    20612079#else
     
    21022120#endif
    21032121
    2104 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     2122#if RATE_CONTROL_LAMBDA_DOMAIN  && (!M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227)
    21052123  if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
    21062124  {
     
    21112129  }
    21122130#endif
     2131#if !RATE_CONTROL_LAMBDA_DOMAIN  && KWU_RC_MADPRED_E0227
     2132  if ( m_pcEncCfg->getUseRateCtrl() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
     2133  {
     2134    UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),
     2135      m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),
     2136      rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );
     2137    m_temporalSAD = (Int)SAD;
     2138  }
     2139#endif
    21132140
    21142141  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
     
    21212148#endif
    21222149  rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    2123 #if LGE_INTER_SDC_E0156
     2150#if H_3D_INTER_SDC
    21242151  TComDataCU *rpcTempCUPre = rpcTempCU;
    21252152#endif
    21262153  xCheckDQP( rpcTempCU );
    21272154  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    2128 #if LGE_INTER_SDC_E0156
     2155#if H_3D_INTER_SDC
    21292156  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() )
    21302157  {
     
    21632190  }
    21642191#endif
    2165 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     2192#if  H_3D_FAST_TEXTURE_ENCODING
    21662193  }
    21672194#endif
     
    22352262  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    22362263 
     2264#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     2265  UChar uhDepth = rpcTempCU->getDepth( 0 );
     2266  if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && eSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
     2267  {
     2268    UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),
     2269      m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),
     2270      rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );
     2271    m_spatialSAD = (Int)SAD;
     2272  }
     2273#endif
     2274#if RATE_CONTROL_LAMBDA_DOMAIN && M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     2275  UChar uhDepth = rpcTempCU->getDepth( 0 );
     2276  if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && eSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
     2277  {
     2278    UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),
     2279      m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),
     2280      rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );
     2281    m_spatialSAD = (Int)SAD;
     2282  }
     2283#endif
     2284#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_RC_MADPRED_E0227
     2285  UChar uhDepth = rpcTempCU->getDepth( 0 );
     2286  if ( m_pcEncCfg->getUseRateCtrl() && eSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
     2287  {
     2288    UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),
     2289      m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),
     2290      rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );
     2291    m_spatialSAD = (Int)SAD;
     2292  }
     2293#endif
    22372294  xCheckDQP( rpcTempCU );
    22382295  xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);
  • trunk/source/Lib/TLibEncoder/TEncCu.h

    r608 r655  
    102102  Bool                    m_bUseSBACRD;
    103103  TEncRateCtrl*           m_pcRateCtrl;
    104 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     104#if RATE_CONTROL_LAMBDA_DOMAIN
     105#if !M0036_RC_IMPROVEMENT
    105106  UInt                    m_LCUPredictionSAD;
    106107  Int                     m_addSADDepth;
    107108  Int                     m_temporalSAD;
    108109#endif
     110#if M0036_RC_IMPROVEMENT && KWU_RC_MADPRED_E0227
     111  UInt                    m_LCUPredictionSAD;
     112  Int                     m_addSADDepth;
     113  Int                     m_temporalSAD;
     114  Int                     m_spatialSAD;
     115#endif
     116#endif
     117#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_RC_MADPRED_E0227
     118  UInt                    m_LCUPredictionSAD;
     119  Int                     m_addSADDepth;
     120  Int                     m_temporalSAD;
     121  Int                     m_spatialSAD;
     122#endif
     123
    109124public:
    110125  /// copy parameters from encoder class
     
    124139 
    125140  Void setBitCounter        ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; }
    126 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     141#if (RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT) || KWU_RC_MADPRED_E0227
    127142  UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; }
    128143#endif
     
    145160
    146161#if AMP_MRG
    147 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     162#if  H_3D_FAST_TEXTURE_ENCODING
    148163  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize,  Bool bFMD, Bool bUseMRG = false  ) ;
    149164#else
  • trunk/source/Lib/TLibEncoder/TEncEntropy.cpp

    r608 r655  
    662662#endif
    663663
    664 #if LGE_INTER_SDC_E0156
     664#if H_3D_INTER_SDC
    665665  if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
    666666  {
     
    824824}
    825825
    826 #if LGE_INTER_SDC_E0156
     826#if H_3D_INTER_SDC
    827827Void TEncEntropy::encodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    828828{
  • trunk/source/Lib/TLibEncoder/TEncEntropy.h

    r608 r655  
    9494  virtual Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9595#endif
    96 #if LGE_INTER_SDC_E0156
     96#if H_3D_INTER_SDC
    9797  virtual Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9898  virtual Void codeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) = 0;
     
    185185  Void encodeICFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    186186#endif
    187 #if LGE_INTER_SDC_E0156
     187#if H_3D_INTER_SDC
    188188  Void encodeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    189189  Void encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD );
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r622 r655  
    153153#endif
    154154#endif
     155
     156#if KWU_FIX_URQ
     157  m_pcRateCtrl           = pcTEncTop->getRateCtrl();
     158#endif
    155159}
    156160
     
    351355#endif
    352356#if H_MV
    353 Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid)
    354 #else
    355 Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP)
     357Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid, bool isField, bool isTff)
     358#else
     359Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, bool isField, bool isTff)
    356360#endif
    357361{
     
    367371
    368372#if !H_MV
    369   xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut );
     373  xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut, isField );
     374
    370375 
    371376  m_iNumPicCoded = 0;
     
    439444
    440445    /////////////////////////////////////////////////////////////////////////////////////////////////// Initial to start encoding
    441     Int pocCurr = iPOCLast -iNumPicRcvd+ m_pcCfg->getGOPEntry(iGOPid).m_POC;
    442     Int iTimeOffset = m_pcCfg->getGOPEntry(iGOPid).m_POC;
    443     if(iPOCLast == 0)
     446    Int iTimeOffset;
     447    Int pocCurr;
     448   
     449    if(iPOCLast == 0) //case first frame or first top field
    444450    {
    445451      pocCurr=0;
    446452      iTimeOffset = 1;
     453    }
     454    else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value
     455    {
     456      pocCurr = 1;
     457      iTimeOffset = 1;
     458    }
     459    else
     460    {
     461      pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField;
     462      iTimeOffset = m_pcCfg->getGOPEntry(iGOPid).m_POC;
    447463    }
    448464    if(pocCurr>=m_pcCfg->getFramesToBeEncoded())
     
    463479    accessUnitsInGOP.push_back(AccessUnit());
    464480    AccessUnit& accessUnit = accessUnitsInGOP.back();
    465     xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr );
     481    xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr, isField);
    466482
    467483    //  Slice data initialization
     
    472488
    473489
    474 #if H_MV5
    475490#if H_MV
    476     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId() );     
    477 #else
    478     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
    479 #endif
    480 #else
    481 #if H_3D
    482     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId() );     
    483 #else
    484     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
    485 #endif
    486 #endif
     491    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId(), isField  );     
     492#else
     493    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), isField  );
     494#endif
     495   
     496    //Set Frame/Field coding
     497    pcSlice->getPic()->setField(isField);
     498
    487499    pcSlice->setLastIDR(m_iLastIDR);
    488500    pcSlice->setSliceIdx(0);
    489501#if H_MV
    490 #if H_MV5
    491502    pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer0, &m_refPicSetInterLayer1 );
    492 #else
    493     pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer );
    494 #endif
    495503    pcPic  ->setLayerId     ( getLayerId()   );
    496504    pcPic  ->setViewId      ( getViewId()    );   
     
    508516    pcSlice->setLFCrossSliceBoundaryFlag(  pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()  );
    509517    pcSlice->setScalingList ( m_pcEncTop->getScalingList()  );
    510     pcSlice->getScalingList()->setUseTransformSkip(m_pcEncTop->getPPS()->getUseTransformSkip());
    511518    if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_OFF)
    512519    {
     
    562569    if(pcSlice->getTemporalLayerNonReferenceFlag())
    563570    {
    564       if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)
     571      if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_R &&
     572          !(m_iGopSize == 1 && pcSlice->getSliceType() == I_SLICE))
     573        // Add this condition to avoid POC issues with encoder_intra_main.cfg configuration (see #1127 in bug tracker)
    565574      {
    566575        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N);
     
    655664    refPicListModification->setRefPicListModificationFlagL1(0);
    656665#if H_MV
    657 #if H_MV5
    658666    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 1 )
    659667    {
     
    699707    xSetRefPicListModificationsMv( tempRefPicLists, pcSlice, iGOPid );   
    700708#else
    701     if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
    702     {
    703       pcSlice->setDiscardableFlag           ( false );     
    704     }   
    705 
    706     TComVPS*           vps = pcSlice->getVPS();
    707     Int       layerIdInVps = vps    ->getLayerIdInVps( getLayerId());
    708     Int numDirectRefLayers = vps    ->getNumDirectRefLayers( layerIdInVps );
    709     GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
    710    
    711     if ( getLayerId() > 0 && numDirectRefLayers > 0 )
    712     {         
    713       pcSlice->setInterLayerPredEnabledFlag ( gopEntry.m_numActiveRefLayerPics > 0 );     
    714       if ( pcSlice->getInterLayerPredEnabledFlag() && numDirectRefLayers > 1 )
    715       {
    716         if ( !vps->getMaxOneActiveRefLayerFlag() )
    717         {   
    718           pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 );
    719         }
    720         for (Int i = 0; i < gopEntry.m_numActiveRefLayerPics; i++ )
    721         {
    722           pcSlice->setInterLayerPredLayerIdc( i, gopEntry.m_interLayerPredLayerIdc[ i ] );
    723         }
    724       }
    725     }
    726     assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics );
    727    
    728     if ( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0 && pcSlice->getNumActiveRefLayerPics() > 0)
    729     {
    730       pcSlice->setInterLayerSamplePredOnlyFlag( gopEntry.m_numRefPics == 0 );
    731     }   
    732 
    733     pcSlice->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
    734     pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
    735     pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
    736 
    737     xSetRefPicListModificationsMv( pcSlice, iGOPid );   
    738 
    739     pcSlice->setActiveMotionPredRefLayers( );
    740 
    741     if ( getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 && pcSlice->getEnableTMVPFlag() &&
    742         ( pcSlice->getSliceType() == B_SLICE || pcSlice->getSliceType() == P_SLICE ))
    743     {
    744       pcSlice->setAltCollocatedIndicationFlag( gopEntry.m_collocatedRefLayerIdx >= 0 );
    745       if ( pcSlice->getNumActiveRefLayerPics() && pcSlice->getNumActiveMotionPredRefLayers() > 0 )
    746       {
    747         pcSlice->setCollocatedRefLayerIdx( gopEntry.m_collocatedRefLayerIdx );
    748       }
    749     }
    750 
    751 #endif
    752 #else
    753709    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
    754710    pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
     
    760716
    761717    //  Set reference list
    762 #if H_MV5
    763718#if H_MV   
    764719    pcSlice->setRefPicList( tempRefPicLists, usedAsLongTerm, numPocTotalCurr );
     
    782737      }
    783738    }
    784 #endif
    785 #else
    786 #if H_MV   
    787     pcSlice->setRefPicList( rcListPic, m_refPicSetInterLayer );
    788 #if H_3D_ARP
    789     pcSlice->setARPStepNum();
    790     if(pcSlice->getARPStepNum() > 1)
    791     {
    792       for(Int iLayerId = 0; iLayerId < getLayerId(); iLayerId ++ )
    793       {
    794         Int  iViewIdx =   pcSlice->getVPS()->getViewIndex(iLayerId);
    795         Bool bIsDepth = ( pcSlice->getVPS()->getDepthId  ( iLayerId ) == 1 );
    796         if( iViewIdx<getViewIndex() && !bIsDepth )
    797         {
    798           pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );
    799         }
    800       }
    801     }
    802 #endif
    803 #else
    804     pcSlice->setRefPicList ( rcListPic );
    805 #endif
    806739#endif
    807740#if H_3D
     
    913846
    914847    // SAIT_VSO_EST_A0033
     848#if H_3D_FCO
     849    Bool flagRec;
     850    flagRec =  ((m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false, pcSlice->getPOC(), true) == NULL) ? false: true);
     851    pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false, pcSlice->getPOC(), flagRec ) );
     852    pcRdCost->setDepthPicYuv   ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true, pcSlice->getPOC(), false ) );
     853#else
    915854    pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false , pcSlice->getPOC(), true ) );
    916855    pcRdCost->setDepthPicYuv   ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true  , pcSlice->getPOC(), false ) );
     856#endif
    917857
    918858    // LGE_WVSO_A0119
     
    970910      }
    971911      m_pcRateCtrl->initRCPic( frameLevel );
     912
     913#if KWU_RC_MADPRED_E0227
     914      if(m_pcCfg->getLayerId() != 0)
     915      {
     916        m_pcRateCtrl->getRCPic()->setIVPic( m_pcEncTop->getEncTop()->getTEncTop(0)->getRateCtrl()->getRCPic() );
     917      }
     918#endif
     919
    972920      estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits();
    973921
     
    1014962      else    // normal case
    1015963      {
     964#if KWU_RC_MADPRED_E0227
     965        if(m_pcRateCtrl->getLayerID() != 0)
     966        {
     967          list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList();
     968          lambda  = m_pcRateCtrl->getRCPic()->estimatePicLambdaIV( listPreviousPicture, pcSlice->getPOC() );
     969          sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture );
     970        }
     971        else
     972        {
     973#endif
    1016974        list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList();
    1017975#if RATE_CONTROL_INTRA
     
    1021979#endif
    1022980        sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture );
     981#if KWU_RC_MADPRED_E0227
     982        }
     983#endif
    1023984      }
    1024985
     
    11551116        pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc));
    11561117      }
     1118#endif
    11571119#if H_3D
    11581120      pcSlice->setDepthToDisparityLUTs();
    11591121
    11601122#endif
    1161 #endif
    1162 #if MTK_NBDV_TN_FIX_E0172
     1123
     1124#if H_3D_NBDV
    11631125      if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
    11641126      {
    11651127        pcPic->checkTemporalIVRef();
    11661128      }
    1167 #endif
    1168 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
     1129
    11691130      if(pcSlice->getIsDepth())
    11701131      {
     
    14121373        }
    14131374      }
    1414       pictureTimingSEI.m_auCpbRemovalDelay = std::max<Int>(1, m_totalCoded - m_lastBPSEI); // Syntax element signalled as minus, hence the .
     1375      pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the .
    14151376      pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded;
    14161377      Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2;
     
    18621823        pcPic->destroyNonDBFilterInfo();
    18631824      }
    1864 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     1825#if H_3D
    18651826      pcPic->compressMotion(2);
    18661827#endif
     
    18981859          digestStr = digestToString(sei_recon_picture_digest.digest, 4);
    18991860        }
    1900 #if H_MV_FIX_LID_PIC_HASH_SEI_T40
     1861#if H_MV
    19011862        OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer(), getLayerId() );
    19021863#else
     
    19401901      xCalculateAddPSNR( pcPic, pcPic->getPicYuvRec(), accessUnit, dEncTime );
    19411902
     1903    //In case of field coding, compute the interlaced PSNR for both fields
     1904    if (isField && ((!pcPic->isTopField() && isTff) || (pcPic->isTopField() && !isTff)))
     1905    {
     1906      //get complementary top field
     1907      TComPic* pcPicTop;
     1908      TComList<TComPic*>::iterator   iterPic = rcListPic.begin();
     1909      while ((*iterPic)->getPOC() != pcPic->getPOC()-1)
     1910      {
     1911        iterPic ++;
     1912      }
     1913      pcPicTop = *(iterPic);
     1914      xCalculateInterlacedAddPSNR(pcPicTop, pcPic, pcPicTop->getPicYuvRec(), pcPic->getPicYuvRec(), accessUnit, dEncTime );
     1915    }
     1916   
    19421917      if (digestStr)
    19431918      {
     
    20722047            OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
    20732048          m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     2049          pictureTimingSEI.m_picStruct = (isField && pcSlice->getPic()->isTopField())? 1 : isField? 2 : 0;
    20742050          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS());
    20752051          writeRBSPTrailingBits(nalu.m_Bitstream);
     
    21662142      pcPic->setReconMark   ( true );
    21672143#if H_MV
    2168 #if H_MV5
    21692144      TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 
    2170 #else
    2171       TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
    2172 #endif
    21732145      std::vector<Int> temp;
    21742146      TComSlice::markCurrPic( pcPic );
     
    21842156      delete[] pcSubstreamsOut;
    21852157  }
    2186 #if !RATE_CONTROL_LAMBDA_DOMAIN
     2158#if !KWU_FIX_URQ && !RATE_CONTROL_LAMBDA_DOMAIN
    21872159  if(m_pcCfg->getUseRateCtrl())
    21882160  {
     
    21962168
    21972169#if !H_MV
    2198   assert ( m_iNumPicCoded == iNumPicRcvd );
     2170  assert ( (m_iNumPicCoded == iNumPicRcvd) || (isField && iPOCLast == 1) );
    21992171#endif
    22002172}
    22012173
    22022174#if !H_MV
    2203 Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded)
     2175Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded, bool isField)
    22042176{
    22052177  assert (uiNumAllPicCoded == m_gcAnalyzeAll.getNumPic());
     
    22072179   
    22082180  //--CFG_KDY
     2181  if(isField)
     2182  {
     2183    m_gcAnalyzeAll.setFrmRate( m_pcCfg->getFrameRate() * 2);
     2184    m_gcAnalyzeI.setFrmRate( m_pcCfg->getFrameRate() * 2);
     2185    m_gcAnalyzeP.setFrmRate( m_pcCfg->getFrameRate() * 2);
     2186    m_gcAnalyzeB.setFrmRate( m_pcCfg->getFrameRate() * 2);
     2187  }
     2188  else
     2189  {
    22092190  m_gcAnalyzeAll.setFrmRate( m_pcCfg->getFrameRate() );
    22102191  m_gcAnalyzeI.setFrmRate( m_pcCfg->getFrameRate() );
    22112192  m_gcAnalyzeP.setFrmRate( m_pcCfg->getFrameRate() );
    22122193  m_gcAnalyzeB.setFrmRate( m_pcCfg->getFrameRate() );
     2194  }
    22132195 
    22142196  //-- all
     
    22332215  m_gcAnalyzeB.printSummary('B');
    22342216#endif
     2217
     2218  if(isField)
     2219  {
     2220    //-- interlaced summary
     2221    m_gcAnalyzeAll_in.setFrmRate( m_pcCfg->getFrameRate());
     2222    printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
     2223    m_gcAnalyzeAll_in.printOutInterlaced('a',  m_gcAnalyzeAll.getBits());
     2224   
     2225#if _SUMMARY_OUT_
     2226    m_gcAnalyzeAll_in.printSummaryOutInterlaced();
     2227#endif
     2228  }
    22352229
    22362230  printf("\nRVM: %.3lf\n" , xCalculateRVM());
     
    22762270// Protected member functions
    22772271// ====================================================================================================================
     2272
     2273
     2274Void TEncGOP::xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, bool isField )
     2275{
     2276  assert( iNumPicRcvd > 0 );
     2277  //  Exception for the first frames
     2278  if ( ( isField && (iPOCLast == 0 || iPOCLast == 1) ) || (!isField  && (iPOCLast == 0))  )
     2279  {
     2280    m_iGopSize    = 1;
     2281  }
     2282  else
     2283  {
     2284    m_iGopSize    = m_pcCfg->getGOPSize();
     2285  }
     2286  assert (m_iGopSize > 0);
     2287 
     2288  return;
     2289}
    22782290
    22792291Void TEncGOP::xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut )
     
    22992311                         TComPic*&                 rpcPic,
    23002312                         TComPicYuv*&              rpcPicYuvRecOut,
    2301                          Int                       pocCurr )
     2313                         Int                       pocCurr,
     2314                         bool                      isField)
    23022315{
    23032316  Int i;
    23042317  //  Rec. output
    23052318  TComList<TComPicYuv*>::iterator     iterPicYuvRec = rcListPicYuvRecOut.end();
    2306   for ( i = 0; i < iNumPicRcvd - iTimeOffset + 1; i++ )
     2319 
     2320  if (isField)
     2321  {
     2322    for ( i = 0; i < ( (pocCurr == 0 ) || (pocCurr == 1 ) ? (iNumPicRcvd - iTimeOffset + 1) : (iNumPicRcvd - iTimeOffset + 2) ); i++ )
     2323    {
     2324      iterPicYuvRec--;
     2325    }
     2326  }
     2327  else
     2328  {
     2329    for ( i = 0; i < (iNumPicRcvd - iTimeOffset + 1); i++ )
    23072330  {
    23082331    iterPicYuvRec--;
    23092332  }
    23102333 
     2334  }
     2335 
     2336  if (isField)
     2337  {
     2338    if(pocCurr == 1)
     2339    {
     2340      iterPicYuvRec++;
     2341    }
     2342  }
    23112343  rpcPicYuvRecOut = *(iterPicYuvRec);
    23122344 
     
    23232355    iterPic++;
    23242356  }
    2325  
     2357
     2358#if !H_MV
     2359  assert( rpcPic != NULL );
     2360#endif
    23262361  assert (rpcPic->getPOC() == pocCurr);
    23272362 
     
    26422677}
    26432678
     2679
     2680Void reinterlace(Pel* top, Pel* bottom, Pel* dst, UInt stride, UInt width, UInt height, bool isTff)
     2681{
     2682 
     2683  for (Int y = 0; y < height; y++)
     2684  {
     2685    for (Int x = 0; x < width; x++)
     2686    {
     2687      dst[x] = isTff ? (UChar) top[x] : (UChar) bottom[x];
     2688      dst[stride+x] = isTff ? (UChar) bottom[x] : (UChar) top[x];
     2689    }
     2690    top += stride;
     2691    bottom += stride;
     2692    dst += stride*2;
     2693  }
     2694}
     2695
     2696
     2697Void TEncGOP::xCalculateInterlacedAddPSNR( TComPic* pcPicOrgTop, TComPic* pcPicOrgBottom, TComPicYuv* pcPicRecTop, TComPicYuv* pcPicRecBottom, const AccessUnit& accessUnit, Double dEncTime )
     2698{
     2699#if  H_MV
     2700  assert( 0 ); // Field coding and MV need to be aligned.
     2701#else
     2702  Int     x, y;
     2703 
     2704  UInt64 uiSSDY_in  = 0;
     2705  UInt64 uiSSDU_in  = 0;
     2706  UInt64 uiSSDV_in  = 0;
     2707 
     2708  Double  dYPSNR_in  = 0.0;
     2709  Double  dUPSNR_in  = 0.0;
     2710  Double  dVPSNR_in  = 0.0;
     2711 
     2712  /*------ INTERLACED PSNR -----------*/
     2713 
     2714  /* Luma */
     2715 
     2716  Pel*  pOrgTop = pcPicOrgTop->getPicYuvOrg()->getLumaAddr();
     2717  Pel*  pOrgBottom = pcPicOrgBottom->getPicYuvOrg()->getLumaAddr();
     2718  Pel*  pRecTop = pcPicRecTop->getLumaAddr();
     2719  Pel*  pRecBottom = pcPicRecBottom->getLumaAddr();
     2720 
     2721  Int   iWidth;
     2722  Int   iHeight;
     2723  Int iStride;
     2724 
     2725  iWidth  = pcPicOrgTop->getPicYuvOrg()->getWidth () - m_pcEncTop->getPad(0);
     2726  iHeight = pcPicOrgTop->getPicYuvOrg()->getHeight() - m_pcEncTop->getPad(1);
     2727  iStride = pcPicOrgTop->getPicYuvOrg()->getStride();
     2728  Int   iSize   = iWidth*iHeight;
     2729  bool isTff = pcPicOrgTop->isTopField();
     2730 
     2731  TComPicYuv* pcOrgInterlaced = new TComPicYuv;
     2732  pcOrgInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     2733 
     2734  TComPicYuv* pcRecInterlaced = new TComPicYuv;
     2735  pcRecInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     2736 
     2737  Pel* pOrgInterlaced = pcOrgInterlaced->getLumaAddr();
     2738  Pel* pRecInterlaced = pcRecInterlaced->getLumaAddr();
     2739 
     2740  //=== Interlace fields ====
     2741  reinterlace(pOrgTop, pOrgBottom, pOrgInterlaced, iStride, iWidth, iHeight, isTff);
     2742  reinterlace(pRecTop, pRecBottom, pRecInterlaced, iStride, iWidth, iHeight, isTff);
     2743 
     2744  //===== calculate PSNR =====
     2745  for( y = 0; y < iHeight << 1; y++ )
     2746  {
     2747    for( x = 0; x < iWidth; x++ )
     2748    {
     2749      Int iDiff = (Int)( pOrgInterlaced[x] - pRecInterlaced[x] );
     2750      uiSSDY_in   += iDiff * iDiff;
     2751    }
     2752    pOrgInterlaced += iStride;
     2753    pRecInterlaced += iStride;
     2754  }
     2755 
     2756  /*Chroma*/
     2757 
     2758  iHeight >>= 1;
     2759  iWidth  >>= 1;
     2760  iStride >>= 1;
     2761 
     2762  pOrgTop = pcPicOrgTop->getPicYuvOrg()->getCbAddr();
     2763  pOrgBottom = pcPicOrgBottom->getPicYuvOrg()->getCbAddr();
     2764  pRecTop = pcPicRecTop->getCbAddr();
     2765  pRecBottom = pcPicRecBottom->getCbAddr();
     2766  pOrgInterlaced = pcOrgInterlaced->getCbAddr();
     2767  pRecInterlaced = pcRecInterlaced->getCbAddr();
     2768 
     2769  //=== Interlace fields ====
     2770  reinterlace(pOrgTop, pOrgBottom, pOrgInterlaced, iStride, iWidth, iHeight, isTff);
     2771  reinterlace(pRecTop, pRecBottom, pRecInterlaced, iStride, iWidth, iHeight, isTff);
     2772 
     2773  //===== calculate PSNR =====
     2774  for( y = 0; y < iHeight << 1; y++ )
     2775  {
     2776    for( x = 0; x < iWidth; x++ )
     2777    {
     2778      Int iDiff = (Int)( pOrgInterlaced[x] - pRecInterlaced[x] );
     2779      uiSSDU_in   += iDiff * iDiff;
     2780    }
     2781    pOrgInterlaced += iStride;
     2782    pRecInterlaced += iStride;
     2783  }
     2784 
     2785  pOrgTop = pcPicOrgTop->getPicYuvOrg()->getCrAddr();
     2786  pOrgBottom = pcPicOrgBottom->getPicYuvOrg()->getCrAddr();
     2787  pRecTop = pcPicRecTop->getCrAddr();
     2788  pRecBottom = pcPicRecBottom->getCrAddr();
     2789  pOrgInterlaced = pcOrgInterlaced->getCrAddr();
     2790  pRecInterlaced = pcRecInterlaced->getCrAddr();
     2791 
     2792  //=== Interlace fields ====
     2793  reinterlace(pOrgTop, pOrgBottom, pOrgInterlaced, iStride, iWidth, iHeight, isTff);
     2794  reinterlace(pRecTop, pRecBottom, pRecInterlaced, iStride, iWidth, iHeight, isTff);
     2795 
     2796  //===== calculate PSNR =====
     2797  for( y = 0; y < iHeight << 1; y++ )
     2798  {
     2799    for( x = 0; x < iWidth; x++ )
     2800    {
     2801      Int iDiff = (Int)( pOrgInterlaced[x] - pRecInterlaced[x] );
     2802      uiSSDV_in   += iDiff * iDiff;
     2803    }
     2804    pOrgInterlaced += iStride;
     2805    pRecInterlaced += iStride;
     2806  }
     2807 
     2808  Int maxvalY = 255 << (g_bitDepthY-8);
     2809  Int maxvalC = 255 << (g_bitDepthC-8);
     2810  Double fRefValueY = (Double) maxvalY * maxvalY * iSize*2;
     2811  Double fRefValueC = (Double) maxvalC * maxvalC * iSize*2 / 4.0;
     2812  dYPSNR_in            = ( uiSSDY_in ? 10.0 * log10( fRefValueY / (Double)uiSSDY_in ) : 99.99 );
     2813  dUPSNR_in            = ( uiSSDU_in ? 10.0 * log10( fRefValueC / (Double)uiSSDU_in ) : 99.99 );
     2814  dVPSNR_in            = ( uiSSDV_in ? 10.0 * log10( fRefValueC / (Double)uiSSDV_in ) : 99.99 );
     2815 
     2816  /* calculate the size of the access unit, excluding:
     2817   *  - any AnnexB contributions (start_code_prefix, zero_byte, etc.,)
     2818   *  - SEI NAL units
     2819   */
     2820  UInt numRBSPBytes = 0;
     2821  for (AccessUnit::const_iterator it = accessUnit.begin(); it != accessUnit.end(); it++)
     2822  {
     2823    UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size());
     2824   
     2825    if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
     2826      numRBSPBytes += numRBSPBytes_nal;
     2827  }
     2828 
     2829  UInt uibits = numRBSPBytes * 8 ;
     2830 
     2831  //===== add PSNR =====
     2832  m_gcAnalyzeAll_in.addResult (dYPSNR_in, dUPSNR_in, dVPSNR_in, (Double)uibits);
     2833 
     2834  printf("\n                                      Interlaced frame %d: [Y %6.4lf dB    U %6.4lf dB    V %6.4lf dB]", pcPicOrgBottom->getPOC()/2 , dYPSNR_in, dUPSNR_in, dVPSNR_in );
     2835 
     2836  pcOrgInterlaced->destroy();
     2837  delete pcOrgInterlaced;
     2838  pcRecInterlaced->destroy();
     2839  delete pcRecInterlaced;
     2840#endif
     2841}
    26442842/** Function for deciding the nal_unit_type.
    26452843 * \param pocCurr POC of the current picture
     
    30023200
    30033201#if H_MV
    3004 #if H_MV5
    30053202Void TEncGOP::xSetRefPicListModificationsMv( std::vector<TComPic*> tempPicLists[2], TComSlice* pcSlice, UInt iGOPid )
    30063203{
     
    30863283  }
    30873284}
    3088 #else
    3089 Void TEncGOP::xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid )
    3090 {
    3091   Int layer    = pcSlice->getLayerIdInVps( );
    3092  
    3093   if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || pcSlice->getNumActiveRefLayerPics() == 0 )
    3094   {
    3095     return;
    3096   }
    3097 
    3098   // analyze inter-view modifications
    3099   GOPEntry ge = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && ( layer > 0) ) ? MAX_GOP : iGOPid );
    3100   assert( ge.m_numActiveRefLayerPics == pcSlice->getNumActiveRefLayerPics() );
    3101  
    3102   Int maxRefListSize  = pcSlice->getNumRpsCurrTempList();
    3103   Int numTemporalRefs = maxRefListSize - pcSlice->getNumActiveRefLayerPics();
    3104 
    3105   for (Int li = 0; li < 2; li ++) // Loop over lists L0 and L1
    3106   {
    3107     // set inter-view modifications   
    3108     Int tempList[16];
    3109     for( Int k = 0; k < 16; k++ )
    3110     {
    3111       tempList[ k ] = -1;
    3112     }
    3113 
    3114     Bool isModified = false;
    3115     if ( maxRefListSize > 1 )
    3116     {
    3117       for( Int k = 0, orgIdx = numTemporalRefs; k < ge.m_numActiveRefLayerPics; k++, orgIdx++ )
    3118       {
    3119           Int targetIdx = ge.m_interViewRefPosL[ li ][ k ];
    3120 
    3121         isModified = ( targetIdx != orgIdx ) && ( targetIdx >= 0  );
    3122         if ( isModified )
    3123             {
    3124           assert( tempList[ targetIdx ] == -1 ); // Assert when two inter layer reference pictures are sorted to the same position
    3125               tempList[ targetIdx ] = orgIdx;             
    3126         }
    3127       }
    3128     }
    3129 
    3130     TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    3131     refPicListModification->setRefPicListModificationFlagL( li, isModified ); 
    3132 
    3133       if( isModified )
    3134       {
    3135         Int temporalRefIdx = 0;
    3136         for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ )
    3137         {
    3138           if( tempList[i] >= 0 )
    3139           {
    3140             refPicListModification->setRefPicSetIdxL( li, i, tempList[i] );
    3141           }
    3142           else
    3143           {
    3144             refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx );
    3145             temporalRefIdx++;
    3146           }
    3147         }
    3148       }
    3149   }
    3150 }
    3151 #endif
    31523285#endif
    31533286//! \}
  • trunk/source/Lib/TLibEncoder/TEncGOP.h

    r622 r655  
    5757#include "TEncAnalyze.h"
    5858#include "TEncRateCtrl.h"
     59#if KWU_RC_MADPRED_E0227
     60#include "../App/TAppEncoder/TAppEncTop.h"
     61#endif
    5962#include <vector>
    6063
     
    99102#if H_MV
    100103  TComPicLists*           m_ivPicLists;
    101 #if H_MV5
    102104  std::vector<TComPic*>   m_refPicSetInterLayer0;
    103105  std::vector<TComPic*>   m_refPicSetInterLayer1;
    104 #else
    105   std::vector<TComPic*>   m_refPicSetInterLayer;
    106 #endif
    107106
    108107  Int                     m_pocLastCoded;
     
    148147#if H_MV
    149148  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
    150   Void  compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid );
     149  Void  compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid, Bool isField, Bool isTff );
    151150#else
    152   Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
     151  Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP, Bool isField, Bool isTff );
    153152#endif
    154153  Void  xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect);
     
    169168
    170169#if !H_MV
    171   Void  printOutSummary      ( UInt uiNumAllPicCoded );
     170  Void  printOutSummary      ( UInt uiNumAllPicCoded , bool isField);
    172171#endif
    173172#if H_3D_VSO
     
    176175  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
    177176#endif
    178  
     177
     178#if KWU_RC_MADPRED_E0227
     179  TEncTop* getEncTop() { return m_pcEncTop; }
     180#endif
     181
    179182  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
    180183  NalUnitType getNalUnitType( Int pocCurr, Int lastIdr );
     
    184187
    185188protected:
     189  Void xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, bool isField );
     190
    186191  Void  xInitGOP          ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut );
    187   Void  xGetBuffer        ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr );
     192  Void  xGetBuffer        ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr, bool isField );
    188193 
    189194  Void  xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime );
     195  Void  xCalculateInterlacedAddPSNR( TComPic* pcPicOrgTop, TComPic* pcPicOrgBottom, TComPicYuv* pcPicRecTop, TComPicYuv* pcPicRecBottom, const AccessUnit& accessUnit, Double dEncTime );
     196
    190197#if H_3D_VSO
    191198  Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
     
    216223  }
    217224#if H_MV
    218 #if H_MV5
    219225   Void  xSetRefPicListModificationsMv( std::vector<TComPic*> tempPicLists[2], TComSlice* pcSlice, UInt iGOPid );
    220 #else
    221    Void  xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid );
    222 #endif
    223226#endif
    224227  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
  • trunk/source/Lib/TLibEncoder/TEncRateCtrl.cpp

    r608 r655  
    537537  m_lastPicture  = NULL;
    538538#endif
     539
     540#if KWU_RC_MADPRED_E0227
     541  m_lastIVPicture = NULL;
     542#endif
     543
    539544  m_picActualHeaderBits = 0;
    540545#if !M0036_RC_IMPROVEMENT
     
    544549  m_picQP               = 0;
    545550  m_picLambda           = 0.0;
     551
     552#if KWU_RC_MADPRED_E0227
     553  m_IVtotalMAD            = 0.0;
     554#endif
    546555}
    547556
     
    621630}
    622631
     632#if KWU_RC_MADPRED_E0227
     633Void TEncRCPic::addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures )
     634{
     635  m_lastIVPicture = NULL;
     636  m_lastIVPicture = this;
     637}
     638
     639Void TEncRCPic::setIVPic( TEncRCPic* BaseRCPic )
     640{
     641  m_lastIVPicture = BaseRCPic;
     642}
     643#endif
     644
     645#if KWU_RC_MADPRED_E0227
     646Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID )
     647#else
    623648Void TEncRCPic::create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures )
     649#endif
    624650{
    625651  destroy();
     
    673699      Int currHeight = ( (j == picHeightInLCU-1) ? picHeight - LCUHeight*(picHeightInLCU-1) : LCUHeight );
    674700      m_LCUs[LCUIdx].m_numberOfPixel = currWidth * currHeight;
     701
     702#if KWU_RC_MADPRED_E0227
     703      m_LCUs[LCUIdx].m_CUWidth = currWidth;
     704      m_LCUs[LCUIdx].m_CUHeight = currHeight;
     705      m_LCUs[LCUIdx].m_IVMAD = -1.0;
     706#endif
    675707    }
    676708  }
     
    683715  m_picLambda           = 0.0;
    684716
     717
     718#if KWU_RC_MADPRED_E0227
     719  m_LayerID = layerID;
     720  m_lastIVPicture = NULL;
     721  m_IVtotalMAD            = 0.0;
     722#endif
     723
     724
    685725#if !M0036_RC_IMPROVEMENT
    686726  m_lastPicture = NULL;
    687727  list<TEncRCPic*>::reverse_iterator it;
     728  for ( it = listPreviousPictures.rbegin(); it != listPreviousPictures.rend(); it++ )
     729  {
     730    if ( (*it)->getFrameLevel() == m_frameLevel )
     731    {
     732      m_lastPicture = (*it);
     733      break;
     734    }
     735  }
     736#endif
     737
     738#if KWU_RC_MADPRED_E0227
     739  list<TEncRCPic*>::reverse_iterator it;
     740  if( m_LayerID != 0)
     741  {
     742    m_lastIVPicture = NULL;
     743    for ( it = listPreviousPictures.rbegin(); it != listPreviousPictures.rend(); it++ )
     744    {
     745      if ( (*it)->getLayerID() == 0 )
     746      {
     747        m_lastIVPicture = (*it);
     748        break;
     749      }
     750    }
     751  }
     752
     753  m_lastPicture = NULL;
    688754  for ( it = listPreviousPictures.rbegin(); it != listPreviousPictures.rend(); it++ )
    689755  {
     
    856922}
    857923
     924
     925#if KWU_RC_MADPRED_E0227
     926Double TEncRCPic::estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int CurPOC )
     927{
     928  Double alpha         = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha;
     929  Double beta          = m_encRCSeq->getPicPara( m_frameLevel ).m_beta;
     930  Double bpp       = (Double)m_targetBits/(Double)m_numberOfPixel;
     931  Double estLambda = alpha * pow( bpp, beta );
     932  Double lastLevelLambda = -1.0;
     933  Double lastPicLambda   = -1.0;
     934  Double lastValidLambda = -1.0;
     935  list<TEncRCPic*>::iterator it;
     936
     937  if(listPreviousPictures.size() == 0 || CurPOC%8 == 0)
     938  {
     939    lastLevelLambda = m_lastIVPicture->getPicActualLambda();
     940    lastPicLambda     = m_lastIVPicture->getPicActualLambda();
     941  }
     942  else
     943  {
     944    for ( it = listPreviousPictures.begin(); it != listPreviousPictures.end(); it++ )
     945    {
     946      if ( (*it)->getFrameLevel() == m_frameLevel )
     947      {
     948        lastLevelLambda = (*it)->getPicActualLambda();
     949      }
     950      lastPicLambda     = (*it)->getPicActualLambda();
     951
     952      if ( lastPicLambda > 0.0 )
     953      {
     954        lastValidLambda = lastPicLambda;
     955      }
     956    }
     957  }
     958
     959  if ( lastLevelLambda > 0.0 )
     960  {
     961    lastLevelLambda = Clip3( 0.1, 10000.0, lastLevelLambda );
     962    estLambda = Clip3( lastLevelLambda * pow( 2.0, -3.0/3.0 ), lastLevelLambda * pow( 2.0, 3.0/3.0 ), estLambda );
     963  }
     964
     965  if ( lastPicLambda > 0.0 )
     966  {
     967    lastPicLambda = Clip3( 0.1, 2000.0, lastPicLambda );
     968    estLambda = Clip3( lastPicLambda * pow( 2.0, -10.0/3.0 ), lastPicLambda * pow( 2.0, 10.0/3.0 ), estLambda );
     969  }
     970  else if ( lastValidLambda > 0.0 )
     971  {
     972    lastValidLambda = Clip3( 0.1, 2000.0, lastValidLambda );
     973    estLambda = Clip3( lastValidLambda * pow(2.0, -10.0/3.0), lastValidLambda * pow(2.0, 10.0/3.0), estLambda );
     974  }
     975  else
     976  {
     977    estLambda = Clip3( 0.1, 10000.0, estLambda );
     978  }
     979
     980  if ( estLambda < 0.1 )
     981  {
     982    estLambda = 0.1;
     983  }
     984
     985  m_estPicLambda = estLambda;
     986  return estLambda;
     987}
     988#endif
     989
     990
    858991#if RATE_CONTROL_INTRA
    859992Double TEncRCPic::getLCUTargetBpp(SliceType eSliceType) 
     
    9371070}
    9381071
     1072
     1073#if KWU_RC_MADPRED_E0227
     1074Double TEncRCPic::getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity )
     1075{
     1076  Int   LCUIdx    = getLCUCoded();
     1077  Double bpp      = -1.0;
     1078  Int avgBits     = 0;
     1079#if !M0036_RC_IMPROVEMENT
     1080  Double totalMAD = -1.0;
     1081  Double MAD      = -1.0;
     1082#endif
     1083
     1084  Double totalMAD = -1.0;
     1085  Double MAD      = -1.0;
     1086
     1087  Double IVMAD      = -1.0;
     1088  Double SAD = 0.0;
     1089  Int     x, y;
     1090  Int Sum = 0;
     1091
     1092  {
     1093    Pel*  pOrg    = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);
     1094    Pel*  pRec    = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), 0);
     1095    Pel*  pDep    = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);
     1096    Int   iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride();
     1097
     1098    Int   width  = m_LCUs[ LCUIdx ].m_CUWidth;
     1099    Int   height = m_LCUs[ LCUIdx ].m_CUHeight;
     1100
     1101    for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8)
     1102    {
     1103      for( x = 0 ; x < pcCU->getSlice()->getSPS()->getMaxCUWidth() ; x+=8)
     1104      {
     1105        Sum += pDep[x];
     1106      }
     1107      pDep += iStride;
     1108    }
     1109
     1110    Double AvgDepth = (Double)Sum/((pcCU->getSlice()->getSPS()->getMaxCUHeight()/8)*(pcCU->getSlice()->getSPS()->getMaxCUWidth()/8));
     1111
     1112    Double fL = focalLen * abs( basePos - curPos );
     1113    Double z  = abs( 1.0 / znear - 1.0 / zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / zfar);
     1114    *disparity = (Int)(direction*fL * z);
     1115    Int shift = DISTORTION_PRECISION_ADJUSTMENT(g_bitDepthY-8);
     1116
     1117    Int disp = *disparity;
     1118    Int posX, posY;
     1119    pcCU->getPosInPic(0, posX, posY);
     1120    if((posX + *disparity) < 0 || (posX + *disparity + width) >= pcCU->getSlice()->getSPS()->getMaxCUWidth())
     1121    {
     1122      disp = 0;
     1123    }
     1124
     1125    for( y = 0; y < height; y++ )
     1126    {
     1127      for( x = 0; x < width; x++ )
     1128      {
     1129        SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)]
     1130                  - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] )>>shift;
     1131      }
     1132      pOrg += iStride;
     1133      pRec += iStride;
     1134    }
     1135    IVMAD = SAD / (Double)(height * width);
     1136    IVMAD = IVMAD * IVMAD;
     1137
     1138    m_LCUs[ LCUIdx ].m_IVMAD = IVMAD;
     1139    if(m_lastPicture)
     1140    {
     1141      m_LCUs[ LCUIdx ].m_MAD = m_lastPicture->getLCU(LCUIdx).m_MAD;
     1142    }
     1143
     1144    MAD = m_LCUs[ LCUIdx ].m_IVMAD;
     1145
     1146    if(m_lastPicture)
     1147    {
     1148      totalMAD = m_lastPicture->getTotalMAD();      // get total MAD of temporal frame
     1149      for ( Int i=0; i<LCUIdx; i++ )
     1150      {
     1151        totalMAD -= m_lastPicture->getLCU(i).m_MAD;
     1152      }
     1153    }
     1154    else
     1155    {
     1156      totalMAD = m_lastIVPicture->getTotalMAD();      // get total MAD of inter-view frame
     1157      for ( Int i=0; i<LCUIdx; i++ )
     1158      {
     1159        totalMAD -= m_lastIVPicture->getLCU(i).m_MAD;
     1160      }
     1161    }
     1162
     1163
     1164    if ( totalMAD > 0.1 )
     1165    {
     1166      avgBits = Int( (m_bitsLeft * MAD) / totalMAD );
     1167    }
     1168    else
     1169    {
     1170      avgBits = Int( (m_bitsLeft) / m_LCULeft );
     1171    }
     1172  }
     1173
     1174  if ( avgBits < 5 )
     1175  {
     1176    avgBits = 5;
     1177  }
     1178
     1179  bpp = ( Double )avgBits/( Double )m_LCUs[ LCUIdx ].m_numberOfPixel;
     1180  m_LCUs[ LCUIdx ].m_targetBits = avgBits;
     1181
     1182  return bpp;
     1183}
     1184#endif
     1185
     1186
     1187
     1188
    9391189Double TEncRCPic::getLCUEstLambda( Double bpp )
    9401190{
     
    11851435  }
    11861436  m_picLambda           = averageLambda;
    1187 #if !M0036_RC_IMPROVEMENT
     1437#if !M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227
     1438#if KWU_RC_MADPRED_E0227
     1439  m_totalMAD = 0;
     1440#endif
    11881441  for ( Int i=0; i<m_numberOfLCU; i++ )
    11891442  {
     
    13931646
    13941647#if M0036_RC_IMPROVEMENT
     1648#if KWU_RC_MADPRED_E0227
     1649Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry  GOPList[MAX_GOP], Int layerID )
     1650#else
    13951651Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry  GOPList[MAX_GOP] )
     1652#endif
    13961653#else
    13971654Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry  GOPList[MAX_GOP] )
     
    16071864  }
    16081865
     1866#if KWU_RC_MADPRED_E0227
     1867  setLayerID(layerID);
     1868#endif
     1869
    16091870  delete[] bitsRatio;
    16101871  delete[] GOPID2Level;
     
    16141875{
    16151876  m_encRCPic = new TEncRCPic;
     1877#if KWU_RC_MADPRED_E0227
     1878  m_encRCPic->create( m_encRCSeq, m_encRCGOP, frameLevel, m_listRCPictures, m_LayerID );
     1879#else
    16161880  m_encRCPic->create( m_encRCSeq, m_encRCGOP, frameLevel, m_listRCPictures );
     1881#endif
    16171882}
    16181883
     
    18152080  m_sourceHeightInLCU        = (sourceHeight / maxCUHeight) + (( sourceHeight %  maxCUHeight) ? 1 : 0); 
    18162081  m_isLowdelay               = (sizeIntraPeriod == -1) ? true : false;
     2082
    18172083  m_prevBitrate              = ( targetKbps << 10 );  // in units of 1,024 bps
    18182084  m_currBitrate              = ( targetKbps << 10 );
     2085
    18192086  m_frameRate                = frameRate;
    18202087  m_refFrameNum              = m_isLowdelay ? (sizeGOP) : (sizeGOP>>1);
     
    22122479}
    22132480
     2481
     2482#if KWU_RC_MADPRED_E0227
     2483Void  TEncRateCtrl::updateLCUDataEnhancedView(TComDataCU* pcCU, UInt64 uiBits, Int qp, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction)
     2484{
     2485  Int     x, y;
     2486  Double dMAD = 0.0;
     2487  Int Sum = 0;
     2488  Double SAD = 0.0;
     2489
     2490  Pel*  pOrg    = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);
     2491  Pel*  pRec    = pcCU->getSlice()->getIvPic(false, 0)->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), 0);
     2492  Pel*  pDep    = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);
     2493  Int   iStride = pcCU->getSlice()->getIvPic(true, pcCU->getSlice()->getViewIndex())->getPicYuvOrg()->getStride();
     2494
     2495  Int   width  = m_pcLCUData[m_indexLCU].m_widthInPixel;
     2496  Int   height = m_pcLCUData[m_indexLCU].m_heightInPixel;
     2497
     2498  for( y = 0 ; y < pcCU->getSlice()->getSPS()->getMaxCUHeight() ; y+=8)
     2499  {
     2500    for( x = 0 ; x < pcCU->getSlice()->getSPS()->getMaxCUWidth() ; x+=8)
     2501    {
     2502      Sum += pDep[x];
     2503    }
     2504    pDep += iStride;
     2505  }
     2506
     2507  Double AvgDepth = (Double)Sum/((pcCU->getSlice()->getSPS()->getMaxCUHeight()/8)*(pcCU->getSlice()->getSPS()->getMaxCUWidth()/8));
     2508  Double fL = focalLen * abs( basePos - curPos );
     2509  Double z  = abs( 1.0 / znear - 1.0 / zfar ) * ((Double)(AvgDepth) / (( 1 << g_bitDepthY ) - 1) ) + abs(1.0 / zfar);
     2510  Int   disparity = (Int)(direction*fL * z);
     2511  Int shift = DISTORTION_PRECISION_ADJUSTMENT(g_bitDepthY-8);
     2512  Int disp = disparity;
     2513
     2514  for( y = 0; y < height; y++ )
     2515  {
     2516    for( x = 0; x < width; x++ )
     2517    {
     2518      SAD += abs( pOrg[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)]
     2519      - pRec[Clip3(0, (Int)(pcCU->getPic()->getPicYuvOrg()->getWidth() - pcCU->getSlice()->getSPS()->getMaxCUWidth()), x + disp)] )>>shift;
     2520    }
     2521    pOrg += iStride;
     2522    pRec += iStride;
     2523  }
     2524  m_pcLCUData[m_indexLCU].m_qp   = qp;
     2525  m_pcLCUData[m_indexLCU].m_costMAD  = (SAD /(Double)(width*height));
     2526  m_pcLCUData[m_indexLCU].m_bits = (Int)uiBits;
     2527}
     2528#endif
     2529
     2530
    22142531Double TEncRateCtrl::xAdjustmentBits(Int& reductionBits, Int& compensationBits)
    22152532{
  • trunk/source/Lib/TLibEncoder/TEncRateCtrl.h

    r608 r655  
    9898  Int m_targetBitsLeft;
    9999#endif
     100
     101#if KWU_RC_MADPRED_E0227
     102  Double m_MAD;
     103
     104  Int m_CUWidth;
     105  Int m_CUHeight;
     106  Double m_IVMAD;
     107#endif
    100108};
    101109
     
    248256
    249257public:
     258#if KWU_RC_MADPRED_E0227
     259  Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID );
     260#else
    250261  Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures );
     262#endif
    251263  Void destroy();
    252264
     265#if KWU_RC_MADPRED_E0227
     266  Double estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int curPOC );
     267#endif
    253268#if !RATE_CONTROL_INTRA
    254269  Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures );
     
    267282  Double getLCUTargetBpp();
    268283#endif
     284
     285#if KWU_RC_MADPRED_E0227
     286  Double getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity );
     287#endif
     288
    269289  Double getLCUEstLambda( Double bpp );
    270290  Int    getLCUEstQP( Double lambda, Int clipPicQP );
     
    282302
    283303  Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures );
     304
     305#if KWU_RC_MADPRED_E0227
     306  Void addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures );
     307  Void setIVPic( TEncRCPic* baseRCPic );
     308#endif
     309
    284310#if !M0036_RC_IMPROVEMENT
    285311  Double getEffectivePercentage();
     
    322348#endif
    323349
     350#if KWU_RC_MADPRED_E0227
     351  Double getTotalMAD()                                    { return m_totalMAD; }
     352  Void   setTotalMAD( Double MAD )                        { m_totalMAD = MAD; }
     353
     354  Double getIVTotalMAD()                                    { return m_IVtotalMAD; }
     355  Void   setIVTotalMAD( Double MAD )                        { m_IVtotalMAD = MAD; }
     356#endif
     357
    324358  Int  getPicActualBits()                                 { return m_picActualBits; }
    325359  Int  getPicActualQP()                                   { return m_picQP; }
     
    330364  Void setPicEstLambda( Double lambda )                   { m_picLambda = lambda; }
    331365
     366#if KWU_RC_MADPRED_E0227
     367  Int getLayerID()                                         { return m_LayerID; }
     368  Void setLayerID(Int layerid)                              { m_LayerID = layerid; }
     369#endif
     370
    332371private:
    333372  TEncRCSeq* m_encRCSeq;
     
    361400  TEncRCPic* m_lastPicture;
    362401#endif
     402
     403#if KWU_RC_MADPRED_E0227
     404  Double m_totalMAD;
     405  TEncRCPic* m_lastPicture;
     406  Int m_LayerID;
     407  TEncRCPic* m_lastIVPicture;
     408  Double m_IVtotalMAD;
     409#endif
    363410};
    364411
     
    371418public:
    372419#if M0036_RC_IMPROVEMENT
     420#if KWU_RC_MADPRED_E0227
     421  Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int layerID );
     422#else
    373423  Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] );
     424#endif
    374425#else
    375426  Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] );
     
    388439  list<TEncRCPic*>& getPicList() { return m_listRCPictures; }
    389440
     441#if KWU_RC_MADPRED_E0227
     442  Int getLayerID()                { return m_LayerID; }
     443  Void setLayerID(Int layerid)     { m_LayerID = layerid; }
     444#endif
     445
    390446private:
    391447  TEncRCSeq* m_encRCSeq;
     
    394450  list<TEncRCPic*> m_listRCPictures;
    395451  Int        m_RCQP;
     452
     453#if KWU_RC_MADPRED_E0227
     454  Int m_LayerID;
     455#endif
    396456};
    397457
     
    518578  Void          updataRCUnitStatus    ();
    519579  Void          updateLCUData         (TComDataCU* pcCU, UInt64 actualLCUBits, Int qp);
     580#if KWU_RC_MADPRED_E0227
     581  Void          updateLCUDataEnhancedView(TComDataCU* pcCU, UInt64 uiBits, Int qp, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction);
     582#endif
    520583  Void          updateFrameData       (UInt64 actualFrameBits);
    521584  Double        xAdjustmentBits       (Int& reductionBits, Int& compensationBits);
  • trunk/source/Lib/TLibEncoder/TEncSbac.cpp

    r622 r655  
    9595#if H_3D_DIM_DMM
    9696, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    97 #if !SEC_DMM2_E0146_HHIFIX
    98 , m_cDmm2DataSCModel          ( 1,             1,               NUM_DMM2_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    99 #endif
    10097, m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    10198#endif
     
    108105#endif
    109106#endif
    110 #if LGE_INTER_SDC_E0156
     107#if H_3D_INTER_SDC
    111108, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    112109, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
     
    177174#if H_3D_DIM_DMM
    178175  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
    179 #if !SEC_DMM2_E0146_HHIFIX
    180   m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
    181 #endif
    182176  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
    183177#endif
     
    190184#endif
    191185#endif
    192 #if LGE_INTER_SDC_E0156
     186#if H_3D_INTER_SDC
    193187  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    194188  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     
    232226      curCost += m_cCUICFlagSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_IC_FLAG );
    233227#endif
    234 #if LGE_INTER_SDC_E0156
     228#if H_3D_INTER_SDC
    235229      curCost += m_cInterSDCFlagSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    236230      curCost += m_cInterSDCResidualSCModel.calcCost  ( curSliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     
    268262#if H_3D_DIM_DMM
    269263      curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
    270 #if !SEC_DMM2_E0146_HHIFIX
    271       curCost += m_cDmm2DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM2_DATA );
    272 #endif
    273264      curCost += m_cDmm3DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM3_DATA );
    274265#endif
     
    340331#if H_3D_DIM_DMM
    341332  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
    342 #if !SEC_DMM2_E0146_HHIFIX
    343   m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
    344 #endif
    345333  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
    346334#endif
     
    353341#endif
    354342#endif
    355 #if LGE_INTER_SDC_E0156
     343#if H_3D_INTER_SDC
    356344  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    357345  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     
    548536  }
    549537}
    550 
    551 #if !SEC_DMM2_E0146_HHIFIX
    552 Void TEncSbac::xCodeDmm2Offset( Int iOffset )
    553 {
    554   if( DMM2_DELTAEND_MAX > 0 )
    555   {
    556     m_pcBinIf->encodeBin( (iOffset != 0) , m_cDmm2DataSCModel.get(0, 0, 0) );
    557     if( iOffset != 0 )
    558     {
    559       UInt uiAbsValMinus1 = abs(iOffset)-1;
    560       m_pcBinIf->encodeBin( (uiAbsValMinus1 & 0x01),      m_cDmm2DataSCModel.get(0, 0, 0) );
    561       m_pcBinIf->encodeBin( (uiAbsValMinus1 & 0x02) >> 1, m_cDmm2DataSCModel.get(0, 0, 0) );
    562 
    563       UInt uiSign = (iOffset > 0) ? 0 : 1;
    564       m_pcBinIf->encodeBinEP( uiSign );
    565     }
    566   }
    567 }
    568 #endif
    569538
    570539Void TEncSbac::xCodeDmm3WedgeIdx( UInt uiIntraIdx, Int iNumBit )
     
    12401209      xCodeDmm1WedgeIdx( pcCU->getDmmWedgeTabIdx( dimType, absPartIdx ), g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
    12411210    } break;
    1242 #if !SEC_DMM2_E0146_HHIFIX
    1243   case( DMM2_IDX ):
    1244     {
    1245       xCodeDmm2Offset( pcCU->getDmm2DeltaEnd( absPartIdx ) );
    1246     } break;
    1247 #endif
    12481211  case( DMM3_IDX ):
    12491212    {
     
    12941257Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
    12951258{
    1296 #if ZJU_DEPTH_INTRA_MODE_E0204
    12971259    UInt codeWordTable[3][7] =    {{0, 0, 0, 2, 0,6, 7},{0, 0, 2, 7, 3, 6, 2},{0, 1, 0, 0, 0, 0, 0}};
    12981260    UInt codeWordLenTable[3][7] = {{0, 1, 0, 2, 0,3, 3},{1, 1, 2, 3, 2, 3, 2},{1, 1, 0, 0, 0, 0, 0}};
    1299 #else
    1300 #if LGE_SDC_REMOVE_DC_E0158
    1301 #if SEC_DMM2_E0146_HHIFIX
    1302   UInt codeWordTable[3][7] =    {{0, 0, 0, 2, 0,6, 7},{0, 2, 3, 4, 5, 6, 7},{0, 1, 0, 0, 0, 0, 0}};
    1303   UInt codeWordLenTable[3][7] = {{0, 1, 0, 2, 0,3, 3},{2, 3, 3, 3, 3, 3, 3},{1, 1, 0, 0, 0, 0, 0}};
    1304 #else
    1305   UInt codeWordTable[3][8] =    { { 0, 0, 0, 2, 0, 6, 0, 7 }, { 0, 2, 3, 4, 5, 6, 15, 14 }, { 0, 1, 0, 0, 0, 0, 0, 0 } };
    1306   UInt codeWordLenTable[3][8] = { { 0, 1, 0, 2, 0, 3, 0, 3 }, { 2, 3, 3, 3, 3, 3,  4,  4 }, { 1, 1, 0, 0, 0, 0, 0, 0 } };
    1307 #endif
    1308 #else
    1309 #if SEC_DMM2_E0146_HHIFIX
    1310   UInt codeWordTable[3][8] =    {{0, 0, 0, 2, 0,6, 0, 7},{0, 2, 3, 4, 5, 6, 14, 15},{0, 2, 0, 0, 0, 0, 3, 0}};
    1311   UInt codeWordLenTable[3][8] = {{0, 1, 0, 2, 0,3, 0, 3},{2, 3, 3, 3, 3, 3,  4,  4},{1, 2, 0, 0, 0, 0, 2, 0}};
    1312 #else
    1313   UInt codeWordTable[3][9] =    {{0, 0, 0, 2, 0,6, 0, 0, 7},{0, 2, 3, 4, 5, 6, 14, 31, 30},{0, 2, 0, 0, 0, 0, 3, 0, 0}};
    1314   UInt codeWordLenTable[3][9] = {{0, 1, 0, 2, 0,3, 0, 0, 3},{2, 3, 3, 3, 3, 3,  4,  5,  5},{1, 2, 0, 0, 0, 0, 2, 0, 0}};
    1315 #endif
    1316 #endif
    1317 #endif
    13181261  UInt dir = pcCU->getLumaIntraDir( absPartIdx );
    13191262  UInt puIdx = (pcCU->getWidth(absPartIdx) == 64) ? 2 : ( (pcCU->getPartitionSize(absPartIdx) == SIZE_NxN && pcCU->getWidth(absPartIdx) == 8) ? 0 : 1 );
     
    13311274    case DMM4_IDX: codeIdx = 4; break;
    13321275    case DMM3_IDX: codeIdx = 5; break;
    1333 #if LGE_SDC_REMOVE_DC_E0158
    1334 #if SEC_DMM2_E0146_HHIFIX
    13351276    case  RBC_IDX: codeIdx = 6; break;
    1336 #else
    1337     case DMM2_IDX: codeIdx = 6; break;
    1338     case  RBC_IDX: codeIdx = 7; break;
    1339 #endif
    1340 #else
    1341 #if SEC_DMM2_E0146_HHIFIX
    1342     case  RBC_IDX: codeIdx = 7; break;
    1343 #else
    1344     case DMM2_IDX: codeIdx = 7; break;
    1345     case  RBC_IDX: codeIdx = 8; break;
    1346 #endif
    1347 #endif
    13481277    default:                    break;
    13491278    }
     
    13561285    {
    13571286      case PLANAR_IDX:  codeIdx = 0; break;
    1358 #if !LGE_SDC_REMOVE_DC_E0158
    1359       case DC_IDX:      codeIdx = 6; break;
    1360 #endif
    13611287      default:          codeIdx = 2; break;
    13621288    }
    13631289  }
    13641290#endif
    1365 #if ZJU_DEPTH_INTRA_MODE_E0204
    13661291  if( puIdx==1 )
    13671292  {
     
    13751300      }
    13761301  }
    1377 #endif
    13781302  //mode coding
    13791303  for( UInt i = 0; i < codeWordLenTable[puIdx][codeIdx]; i++ )
     
    23042228}
    23052229
    2306 #if LGE_INTER_SDC_E0156
     2230#if H_3D_INTER_SDC
    23072231Void TEncSbac::codeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
    23082232{
  • trunk/source/Lib/TLibEncoder/TEncSbac.h

    r622 r655  
    121121#if H_3D_DIM_DMM
    122122  Void  xCodeDmm1WedgeIdx    ( UInt uiTabIdx, Int iNumBit );
    123 #if !SEC_DMM2_E0146_HHIFIX
    124   Void  xCodeDmm2Offset      ( Int iOffset );
    125 #endif
    126123  Void  xCodeDmm3WedgeIdx    ( UInt uiIntraIdx, Int iNumBit );
    127124#endif
     
    160157  Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    161158#endif
    162 #if LGE_INTER_SDC_E0156
     159#if H_3D_INTER_SDC
    163160  Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    164161  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
     
    256253#if H_3D_DIM_DMM
    257254  ContextModel3DBuffer m_cDmm1DataSCModel;
    258 #if !SEC_DMM2_E0146_HHIFIX
    259   ContextModel3DBuffer m_cDmm2DataSCModel;
    260 #endif
    261255  ContextModel3DBuffer m_cDmm3DataSCModel;
    262256#endif
     
    269263#endif
    270264#endif
    271 #if LGE_INTER_SDC_E0156
     265#if H_3D_INTER_SDC
    272266  ContextModel3DBuffer m_cInterSDCFlagSCModel;
    273267  ContextModel3DBuffer m_cInterSDCResidualSCModel;
  • trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r622 r655  
    4141#include "TEncSearch.h"
    4242#include <math.h>
    43 #if LGE_INTER_SDC_E0156
     43#if H_3D_INTER_SDC
    4444#include <memory.h>
    4545#endif
     
    323323  m_cDistParam.bUseIC = pcPatternKey->getICFlag();
    324324#endif
    325 #if LGE_INTER_SDC_E0156
     325#if H_3D_INTER_SDC
    326326  m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();
    327327#endif
     
    755755    m_cDistParam.bUseIC = pcPatternKey->getICFlag();
    756756#endif
    757 #if LGE_INTER_SDC_E0156
     757#if H_3D_INTER_SDC
    758758    m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();
    759759#endif
     
    19001900  // get DC prediction for each segment
    19011901  Pel apDCPredValues[2];
    1902 #if KWU_SDC_SIMPLE_DC_E0117
    19031902  analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode );
    1904 #else
    1905   analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride );
    1906 #endif
    19071903 
    19081904  // get original DC for each segment
    19091905  Pel apDCOrigValues[2];
    1910 #if KWU_SDC_SIMPLE_DC_E0117
    19111906  analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode, true );
    1912 #else
    1913   analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride );
    1914 #endif
    19151907 
    19161908  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
     
    28512843    {
    28522844
    2853 #if SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     2845#if H_3D_FAST_DEPTH_INTRA
    28542846      Int  threshold    = max(((pcCU->getQP(0))>>3)-1,3);
    28552847      Int  varThreshold = (Int)( threshold * threshold - 8 );
     
    28592851#if H_3D_DIM_DMM
    28602852      if( m_pcEncCfg->getUseDMM()
    2861 #if SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     2853#if H_3D_FAST_DEPTH_INTRA
    28622854         && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
    28632855#endif
     
    28662858        for( UInt dmmType = 0; dmmType < DMM_NUM_TYPE; dmmType++ )
    28672859        {
     2860#if H_3D_FCO
     2861            TComPic* picTexture  = pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() );
     2862            if ( !picTexture->getReconMark() && (DMM3_IDX == dmmType || DMM4_IDX == dmmType ) )
     2863            {
     2864                continue;
     2865            }
     2866#endif
    28682867          UInt uiTabIdx = 0;
    28692868          TComWedgelet* biSegmentation = NULL;
     
    28772876              biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
    28782877            } break;
    2879 #if !SEC_DMM2_E0146_HHIFIX
    2880           case( DMM2_IDX ):
    2881             {
    2882               if( uiWidth > 4 )
    2883               {
    2884                 Int dmm2DeltaEnd = 0;
    2885                 xSearchDmm2Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx, dmm2DeltaEnd );
    2886                 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth );
    2887                 pcCU->setDmm2DeltaEndSubParts( dmm2DeltaEnd, uiPartOffset, uiDepth + uiInitTrDepth );
    2888                 biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
    2889               }
    2890             } break;
    2891 #endif
    28922878          case( DMM3_IDX ):
    28932879            {
    2894 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
     2880
    28952881              TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
    28962882              TComDataCU* pcColTexCU = pcPicTex->getCU( pcCU->getAddr() );
     
    29002886              if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 )
    29012887              {
    2902 #endif
    2903               UInt uiIntraTabIdx = 0;
    2904 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
     2888             UInt uiIntraTabIdx = 0;
    29052889              xSearchDmm3Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx, uiIntraTabIdx, uiColTexIntraDir );
    2906 #else
    2907               xSearchDmm3Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx, uiIntraTabIdx );
    2908 #endif
    29092890              pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth );
    29102891              pcCU->setDmm3IntraTabIdxSubParts( uiIntraTabIdx, uiPartOffset, uiDepth + uiInitTrDepth );
    29112892              biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
    2912 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    29132893              }
    2914 #endif
    29152894            } break;
    29162895          case( DMM4_IDX ):
     
    29412920#if H_3D_DIM_RBC
    29422921      if( m_pcEncCfg->getUseRBC()
    2943 #if SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     2922#if H_3D_FAST_DEPTH_INTRA
    29442923          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
    29452924#endif
     
    35813560  cDistParam.bUseIC = false;
    35823561#endif
    3583 #if LGE_INTER_SDC_E0156
     3562#if H_3D_INTER_SDC
    35843563  cDistParam.bUseSDCMRSAD = false;
    35853564#endif
     
    37243703 */
    37253704#if AMP_MRG
    3726 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     3705#if  H_3D_FAST_TEXTURE_ENCODING
    37273706Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bFMD, Bool bUseRes, Bool bUseMRG )
    37283707#else
     
    38363815#if AMP_MRG
    38373816    Bool bTestNormalMC = true;
    3838 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     3817#if  H_3D_FAST_TEXTURE_ENCODING
    38393818    if (bFMD||( bUseMRG && pcCU->getWidth( 0 ) > 8 && iNumPart == 2 ))
    38403819#else           
     
    47064685  pcPatternKey->setICFlag( bICFlag );
    47074686#endif
    4708 #if LGE_INTER_SDC_E0156
     4687#if H_3D_INTER_SDC
    47094688  if ( pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
    47104689  {
     
    48624841      m_cDistParam.bUseIC = pcPatternKey->getICFlag();
    48634842#endif
    4864 #if LGE_INTER_SDC_E0156
     4843#if H_3D_INTER_SDC
    48654844      m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();
    48664845#endif
     
    54715450}
    54725451
    5473 #if LGE_INTER_SDC_E0156
     5452#if H_3D_INTER_SDC
    54745453Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, const UInt uiDepth )
    54755454{
     
    67946773    m_pcEntropyCoder->encodeARPW( pcCU , 0 );
    67956774#endif
    6796 #if LGE_INTER_SDC_E0156
     6775#if H_3D_INTER_SDC
    67976776    m_pcEntropyCoder->encodeInterSDCFlag( pcCU, 0, true );
    67986777#endif
     
    70457024}
    70467025
     7026#if H_3D_DIM
    70477027  // -------------------------------------------------------------------------------------------------------------------
    70487028  // Depth intra search
    70497029  // -------------------------------------------------------------------------------------------------------------------
    7050 #if H_3D_DIM
    70517030Void TEncSearch::xCalcBiSegDCs( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2 )
    70527031{
     
    73217300}
    73227301
    7323 #if !SEC_DMM2_E0146_HHIFIX
    7324 Void TEncSearch::xSearchDmm2Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd )
    7325 {
    7326   ruiTabIdx       = 0;
    7327   riWedgeDeltaEnd = 0;
    7328 
    7329   // local pred buffer
    7330   TComYuv cPredYuv;
    7331   cPredYuv.create( uiWidth, uiHeight );
    7332   cPredYuv.clear();
    7333 
    7334   UInt uiPredStride = cPredYuv.getStride();
    7335   Pel* piPred       = cPredYuv.getLumaAddr();
    7336 
    7337 
    7338   // regular wedge search
    7339   Dist uiBestDist    = RDO_DIST_MAX;
    7340   UInt uiBestTabIdx  = 0;
    7341   Int  iBestDeltaEnd = 0;
    7342 
    7343   UInt uiIdx = 0;
    7344   Pel refDC1 = 0; Pel refDC2 = 0;
    7345   for( Int iTestDeltaEnd = -DMM2_DELTAEND_MAX; iTestDeltaEnd <= DMM2_DELTAEND_MAX; iTestDeltaEnd++ )
    7346   {
    7347     uiIdx = xPredWedgeFromIntra( pcCU, uiAbsPtIdx, uiWidth, uiHeight, iTestDeltaEnd );
    7348     TComWedgelet* pcWedgelet = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiIdx]);
    7349     xCalcBiSegDCs  ( piRef,  uiRefStride,  pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7350     xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7351 
    7352     Dist uiActDist = RDO_DIST_MAX;
    7353 #if H_3D_VSO
    7354     if( m_pcRdCost->getUseVSO() )
    7355     {
    7356       if( m_pcRdCost->getUseEstimatedVSD() )
    7357       {
    7358         uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );
    7359       }
    7360       else
    7361       {
    7362         uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false );
    7363       }
    7364     }
    7365     else
    7366 #endif
    7367     {
    7368       uiActDist = m_pcRdCost->getDistPart( g_bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, TEXT_LUMA, DF_SAD );
    7369     }
    7370 
    7371     if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
    7372     {
    7373       uiBestDist    = uiActDist;
    7374       uiBestTabIdx  = uiIdx;
    7375       iBestDeltaEnd = iTestDeltaEnd;
    7376     }
    7377     else if( uiIdx == uiBestTabIdx && abs(iTestDeltaEnd) < abs(iBestDeltaEnd) )
    7378     {
    7379       iBestDeltaEnd = iTestDeltaEnd;
    7380     }
    7381   }
    7382 
    7383   ruiTabIdx       = uiBestTabIdx;
    7384   riWedgeDeltaEnd = iBestDeltaEnd;
    7385 
    7386   cPredYuv.destroy();
    7387   return;
    7388 }
    7389 #endif
    7390 
    7391 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    73927302Void TEncSearch::xSearchDmm3Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx, UInt colTexIntraDir )
    73937303{
     
    74267336  cPredYuv.destroy();
    74277337}
    7428 #else
    7429 Void TEncSearch::xSearchDmm3Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx )
    7430 {
    7431   ruiTabIdx       = 0;
    7432   ruiIntraTabIdx  = 0;
    7433 
    7434   // local pred buffer
    7435   TComYuv cPredYuv;
    7436   cPredYuv.create( uiWidth, uiHeight );
    7437   cPredYuv.clear();
    7438   Pel* piPred = cPredYuv.getLumaAddr();
    7439   UInt uiPredStride = cPredYuv.getStride();
    7440 
    7441   // wedge search
    7442   UInt uiBestDist = MAX_UINT;
    7443   WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
    7444   Pel refDC1 = 0; Pel refDC2 = 0;
    7445 
    7446   TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
    7447   assert( pcPicTex != NULL );
    7448   TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr());
    7449   UInt      uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPtIdx;
    7450   Int   uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
    7451 
    7452   std::vector< std::vector<UInt> > pauiWdgLstSz = g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]];
    7453   if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 )
    7454   {
    7455     std::vector<UInt>* pauiWdgLst = &pauiWdgLstSz[uiColTexIntraDir-2];
    7456     for( UInt uiIdxW = 0; uiIdxW < pauiWdgLst->size(); uiIdxW++ )
    7457     {
    7458       UInt uiIdx     =   pauiWdgLst->at(uiIdxW);
    7459       TComWedgelet* pcWedgelet = &(pacWedgeList->at(uiIdx));
    7460       xCalcBiSegDCs  ( piRef,  uiRefStride,  pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7461       xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7462 
    7463       UInt uiActDist = m_pcRdCost->getDistPart( g_bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, TEXT_LUMA, DF_SAD );
    7464       if( uiActDist < uiBestDist || uiBestDist == MAX_UINT )
    7465       {
    7466         uiBestDist     = uiActDist;
    7467         ruiTabIdx      = uiIdx;
    7468         ruiIntraTabIdx = uiIdxW;
    7469       }
    7470     }
    7471   }
    7472   else
    7473   {
    7474     WedgeNodeList* pacWedgeNodeList = &g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])];
    7475     UInt uiBestNodeDist = MAX_UINT;
    7476     UInt uiBestNodeId   = 0;
    7477     for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ )
    7478     {
    7479       TComWedgelet* pcWedgelet = &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx()));
    7480       xCalcBiSegDCs  ( piRef,  uiRefStride,  pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7481       xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7482 
    7483       UInt uiActDist = m_pcRdCost->getDistPart( g_bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, TEXT_LUMA, DF_SAD );
    7484       if( uiActDist < uiBestNodeDist || uiBestNodeDist == MAX_UINT )
    7485       {
    7486         uiBestNodeDist = uiActDist;
    7487         uiBestNodeId   = uiNodeId;
    7488         ruiIntraTabIdx = uiNodeId;
    7489       }
    7490     }
    7491     ruiTabIdx = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx();
    7492   }
    7493 
    7494   cPredYuv.destroy();
    7495 }
    7496 #endif
     7338
    74977339#endif
    74987340#if H_3D_DIM_RBC
  • trunk/source/Lib/TLibEncoder/TEncSearch.h

    r622 r655  
    196196                                  TComYuv*&   rpcResiYuv,
    197197                                  TComYuv*&   rpcRecoYuv,
    198 #if MTK_FAST_TEXTURE_ENCODING_E0173
     198#if H_3D_FAST_TEXTURE_ENCODING
    199199                                  Bool        bFMD,
    200200#endif
     
    213213                                  TComYuv*&   rpcYuvRec,
    214214                                  Bool        bSkipRes );
    215 #if LGE_INTER_SDC_E0156
     215#if H_3D_INTER_SDC
    216216  Void encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU,
    217217    TComYuv* pcOrg,
     
    343343                                    UInt         stateU0V1Both2 );
    344344
    345 
     345#if H_3D_DIM
    346346  // -------------------------------------------------------------------------------------------------------------------
    347347  // Depth intra search
    348348  // -------------------------------------------------------------------------------------------------------------------
    349 #if H_3D_DIM
    350349  Void xCalcBiSegDCs              ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2 );
    351350#if H_3D_DIM_DMM
    352351  Void xSearchDmmDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
    353352  Void xSearchDmm1Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx );
    354 #if !SEC_DMM2_E0146_HHIFIX
    355   Void xSearchDmm2Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd );
    356 #endif
    357 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    358353  Void xSearchDmm3Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx, UInt colTexIntraDir );
    359 #else
    360   Void xSearchDmm3Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx );
    361 #endif
    362354#endif
    363355#if H_3D_DIM_RBC
  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r622 r655  
    157157  m_pdRdPicQp         = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
    158158  m_piRdPicQp         = (Int*   )xMalloc( Int,    m_pcCfg->getDeltaQpRD() * 2 + 1 );
     159#if KWU_RC_MADPRED_E0227
     160  if(m_pcCfg->getUseRateCtrl())
     161  {
     162    m_pcRateCtrl        = pcEncTop->getRateCtrl();
     163  }
     164  else
     165  {
     166    m_pcRateCtrl        = NULL;
     167  }
     168#else
    159169  m_pcRateCtrl        = pcEncTop->getRateCtrl();
     170#endif
    160171}
    161172
     
    176187 \param pPPS          PPS associated with the slice
    177188 */
    178 #if H_MV5
    179189#if H_MV
    180 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId )
    181 #else
    182 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )
    183 #endif
    184 #else
    185 #if H_3D
    186 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId )
    187 #else
    188 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )
    189 #endif
     190Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId, bool isField )
     191#else
     192Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, bool isField )
    190193#endif
    191194{
     
    195198  rpcSlice = pcPic->getSlice(0);
    196199
    197 #if H_MV5
     200#if H_MV
    198201  rpcSlice->setVPS( pVPS );
    199202
     
    203206#if H_3D
    204207  rpcSlice->setIsDepth     ( pVPS->getDepthId     ( layerId ) != 0 );   
    205 #endif
    206 #else
    207 #if H_3D
    208   // GT: Should also be activated for MV-HEVC at some stage
    209   rpcSlice->setVPS( pVPS );
    210   Int vpsLayerId = pVPS->getLayerIdInNuh( layerId );
    211 
    212   rpcSlice->setLayerId     ( layerId );
    213   rpcSlice->setViewId      ( pVPS->getViewId      ( vpsLayerId ) );   
    214   rpcSlice->setViewIndex   ( pVPS->getViewIndex   ( vpsLayerId ) );
    215   rpcSlice->setIsDepth     ( pVPS->getDepthId     ( vpsLayerId ) != 0 );   
    216208#endif
    217209#endif
     
    342334    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
    343335    Int    SHIFT_QP = 12;
    344     Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)NumberBFrames );
     336    Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? NumberBFrames/2 : NumberBFrames) );
    345337#if FULL_NBIT
    346338    Int    bitdepth_luma_qp_scale = 6 * (g_bitDepth - 8);
     
    11251117    if(m_pcCfg->getUseRateCtrl())
    11261118    {
     1119#if KWU_RC_MADPRED_E0227
     1120      if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth())
     1121      {
     1122        Double zn, zf, focallength, position, camshift;
     1123        Double basepos;
     1124        Bool bInterpolated;
     1125        Int direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId();
     1126
     1127        pcEncTop->getCamParam()->xGetZNearZFar(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), zn, zf);
     1128        pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[0], pcSlice->getPOC(), focallength, basepos, camshift, bInterpolated);
     1129        pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), focallength, position, camshift, bInterpolated);
     1130
     1131        m_pcRateCtrl->updateLCUDataEnhancedView(pcCU, pcCU->getTotalBits(), pcCU->getQP(0), basepos, position, focallength, zn, zf, (direction > 0 ? 1 : -1));
     1132      }
     1133#endif
    11271134      if(m_pcRateCtrl->calculateUnitQP())
    11281135      {
     
    12231230        else
    12241231        {
     1232#if KWU_RC_MADPRED_E0227
     1233          if(pcSlice->getLayerId() != 0 && m_pcCfg->getUseDepthMADPred() && !pcSlice->getIsDepth())
     1234          {
     1235            Double zn, zf, focallength, position, camShift;
     1236            Double basePos;
     1237            Bool bInterpolated;
     1238            Int direction = pcSlice->getViewId() - pcCU->getSlice()->getIvPic(false, 0)->getViewId();
     1239            Int disparity;
     1240
     1241            pcEncTop->getCamParam()->xGetZNearZFar(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), zn, zf);
     1242            pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[0], pcSlice->getPOC(), focallength, basePos, camShift, bInterpolated);
     1243            pcEncTop->getCamParam()->xGetGeometryData(pcEncTop->getCamParam()->getBaseViewNumbers()[pcSlice->getViewIndex()], pcSlice->getPOC(), focallength, position, camShift, bInterpolated);
     1244            bpp       = m_pcRateCtrl->getRCPic()->getLCUTargetBppforInterView( m_pcRateCtrl->getPicList(), pcCU,
     1245              basePos, position, focallength, zn, zf, (direction > 0 ? 1 : -1), &disparity );
     1246          }
     1247          else
     1248          {
     1249#endif
    12251250#if RATE_CONTROL_INTRA
    12261251          bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(pcSlice->getSliceType());
     
    12391264          estQP     = m_pcRateCtrl->getRCPic()->getLCUEstQP    ( estLambda, pcSlice->getSliceQp() );
    12401265#endif
    1241 
     1266#if KWU_RC_MADPRED_E0227
     1267          }
     1268#endif
     1269#if KWU_RC_MADPRED_E0227
     1270          estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp );
     1271          estQP     = m_pcRateCtrl->getRCPic()->getLCUEstQP    ( estLambda, pcSlice->getSliceQp() );
     1272#endif
    12421273          estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP );
    12431274
     
    13431374      if ( m_pcCfg->getUseRateCtrl() )
    13441375      {
    1345 #if !M0036_RC_IMPROVEMENT
     1376#if !M0036_RC_IMPROVEMENT || KWU_RC_MADPRED_E0227
    13461377        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
    13471378        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
  • trunk/source/Lib/TLibEncoder/TEncSlice.h

    r622 r655  
    116116 
    117117  /// preparation of slice encoding (reference marking, QP and lambda)
    118 #if H_MV5
    119118#if H_MV
    120119  Void    initEncSlice        ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    121                                 Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId );
     120                                Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId, bool isField );
    122121#else
    123122  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    124                                 Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS );
    125 #endif
    126 #else
    127 #if H_3D
    128   Void    initEncSlice        ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    129                                 Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId );
    130 #else
    131   Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    132                                 Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS );
    133 #endif
     123                                Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, bool isField  );
    134124#endif
    135125#if RATE_CONTROL_LAMBDA_DOMAIN
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r622 r655  
    123123  if ( m_RCEnableRateControl )
    124124  {
     125#if KWU_RC_MADPRED_E0227
     126    m_cRateCtrl.init( m_framesToBeEncoded, m_RCTargetBitrate, m_iFrameRate, m_iGOPSize, m_iSourceWidth, m_iSourceHeight,
     127      g_uiMaxCUWidth, g_uiMaxCUHeight, m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList, getLayerId() );
     128#else
    125129    m_cRateCtrl.init( m_framesToBeEncoded, m_RCTargetBitrate, m_iFrameRate, m_iGOPSize, m_iSourceWidth, m_iSourceHeight,
    126130                      g_uiMaxCUWidth, g_uiMaxCUHeight, m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList );
     131#endif
    127132  }
    128133#else
    129   m_cRateCtrl.create(getIntraPeriod(), getGOPSize(), getFrameRate(), getTargetBitrate(), getQP(), getNumLCUInUnit(), getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight);
     134#if KWU_FIX_URQ
     135  if(m_enableRateCtrl)
     136#endif
     137    m_cRateCtrl.create(getIntraPeriod(), getGOPSize(), getFrameRate(), getTargetBitrate(), getQP(), getNumLCUInUnit(), getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight);
    130138#endif
    131139  // if SBAC-based RD optimization is used
     
    284292}
    285293
    286 Void TEncTop::init()
     294#if KWU_RC_MADPRED_E0227
     295Void TEncTop::init(TAppEncTop* pcTAppEncTop, Bool isFieldCoding)
     296#else
     297Void TEncTop::init(Bool isFieldCoding)
     298#endif
    287299{
    288300  // initialize SPS
     
    301313  m_cPPS.setSPS(&m_cSPS);
    302314  xInitPPS();
    303   xInitRPS();
     315  xInitRPS(isFieldCoding);
    304316
    305317  xInitPPSforTiles();
     
    310322  m_cCuEncoder.   init( this );
    311323 
     324#if KWU_RC_MADPRED_E0227
     325  m_pcTAppEncTop = pcTAppEncTop;
     326#endif
    312327  // initialize transform & quantization class
    313328  m_pcCavlcCoder = getCavlcCoder();
     
    392407  if( picLastCoded )
    393408  {
    394 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    395409    picLastCoded->compressMotion(1);
    396 #else
    397     picLastCoded->compressMotion();
    398 #endif
    399410  }
    400411#endif
     
    433444#if H_MV
    434445  }
    435   m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, gopId );
     446  m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, gopId, false, false );
    436447
    437448  if( gopId + 1 == m_cGOPEncoder.getGOPSize() )
     
    439450#else
    440451  // compress GOP
    441   m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut);
     452  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false);
    442453#endif
    443454
     
    456467#endif
    457468}
     469/**------------------------------------------------
     470 Separate interlaced frame into two fields
     471 -------------------------------------------------**/
     472void separateFields(Pel* org, Pel* dstField, UInt stride, UInt width, UInt height, bool isTop)
     473{
     474  if (!isTop)
     475  {
     476    org += stride;
     477  }
     478  for (Int y = 0; y < height>>1; y++)
     479  {
     480    for (Int x = 0; x < width; x++)
     481    {
     482      dstField[x] = org[x];
     483    }
     484   
     485    dstField += stride;
     486    org += stride*2;
     487  }
     488 
     489}
     490
     491#if H_MV
     492Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff, Int gopId )
     493{
     494  assert( 0 ); // Field coding and multiview need to be furhter harmonized.
     495}
     496#else
     497Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff)
     498{
     499  /* -- TOP FIELD -- */
     500 
     501  if (pcPicYuvOrg)
     502  {
     503   
     504    /* -- Top field initialization -- */
     505   
     506    TComPic *pcTopField;
     507    xGetNewPicBuffer( pcTopField );
     508    pcTopField->getPicSym()->allocSaoParam(&m_cEncSAO);
     509    pcTopField->setReconMark (false);
     510   
     511    pcTopField->getSlice(0)->setPOC( m_iPOCLast );
     512    pcTopField->getPicYuvRec()->setBorderExtension(false);
     513    pcTopField->setTopField(isTff);
     514   
     515    int nHeight = pcPicYuvOrg->getHeight();
     516    int nWidth = pcPicYuvOrg->getWidth();
     517    int nStride = pcPicYuvOrg->getStride();
     518    int nPadLuma = pcPicYuvOrg->getLumaMargin();
     519    int nPadChroma = pcPicYuvOrg->getChromaMargin();
     520   
     521    // Get pointers
     522    Pel * PicBufY = pcPicYuvOrg->getBufY();
     523    Pel * PicBufU = pcPicYuvOrg->getBufU();
     524    Pel * PicBufV = pcPicYuvOrg->getBufV();
     525   
     526    Pel * pcTopFieldY =  pcTopField->getPicYuvOrg()->getLumaAddr();
     527    Pel * pcTopFieldU =  pcTopField->getPicYuvOrg()->getCbAddr();
     528    Pel * pcTopFieldV =  pcTopField->getPicYuvOrg()->getCrAddr();
     529   
     530    // compute image characteristics
     531    if ( getUseAdaptiveQP() )
     532    {
     533      m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcTopField ) );
     534    }
     535   
     536    /* -- Defield -- */
     537   
     538    bool isTop = isTff;
     539   
     540    separateFields(PicBufY + nPadLuma + nStride*nPadLuma, pcTopFieldY, nStride, nWidth, nHeight, isTop);
     541    separateFields(PicBufU + nPadChroma + (nStride >> 1)*nPadChroma, pcTopFieldU, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop);
     542    separateFields(PicBufV + nPadChroma + (nStride >> 1)*nPadChroma, pcTopFieldV, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop);
     543   
     544  }
     545 
     546  if (m_iPOCLast == 0) // compress field 0
     547  {
     548    m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff);
     549  }
     550 
     551  /* -- BOTTOM FIELD -- */
     552 
     553  if (pcPicYuvOrg)
     554  {
     555   
     556    /* -- Bottom field initialization -- */
     557   
     558    TComPic* pcBottomField;
     559    xGetNewPicBuffer( pcBottomField );
     560    pcBottomField->getPicSym()->allocSaoParam(&m_cEncSAO);
     561    pcBottomField->setReconMark (false);
     562   
     563    TComPicYuv* rpcPicYuvRec = new TComPicYuv;
     564    if ( rcListPicYuvRecOut.size() == (UInt)m_iGOPSize )
     565    {
     566      rpcPicYuvRec = rcListPicYuvRecOut.popFront();
     567    }
     568    else
     569    {
     570      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     571    }
     572    rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
     573   
     574    pcBottomField->getSlice(0)->setPOC( m_iPOCLast);
     575    pcBottomField->getPicYuvRec()->setBorderExtension(false);
     576    pcBottomField->setTopField(!isTff);
     577   
     578    int nHeight = pcPicYuvOrg->getHeight();
     579    int nWidth = pcPicYuvOrg->getWidth();
     580    int nStride = pcPicYuvOrg->getStride();
     581    int nPadLuma = pcPicYuvOrg->getLumaMargin();
     582    int nPadChroma = pcPicYuvOrg->getChromaMargin();
     583   
     584    // Get pointers
     585    Pel * PicBufY = pcPicYuvOrg->getBufY();
     586    Pel * PicBufU = pcPicYuvOrg->getBufU();
     587    Pel * PicBufV = pcPicYuvOrg->getBufV();
     588   
     589    Pel * pcBottomFieldY =  pcBottomField->getPicYuvOrg()->getLumaAddr();
     590    Pel * pcBottomFieldU =  pcBottomField->getPicYuvOrg()->getCbAddr();
     591    Pel * pcBottomFieldV =  pcBottomField->getPicYuvOrg()->getCrAddr();
     592   
     593    // Compute image characteristics
     594    if ( getUseAdaptiveQP() )
     595    {
     596      m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcBottomField ) );
     597    }
     598   
     599    /* -- Defield -- */
     600   
     601    bool isTop = !isTff;
     602   
     603    separateFields(PicBufY + nPadLuma + nStride*nPadLuma, pcBottomFieldY, nStride, nWidth, nHeight, isTop);
     604    separateFields(PicBufU + nPadChroma + (nStride >> 1)*nPadChroma, pcBottomFieldU, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop);
     605    separateFields(PicBufV + nPadChroma + (nStride >> 1)*nPadChroma, pcBottomFieldV, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop);
     606   
     607  }
     608 
     609  if ( ( !(m_iNumPicRcvd) || (!flush && m_iPOCLast != 1 && m_iNumPicRcvd != m_iGOPSize && m_iGOPSize)) )
     610  {
     611    iNumEncoded = 0;
     612    return;
     613  }
     614 
     615  // compress GOP
     616  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff);
     617 
     618  iNumEncoded = m_iNumPicRcvd;
     619  m_iNumPicRcvd = 0;
     620  m_uiNumAllPicCoded += iNumEncoded;
     621}
     622#endif
     623
     624
    458625
    459626// ====================================================================================================================
     
    551718   * that chooses the actual compatibility based upon options */
    552719
    553 #if H_MV5
    554720#if H_MV 
    555721  m_cSPS.setUpdateRepFormatFlag           ( m_layerId == 0 );   
    556722  m_cSPS.setSpsInferScalingListFlag       ( m_layerId > 0 && m_cVPS->getInDirectDependencyFlag( getLayerIdInVps(), 0 ) );
    557723  m_cSPS.setSpsScalingListRefLayerId      ( 0              );
    558 #endif
    559724#endif
    560725  m_cSPS.setPicWidthInLumaSamples         ( m_iSourceWidth      );
     
    680845{
    681846#if H_MV
    682 #if H_MV5
    683847  m_cPPS.setLayerId( getLayerId() );
    684848  if( getVPS()->getNumDirectRefLayers( getLayerId() ) > 0 )
    685 #else
    686   if( getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) > 0 )
    687 #endif
    688849  {
    689850    m_cPPS.setListsModificationPresentFlag( true );
     
    734895#if RATE_CONTROL_LAMBDA_DOMAIN
    735896  if ( m_RCEnableRateControl )
     897  {
     898    m_cPPS.setUseDQP(true);
     899    m_cPPS.setMaxCuDQPDepth( 0 );
     900    m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) );
     901  }
     902#endif
     903#if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ
     904  if ( m_enableRateCtrl )
    736905  {
    737906    m_cPPS.setUseDQP(true);
     
    751920  m_cPPS.setOutputFlagPresentFlag( false );
    752921#if H_MV
    753 #if H_MV5
    754922  m_cPPS.setNumExtraSliceHeaderBits( 2 );
    755 #else
    756   m_cPPS.setNumExtraSliceHeaderBits( 1 );
    757 #endif
    758923#endif
    759924  m_cPPS.setSignHideFlag(getSignHideFlag());
    760   m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
     925  if ( getDeblockingFilterMetric() )
     926  {
     927    m_cPPS.setDeblockingFilterControlPresentFlag (true);
     928    m_cPPS.setDeblockingFilterOverrideEnabledFlag(true);
     929    m_cPPS.setPicDisableDeblockingFilterFlag(false);
     930    m_cPPS.setDeblockingFilterBetaOffsetDiv2(0);
     931    m_cPPS.setDeblockingFilterTcOffsetDiv2(0);
     932  }
     933  else
     934  {
     935    m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
     936  }
    761937  m_cPPS.setLog2ParallelMergeLevelMinus2   (m_log2ParallelMergeLevelMinus2 );
    762938  m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
     
    812988
    813989//Function for initializing m_RPSList, a list of TComReferencePictureSet, based on the GOPEntry objects read from the config file.
    814 Void TEncTop::xInitRPS()
     990Void TEncTop::xInitRPS(Bool isFieldCoding)
    815991{
    816992  TComReferencePictureSet*      rps;
    817993 
    818   m_cSPS.createRPSList(getGOPSize()+m_extraRPSs);
     994  m_cSPS.createRPSList(getGOPSize()+m_extraRPSs+1);
    819995  TComRPSList* rpsList = m_cSPS.getRPSList();
    820996
     
    9131089        printf("Warning: number of negative pictures in RPS is different between intra and inter RPS specified in the config file.\n");
    9141090        rps->setNumberOfNegativePictures(numNeg);
    915         rps->setNumberOfPositivePictures(numNeg+numPos);
     1091        rps->setNumberOfPictures(numNeg+numPos);
    9161092      }
    9171093      if (numPos != rps->getNumberOfPositivePictures())
     
    9191095        printf("Warning: number of positive pictures in RPS is different between intra and inter RPS specified in the config file.\n");
    9201096        rps->setNumberOfPositivePictures(numPos);
    921         rps->setNumberOfPositivePictures(numNeg+numPos);
     1097        rps->setNumberOfPictures(numNeg+numPos);
    9221098      }
    9231099      RPSTemp.setNumberOfPictures(numNeg+numPos);
     
    9831159#endif //INTER_RPS_AUTO
    9841160  }
    985  
     1161  //In case of field coding, we need to set special parameters for the first bottom field of the sequence, since it is not specified in the cfg file.
     1162  //The position = GOPSize + extraRPSs which is (a priori) unused is reserved for this field in the RPS.
     1163  if (isFieldCoding)
     1164  {
     1165    rps = rpsList->getReferencePictureSet(getGOPSize()+m_extraRPSs);
     1166    rps->setNumberOfPictures(1);
     1167    rps->setNumberOfNegativePictures(1);
     1168    rps->setNumberOfPositivePictures(0);
     1169    rps->setNumberOfLongtermPictures(0);
     1170    rps->setDeltaPOC(0,-1);
     1171    rps->setPOC(0,0);
     1172    rps->setUsed(0,true);
     1173    rps->setInterRPSPrediction(false);
     1174    rps->setDeltaRIdxMinus1(0);
     1175    rps->setDeltaRPS(0);
     1176    rps->setNumRefIdc(0);
     1177}
    9861178}
    9871179
     
    10281220    }
    10291221  }
     1222  if(POCCurr == 1 && slice->getPic()->isField())
     1223  {
     1224    slice->setRPSidx(m_iGOPSize+m_extraRPSs);
     1225  }
    10301226
    10311227  slice->setRPS(getSPS()->getRPSList()->getReferencePictureSet(slice->getRPSidx()));
     
    11471343}
    11481344#if H_MV
    1149 Void TEncTop::printSummary( Int numAllPicCoded )
    1150 {
     1345Void TEncTop::printSummary( Int numAllPicCoded, Bool isField )
     1346{
     1347  assert ( !isField ); // Multiview and field coding need to be further unified
    11511348  assert (numAllPicCoded == m_cAnalyzeAll.getNumPic());
    11521349
  • trunk/source/Lib/TLibEncoder/TEncTop.h

    r608 r655  
    6464// ====================================================================================================================
    6565
     66#if KWU_RC_MADPRED_E0227
     67class TAppEncTop;
     68#endif
    6669/// encoder class
    6770class TEncTop : public TEncCfg
     
    124127  TComScalingList         m_scalingList;                 ///< quantization matrix information
    125128  TEncRateCtrl            m_cRateCtrl;                    ///< Rate control class
     129
     130#if KWU_RC_MADPRED_E0227
     131  TAppEncTop*             m_pcTAppEncTop;
     132  TAppComCamPara*         m_cCamParam;
     133#endif
    126134 
    127135#if H_MV
     
    137145 
    138146  Void  xInitPPSforTiles  ();
    139   Void  xInitRPS          ();                             ///< initialize PPS from encoder options
     147  Void  xInitRPS          (Bool isFieldCoding);           ///< initialize PPS from encoder options
    140148
    141149public:
     
    145153  Void      create          ();
    146154  Void      destroy         ();
    147   Void      init            ();
     155#if KWU_RC_MADPRED_E0227
     156  Void      init            ( TAppEncTop* pcTAppEncTop, Bool isFieldCoding );
     157#else
     158  Void      init            (Bool isFieldCoding);
     159#endif
     160
    148161#if H_MV 
    149162  TComPicLists* getIvPicLists() { return m_ivPicLists; }
     
    185198  TEncSbac*               getRDGoOnSbacCoders   () { return  m_pcRDGoOnSbacCoders;   }
    186199  TEncRateCtrl*           getRateCtrl           () { return &m_cRateCtrl;             }
     200#if KWU_RC_MADPRED_E0227
     201  TAppEncTop*             getEncTop             () { return m_pcTAppEncTop; }
     202  TAppComCamPara*         getCamParam()                 { return m_cCamParam;}
     203  Void                    setCamParam(TAppComCamPara * pCamparam)                 { m_cCamParam = pCamparam;}
     204#endif
    187205  TComSPS*                getSPS                () { return  &m_cSPS;                 }
    188206  TComPPS*                getPPS                () { return  &m_cPPS;                 }
     
    210228#if H_MV
    211229  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded  , Int gopId  ); 
     230
     231   /// encode several number of pictures until end-of-sequence
     232  Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
     233              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff  , Int gopId );
     234
    212235#else
    213236  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
    214               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 
    215 #endif
    216 
    217 #if H_MV
    218   Void printSummary      ( Int numAllPicCoded );
    219 #else
    220   void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); }
     237              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded );
     238   /// encode several number of pictures until end-of-sequence
     239  Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
     240              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff);
     241
     242#endif
     243
     244#if H_MV
     245  Void printSummary      ( Int numAllPicCoded, bool isField );
     246#else
     247  Void printSummary(bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField); }
    221248#endif
    222249
  • trunk/source/Lib/TLibExtractor/TExtrTop.cpp

    r622 r655  
    100100Void TExtrTop::dumpVpsInfo( std::ostream& rcVpsInfoHandle )
    101101{
    102 #if H_MV5
    103102  rcVpsInfoHandle << "MaxLayers      = " << m_cVPS.getMaxLayersMinus1() + 1 << std::endl;
    104103  rcVpsInfoHandle << "MaxNuhLayerId  = " << m_cVPS.getVpsMaxLayerId() << std::endl;                     
     
    114113#endif
    115114    rcVpsInfoHandle << "ViewId         = " << m_cVPS.getViewId        ( layerId ) << std::endl;     
    116 #else
    117   rcVpsInfoHandle << "MaxLayers = "     << m_cVPS.getMaxLayers()     << std::endl;
    118   rcVpsInfoHandle << "MaxNuhLayerId = " << m_cVPS.getVpsMaxLayerId() << std::endl;
    119  
    120   for ( Int layerIdxInVps = 0; layerIdxInVps < m_cVPS.getMaxLayers(); layerIdxInVps++ )
    121   { 
    122     rcVpsInfoHandle << "LayerIdxInVps =  " << layerIdxInVps                           << std::endl;
    123     rcVpsInfoHandle << "LayerIdInNuh = "   << m_cVPS.getLayerIdInNuh( layerIdxInVps ) << std::endl;
    124     rcVpsInfoHandle << "ViewId = "         << m_cVPS.getViewId      ( layerIdxInVps ) << std::endl;
    125 #if H_3D
    126     rcVpsInfoHandle << "DepthFlag = "      << m_cVPS.getViewIndex   ( layerIdxInVps ) << std::endl;     
    127     rcVpsInfoHandle << "DepthFlag = "      << m_cVPS.getDepthId     ( layerIdxInVps ) << std::endl;     
    128 #endif
    129 #endif
    130115  }
    131116}
  • trunk/source/Lib/TLibRenderer/TRenTop.cpp

    r608 r655  
    10331033            for ( ; iInterPolPos <= xCeil (iShiftedPos ) -1 ; iInterPolPos++)
    10341034            {
    1035 #if H_3D_FIX_REN
    10361035              if ( ( iInterPolPos >= 0 ) && ( iInterPolPos < iOutputWidth ) )
    10371036              {
     
    10501049                }
    10511050              }
    1052 #else
    1053               for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
    1054               {
    1055                 if ( ( iInterPolPos >= 0 ) && ( iInterPolPos < iOutputWidth ) )
    1056                 {
    1057                   apcOutputData[uiCurPlane][iInterPolPos]  = apcInputData[uiCurPlane][iPosX];
    1058                 }
    1059               }
    1060 #endif
    10611051            }
    10621052          }
     
    13041294        else
    13051295        {
    1306 #if H_3D_FIX_REN
    13071296          pcAlphaData[iXPos] = pcFilledData[iXPos];
    1308 #else
    1309           pcAlphaData[iXPos] = REN_IS_FILLED;
    1310 #endif
    13111297        }
    13121298      }
  • trunk/source/Lib/TLibVideoIO/TVideoIOYuv.cpp

    r608 r655  
    339339}
    340340
     341static Bool writeField(ostream& fd, Pel* top, Pel* bottom, Bool is16bit,
     342                       UInt stride,
     343                       UInt width, UInt height, bool isTff)
     344{
     345  Int write_len = width * (is16bit ? 2 : 1)*2;
     346  UChar *buf = new UChar[write_len];
     347  for (Int y = 0; y < height; y++)
     348  {
     349    if (!is16bit)
     350    {
     351      for (Int x = 0; x < width; x++)
     352      {
     353        buf[x] = isTff ? (UChar) top[x] : (UChar) bottom[x];
     354        buf[width+x] = isTff ? (UChar) bottom[x] : (UChar) top[x];
     355      }
     356    }
     357    else
     358    {
     359      for (Int x = 0; x < width; x++)
     360      {
     361        buf[2*x] = isTff ? top[x] & 0xff : bottom[x] & 0xff;
     362        buf[2*x+1] = isTff ? (top[x] >> 8) & 0xff : (bottom[x] >> 8) & 0xff;
     363       
     364        buf[width+2*x] = isTff ? bottom[x] & 0xff : top[x] & 0xff;
     365        buf[width+2*x+1] = isTff ? (bottom[x] >> 8) & 0xff : (top[x] >> 8) & 0xff;
     366      }
     367    }
     368   
     369    fd.write(reinterpret_cast<Char*>(buf), write_len);
     370    if (fd.eof() || fd.fail() )
     371    {
     372      delete[] buf;
     373      return false;
     374    }
     375    top += stride;
     376    bottom += stride;
     377  }
     378  delete[] buf;
     379  return true;
     380}
    341381/**
    342382 * Read one Y'CbCr frame, performing any required input scaling to change
     
    501541}
    502542
     543
     544/**
     545 * Write one Y'CbCr frame. No bit-depth conversion is performed, pcPicYuv is
     546 * assumed to be at TVideoIO::m_fileBitdepth depth.
     547 *
     548 * @param pPicTop     input top field YUV buffer class pointer
     549 * @param pPicBottom  input bottom field YUV buffer class pointer
     550 * @param aiPad       source padding size, aiPad[0] = horizontal, aiPad[1] = vertical
     551 * @return true for success, false in case of error
     552 */
     553Bool TVideoIOYuv::write( TComPicYuv* pPicTop, TComPicYuv* pPicBottom, Int cropLeft, Int cropRight, Int cropTop, Int cropBottom , bool isTff)
     554{
     555  // compute actual YUV frame size excluding padding size
     556  Int   iStride = pPicTop->getStride();
     557  UInt  width  = pPicTop->getWidth()  - cropLeft - cropRight;
     558  UInt  height = pPicTop->getHeight() - cropTop  - cropBottom;
     559  Bool is16bit = m_fileBitDepthY > 8 || m_fileBitDepthC > 8;
     560 
     561  TComPicYuv *dstPicTop = NULL;
     562  TComPicYuv *dstPicBottom = NULL;
     563 
     564  Bool retval = true;
     565 
     566  if (m_bitDepthShiftY != 0 || m_bitDepthShiftC != 0)
     567  {
     568    dstPicTop = new TComPicYuv;
     569    dstPicTop->create( pPicTop->getWidth(), pPicTop->getHeight(), 1, 1, 0 );
     570    pPicTop->copyToPic(dstPicTop);
     571   
     572    dstPicBottom = new TComPicYuv;
     573    dstPicBottom->create( pPicBottom->getWidth(), pPicBottom->getHeight(), 1, 1, 0 );
     574    pPicBottom->copyToPic(dstPicBottom);
     575   
     576    Pel minvalY = 0;
     577    Pel minvalC = 0;
     578    Pel maxvalY = (1 << m_fileBitDepthY) - 1;
     579    Pel maxvalC = (1 << m_fileBitDepthC) - 1;
     580#if CLIP_TO_709_RANGE
     581    if (-m_bitDepthShiftY < 0 && m_fileBitDepthY >= 8)
     582    {
     583      /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
     584      minvalY = 1 << (m_fileBitDepthY - 8);
     585      maxvalY = (0xff << (m_fileBitDepthY - 8)) -1;
     586    }
     587    if (-m_bitDepthShiftC < 0 && m_fileBitDepthC >= 8)
     588    {
     589      /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */
     590      minvalC = 1 << (m_fileBitDepthC - 8);
     591      maxvalC = (0xff << (m_fileBitDepthC - 8)) -1;
     592    }
     593#endif
     594    scalePlane(dstPicTop->getLumaAddr(), dstPicTop->getStride(), dstPicTop->getWidth(), dstPicTop->getHeight(), -m_bitDepthShiftY, minvalY, maxvalY);
     595    scalePlane(dstPicTop->getCbAddr(), dstPicTop->getCStride(), dstPicTop->getWidth()>>1, dstPicTop->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC);
     596    scalePlane(dstPicTop->getCrAddr(), dstPicTop->getCStride(), dstPicTop->getWidth()>>1, dstPicTop->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC);
     597   
     598    scalePlane(dstPicBottom->getLumaAddr(), dstPicBottom->getStride(), dstPicBottom->getWidth(), dstPicBottom->getHeight(), -m_bitDepthShiftY, minvalY, maxvalY);
     599    scalePlane(dstPicBottom->getCbAddr(), dstPicBottom->getCStride(), dstPicBottom->getWidth()>>1, dstPicBottom->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC);
     600    scalePlane(dstPicBottom->getCrAddr(), dstPicBottom->getCStride(), dstPicBottom->getWidth()>>1, dstPicBottom->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC);
     601  }
     602  else
     603  {
     604    dstPicTop = pPicTop;
     605    dstPicBottom = pPicBottom;
     606  }
     607  // location of upper left pel in a plane
     608  Int planeOffset = 0; //cropLeft + cropTop * iStride;
     609  //Write luma
     610  if (! writeField(m_cHandle, dstPicTop->getLumaAddr() + planeOffset,  dstPicBottom->getLumaAddr() + planeOffset, is16bit, iStride, width, height, isTff))
     611  {
     612    retval=false;
     613    goto exit;
     614  }
     615 
     616  width >>= 1;
     617  height >>= 1;
     618  iStride >>= 1;
     619  cropLeft >>= 1;
     620  cropRight >>= 1;
     621 
     622  planeOffset = 0; // cropLeft + cropTop * iStride;
     623 
     624  //Write chroma U
     625  if (! writeField(m_cHandle, dstPicTop->getCbAddr() + planeOffset, dstPicBottom->getCbAddr() + planeOffset, is16bit, iStride, width, height, isTff))
     626  {
     627    retval=false;
     628    goto exit;
     629  }
     630 
     631  //Write chroma V
     632  if (! writeField(m_cHandle, dstPicTop->getCrAddr() + planeOffset, dstPicBottom->getCrAddr() + planeOffset, is16bit, iStride, width, height, isTff))
     633   
     634  {
     635    retval=false;
     636    goto exit;
     637  }
     638 
     639exit:
     640  if (m_bitDepthShiftY != 0 || m_bitDepthShiftC != 0)
     641  {
     642    dstPicTop->destroy();
     643    delete dstPicTop;
     644    dstPicBottom->destroy();
     645    delete dstPicBottom;
     646  } 
     647  return retval;
     648}
  • trunk/source/Lib/TLibVideoIO/TVideoIOYuv.h

    r608 r655  
    7272  Bool  read  ( TComPicYuv*   pPicYuv, Int aiPad[2] );     ///< read  one YUV frame with padding parameter
    7373  Bool  write( TComPicYuv*    pPicYuv, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0 );
     74  Bool  write( TComPicYuv*    pPicYuv, TComPicYuv*    pPicYuv2, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0  , bool isTff=false);
    7475 
    7576  Bool  isEof ();                                           ///< check for end-of-file
Note: See TracChangeset for help on using the changeset viewer.