Module Name: src Committed By: nat Date: Tue Nov 28 07:35:27 UTC 2017
Modified Files: src/sys/dev: audio.c Log Message: Speed up improvements for MIX_FUNC. As suggested by jmcneill@. To generate a diff of this commit: cvs rdiff -u -r1.440 -r1.441 src/sys/dev/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/audio.c diff -u src/sys/dev/audio.c:1.440 src/sys/dev/audio.c:1.441 --- src/sys/dev/audio.c:1.440 Thu Nov 16 23:43:48 2017 +++ src/sys/dev/audio.c Tue Nov 28 07:35:27 2017 @@ -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 <nathanialsl...@yahoo.com.au> @@ -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 @@ mix_write(void *arg) 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; \ } \ \