ref: 20c386a47b4eeb9cf446488f64e6f586278d9115
parent: da0c1fa75bd21fc4d2f24bf18d9eccb0ae5410d0
parent: e66ad9ab86935c3fa405de77dd7a0dff6c541e0d
author: Ethan Hugg <ethanhugg@gmail.com>
date: Sat Feb 8 03:42:22 EST 2014
Merge pull request #269 from mstorsjo/remove-float-typedefs Remove typedefs for float_t, double_t and real32_t
--- a/codec/common/typedefs.h
+++ b/codec/common/typedefs.h
@@ -62,7 +62,8 @@
// 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
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -63,7 +63,7 @@
* \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);
--- a/codec/encoder/core/inc/picture.h
+++ b/codec/encoder/core/inc/picture.h
@@ -58,7 +58,7 @@
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
--- 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;
--- a/codec/encoder/core/inc/utils.h
+++ b/codec/encoder/core/inc/utils.h
@@ -68,12 +68,12 @@
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 @@
* \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__
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3126,7 +3126,7 @@
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)
--- a/codec/encoder/core/src/utils.cpp
+++ b/codec/encoder/core/src/utils.cpp
@@ -60,12 +60,12 @@
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 @@
#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 @@
* \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;
--- a/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp
+++ b/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp
@@ -69,12 +69,12 @@
SVAACalcResult* pVaaCalcResults = NULL;
int8_t iMotionTextureIndexToDeltaQp = 0;
int32_t iAverMotionTextureIndexToDeltaQp = 0; // double to uint32
- double_t dAverageMotionIndex = 0.0; // double to float
- double_t dAverageTextureIndex = 0.0;
+ double dAverageMotionIndex = 0.0; // double to float
+ double dAverageTextureIndex = 0.0;
- double_t dQStep = 0.0;
- double_t dLumaMotionDeltaQp = 0;
- double_t dLumaTextureDeltaQp = 0;
+ double dQStep = 0.0;
+ double dLumaMotionDeltaQp = 0;
+ double dLumaTextureDeltaQp = 0;
uint8_t* pRefFrameY = NULL, *pCurFrameY = NULL;
int32_t iRefStride = 0, iCurStride = 0;
@@ -170,7 +170,7 @@
pMotionTexture = m_sAdaptiveQuantParam.pMotionTextureUnit;
for (j = 0; j < iMbHeight; j ++) {
for (i = 0; i < iMbWidth; i++) {
- double_t a = pMotionTexture->uiTextureIndex / dAverageTextureIndex;
+ double a = pMotionTexture->uiTextureIndex / dAverageTextureIndex;
dQStep = (a - 1) / (a + MODEL_ALPHA);
dLumaTextureDeltaQp = MODEL_TIME * dQStep;// range +- 6
--- a/codec/processing/src/common/typedef.h
+++ b/codec/processing/src/common/typedef.h
@@ -76,11 +76,6 @@
typedef char str_t ; // [comment]: specific use plain char only for character parameters
typedef bool bool_t ;
-#if defined(_WIN32) || defined(_MACH_PLATFORM) || defined(__GNUC__)
-typedef float float_t ;
-typedef double double_t ;
-#endif
-
enum {
FALSE = 0,
TRUE = !FALSE
--- a/codec/processing/src/denoise/denoise.h
+++ b/codec/processing/src/denoise/denoise.h
@@ -96,7 +96,7 @@
void WaverageDenoiseChroma (uint8_t* pSrcUV, int32_t width, int32_t height, int32_t stride);
private:
- float_t m_fSigmaGrey; //sigma for grey scale similarity, suggestion 2.5-3
+ float m_fSigmaGrey; //sigma for grey scale similarity, suggestion 2.5-3
uint32_t m_uiFilterWindow; //filter window diameter
uint16_t m_uiSpaceRadius; //filter windows radius: 1-3x3, 2-5x5,3-7x7. Larger size, slower speed
uint16_t m_uiType; //do denoising on which component 1-Y, 2-U, 4-V; 7-YUV, 3-YU, 5-YV, 6-UV
--- a/codec/processing/src/downsample/downsamplefuncs.cpp
+++ b/codec/processing/src/downsample/downsamplefuncs.cpp
@@ -73,8 +73,8 @@
uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
const uint32_t kuiScaleBitWidth = 16, kuiScaleBitHeight = 15;
const uint32_t kuiScaleWidth = (1 << kuiScaleBitWidth), kuiScaleHeight = (1 << kuiScaleBitHeight);
- int32_t fScalex = (int32_t) ((float_t)kiSrcWidth / (float_t)kiDstWidth * kuiScaleWidth);
- int32_t fScaley = (int32_t) ((float_t)kiSrcHeight / (float_t)kiDstHeight * kuiScaleHeight);
+ int32_t fScalex = (int32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth);
+ int32_t fScaley = (int32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScaleHeight);
uint32_t x;
int32_t iYInverse, iXInverse;
@@ -142,8 +142,8 @@
uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) {
const int32_t kiScaleBit = 15;
const int32_t kiScale = (1 << kiScaleBit);
- int32_t iScalex = (int32_t) ((float_t)kiSrcWidth / (float_t)kiDstWidth * kiScale);
- int32_t iScaley = (int32_t) ((float_t)kiSrcHeight / (float_t)kiDstHeight * kiScale);
+ int32_t iScalex = (int32_t) ((float)kiSrcWidth / (float)kiDstWidth * kiScale);
+ int32_t iScaley = (int32_t) ((float)kiSrcHeight / (float)kiDstHeight * kiScale);
int64_t x;
int32_t iYInverse, iXInverse;
@@ -208,8 +208,8 @@
// const int32_t kiScaleBitWidth = 16, kiScaleBitHeight = 15;
// const uint32_t kuiScaleWidth = (1 << kiScaleBitWidth), kuiScaleHeight = (1 << kiScaleBitHeight);
//
-// uint32_t uiScalex = (uint32_t) ((float_t)kiSrcWidth / (float_t)kiDstWidth * kuiScaleWidth);
-// uint32_t uiScaley = (uint32_t) ((float_t)kiSrcHeight / (float_t)kiDstHeight * kuiScaleHeight);
+// uint32_t uiScalex = (uint32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth);
+// uint32_t uiScaley = (uint32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScaleHeight);
//
// GeneralBilinearFastDownsampler_sse2 (pDst, kiDstStride, kiDstWidth, kiDstHeight,
// pSrc, kiSrcStride, kiSrcWidth, kiSrcHeight, uiScalex, uiScaley);
@@ -221,8 +221,8 @@
// const int32_t kiScaleBit = 15;
// const uint32_t kuiScale = (1 << kiScaleBit);
//
-// uint32_t uiScalex = (uint32_t) ((float_t)kiSrcWidth / (float_t)kiDstWidth * kuiScale);
-// uint32_t uiScaley = (uint32_t) ((float_t)kiSrcHeight / (float_t)kiDstHeight * kuiScale);
+// uint32_t uiScalex = (uint32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScale);
+// uint32_t uiScaley = (uint32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScale);
//
// GeneralBilinearAccurateDownsampler_sse2 (pDst, kiDstStride, kiDstWidth, kiDstHeight,
// pSrc, kiSrcStride, kiSrcWidth, kiSrcHeight, uiScalex, uiScaley);