Changeset 210 in 3DVCSoftware for trunk/source/App/TAppEncoder


Ignore:
Timestamp:
11 Dec 2012, 18:52:43 (12 years ago)
Author:
tech
Message:

Reintegrated /branches/HTM-5.0-dev0 rev. 207.

Location:
trunk/source/App/TAppEncoder
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r189 r210  
    111111  if (m_pchBitstreamFile != NULL)
    112112    free (m_pchBitstreamFile) ;
     113#if FLEX_CODING_ORDER_M23723
     114  if (m_pchMVCJointCodingOrder != NULL)
     115  {
     116    free(m_pchMVCJointCodingOrder) ;
     117  }
     118#endif
    113119#if HHI_VSO
    114120  if (  m_pchVSOConfig != NULL)
     
    203209  string cfg_RowHeight;
    204210  string cfg_ScalingListFile;
     211
     212 #if FLEX_CODING_ORDER_M23723
     213  string cfg_JointCodingOrdering;
     214#endif
     215
    205216  po::Options opts;
    206217  opts.addOptions()
     
    246257 
    247258  ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
     259#if FLEX_CODING_ORDER_M23723
     260  ("FCO",               m_b3DVFlexOrder,   false, "flexible coding order flag" )
     261  ("FCOCodingOrder",   cfg_JointCodingOrdering,  string(""), "The coding order for joint texture-depth coding")
     262#endif
    248263  /* Unit definition parameters */
    249264  ("MaxCUWidth",          m_uiMaxCUWidth,  64u)
     
    276291  ("FastSearch", m_iFastSearch, 1, "0:Full search  1:Diamond  2:PMVFAST")
    277292  ("SearchRange,-sr",m_iSearchRange, 96, "motion search range")
     293#if DV_V_RESTRICTION_B0037
     294  ("DisparitySearchRangeRestriction",m_bUseDisparitySearchRangeRestriction, false, "restrict disparity search range")
     295  ("VerticalDisparitySearchRange",m_iVerticalDisparitySearchRange, 56, "vertical disparity search range")
     296#endif
    278297  ("BipredSearchRange", m_bipredSearchRange, 4, "motion search range for bipred refinement")
    279298  ("HadamardME", m_bUseHADME, true, "hadamard ME for fractional-pel")
     
    329348  /* Camera Paremetes */
    330349  ("CameraParameterFile,cpf", m_pchCameraParameterFile,    (Char *) 0, "Camera Parameter File Name")
     350#if QC_MVHEVC_B0046
     351  ("BaseViewCameraNumbers" ,  m_aiVId,     std::vector<Int>(1, MAX_VIEW_NUM), "Numbers of base views")
     352#endif
    331353  ("BaseViewCameraNumbers" ,  m_pchBaseViewCameraNumbers,  (Char *) 0, "Numbers of base views")
    332354
     
    526548  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    527549  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    528  
     550#if FLEX_CODING_ORDER_M23723
     551  m_pchMVCJointCodingOrder= cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str());
     552  // If flexible order is enabled and if depth comes before the texture for a view, disable VSO
     553#if HHI_VSO && DISABLE_FCO_FOR_VSO
     554  Bool depthComesFirst = false;
     555  int iter = 0;
     556  if ( m_b3DVFlexOrder )
     557  {
     558    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
     559    {
     560      iter = 0;
     561      for ( Int ii=1; ii<12; ii+=2 )
     562      {
     563        Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
     564        if ( iViewIdxCfg == iViewIdx )
     565        {
     566          iter ++;
     567          if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
     568          {
     569            if(iter == 1)
     570           {
     571            depthComesFirst = true;
     572            break;
     573           }
     574          }
     575          else
     576          {
     577            assert(m_pchMVCJointCodingOrder[ii-1]=='T');
     578          }
     579        }
     580      }
     581    }
     582  }
     583  if (depthComesFirst)
     584  {
     585    m_bUseVSO = false;
     586  }
     587#endif
     588#endif
    529589  m_pchColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str());
    530590  m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str());
     
    786846}
    787847#else
     848#if !QC_MVHEVC_B0046
    788849  m_cCameraData     .init     ( (UInt)m_iNumberOfViews,
    789850    m_uiInputBitDepth,
     
    797858    LOG2_DISP_PREC_LUT );
    798859#endif
     860#endif
    799861
    800862
    801863  // check validity of input parameters
    802864  xCheckParameter();
     865#if !QC_MVHEVC_B0046
    803866  m_cCameraData.check( false, true );
    804  
     867#endif
    805868  // print-out parameters
    806869  xPrintParameter();
     
    850913  xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
    851914  xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
     915#if DV_V_RESTRICTION_B0037
     916  xConfirmPara( m_iVerticalDisparitySearchRange <= 0 ,                                      "Vertical Disparity Search Range must be more than 0" );
     917#endif
    852918  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    853919  xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
     
    15951661  printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    15961662  printf("Motion search range          : %d\n", m_iSearchRange );
     1663#if DV_V_RESTRICTION_B0037
     1664  printf("Disp search range restriction: %d\n", m_bUseDisparitySearchRangeRestriction );
     1665  printf("Vertical disp search range   : %d\n", m_iVerticalDisparitySearchRange );
     1666#endif
    15971667  printf("Intra period                 : %d\n", m_iIntraPeriod );
    15981668  printf("Decoding refresh type        : %d\n", m_iDecodingRefreshType );
     
    17451815#if TMVP_DEPTH_SWITCH
    17461816  printf("TMVP:%d ", (m_enableTMVP[1] ? 1 : 0) );
     1817#endif
     1818#if FLEX_CODING_ORDER_M23723
     1819  printf("FCO:%d ",   (m_b3DVFlexOrder ? 1: 0));
     1820
     1821  if(m_b3DVFlexOrder)
     1822  {
     1823    printf("CodingOrder: %s ", m_pchMVCJointCodingOrder);
     1824  }
    17471825#endif
    17481826#if HHI_VSO
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r189 r210  
    8888  Int       m_iNumberOfViews;                                 ///< number Views to Encode
    8989  Bool      m_bUsingDepthMaps;
     90 
     91#if FLEX_CODING_ORDER_M23723
     92  Char*  m_pchMVCJointCodingOrder;      ///<  texture-depth coding order
     93  Bool    m_b3DVFlexOrder;    ///<  flexible coding order flag
     94#endif
     95
    9096  // coding structure
    9197  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
     
    109115  std::vector<Double>  m_adQP;                                ///< QP value of key-picture (floating point) [0] video, [1] depth
    110116  std::vector<Int>     m_aiQP;                                ///< QP value of key-picture (integer) [0] video, [1] depth
     117#if QC_MVHEVC_B0046
     118  std::vector<Int>     m_aiVId;                                ///< view id
     119#endif
    111120  Int       m_aiTLayerQPOffset[MAX_TLAYER];                   ///< QP offset corresponding to temporal layer depth
    112121  char*     m_pchdQPFile;                                     ///< QP offset for each slice (initialized from external file)
     
    200209  Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
    201210  Int       m_iSearchRange;                                   ///< ME search range
     211#if DV_V_RESTRICTION_B0037
     212  Bool      m_bUseDisparitySearchRangeRestriction;            ///< restrict vertical search range for inter-view prediction
     213  Int       m_iVerticalDisparitySearchRange;                  ///< ME vertical search range for inter-view prediction
     214#endif
    202215  Int       m_bipredSearchRange;                              ///< ME search range for bipred refinement
    203216  Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
     
    285298  Char*     m_pchCameraParameterFile;                         ///< camera parameter file
    286299  Char*     m_pchBaseViewCameraNumbers;
     300#if !QC_MVHEVC_B0046
    287301  TAppComCamPara m_cCameraData;
    288 
     302#endif
    289303  Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
    290304
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r189 r210  
    6767Void TAppEncTop::xInitLibCfg()
    6868{
    69 #if VIDYO_VPS_INTEGRATION
     69#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
     70#if !QC_MVHEVC_B0046
    7071  UInt layerId = 0;
     72#endif
    7173  // TODO: fix the assumption here that the temporal structures are all equal across all layers???
    7274  m_cVPS.setMaxTLayers( m_maxTempLayer[0] );
     75#if QC_MVHEVC_B0046
     76  m_cVPS.setMaxLayers( m_iNumberOfViews );
     77#else
    7378  m_cVPS.setMaxLayers( m_iNumberOfViews * (m_bUsingDepthMaps ? 2:1) );
     79#endif
    7480  for(Int i = 0; i < MAX_TLAYER; i++)
    7581  {
     
    101107    m_acTEncTopList[iViewIdx]->setViewId                       ( iViewIdx );
    102108    m_acTEncTopList[iViewIdx]->setIsDepth                      ( false );
     109#if QC_MVHEVC_B0046
     110    m_acTEncTopList[iViewIdx]->setLayerId                      ( iViewIdx );
     111    m_cVPS.setViewId                                           ( m_aiVId[ iViewIdx ], iViewIdx );
     112#else
    103113    m_acTEncTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
    104114#if VIDYO_VPS_INTEGRATION
     
    117127    m_acTEncTopList[iViewIdx]->setCodedScale                   ( m_cCameraData.getCodedScale             () );
    118128    m_acTEncTopList[iViewIdx]->setCodedOffset                  ( m_cCameraData.getCodedOffset            () );
     129#endif   
    119130
    120131  //====== Coding Structure ========
     
    170181    m_acTEncTopList[iViewIdx]->setSearchRange                  ( m_iSearchRange );
    171182    m_acTEncTopList[iViewIdx]->setBipredSearchRange            ( m_bipredSearchRange );
    172 
     183#if DV_V_RESTRICTION_B0037
     184    m_acTEncTopList[iViewIdx]->setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction );
     185    m_acTEncTopList[iViewIdx]->setVerticalDisparitySearchRange( m_iVerticalDisparitySearchRange );
     186#endif
    173187  //====== Quality control ========
    174188    m_acTEncTopList[iViewIdx]->setMaxDeltaQP                   ( m_iMaxDeltaQP  );
     
    386400    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
    387401    {
     402
     403#if FLEX_CODING_ORDER_M23723
     404      // Detect whether depth comes before than texture for this view
     405      Bool isDepthFirst = false;
     406      if ( m_b3DVFlexOrder )
     407      {
     408        for ( Int ii=1; ii<12; ii+=2 )
     409        {
     410          Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
     411          if ( iViewIdxCfg == iViewIdx )
     412          {
     413            if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
     414            {
     415              isDepthFirst = true;
     416            }
     417            else
     418            {
     419              assert(m_pchMVCJointCodingOrder[ii-1]=='T');
     420            }
     421            break;
     422          }
     423        }
     424      }
     425#endif
     426
    388427      m_depthFrameRcvd.push_back(0);
    389428      m_acTEncDepthTopList.push_back(new TEncTop);
     
    406445      m_acTEncDepthTopList[iViewIdx]->setViewId                       ( iViewIdx );
    407446      m_acTEncDepthTopList[iViewIdx]->setIsDepth                      ( true );
     447#if QC_MVHEVC_B0046
     448      m_acTEncDepthTopList[iViewIdx]->setLayerId                      ( iViewIdx );
     449#else
    408450      m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
     451#endif
    409452#if VIDYO_VPS_INTEGRATION
    410453      layerId = iViewIdx * 2 + 1;
     
    473516      m_acTEncDepthTopList[iViewIdx]->setSearchRange                  ( m_iSearchRange );
    474517      m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange            ( m_bipredSearchRange );
    475 
     518#if DV_V_RESTRICTION_B0037
     519      m_acTEncDepthTopList[iViewIdx]->setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction );
     520      m_acTEncDepthTopList[iViewIdx]->setVerticalDisparitySearchRange( m_iVerticalDisparitySearchRange );
     521#endif
    476522      //====== Quality control ========
    477523      m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP                   ( m_iMaxDeltaQP  );
     
    661707    m_acTEncDepthTopList[iViewIdx]->setUseDMM                     ( m_bUseDMM );
    662708#endif
     709#if FLEX_CODING_ORDER_M23723 && HHI_DMM_PRED_TEX
     710    m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM );
     711#endif
     712
    663713#if OL_QTLIMIT_PREDCODING_B0068
    664714    m_acTEncDepthTopList[iViewIdx]->setUseQTLPC                   (m_bUseQTLPC);
    665715#endif
    666716#if HHI_MPI
     717#if FLEX_CODING_ORDER_M23723
     718    m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI );
     719#else
    667720     m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
     721#endif
    668722#endif
    669723#if RWTH_SDC_DLT_B0036
     
    821875  {
    822876    m_acTEncTopList[iViewIdx]->init( this );
     877#if QC_MVHEVC_B0046
     878  //set setNumDirectRefLayer
     879  Int iNumDirectRef = m_acTEncTopList[iViewIdx]->getSPS()->getNumberOfUsableInterViewRefs();
     880  m_acTEncTopList[iViewIdx]->getEncTop()->getVPS()->setNumDirectRefLayer(iNumDirectRef, iViewIdx);
     881  for(Int iNumIvRef = 0; iNumIvRef < iNumDirectRef; iNumIvRef ++)
     882  {
     883    Int iLayerId = m_acTEncTopList[iViewIdx]->getSPS()->getUsableInterViewRef(iNumIvRef);
     884    m_acTEncTopList[iViewIdx]->getEncTop()->getVPS()->setDirectRefLayerId( iLayerId + iViewIdx, iViewIdx, iNumIvRef);
     885  }
     886#endif
    823887  }
    824888  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
     
    862926  TComPicYuv*       pcPicYuvOrg = new TComPicYuv;
    863927  TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
     928#if !QC_MVHEVC_B0046
    864929  TComPicYuv*       pcPdmDepthOrg    = new TComPicYuv;
     930#endif
    865931  TComPicYuv*       pcPicYuvRec = NULL;
    866932  TComPicYuv*       pcDepthPicYuvRec = NULL;
     
    9631029    {
    9641030      Int  iNumEncoded = 0;
     1031#if !QC_MVHEVC_B0046
    9651032      UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
    9661033      if ( iNextPoc < m_iFrameToBeEncoded )
     
    9681035      m_cCameraData.update( iNextPoc );
    9691036      }
     1037#endif
     1038
     1039#if FLEX_CODING_ORDER_M23723
     1040      if (m_b3DVFlexOrder)
     1041      {
     1042        Int  iNumDepthEncoded = 0;
     1043        iNumEncoded = 0;
     1044        Int i=0;
     1045        Int iViewIdx=0;
     1046        Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0;
     1047        for (Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ )
     1048        {
     1049          if (m_pchMVCJointCodingOrder[i]=='T')
     1050          {
     1051
     1052            i++;
     1053            assert(isdigit(m_pchMVCJointCodingOrder[i]));
     1054            iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
     1055
     1056            m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId );
     1057            xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false);
     1058            outputAccessUnits.clear();
     1059            i++;
     1060          }
     1061          else if ( m_pchMVCJointCodingOrder[i] == 'D')
     1062          {
     1063
     1064            i++;
     1065            if( m_bUsingDepthMaps )
     1066            {
     1067              assert(isdigit(m_pchMVCJointCodingOrder[i]));
     1068              iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
     1069#if SAIT_VSO_EST_A0033
     1070              if( m_bUseVSO && iNextPoc < m_iFrameToBeEncoded )
     1071              {
     1072                m_cCameraData.xSetDispCoeff( iNextPoc, iViewIdx );
     1073                m_acTEncDepthTopList[iViewIdx]->setDispCoeff( m_cCameraData.getDispCoeff() );
     1074              }
     1075#endif
     1076              m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId );
     1077              xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true);
     1078              outputAccessUnits.clear();
     1079              i++;
     1080            }
     1081          }
     1082        }
     1083      }
     1084      else
     1085      {
     1086
     1087#endif
    9701088      for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
    9711089      {
     
    9911109        }
    9921110      }
     1111 
     1112#if FLEX_CODING_ORDER_M23723
     1113      }
     1114#endif
     1115
    9931116#if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED
    9941117      for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
     
    10231146  pcDepthPicYuvOrg = NULL;
    10241147 
     1148#if !QC_MVHEVC_B0046
     1149#if FIX_DEL_NULLPTR
     1150  if ( pcPdmDepthOrg != NULL && m_uiMultiviewMvRegMode )
     1151#else
    10251152  if ( pcPdmDepthOrg != NULL )
     1153#endif
    10261154  {
    10271155    pcPdmDepthOrg->destroy();
     
    10291157    pcPdmDepthOrg = NULL;
    10301158  };
    1031 
     1159#endif
    10321160 
    10331161  for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
     
    12331361    case NAL_UNIT_CODED_SLICE:
    12341362#if H0566_TLA
     1363#if !QC_REM_IDV_B0046
    12351364    case NAL_UNIT_CODED_SLICE_IDV:
     1365#endif
    12361366    case NAL_UNIT_CODED_SLICE_TLA:
    12371367    case NAL_UNIT_CODED_SLICE_CRA:
  • trunk/source/App/TAppEncoder/TAppEncTop.h

    r189 r210  
    8787#endif
    8888
    89 #if VIDYO_VPS_INTEGRATION
     89#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    9090  TComVPS                     m_cVPS;
    9191#endif
     
    139139#endif
    140140 
     141#if QC_MVHEVC_B0046
     142  TComVPS*          getVPS()  { return &m_cVPS; }
     143#endif
    141144#if VIDYO_VPS_INTEGRATION
    142145  TComVPS*          getVPS()  { return &m_cVPS; }
Note: See TracChangeset for help on using the changeset viewer.