Remove the real32_t typedef

The float type is defined in standards and is portably available
on all supported compilers and platforms.
This commit is contained in:
Martin Storsjö 2014-01-23 19:16:03 +02:00
parent d36b10fac5
commit e66ad9ab86
7 changed files with 33 additions and 32 deletions

View File

@ -62,7 +62,8 @@ typedef unsigned __int64 uint64_t;
// FIXME: all string type should be declared explicit as char.
typedef char str_t;
typedef float real32_t;
// The 'float' type is portable and usable without any need for any extra typedefs.
#ifdef EPSN
#undef EPSN
#endif//EPSN

View File

@ -63,7 +63,7 @@ extern const uint8_t g_kuiTemporalIdListTable[MAX_TEMPORAL_LEVEL][MAX_GOP_SIZE
* \param upper input upper value
* \return 2 based scaling factor
*/
static inline uint32_t GetLogFactor (real32_t base, real32_t upper) {
static inline uint32_t GetLogFactor (float base, float upper) {
const double dLog2factor = log10 (1.0 * upper / base) / log10 (2.0);
const double dEpsilon = 0.0001;
const double dRound = floor (dLog2factor + 0.5);

View File

@ -58,7 +58,7 @@ typedef struct TagPicture {
int32_t iPictureType; // got from sSliceHeader(): eSliceType
int32_t iFramePoc; // frame POC
real32_t fFrameRate; // MOVE
float fFrameRate; // MOVE
int32_t iFrameNum; // frame number //for pRef pic management
uint32_t* uiRefMbType; // for iMbWidth*iMbHeight

View File

@ -45,9 +45,9 @@
*/
typedef struct TagStatQuality {
real32_t rYPsnr[5];
real32_t rUPsnr[5];
real32_t rVPsnr[5];
float rYPsnr[5];
float rUPsnr[5];
float rVPsnr[5];
} SStatQuality;

View File

@ -68,12 +68,12 @@ WELS_LOG_DEFAULT = WELS_LOG_ERROR | WELS_LOG_WARNING | WELS_LOG_INFO | WELS_LOG_
typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const str_t* kpFmt, va_list argv);
// wels psnr calc
typedef real32_t (*PWelsPsnrFunc) (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight);
typedef float (*PWelsPsnrFunc) (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight);
extern PWelsLogCallbackFunc wlog;
@ -176,12 +176,12 @@ void WelsReopenTraceFile (void* pCtx, str_t* pCurPath);
* \note N/A
*************************************************************************************
*/
real32_t WelsCalcPsnr (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight);
float WelsCalcPsnr (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight);
}
#endif//WELS_UTILS_H__

View File

@ -3126,7 +3126,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur
int8_t iCurTid = 0;
bool_t bAvcBased = false;
#if defined(ENABLE_PSNR_CALC)
real32_t snr_y = .0f, snr_u = .0f, snr_v = .0f;
float snr_y = .0f, snr_u = .0f, snr_v = .0f;
#endif//ENABLE_PSNR_CALC
#if defined(_DEBUG)

View File

@ -60,12 +60,12 @@ namespace WelsSVCEnc {
void WelsLogDefault (void* pCtx, const int32_t kiLevel, const str_t* kpFmtStr, va_list argv);
void WelsLogNil (void* pCtx, const int32_t kiLevel, const str_t* kpFmtStr, va_list argv);
real32_t WelsCalcPsnr (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight);
float WelsCalcPsnr (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight);
// to fill default routines
#ifdef ENABLE_TRACE_FILE
@ -343,7 +343,7 @@ void WelsLog (void* pCtx, int32_t iLevel, const str_t* kpFmt, ...) {
#ifndef CALC_PSNR
#define CONST_FACTOR_PSNR (10.0 / log(10.0)) // for good computation
#define CALC_PSNR(w, h, s) ((real32_t)(CONST_FACTOR_PSNR * log( 65025.0 * w * h / iSqe )))
#define CALC_PSNR(w, h, s) ((float)(CONST_FACTOR_PSNR * log( 65025.0 * w * h / iSqe )))
#endif//CALC_PSNR
/*
@ -365,12 +365,12 @@ void WelsLog (void* pCtx, int32_t iLevel, const str_t* kpFmt, ...) {
* \note N/A
*************************************************************************************
*/
real32_t WelsCalcPsnr (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight) {
float WelsCalcPsnr (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
const int32_t kiRefStride,
const int32_t kiWidth,
const int32_t kiHeight) {
int64_t iSqe = 0;
int32_t x, y;
uint8_t* pTar = (uint8_t*)kpTarPic;