shithub: openh264

Download patch

ref: e66ad9ab86935c3fa405de77dd7a0dff6c541e0d
parent: d36b10fac5e981e071349e2883bdae886a90443d
author: Martin Storsjö <martin@martin.st>
date: Thu Jan 23 14:16:03 EST 2014

Remove the real32_t typedef

The float type is defined in standards and is portably available
on all supported compilers and platforms.

--- 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;