diff --git a/codec/common/typedefs.h b/codec/common/typedefs.h index 5e181430..8e11b097 100644 --- a/codec/common/typedefs.h +++ b/codec/common/typedefs.h @@ -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 diff --git a/codec/encoder/core/inc/param_svc.h b/codec/encoder/core/inc/param_svc.h index 5cae54ad..7339b526 100644 --- a/codec/encoder/core/inc/param_svc.h +++ b/codec/encoder/core/inc/param_svc.h @@ -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); diff --git a/codec/encoder/core/inc/picture.h b/codec/encoder/core/inc/picture.h index 4a6f93f0..d3424248 100644 --- a/codec/encoder/core/inc/picture.h +++ b/codec/encoder/core/inc/picture.h @@ -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 diff --git a/codec/encoder/core/inc/stat.h b/codec/encoder/core/inc/stat.h index 1864e7e5..1149bf25 100644 --- a/codec/encoder/core/inc/stat.h +++ b/codec/encoder/core/inc/stat.h @@ -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; diff --git a/codec/encoder/core/inc/utils.h b/codec/encoder/core/inc/utils.h index 37de9404..ea781fa2 100644 --- a/codec/encoder/core/inc/utils.h +++ b/codec/encoder/core/inc/utils.h @@ -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__ diff --git a/codec/encoder/core/src/encoder_ext.cpp b/codec/encoder/core/src/encoder_ext.cpp index 8e48df8e..cb082e41 100644 --- a/codec/encoder/core/src/encoder_ext.cpp +++ b/codec/encoder/core/src/encoder_ext.cpp @@ -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) diff --git a/codec/encoder/core/src/utils.cpp b/codec/encoder/core/src/utils.cpp index 2533ccb0..27f80fcb 100644 --- a/codec/encoder/core/src/utils.cpp +++ b/codec/encoder/core/src/utils.cpp @@ -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;