Ignore:
Timestamp:
26 Mar 2012, 09:03:21 (13 years ago)
Author:
poznan-univ
Message:

Adjustment for FlexCO, and high-level syntax improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp

    r28 r41  
    110110    free (m_pchBitstreamFile) ;
    111111
     112#if FLEX_CODING_ORDER
     113  if (m_pchMVCJointCodingOrder != NULL)
     114  {
     115    free(m_pchMVCJointCodingOrder) ;
     116  }
     117#endif
     118
    112119  for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ )
    113120  {
     
    153160  string cfg_ReconFile;
    154161  string cfg_dQPFile;
     162
     163#if FLEX_CODING_ORDER
     164  string cfg_JointCodingOrdering;
     165#endif
     166
    155167  po::Options opts;
    156168  opts.addOptions()
     
    191203  ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
    192204
     205#if FLEX_CODING_ORDER
     206  ("3DVFlexOrder",          m_b3DVFlexOrder,   false, "flexible coding order flag" )
     207  ("3DVCodingOrder",            cfg_JointCodingOrdering,  string(""), "The coding order for joint texture-depth coding")
     208#endif
    193209
    194210  /* Unit definition parameters */
     
    367383#endif
    368384#if POZNAN_NONLINEAR_DEPTH
    369   ("DepthPower,-dpow",    m_fDepthPower,      (Double)1.0, "Depth power value (for non-linear processing)")
     385  ("NonlinearDepth",           m_bUseNonlinearDepth,    true, "usage of non-linear depth representation")   
     386  ("NonlinearDepthModel",      m_aiNonlinearDepthModel, std::vector<Int>(0,0), "Nodes for definition of non-linear depth representation")   
     387#if POZNAN_NONLINEAR_DEPTH_THRESHOLD
     388  ("NonlinearDepthThreshold",  m_iNonlinearDepthThreshold, 100, "Threshold for usage of Nonlinear depth representation")   
     389#endif
    370390#endif
    371391
     
    398418  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    399419  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
     420
     421#if FLEX_CODING_ORDER && HHI_VSO
     422  m_pchMVCJointCodingOrder      = cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str());
     423  // If flexible order is enabled and if depth comes before the texture for a view, disable VSO
     424  Bool depthComesFirst = false;
     425  if ( m_b3DVFlexOrder )
     426  {
     427    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
     428    {
     429      for ( Int ii=1; ii<12; ii+=2 )
     430      {
     431        Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
     432        if ( iViewIdxCfg == iViewIdx )
     433        {
     434          if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
     435          {
     436            depthComesFirst = true;
     437            break;
     438          }
     439          else
     440          {
     441            assert(m_pchMVCJointCodingOrder[ii-1]=='T');
     442          }
     443        }
     444      }
     445    }
     446  }
     447  if (depthComesFirst)
     448  {
     449    m_bUseVSO = false;         
     450  }
     451#endif
    400452
    401453
     
    458510
    459511#if POZNAN_NONLINEAR_DEPTH
    460 if (m_fDepthPower<=0)
    461   {
    462     Float fDepthQP = m_adQP[ m_adQP.size()  < 2 ? 0 : 1];
    463     m_fDepthPower = (fDepthQP-30) *0.25/20.0 + 1.25;
    464     if (m_fDepthPower<=1.0) m_fDepthPower = 1.0;
    465     // QP = 30 = 1.25
    466     // QP = 50 = 1.5
    467     if (m_fDepthPower>=1.66) m_fDepthPower = 1.66;
    468   };
    469 
    470 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
    471   m_fDepthPower = dequantizeDepthPower(quantizeDepthPower((Float)m_fDepthPower));
    472 #endif
    473 
     512#if POZNAN_NONLINEAR_DEPTH_THRESHOLD
     513  if(m_bUseNonlinearDepth && m_iNonlinearDepthThreshold>0)
     514  {
     515    FILE *base_depth_file;
     516    unsigned char *depth_buf;
     517    int histogram[256];
     518    int i, size;
     519    float weighted_avg;
     520    base_depth_file = fopen(m_pchDepthInputFileList[0], "rb");
     521    if (base_depth_file)
     522    {
     523      size = m_iSourceWidth*m_iSourceHeight;
     524      depth_buf = (unsigned char *)malloc(size);
     525      fread(depth_buf, 1, size, base_depth_file);
     526      fclose(base_depth_file);
     527      memset(histogram, 0, sizeof(histogram));
     528      for (i=0; i<size;++i) histogram[depth_buf[i]]++;
     529      weighted_avg = 0;
     530      for (i=0; i<256; ++i) weighted_avg += i*histogram[i];
     531      weighted_avg /= size;
     532
     533      if (weighted_avg<m_iNonlinearDepthThreshold)
     534      {
     535        m_bUseNonlinearDepth = 0;
     536        printf ("\nWeighted average of depth histogram:%f < %d, turning NonlinearDepthRepresentation OFF\n", weighted_avg, m_iNonlinearDepthThreshold);
     537      }
     538    }
     539  }
     540#endif
     541
     542  if(m_bUseNonlinearDepth)
     543  {
     544    m_cNonlinearDepthModel.m_iNum = (Int)m_aiNonlinearDepthModel.size();
     545    m_cNonlinearDepthModel.m_aiPoints[0]=0;
     546    for (int i=0; i<m_cNonlinearDepthModel.m_iNum; ++i)
     547      m_cNonlinearDepthModel.m_aiPoints[i+1] = m_aiNonlinearDepthModel[i];
     548
     549    m_cNonlinearDepthModel.m_aiPoints[m_cNonlinearDepthModel.m_iNum+1]=0;
     550    m_cNonlinearDepthModel.Init();
     551  }
    474552#endif
    475553
     
    555633                                      LOG2_DISP_PREC_LUT
    556634#if POZNAN_NONLINEAR_DEPTH                                     
    557                                       ,m_fDepthPower
     635                                      ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL)
    558636#endif
    559637                                      );
     
    572650                                      LOG2_DISP_PREC_LUT
    573651#if POZNAN_NONLINEAR_DEPTH                                     
    574                                       ,m_fDepthPower
     652                                      ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL)
    575653#endif                                     
    576654                                      );
     
    589667    LOG2_DISP_PREC_LUT
    590668#if POZNAN_NONLINEAR_DEPTH                                     
    591     ,m_fDepthPower
     669    ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL)
    592670#endif   
    593671    );
     
    605683    LOG2_DISP_PREC_LUT
    606684#if POZNAN_NONLINEAR_DEPTH                                     
    607     ,m_fDepthPower
     685    ,(m_bUseNonlinearDepth ? &m_cNonlinearDepthModel : NULL)
    608686#endif   
    609687    );
     
    10641142#endif
    10651143#if POZNAN_NONLINEAR_DEPTH
    1066   printf("DepthPower:%f ", m_fDepthPower);
     1144  printf("NLDR:%d ", m_bUseNonlinearDepth ? 1 : 0);
    10671145#endif
    10681146  printf("\n");
Note: See TracChangeset for help on using the changeset viewer.