📄 umc_vc1_enc_statistic.h
字号:
/* /////////////////////////////////////////////////////////////////////////////
//
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright(c) 2004-2007 Intel Corporation. All Rights Reserved.
//
//
// VC-1 (VC1) encoder, vc1 encoder statistics
//
*/
#include "umc_defs.h"
#if defined (UMC_ENABLE_VC1_VIDEO_ENCODER)
#ifndef _UMC_VC1_ENC_STATISTIC_H_
#define _UMC_VC1_ENC_STATISTIC_H_
#include "ippvc.h"
#include "umc_structures.h"
//#define VC1_ENC_STAT
#ifdef VC1_ENC_STAT
namespace UMC_VC1_ENCODER
{
class EncoderStatistic
{
public:
EncoderStatistic()
{
nAC = 0;
lengthAC = 0;
lengthMV = 0;
lengthMB = 0;
wMB = 0;
hMB = 0;
blkType = 0;
}
UMC::Status Init(Ipp32u w, Ipp32u h)
{
Close();
wMB = w;
hMB = h;
nAC = new Ipp8u[wMB*hMB*6];
if (!nAC)
return UMC::UMC_ERR_ALLOC;
lengthAC = new Ipp32u[wMB*hMB*6];
if (!lengthAC)
return UMC::UMC_ERR_ALLOC;
lengthMV = new Ipp32u[wMB*hMB*4];
if (!lengthMV)
return UMC::UMC_ERR_ALLOC;
lengthMB = new Ipp32u[wMB*hMB];
if (!lengthMB)
return UMC::UMC_ERR_ALLOC;
blkType = new Ipp8u[wMB*hMB*6];
if (!blkType)
return UMC::UMC_ERR_ALLOC;
return UMC::UMC_OK;
}
void Reset()
{
if (nAC)
memset(nAC,0,wMB*hMB*6*sizeof(Ipp8u));
if (lengthAC)
memset(lengthAC,0,wMB*hMB*6*sizeof(Ipp32u));
if (lengthMV)
memset(lengthMV,0,wMB*hMB*4*sizeof(Ipp32u));
if (lengthMB)
memset(lengthMB,0,wMB*hMB*sizeof(Ipp8u));
if (blkType)
memset(blkType,0,wMB*hMB*6*sizeof(Ipp8u));
}
void Close()
{
wMB = 0;
hMB = 0;
if (nAC)
{
delete [] nAC;
nAC = 0;
}
if (lengthAC)
{
delete [] lengthAC;
lengthAC = 0;
}
if (lengthMV)
{
delete [] lengthMV;
lengthMV = 0;
}
if (lengthMB)
{
delete [] lengthMB;
lengthMB = 0;
}
if (blkType)
{
delete [] blkType;
blkType = 0;
}
}
~EncoderStatistic()
{
Close();
}
Ipp8u GetNumCoeffBlok(Ipp32u x, Ipp32u y, Ipp8u blk)
{
if (!nAC || blk>5 || x>=wMB || y>= hMB)
return 0;
return nAC[(x+y*wMB)*6 + blk];
}
bool SetNumCoeffBlok(Ipp8u n, Ipp32u x, Ipp32u y, Ipp8u blk)
{
if (!nAC || blk>5 || x>=wMB || y>= hMB)
return false;
nAC[(x+y*wMB)*6 + blk] = n;
return true;
}
Ipp8u GetNumCoeffMB(Ipp32u x, Ipp32u y)
{
if (!nAC || x>=wMB || y>= hMB)
return 0;
return nAC[(x+y*wMB)*6 + 0]+nAC[(x+y*wMB)*6 + 1]+
nAC[(x+y*wMB)*6 + 2]+nAC[(x+y*wMB)*6 + 3]+
nAC[(x+y*wMB)*6 + 4]+nAC[(x+y*wMB)*6 + 5];
}
Ipp32u GetLenBlock(Ipp32u x, Ipp32u y, Ipp8u blk)
{
if (!lengthAC || blk>5 || x>=wMB || y>= hMB)
return 0;
return lengthAC[(x+y*wMB)*6 + blk];
}
bool SetLenBlock(Ipp32u len, Ipp32u x, Ipp32u y, Ipp8u blk)
{
if (!lengthAC || blk>5 || x>=wMB || y>= hMB)
return false;
lengthAC[(x+y*wMB)*6 + blk] = len;
return true;
}
Ipp32u GetLenMV(Ipp32u x, Ipp32u y, Ipp8u blk=0)
{
if (!lengthMV || blk>3 || x>=wMB || y>= hMB)
return 0;
return lengthMV[(x+y*wMB)*4 + blk];
}
bool SetLenMV(Ipp32u len, Ipp32u x, Ipp32u y, Ipp8u blk=0)
{
if (!lengthMV || blk>3 || x>=wMB || y>= hMB)
return false;
lengthMV[(x+y*wMB)*4 + blk] = len;
return true;
}
Ipp32u GetLenMB(Ipp32u x, Ipp32u y)
{
if (!lengthMB || x>=wMB || y>= hMB)
return 0;
return lengthMB[(x+y*wMB)];
}
bool SetLenMB(Ipp32u len, Ipp32u x, Ipp32u y)
{
if (!lengthMB || x>=wMB || y>= hMB)
return false;
lengthMB[(x+y*wMB)] = len;
return true;
}
Ipp8u GetTypeBlock(Ipp32u x, Ipp32u y, Ipp8u blk=0)
{
if (!blkType || blk>5 || x>=wMB || y>= hMB)
return 0;
return blkType[(x+y*wMB)*6 + blk];
}
bool SetTypeBlock(Ipp8u type, Ipp32u x, Ipp32u y, Ipp8u blk=0)
{
if (!blkType || blk>5 || x>=wMB || y>= hMB)
return false;
blkType[(x+y*wMB)*6 + blk] = type;
return true;
}
private:
Ipp32u wMB;
Ipp32u hMB;
Ipp8u* nAC;
Ipp32u* lengthAC;
Ipp32u* lengthMV;
Ipp32u* lengthMB;
Ipp8u* blkType;
};
}
#endif //VC1_ENC_STAT
//# define _PROJECT_STATISTICS_
#ifdef _PROJECT_STATISTICS_
#include "vm_time.h"
#include "umc_sys_info.h"
#include "vm_sys_info.h"
#include <string.h>
typedef struct
{
Ipp64u frameCount;
vm_char streamName[256];
Ipp32s bitrate;
Ipp32s GOPLen;
Ipp32s BLen;
Ipp64u startTime; //application start time
Ipp64u endTime; // aplication end time
Ipp64u totalTime; // total time
//Motion estimation
Ipp64u me_StartTime;
Ipp64u me_EndTime;
Ipp64u me_TotalTime;
Ipp32s meSpeedSearch;
//Interpolation
Ipp64u Interpolate_StartTime;
Ipp64u Interpolate_EndTime;
Ipp64u Interpolate_TotalTime;
//Intra prediction
Ipp64u Intra_StartTime;
Ipp64u Intra_EndTime;
Ipp64u Intra_TotalTime;
//Inter prediction
Ipp64u Inter_StartTime;
Ipp64u Inter_EndTime;
Ipp64u Inter_TotalTime;
//Forward quantization and transforming
Ipp64u FwdQT_StartTime;
Ipp64u FwdQT_EndTime;
Ipp64u FwdQT_TotalTime;
//Inverse quantization and transforming
Ipp64u InvQT_StartTime;
Ipp64u InvQT_EndTime;
Ipp64u InvQT_TotalTime;
//Inverse quantization and transforming
Ipp64u Reconst_StartTime;
Ipp64u Reconst_EndTime;
Ipp64u Reconst_TotalTime;
//Deblocking
Ipp64u Deblk_StartTime;
Ipp64u Deblk_EndTime;
Ipp64u Deblk_TotalTime;
//Coding AC coeffs
Ipp64u AC_Coefs_StartTime;
Ipp64u AC_Coefs_EndTime;
Ipp64u AC_Coefs_TotalTime;
}VC1EncTimeStatistics;
extern VC1EncTimeStatistics* m_TStat;
#define STATISTICS_START_TIME(startTime) (startTime) = ippGetCpuClocks();
#define STATISTICS_END_TIME(startTime, endTime, totalTime) \
(endTime)=ippGetCpuClocks(); \
(totalTime) += ((endTime) - (startTime));
void TimeStatisticsStructureInitialization();
void WriteStatisticResults();
void DeleteStatistics();
#else
#include "vm_time.h"
#define STATISTICS_START_TIME(startTime)
#define STATISTICS_END_TIME(startTime,endTime,totalTime)
#endif
//#define _VC1_IPP_STATISTICS_
#ifdef _VC1_IPP_STATISTICS_
#include "vm_time.h"
#include "umc_sys_info.h"
#include "vm_sys_info.h"
#include <string.h>
typedef struct
{
Ipp64u frameCount;
vm_char streamName[256];
Ipp32s bitrate;
Ipp32s GOPLen;
Ipp32s BLen;
Ipp64u startTime; //application start time
Ipp64u endTime; // aplication end time
Ipp64u totalTime; // total time
Ipp64u IppStartTime; //application start time
Ipp64u IppEndTime; // aplication end time
Ipp64u IppTotalTime; // total time
Ipp32s meSpeedSearch; //ME speed
}VC1EncIppStatistics;
extern VC1EncIppStatistics* m_IppStat;
#define IPP_STAT_START_TIME(startTime) (startTime) = ippGetCpuClocks();
#define IPP_STAT_END_TIME(startTime, endTime, totalTime) \
(endTime)=ippGetCpuClocks(); \
(totalTime) += ((endTime) - (startTime));
void IppStatisticsStructureInitialization();
void WriteIppStatisticResults();
void DeleteIppStatistics();
#else
#include "vm_time.h"
#define IPP_STAT_START_TIME(startTime)
#define IPP_STAT_END_TIME(startTime,endTime,totalTime)
#endif//_VC1_IPP_STATISTICS_
#endif //_UMC_VC1_ENC_STATISTIC_H
#endif //UMC_ENABLE_VC1_VIDEO_ENCODER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -