www.pudn.com > XvidQP.rar > DistributionDlg.cpp
// DistributionDlg.cpp : implementation file
//
#include "stdafx.h"
#include "XvidQuantsParser.h"
#include "DistributionDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDistributionDlg dialog
CDistributionDlg::CDistributionDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDistributionDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDistributionDlg)
m_icount = 0;
m_pcount = 0;
m_pavg = 0.0f;
m_iavg = 0.0f;
m_imaxfs = 0;
m_iminfs = 0;
m_pmaxfs = 0;
m_pminfs = 0;
//}}AFX_DATA_INIT
qarray = NULL;
}
void CDistributionDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDistributionDlg)
DDX_Control(pDX, IDC_LIST_PFRAMES, m_listp);
DDX_Control(pDX, IDC_LIST_IFRAMES, m_listi);
DDX_Text(pDX, IDC_EDIT_ICOUNT, m_icount);
DDX_Text(pDX, IDC_EDIT_PCOUNT, m_pcount);
DDX_Text(pDX, IDC_EDIT_PAVG, m_pavg);
DDX_Text(pDX, IDC_EDIT_IAVG, m_iavg);
DDX_Control(pDX, IDC_GRAPH_G, m_graphg);
DDX_Control(pDX, IDC_GRAPH_I, m_graphi);
DDX_Control(pDX, IDC_GRAPH_P, m_graphp);
DDX_Text(pDX, IDC_EDIT_IMAXFS, m_imaxfs);
DDX_Text(pDX, IDC_EDIT_IMINFS, m_iminfs);
DDX_Text(pDX, IDC_EDIT_PMAXFS, m_pmaxfs);
DDX_Text(pDX, IDC_EDIT_PMINFS, m_pminfs);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDistributionDlg, CDialog)
//{{AFX_MSG_MAP(CDistributionDlg)
ON_BN_CLICKED(IDC_BUTTON_DRAW, OnButtonDraw)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDistributionDlg message handlers
void CDistributionDlg::Init(CXvid &xvid, CXvid::QUANTS *quants, int nframes)
{
nelem = nframes;
qarray = quants;
pavg = xvid.GetPAvgQuants();
pmaxfs = xvid.GetPMaxFrameSize();
pminfs = xvid.GetPMinFrameSize();
iavg = xvid.GetIAvgQuants();
imaxfs = xvid.GetIMaxFrameSize();
iminfs = xvid.GetIMinFrameSize();
}
//-----------------------------------------------------------------------------------
void CDistributionDlg::ParsePFrames(void)
{
char index[3], percent[6], fcount[8];
pcount=0;
//初始化
for (int i=0; i<31; i++)
{
phisto[i] = 0;
}
//分析
for (int j=0; j 0)
m_graphg.DrawLine(i+1, 1, i+1, ((ghisto[i]*100)/(pcount+icount))+2);
}
//p-frames
for (i=0; i<31; i++)
{
if (phisto[i] > 0)
m_graphp.DrawLine(i+1, 1, i+1, ((phisto[i]*100)/pcount)+2);
}
//i-frames
for (i=0; i<31; i++)
{
if (ihisto[i] > 0)
m_graphi.DrawLine(i+1, 1, i+1, ((ihisto[i]*100)/icount)+2);
}
}
//-----------------------------------------------------------------------------------
void CDistributionDlg::OnButtonDraw()
{
DrawHistograms();
}