[svn-commits] sruffell: branch linux/sruffell/chan_list_refactoring r9264 - /linux/team/sru...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Sep 2 12:41:06 CDT 2010
Author: sruffell
Date: Thu Sep 2 12:40:55 2010
New Revision: 9264
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9264
Log:
dahdi: chans[ms->confna] -> conf_chan.
In __dahdi_process_getaudio_chunk and __dahdi_process_putaudio_chunk we
can streamline the operation slightly by saving a constant pointer to
the conference channel instead of constantly dereferencing the master
channel and indexing into the chan array.
Modified:
linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c
Modified: linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c?view=diff&rev=9264&r1=9263&r2=9264
==============================================================================
--- linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c Thu Sep 2 12:40:55 2010
@@ -6519,6 +6519,7 @@
if ((!ms->confmute && !ms->dialing) || (ms->flags & DAHDI_FLAG_PSEUDO)) {
/* Handle conferencing on non-clear channel and non-HDLC channels */
+ struct dahdi_chan *const conf_chan = chans[ms->confna];
switch(ms->confmode & DAHDI_CONF_MODE_MASK) {
case DAHDI_CONF_NORMAL:
/* Do nuffin */
@@ -6527,11 +6528,11 @@
/* if a pseudo-channel, ignore */
if (ms->flags & DAHDI_FLAG_PSEUDO) break;
/* Add monitored channel */
- if (chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO) {
- ACSS(getlin, chans[ms->confna]->getlin);
- } else {
- ACSS(getlin, chans[ms->confna]->putlin);
- }
+ if (conf_chan->flags & DAHDI_FLAG_PSEUDO)
+ ACSS(getlin, conf_chan->getlin);
+ else
+ ACSS(getlin, conf_chan->putlin);
+
for (x=0;x<DAHDI_CHUNKSIZE;x++)
txb[x] = DAHDI_LIN2X(getlin[x], ms);
break;
@@ -6539,11 +6540,10 @@
/* if a pseudo-channel, ignore */
if (ms->flags & DAHDI_FLAG_PSEUDO) break;
/* Add monitored channel */
- if (chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO) {
- ACSS(getlin, chans[ms->confna]->putlin);
- } else {
- ACSS(getlin, chans[ms->confna]->getlin);
- }
+ if (conf_chan->flags & DAHDI_FLAG_PSEUDO)
+ ACSS(getlin, conf_chan->putlin);
+ else
+ ACSS(getlin, conf_chan->getlin);
for (x=0;x<DAHDI_CHUNKSIZE;x++)
txb[x] = DAHDI_LIN2X(getlin[x], ms);
@@ -6551,8 +6551,8 @@
case DAHDI_CONF_MONITORBOTH: /* monitor a channel's rx and tx mode */
/* if a pseudo-channel, ignore */
if (ms->flags & DAHDI_FLAG_PSEUDO) break;
- ACSS(getlin, chans[ms->confna]->putlin);
- ACSS(getlin, chans[ms->confna]->getlin);
+ ACSS(getlin, conf_chan->putlin);
+ ACSS(getlin, conf_chan->getlin);
for (x=0;x<DAHDI_CHUNKSIZE;x++)
txb[x] = DAHDI_LIN2X(getlin[x], ms);
break;
@@ -6561,12 +6561,12 @@
if (ms->flags & DAHDI_FLAG_PSEUDO)
break;
- if (!chans[ms->confna]->readchunkpreec)
+ if (!conf_chan->readchunkpreec)
break;
/* Add monitored channel */
- ACSS(getlin, chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO ?
- chans[ms->confna]->readchunkpreec : chans[ms->confna]->putlin);
+ ACSS(getlin, conf_chan->flags & DAHDI_FLAG_PSEUDO ?
+ conf_chan->readchunkpreec : conf_chan->putlin);
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
txb[x] = DAHDI_LIN2X(getlin[x], ms);
@@ -6576,12 +6576,12 @@
if (ms->flags & DAHDI_FLAG_PSEUDO)
break;
- if (!chans[ms->confna]->readchunkpreec)
+ if (!conf_chan->readchunkpreec)
break;
/* Add monitored channel */
- ACSS(getlin, chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO ?
- chans[ms->confna]->putlin : chans[ms->confna]->readchunkpreec);
+ ACSS(getlin, conf_chan->flags & DAHDI_FLAG_PSEUDO ?
+ conf_chan->putlin : conf_chan->readchunkpreec);
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
txb[x] = DAHDI_LIN2X(getlin[x], ms);
@@ -6591,11 +6591,11 @@
if (ms->flags & DAHDI_FLAG_PSEUDO)
break;
- if (!chans[ms->confna]->readchunkpreec)
+ if (!conf_chan->readchunkpreec)
break;
- ACSS(getlin, chans[ms->confna]->putlin);
- ACSS(getlin, chans[ms->confna]->readchunkpreec);
+ ACSS(getlin, conf_chan->putlin);
+ ACSS(getlin, conf_chan->readchunkpreec);
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
txb[x] = DAHDI_LIN2X(getlin[x], ms);
@@ -6679,21 +6679,22 @@
break;
case DAHDI_CONF_DIGITALMON:
/* Real digital monitoring, but still echo cancel if desired */
- if (!chans[ms->confna])
+ if (!conf_chan)
break;
- if (chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO) {
+ if (conf_chan->flags & DAHDI_FLAG_PSEUDO) {
if (ms->ec_state) {
for (x=0;x<DAHDI_CHUNKSIZE;x++)
- txb[x] = DAHDI_LIN2X(chans[ms->confna]->getlin[x], ms);
+ txb[x] = DAHDI_LIN2X(conf_chan->getlin[x], ms);
} else {
- memcpy(txb, chans[ms->confna]->getraw, DAHDI_CHUNKSIZE);
+ memcpy(txb, conf_chan->getraw, DAHDI_CHUNKSIZE);
}
} else {
if (ms->ec_state) {
- for (x=0;x<DAHDI_CHUNKSIZE;x++)
- txb[x] = DAHDI_LIN2X(chans[ms->confna]->putlin[x], ms);
+ for (x = 0; x < DAHDI_CHUNKSIZE; x++)
+ txb[x] = DAHDI_LIN2X(conf_chan->putlin[x], ms);
} else {
- memcpy(txb, chans[ms->confna]->putraw, DAHDI_CHUNKSIZE);
+ memcpy(txb, conf_chan->putraw,
+ DAHDI_CHUNKSIZE);
}
}
for (x=0;x<DAHDI_CHUNKSIZE;x++)
@@ -7586,6 +7587,7 @@
back */
if ((!ms->confmute && !ms->afterdialingtimer) ||
(ms->flags & DAHDI_FLAG_PSEUDO)) {
+ struct dahdi_chan *const conf_chan = chans[ms->confna];
switch(ms->confmode & DAHDI_CONF_MODE_MASK) {
case DAHDI_CONF_NORMAL: /* Normal mode */
/* Do nothing. rx goes output */
@@ -7594,11 +7596,10 @@
/* if not a pseudo-channel, ignore */
if (!(ms->flags & DAHDI_FLAG_PSEUDO)) break;
/* Add monitored channel */
- if (chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO) {
- ACSS(putlin, chans[ms->confna]->getlin);
- } else {
- ACSS(putlin, chans[ms->confna]->putlin);
- }
+ if (conf_chan->flags & DAHDI_FLAG_PSEUDO)
+ ACSS(putlin, conf_chan->getlin);
+ else
+ ACSS(putlin, conf_chan->putlin);
/* Convert back */
for(x=0;x<DAHDI_CHUNKSIZE;x++)
rxb[x] = DAHDI_LIN2X(putlin[x], ms);
@@ -7607,11 +7608,10 @@
/* if not a pseudo-channel, ignore */
if (!(ms->flags & DAHDI_FLAG_PSEUDO)) break;
/* Add monitored channel */
- if (chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO) {
- ACSS(putlin, chans[ms->confna]->putlin);
- } else {
- ACSS(putlin, chans[ms->confna]->getlin);
- }
+ if (conf_chan->flags & DAHDI_FLAG_PSEUDO)
+ ACSS(putlin, conf_chan->putlin);
+ else
+ ACSS(putlin, conf_chan->getlin);
/* Convert back */
for(x=0;x<DAHDI_CHUNKSIZE;x++)
rxb[x] = DAHDI_LIN2X(putlin[x], ms);
@@ -7623,8 +7623,8 @@
the end of the whole addition, but for performance
reasons, we don't do that. Besides, it only matters
when you're so loud you're clipping anyway */
- ACSS(putlin, chans[ms->confna]->getlin);
- ACSS(putlin, chans[ms->confna]->putlin);
+ ACSS(putlin, conf_chan->getlin);
+ ACSS(putlin, conf_chan->putlin);
/* Convert back */
for(x=0;x<DAHDI_CHUNKSIZE;x++)
rxb[x] = DAHDI_LIN2X(putlin[x], ms);
@@ -7634,12 +7634,12 @@
if (!(ms->flags & DAHDI_FLAG_PSEUDO))
break;
- if (!chans[ms->confna]->readchunkpreec)
+ if (!conf_chan->readchunkpreec)
break;
/* Add monitored channel */
- ACSS(putlin, chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO ?
- chans[ms->confna]->getlin : chans[ms->confna]->readchunkpreec);
+ ACSS(putlin, conf_chan->flags & DAHDI_FLAG_PSEUDO ?
+ conf_chan->getlin : conf_chan->readchunkpreec);
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
rxb[x] = DAHDI_LIN2X(putlin[x], ms);
@@ -7649,12 +7649,12 @@
if (!(ms->flags & DAHDI_FLAG_PSEUDO))
break;
- if (!chans[ms->confna]->readchunkpreec)
+ if (!conf_chan->readchunkpreec)
break;
/* Add monitored channel */
- ACSS(putlin, chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO ?
- chans[ms->confna]->readchunkpreec : chans[ms->confna]->getlin);
+ ACSS(putlin, conf_chan->flags & DAHDI_FLAG_PSEUDO ?
+ conf_chan->readchunkpreec : conf_chan->getlin);
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
rxb[x] = DAHDI_LIN2X(putlin[x], ms);
@@ -7664,15 +7664,15 @@
if (!(ms->flags & DAHDI_FLAG_PSEUDO))
break;
- if (!chans[ms->confna]->readchunkpreec)
+ if (!conf_chan->readchunkpreec)
break;
/* Note: Technically, saturation should be done at
the end of the whole addition, but for performance
reasons, we don't do that. Besides, it only matters
when you're so loud you're clipping anyway */
- ACSS(putlin, chans[ms->confna]->getlin);
- ACSS(putlin, chans[ms->confna]->readchunkpreec);
+ ACSS(putlin, conf_chan->getlin);
+ ACSS(putlin, conf_chan->readchunkpreec);
for (x = 0; x < DAHDI_CHUNKSIZE; x++)
rxb[x] = DAHDI_LIN2X(putlin[x], ms);
@@ -7756,11 +7756,10 @@
/* if not a pseudo-channel, ignore */
if (!(ms->flags & DAHDI_FLAG_PSEUDO)) break;
/* Add monitored channel */
- if (chans[ms->confna]->flags & DAHDI_FLAG_PSEUDO) {
- memcpy(rxb, chans[ms->confna]->getraw, DAHDI_CHUNKSIZE);
- } else {
- memcpy(rxb, chans[ms->confna]->putraw, DAHDI_CHUNKSIZE);
- }
+ if (conf_chan->flags & DAHDI_FLAG_PSEUDO)
+ memcpy(rxb, conf_chan->getraw, DAHDI_CHUNKSIZE);
+ else
+ memcpy(rxb, conf_chan->putraw, DAHDI_CHUNKSIZE);
break;
}
}
More information about the svn-commits
mailing list