Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Speed up improvements for MIX_FUNC.



details:   https://anonhg.NetBSD.org/src/rev/7cbad1a7d874
branches:  trunk
changeset: 828095:7cbad1a7d874
user:      nat <nat%NetBSD.org@localhost>
date:      Tue Nov 28 07:35:27 2017 +0000

description:
Speed up improvements for MIX_FUNC.

As suggested by jmcneill@.

diffstat:

 sys/dev/audio.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 401914895519 -r 7cbad1a7d874 sys/dev/audio.c
--- a/sys/dev/audio.c   Tue Nov 28 07:24:32 2017 +0000
+++ b/sys/dev/audio.c   Tue Nov 28 07:35:27 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.440 2017/11/16 23:43:48 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.441 2017/11/28 07:35:27 nat Exp $  */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.440 2017/11/16 23:43:48 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.441 2017/11/28 07:35:27 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5592,14 +5592,20 @@
                                cc = cc2;                               \
                                                                        \
                        for (m = 0; m < (cc / (bits / NBBY)); m++) {    \
+                               if (vc->sc_swvol == 255)                \
+                                       goto vol_done;                  \
                                tomix[m] = (bigger_type)tomix[m] *      \
                                    (bigger_type)(vc->sc_swvol) / 255;  \
+vol_done:                                                              \
                                result = (bigger_type)orig[m] + tomix[m]; \
+                               if (sc->sc_opens == 1)                  \
+                                       goto adj_done;                  \
                                product = (bigger_type)orig[m] * tomix[m]; \
                                if (orig[m] > 0 && tomix[m] > 0)        \
                                        result -= product / MAXVAL;     \
                                else if (orig[m] < 0 && tomix[m] < 0)   \
                                        result -= product / MINVAL;     \
+adj_done:                                                              \
                                orig[m] = result;                       \
                        }                                               \
                                                                        \



Home | Main Index | Thread Index | Old Index