shithub: openh264

Download patch

ref: d36b10fac5e981e071349e2883bdae886a90443d
parent: ba6bf7da18a3ad6326bdc38759cd1dc701ef4aea
author: Martin Storsjö <[email protected]>
date: Thu Jan 23 13:45:59 EST 2014

Remove typedefs for float_t and double_t

The actual float and double data types are defined in C89 and are
usable as such without any extra typedefs.

Removing the extra typedefs simplifies the compatibility typedef
headers, simplifies portability and makes the code base easier
to work with for people new to the library.

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