Ignore:
Timestamp:
30 Mar 2012, 18:57:41 (13 years ago)
Author:
poznan-univ
Message:

some bug fix on high level syntax
fixed some compiler warning issues under windows and linux

File:
1 edited

Legend:

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

    r41 r48  
    523523      size = m_iSourceWidth*m_iSourceHeight;
    524524      depth_buf = (unsigned char *)malloc(size);
    525       fread(depth_buf, 1, size, base_depth_file);
     525      size_t read = fread(depth_buf, 1, size, base_depth_file);
    526526      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)
     527      if(read)
    534528      {
    535         m_bUseNonlinearDepth = 0;
    536         printf ("\nWeighted average of depth histogram:%f < %d, turning NonlinearDepthRepresentation OFF\n", weighted_avg, m_iNonlinearDepthThreshold);
     529        memset(histogram, 0, sizeof(histogram));
     530        for (i=0; i<size;++i) histogram[depth_buf[i]]++;
     531        weighted_avg = 0;
     532        for (i=0; i<256; ++i) weighted_avg += i*histogram[i];
     533        weighted_avg /= size;
     534
     535        if (weighted_avg<m_iNonlinearDepthThreshold)
     536        {
     537          m_bUseNonlinearDepth = 0;
     538          printf ("\nWeighted average of depth histogram:%f < %d, turning NonlinearDepthRepresentation OFF\n", weighted_avg, m_iNonlinearDepthThreshold);
     539        }
    537540      }
    538541    }
     
    542545  if(m_bUseNonlinearDepth)
    543546  {
     547     if((Int)m_aiNonlinearDepthModel.size()== 0)
     548     {
     549       m_aiNonlinearDepthModel.push_back(10);
     550       m_aiNonlinearDepthModel.push_back(19);
     551       m_aiNonlinearDepthModel.push_back(24);
     552       m_aiNonlinearDepthModel.push_back(27);
     553       m_aiNonlinearDepthModel.push_back(26);
     554       m_aiNonlinearDepthModel.push_back(22);
     555       m_aiNonlinearDepthModel.push_back(13);
     556     }
     557    //10,19,24,27,26,22,13
    544558    m_cNonlinearDepthModel.m_iNum = (Int)m_aiNonlinearDepthModel.size();
     559   
    545560    m_cNonlinearDepthModel.m_aiPoints[0]=0;
     561
    546562    for (int i=0; i<m_cNonlinearDepthModel.m_iNum; ++i)
    547563      m_cNonlinearDepthModel.m_aiPoints[i+1] = m_aiNonlinearDepthModel[i];
Note: See TracChangeset for help on using the changeset viewer.