]> code.delx.au - pulseaudio/commitdiff
svolume: cleanups
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 20 Aug 2009 10:30:48 +0000 (12:30 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 20 Aug 2009 10:30:48 +0000 (12:30 +0200)
Use PA_MAX
Use pa_rtclock_now() for benchmarks

src/pulsecore/svolume_arm.c
src/pulsecore/svolume_mmx.c
src/pulsecore/svolume_sse.c

index 0d39d10563616c6bb3ce793b7b69acf31afcd608..5bd1448f33ae9df0030325822fc1cc473e79f09e 100644 (file)
@@ -47,7 +47,7 @@ pa_volume_s16ne_arm (int16_t *samples, int32_t *volumes, unsigned channels, unsi
 {
     int32_t *ve;
 
-    channels = MAX (4, channels);
+    channels = PA_MAX (4U, channels);
     ve = volumes + channels;
 
     __asm__ __volatile__ (
@@ -137,7 +137,7 @@ static void run_test (void) {
     int32_t volumes[CHANNELS + PADDING];
     int i, j, padding;
     pa_do_volume_func_t func;
-    struct timeval start, stop;
+    pa_usec_t start, stop;
 
     func = pa_get_volume_func (PA_SAMPLE_S16NE);
 
@@ -161,21 +161,21 @@ static void run_test (void) {
         }
     }
 
-    pa_gettimeofday(&start);
+    start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
         memcpy (samples, samples_orig, sizeof (samples));
         pa_volume_s16ne_arm (samples, volumes, CHANNELS, sizeof (samples));
     }
-    pa_gettimeofday(&stop);
-    pa_log_info("ARM: %llu usec.", (long long unsigned int)pa_timeval_diff (&stop, &start));
+    stop = pa_rtclock_now();
+    pa_log_info("ARM: %llu usec.", (long long unsigned int) (stop - start));
 
-    pa_gettimeofday(&start);
+    start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
         memcpy (samples_ref, samples_orig, sizeof (samples));
         func (samples_ref, volumes, CHANNELS, sizeof (samples));
     }
-    pa_gettimeofday(&stop);
-    pa_log_info("ref: %llu usec.", (long long unsigned int)pa_timeval_diff (&stop, &start));
+    stop = pa_rtclock_now();
+    pa_log_info("ref: %llu usec.", (long long unsigned int) (stop - start));
 }
 #endif
 
index 7e24268430abb163fa1a79d98553caf176fbbbe2..8510b0c41f4f4e0ce7c57a0a4609b43044a0e760 100644 (file)
@@ -100,7 +100,7 @@ pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
 
     /* the max number of samples we process at a time, this is also the max amount
      * we overread the volume array, which should have enough padding. */
-    channels = MAX (4, channels);
+    channels = PA_MAX (4U, channels);
 
     __asm__ __volatile__ (
         " xor %3, %3                    \n\t"
@@ -170,7 +170,7 @@ pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
 
     /* the max number of samples we process at a time, this is also the max amount
      * we overread the volume array, which should have enough padding. */
-    channels = MAX (4, channels);
+    channels = PA_MAX (4U, channels);
 
     __asm__ __volatile__ (
         " xor %3, %3                    \n\t"
@@ -254,7 +254,7 @@ static void run_test (void) {
     int32_t volumes[CHANNELS + PADDING];
     int i, j, padding;
     pa_do_volume_func_t func;
-    struct timeval start, stop;
+    pa_usec_t start, stop;
 
     func = pa_get_volume_func (PA_SAMPLE_S16NE);
 
@@ -278,21 +278,21 @@ static void run_test (void) {
         }
     }
 
-    pa_gettimeofday(&start);
+    start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
         memcpy (samples, samples_orig, sizeof (samples));
         pa_volume_s16ne_mmx (samples, volumes, CHANNELS, sizeof (samples));
     }
-    pa_gettimeofday(&stop);
-    pa_log_info("MMX: %llu usec.", (long long unsigned int)pa_timeval_diff (&stop, &start));
+    stop = pa_rtclock_now();
+    pa_log_info("MMX: %llu usec.", (long long unsigned int)(stop - start));
 
-    pa_gettimeofday(&start);
+    start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
         memcpy (samples_ref, samples_orig, sizeof (samples));
         func (samples_ref, volumes, CHANNELS, sizeof (samples));
     }
-    pa_gettimeofday(&stop);
-    pa_log_info("ref: %llu usec.", (long long unsigned int)pa_timeval_diff (&stop, &start));
+    stop = pa_rtclock_now();
+    pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
 }
 #endif
 
index b5e3687f5dbb6ab58293901d321e8505ec2c49cf..54af4a57384c9d6cc21e4056235d790594119b14 100644 (file)
@@ -81,7 +81,7 @@ pa_volume_s16ne_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsi
 
     /* the max number of samples we process at a time, this is also the max amount
      * we overread the volume array, which should have enough padding. */
-    channels = MAX (8, channels);
+    channels = PA_MAX (8U, channels);
 
     __asm__ __volatile__ (
         " xor %3, %3                    \n\t"
@@ -161,7 +161,7 @@ pa_volume_s16re_sse (int16_t *samples, int32_t *volumes, unsigned channels, unsi
 
     /* the max number of samples we process at a time, this is also the max amount
      * we overread the volume array, which should have enough padding. */
-    channels = MAX (8, channels);
+    channels = PA_MAX (8U, channels);
 
     __asm__ __volatile__ (
         " xor %3, %3                    \n\t"
@@ -257,7 +257,7 @@ static void run_test (void) {
     int32_t volumes[CHANNELS + PADDING];
     int i, j, padding;
     pa_do_volume_func_t func;
-    struct timeval start, stop;
+    pa_usec_t start, stop;
 
     func = pa_get_volume_func (PA_SAMPLE_S16NE);
 
@@ -281,21 +281,21 @@ static void run_test (void) {
         }
     }
 
-    pa_gettimeofday(&start);
+    start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
         memcpy (samples, samples_orig, sizeof (samples));
         pa_volume_s16ne_sse (samples, volumes, CHANNELS, sizeof (samples));
     }
-    pa_gettimeofday(&stop);
-    pa_log_info("SSE: %llu usec.", (long long unsigned int)pa_timeval_diff (&stop, &start));
+    stop = pa_rtclock_now();
+    pa_log_info("SSE: %llu usec.", (long long unsigned int)(stop - start));
 
-    pa_gettimeofday(&start);
+    start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
         memcpy (samples_ref, samples_orig, sizeof (samples));
         func (samples_ref, volumes, CHANNELS, sizeof (samples));
     }
-    pa_gettimeofday(&stop);
-    pa_log_info("ref: %llu usec.", (long long unsigned int)pa_timeval_diff (&stop, &start));
+    stop = pa_rtclock_now();
+    pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
 }
 #endif
 #endif /* defined (__i386__) || defined (__amd64__) */