/[pcsx2_0.9.7]/trunk/3rdparty/portaudio/src/common/pa_converters.c
ViewVC logotype

Diff of /trunk/3rdparty/portaudio/src/common/pa_converters.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/3rdparty/portaudio/src/common/pa_converters.c	2010/11/12 00:35:47	272
+++ trunk/3rdparty/portaudio/src/common/pa_converters.c	2010/11/12 01:10:22	273
@@ -26,13 +26,13 @@
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however,
+ * The text above constitutes the entire PortAudio license; however, 
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
+ * they can be incorporated into the canonical version. It is also 
+ * requested that these non-binding requests be included along with the 
  * license above.
  */
 
@@ -40,7 +40,7 @@
  @ingroup common_src
 
  @brief Conversion function implementations.
-
+ 
  If the C9x function lrintf() is available, define PA_USE_C99_LRINTF to use it
 
  @todo Consider whether functions which dither but don't clip should exist,
@@ -49,7 +49,7 @@
 
  @todo implement the converters marked IMPLEMENT ME: Float32_To_UInt8_Dither,
  Float32_To_UInt8_Clip, Float32_To_UInt8_DitherClip, Int32_To_Int24_Dither,
- Int32_To_UInt8_Dither, Int24_To_Int16_Dither, Int24_To_Int8_Dither,
+ Int32_To_UInt8_Dither, Int24_To_Int16_Dither, Int24_To_Int8_Dither, 
  Int24_To_UInt8_Dither, Int16_To_Int8_Dither, Int16_To_UInt8_Dither,
 
  @todo review the converters marked REVIEW: Float32_To_Int32,
@@ -71,7 +71,7 @@
 
     format &= ~paNonInterleaved;
     availableFormats &= ~paNonInterleaved;
-
+    
     if( (format & availableFormats) == 0 )
     {
         /* NOTE: this code depends on the sample format constants being in
@@ -94,7 +94,7 @@
         {
             result = 0;
         }
-
+        
         if( result == 0 ){
             /* scan for worse formats */
             result = format;
@@ -107,7 +107,7 @@
             if( (result & availableFormats) == 0 )
                 result = paSampleFormatNotSupported;
         }
-
+        
     }else{
         result = format;
     }
@@ -283,7 +283,7 @@
     0, /* PaUtilConverter *Int24_To_Int8_Dither; */
     0, /* PaUtilConverter *Int24_To_UInt8; */
     0, /* PaUtilConverter *Int24_To_UInt8_Dither; */
-
+    
     0, /* PaUtilConverter *Int16_To_Float32; */
     0, /* PaUtilConverter *Int16_To_Int32; */
     0, /* PaUtilConverter *Int16_To_Int24; */
@@ -345,9 +345,9 @@
         *dest = lrintf(scaled-0.5f);
 #else
         double scaled = *src * 0x7FFFFFFF;
-        *dest = (PaInt32) scaled;
+        *dest = (PaInt32) scaled;        
 #endif
-
+        
         src += sourceStride;
         dest += destinationStride;
     }
@@ -392,7 +392,7 @@
     float *src = (float*)sourceBuffer;
     PaInt32 *dest =  (PaInt32*)destinationBuffer;
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
         /* REVIEW */
@@ -455,13 +455,13 @@
     PaInt32 temp;
 
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
         /* convert to 32 bit and drop the low 8 bits */
         double scaled = *src * 0x7FFFFFFF;
         temp = (PaInt32) scaled;
-
+        
 #if defined(PA_LITTLE_ENDIAN)
         dest[0] = (unsigned char)(temp >> 8);
         dest[1] = (unsigned char)(temp >> 16);
@@ -495,7 +495,7 @@
         double dither  = PaUtil_GenerateFloatTriangularDither( ditherGenerator );
         /* use smaller scaler to prevent overflow when we add the dither */
         double dithered = ((double)*src * (2147483646.0)) + dither;
-
+        
         temp = (PaInt32) dithered;
 
 #if defined(PA_LITTLE_ENDIAN)
@@ -525,7 +525,7 @@
     PaInt32 temp;
 
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
         /* convert to 32 bit and drop the low 8 bits */
@@ -558,16 +558,16 @@
     float *src = (float*)sourceBuffer;
     unsigned char *dest = (unsigned char*)destinationBuffer;
     PaInt32 temp;
-
+    
     while( count-- )
     {
         /* convert to 32 bit and drop the low 8 bits */
-
+        
         double dither  = PaUtil_GenerateFloatTriangularDither( ditherGenerator );
         /* use smaller scaler to prevent overflow when we add the dither */
         double dithered = ((double)*src * (2147483646.0)) + dither;
         PA_CLIP_( dithered, -2147483648., 2147483647.  );
-
+        
         temp = (PaInt32) dithered;
 
 #if defined(PA_LITTLE_ENDIAN)
@@ -898,7 +898,7 @@
     PaInt32 *src    = (PaInt32*)sourceBuffer;
     unsigned char *dest = (unsigned char*)destinationBuffer;
     (void) ditherGenerator; /* unused parameter */
-
+    
 	while( count-- )
     {
 		/* REVIEW */
@@ -1029,7 +1029,7 @@
 
     while( count-- )
     {
-		(*dest) = (unsigned char)(((*src) >> 24) + 128);
+		(*dest) = (unsigned char)(((*src) >> 24) + 128); 
 
         src += sourceStride;
         dest += destinationStride;
@@ -1068,12 +1068,12 @@
     PaInt32 temp;
 
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
 
 #if defined(PA_LITTLE_ENDIAN)
-        temp = (((PaInt32)src[0]) << 8);
+        temp = (((PaInt32)src[0]) << 8);  
         temp = temp | (((PaInt32)src[1]) << 16);
         temp = temp | (((PaInt32)src[2]) << 24);
 #elif defined(PA_BIG_ENDIAN)
@@ -1101,12 +1101,12 @@
     PaInt32 temp;
 
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
 
 #if defined(PA_LITTLE_ENDIAN)
-        temp = (((PaInt32)src[0]) << 8);
+        temp = (((PaInt32)src[0]) << 8);  
         temp = temp | (((PaInt32)src[1]) << 16);
         temp = temp | (((PaInt32)src[2]) << 24);
 #elif defined(PA_BIG_ENDIAN)
@@ -1131,14 +1131,14 @@
 {
     unsigned char *src = (unsigned char*)sourceBuffer;
     PaInt16 *dest = (PaInt16*)destinationBuffer;
-
+    
     PaInt16 temp;
 
     (void) ditherGenerator; /* unused parameter */
-
+        
     while( count-- )
     {
-
+		
 #if defined(PA_LITTLE_ENDIAN)
 		/* src[0] is discarded */
         temp = (((PaInt16)src[1]));
@@ -1179,7 +1179,7 @@
     {
         dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator );
 
-		/* downscale 24-bit int to 16-bit int placed into 32-bit float container,
+		/* downscale 24-bit int to 16-bit int placed into 32-bit float container, 
 		   16-bit scaler is decreased by 2 to leave space for dither in order not to overflow
 		*/
 		dithered = _PA_INT24_TO_FLOAT(src, -2.0f) + dither;
@@ -1205,12 +1205,12 @@
 {
     unsigned char *src = (unsigned char*)sourceBuffer;
     signed char  *dest = (signed char*)destinationBuffer;
-
+    
     (void) ditherGenerator; /* unused parameter */
-
+        
     while( count-- )
-    {
-
+    {	
+	
 #if defined(PA_LITTLE_ENDIAN)
 		/* src[0] is discarded */
 		/* src[1] is discarded */
@@ -1251,12 +1251,12 @@
 {
     unsigned char *src = (unsigned char*)sourceBuffer;
     unsigned char *dest = (unsigned char*)destinationBuffer;
-
+    
     (void) ditherGenerator; /* unused parameter */
-
+        
     while( count-- )
     {
-
+		
 #if defined(PA_LITTLE_ENDIAN)
 		/* src[0] is discarded */
 		/* src[1] is discarded */
@@ -1264,7 +1264,7 @@
 #elif defined(PA_BIG_ENDIAN)
         *dest = (unsigned char)(src[0] + 128);
 		/* src[1] is discarded */
-		/* src[2] is discarded */
+		/* src[2] is discarded */		
 #endif
 
         src += sourceStride * 3;
@@ -1325,7 +1325,7 @@
         /* REVIEW: we should consider something like
             (*src << 16) | (*src & 0xFFFF)
         */
-
+        
         *dest = *src << 16;
 
         src += sourceStride;
@@ -1345,11 +1345,11 @@
     PaInt16 temp;
 
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
         temp = *src;
-
+        
 #if defined(PA_LITTLE_ENDIAN)
         dest[0] = 0;
         dest[1] = (unsigned char)(temp);
@@ -1418,7 +1418,7 @@
 
     while( count-- )
     {
-		(*dest) = (unsigned char)(((*src) >> 8) + 128);
+		(*dest) = (unsigned char)(((*src) >> 8) + 128); 
 
         src += sourceStride;
         dest += destinationStride;
@@ -1606,7 +1606,7 @@
 	unsigned char *src  = (unsigned char*)sourceBuffer;
     unsigned char *dest = (unsigned char*)destinationBuffer;
     (void) ditherGenerator; /* unused parameters */
-
+    
 	while( count-- )
     {
 
@@ -1619,9 +1619,9 @@
         dest[1] = 0;
         dest[2] = 0;
 #endif
-
+		
         src += sourceStride;
-        dest += destinationStride * 3;
+        dest += destinationStride * 3;    
 	}
 }
 
@@ -1674,7 +1674,7 @@
 {
     unsigned char *src = (unsigned char*)sourceBuffer;
     unsigned char *dest = (unsigned char*)destinationBuffer;
-
+                                                      
     (void) ditherGenerator; /* unused parameter */
 
     while( count-- )
@@ -1695,9 +1695,9 @@
 {
     PaUint16 *src = (PaUint16 *)sourceBuffer;
     PaUint16 *dest = (PaUint16 *)destinationBuffer;
-
+                                                        
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
         *dest = *src;
@@ -1718,7 +1718,7 @@
     unsigned char *dest = (unsigned char*)destinationBuffer;
 
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
         dest[0] = src[0];
@@ -1741,7 +1741,7 @@
     PaUint32 *src = (PaUint32 *)sourceBuffer;
 
     (void) ditherGenerator; /* unused parameter */
-
+    
     while( count-- )
     {
         *dest = *src;
@@ -1763,7 +1763,7 @@
     Float32_To_Int24_Dither,       /* PaUtilConverter *Float32_To_Int24_Dither; */
     Float32_To_Int24_Clip,         /* PaUtilConverter *Float32_To_Int24_Clip; */
     Float32_To_Int24_DitherClip,   /* PaUtilConverter *Float32_To_Int24_DitherClip; */
-
+    
     Float32_To_Int16,              /* PaUtilConverter *Float32_To_Int16; */
     Float32_To_Int16_Dither,       /* PaUtilConverter *Float32_To_Int16_Dither; */
     Float32_To_Int16_Clip,         /* PaUtilConverter *Float32_To_Int16_Clip; */

 

  ViewVC Help
Powered by ViewVC 1.1.22