diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-03 22:25:14 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-03 22:25:14 +0000 |
commit | 723c50cd1bb9337248bbd2997f9df971990edea2 (patch) | |
tree | 3c94418e6656ca04915ff70d6c17fc7f6d4aa12e /usr.bin/aucat/abuf.c | |
parent | 4aa23092c2f9e39b46581c898a9fd591b6c8a754 (diff) |
A small optimization: handle most N-channel <-> M-channel conversions
inside the mixer and the demultiplexer. This way, aucat will not
trigger the heavy conversion code when only channel conversions are
required. Cuts ~50% of the CPU usage on envy(4) devices, can improve
surround 4.0, 5.1 and 7.1 capable devices. No functionnal change.
Diffstat (limited to 'usr.bin/aucat/abuf.c')
-rw-r--r-- | usr.bin/aucat/abuf.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/aucat/abuf.c b/usr.bin/aucat/abuf.c index 61a18a17293..c15b138ad31 100644 --- a/usr.bin/aucat/abuf.c +++ b/usr.bin/aucat/abuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: abuf.c,v 1.7 2008/10/26 08:49:43 ratchov Exp $ */ +/* $OpenBSD: abuf.c,v 1.8 2008/11/03 22:25:13 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -38,6 +38,7 @@ #include <stdarg.h> #include "conf.h" +#include "aparams.h" #include "aproc.h" #include "abuf.h" @@ -63,11 +64,12 @@ abuf_dprn(int n, struct abuf *buf, char *fmt, ...) #endif struct abuf * -abuf_new(unsigned nfr, unsigned bpf) +abuf_new(unsigned nfr, struct aparams *par) { struct abuf *buf; - unsigned len; + unsigned len, bpf; + bpf = aparams_bpf(par); len = nfr * bpf; buf = malloc(sizeof(struct abuf) + len); if (buf == NULL) { @@ -75,6 +77,8 @@ abuf_new(unsigned nfr, unsigned bpf) abort(); } buf->bpf = bpf; + buf->cmin = par->cmin; + buf->cmax = par->cmax; buf->inuse = 0; /* |