[BACK]Return to aproc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / aucat

Diff for /src/usr.bin/aucat/Attic/aproc.c between version 1.62 and 1.63

version 1.62, 2010/10/21 21:42:46 version 1.63, 2010/11/04 17:55:28
Line 583 
Line 583 
 void  void
 mix_bzero(struct abuf *obuf, unsigned maxtodo)  mix_bzero(struct abuf *obuf, unsigned maxtodo)
 {  {
         short *odata;          adata_t *odata;
         unsigned ocount, todo;          unsigned ocount, todo;
   
         if (obuf->w.mix.todo >= maxtodo)          if (obuf->w.mix.todo >= maxtodo)
                 return;                  return;
         todo = maxtodo - obuf->w.mix.todo;          todo = maxtodo - obuf->w.mix.todo;
         odata = (short *)abuf_wgetblk(obuf, &ocount, obuf->w.mix.todo);          odata = (adata_t *)abuf_wgetblk(obuf, &ocount, obuf->w.mix.todo);
         if (ocount > todo)          if (ocount > todo)
                 ocount = todo;                  ocount = todo;
         if (ocount == 0)          if (ocount == 0)
Line 612 
Line 612 
 unsigned  unsigned
 mix_badd(struct abuf *ibuf, struct abuf *obuf)  mix_badd(struct abuf *ibuf, struct abuf *obuf)
 {  {
         short *idata, *odata;          adata_t *idata, *odata;
         unsigned cmin, cmax;          unsigned cmin, cmax;
         unsigned i, j, cc, istart, inext, onext, ostart;          unsigned i, j, cc, istart, inext, onext, ostart;
         unsigned scount, icount, ocount;          unsigned scount, icount, ocount;
Line 647 
Line 647 
         /*          /*
          * Calculate the maximum we can read.           * Calculate the maximum we can read.
          */           */
         idata = (short *)abuf_rgetblk(ibuf, &icount, 0);          idata = (adata_t *)abuf_rgetblk(ibuf, &icount, 0);
         if (icount == 0)          if (icount == 0)
                 return 0;                  return 0;
   
         /*          /*
          * Calculate the maximum we can write.           * Calculate the maximum we can write.
          */           */
         odata = (short *)abuf_wgetblk(obuf, &ocount, ibuf->r.mix.done);          odata = (adata_t *)abuf_wgetblk(obuf, &ocount, ibuf->r.mix.done);
         if (ocount == 0)          if (ocount == 0)
                 return 0;                  return 0;
   
         scount = (icount < ocount) ? icount : ocount;          scount = (icount < ocount) ? icount : ocount;
         mix_bzero(obuf, scount + ibuf->r.mix.done);          mix_bzero(obuf, scount + ibuf->r.mix.done);
   
         vol = (ibuf->r.mix.weight * ibuf->r.mix.vol) >> ADATA_SHIFT;          vol = ADATA_MUL(ibuf->r.mix.weight, ibuf->r.mix.vol);
         cmin = obuf->cmin > ibuf->cmin ? obuf->cmin : ibuf->cmin;          cmin = obuf->cmin > ibuf->cmin ? obuf->cmin : ibuf->cmin;
         cmax = obuf->cmax < ibuf->cmax ? obuf->cmax : ibuf->cmax;          cmax = obuf->cmax < ibuf->cmax ? obuf->cmax : ibuf->cmax;
         ostart = cmin - obuf->cmin;          ostart = cmin - obuf->cmin;
Line 673 
Line 673 
         idata += istart;          idata += istart;
         for (i = scount; i > 0; i--) {          for (i = scount; i > 0; i--) {
                 for (j = cc; j > 0; j--) {                  for (j = cc; j > 0; j--) {
                         *odata += (*idata * vol) >> ADATA_SHIFT;                          *odata += ADATA_MUL(*idata, vol);
                         idata++;                          idata++;
                         odata++;                          odata++;
                 }                  }
Line 1155 
Line 1155 
 void  void
 sub_bcopy(struct abuf *ibuf, struct abuf *obuf)  sub_bcopy(struct abuf *ibuf, struct abuf *obuf)
 {  {
         short *idata, *odata;          adata_t *idata, *odata;
         unsigned cmin, cmax;          unsigned cmin, cmax;
         unsigned i, j, cc, istart, inext, onext, ostart;          unsigned i, j, cc, istart, inext, onext, ostart;
         unsigned icount, ocount, scount;          unsigned icount, ocount, scount;
Line 1171 
Line 1171 
                 obuf->w.sub.silence += scount;                  obuf->w.sub.silence += scount;
         }          }
   
         idata = (short *)abuf_rgetblk(ibuf, &icount, obuf->w.sub.done);          idata = (adata_t *)abuf_rgetblk(ibuf, &icount, obuf->w.sub.done);
         if (icount == 0)          if (icount == 0)
                 return;                  return;
         odata = (short *)abuf_wgetblk(obuf, &ocount, 0);          odata = (adata_t *)abuf_wgetblk(obuf, &ocount, 0);
         if (ocount == 0)          if (ocount == 0)
                 return;                  return;
         cmin = obuf->cmin > ibuf->cmin ? obuf->cmin : ibuf->cmin;          cmin = obuf->cmin > ibuf->cmin ? obuf->cmin : ibuf->cmin;
Line 1459 
Line 1459 
 resamp_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)  resamp_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
 {  {
         unsigned inch;          unsigned inch;
         short *idata;          adata_t *idata;
         unsigned oblksz;          unsigned oblksz;
         unsigned ifr;          unsigned ifr;
         unsigned onch;          unsigned onch;
         int s1, s2, diff;          int s, ds, diff;
         short *odata;          adata_t *odata;
         unsigned iblksz;          unsigned iblksz;
         unsigned ofr;          unsigned ofr;
         unsigned c;          unsigned c;
         short *ctxbuf, *ctx;          adata_t *ctxbuf, *ctx;
         unsigned ctx_start;          unsigned ctx_start;
         unsigned icount, ocount;          unsigned icount, ocount;
   
         /*          /*
          * Calculate max frames readable at once from the input buffer.           * Calculate max frames readable at once from the input buffer.
          */           */
         idata = (short *)abuf_rgetblk(ibuf, &icount, 0);          idata = (adata_t *)abuf_rgetblk(ibuf, &icount, 0);
         ifr = icount;          ifr = icount;
   
         odata = (short *)abuf_wgetblk(obuf, &ocount, 0);          odata = (adata_t *)abuf_wgetblk(obuf, &ocount, 0);
         ofr = ocount;          ofr = ocount;
   
         /*          /*
Line 1526 
Line 1526 
                                 break;                                  break;
                         ctx = ctxbuf;                          ctx = ctxbuf;
                         for (c = onch; c > 0; c--) {                          for (c = onch; c > 0; c--) {
                                 s1 = ctx[ctx_start];                                  s = ctx[ctx_start];
                                 s2 = ctx[ctx_start ^ 1];                                  ds = ctx[ctx_start ^ 1] - s;
                                 ctx += RESAMP_NCTX;                                  ctx += RESAMP_NCTX;
                                 *odata++ = s1 + (s2 - s1) * diff / (int)oblksz;                                  *odata++ = s + ADATA_MULDIV(ds, diff, oblksz);
                         }                          }
                         diff -= iblksz;                          diff -= iblksz;
                         ofr--;                          ofr--;
Line 1685 
Line 1685 
 {  {
         unsigned nch, scount, icount, ocount;          unsigned nch, scount, icount, ocount;
         unsigned f;          unsigned f;
         short *idata;          adata_t *idata;
         int s;          int s;
         unsigned oshift;          unsigned oshift;
         int osigbit;          int osigbit;
Line 1698 
Line 1698 
         /*          /*
          * Calculate max frames readable at once from the input buffer.           * Calculate max frames readable at once from the input buffer.
          */           */
         idata = (short *)abuf_rgetblk(ibuf, &icount, 0);          idata = (adata_t *)abuf_rgetblk(ibuf, &icount, 0);
         if (icount == 0)          if (icount == 0)
                 return;                  return;
         odata = abuf_wgetblk(obuf, &ocount, 0);          odata = abuf_wgetblk(obuf, &ocount, 0);
Line 1733 
Line 1733 
         odata += p->u.conv.bfirst;          odata += p->u.conv.bfirst;
         for (f = scount * nch; f > 0; f--) {          for (f = scount * nch; f > 0; f--) {
                 s = *idata++;                  s = *idata++;
                 s <<= 16;                  s <<= 32 - ADATA_BITS;
                 s >>= oshift;                  s >>= oshift;
                 s ^= osigbit;                  s ^= osigbit;
                 for (i = obps; i > 0; i--) {                  for (i = obps; i > 0; i--) {
Line 1851 
Line 1851 
         int isnext;          int isnext;
         int isigbit;          int isigbit;
         unsigned ishift;          unsigned ishift;
         short *odata;          adata_t *odata;
   
         /*          /*
          * Calculate max frames readable at once from the input buffer.           * Calculate max frames readable at once from the input buffer.
Line 1859 
Line 1859 
         idata = abuf_rgetblk(ibuf, &icount, 0);          idata = abuf_rgetblk(ibuf, &icount, 0);
         if (icount == 0)          if (icount == 0)
                 return;                  return;
         odata = (short *)abuf_wgetblk(obuf, &ocount, 0);          odata = (adata_t *)abuf_wgetblk(obuf, &ocount, 0);
         if (ocount == 0)          if (ocount == 0)
                 return;                  return;
         scount = (icount < ocount) ? icount : ocount;          scount = (icount < ocount) ? icount : ocount;
Line 1898 
Line 1898 
                 idata += isnext;                  idata += isnext;
                 s ^= isigbit;                  s ^= isigbit;
                 s <<= ishift;                  s <<= ishift;
                 s >>= 16;                  s >>= 32 - ADATA_BITS;
                 *odata++ = s;                  *odata++ = s;
         }          }
   
Line 2001 
Line 2001 
 {  {
         unsigned h, hops;          unsigned h, hops;
         unsigned inch, inext;          unsigned inch, inext;
         short *idata;          adata_t *idata;
         unsigned onch, onext;          unsigned onch, onext;
         short *odata;          adata_t *odata;
         int scale;          int scale;
         unsigned c, f, scount, icount, ocount;          unsigned c, f, scount, icount, ocount;
   
         /*          /*
          * Calculate max frames readable at once from the input buffer.           * Calculate max frames readable at once from the input buffer.
          */           */
         idata = (short *)abuf_rgetblk(ibuf, &icount, 0);          idata = (adata_t *)abuf_rgetblk(ibuf, &icount, 0);
         if (icount == 0)          if (icount == 0)
                 return;                  return;
         odata = (short *)abuf_wgetblk(obuf, &ocount, 0);          odata = (adata_t *)abuf_wgetblk(obuf, &ocount, 0);
         if (ocount == 0)          if (ocount == 0)
                 return;                  return;
         scount = icount < ocount ? icount : ocount;          scount = icount < ocount ? icount : ocount;
Line 2043 
Line 2043 
                 hops--;                  hops--;
                 for (f = scount; f > 0; f--) {                  for (f = scount; f > 0; f--) {
                         for (c = onch; c > 0; c--)                          for (c = onch; c > 0; c--)
                                 *odata++ = (*idata++ * scale)                                  *odata++ = ADATA_MUL(*idata++, scale);
                                     >> ADATA_SHIFT;  
                         for (h = hops; h > 0; h--) {                          for (h = hops; h > 0; h--) {
                                 odata -= onch;                                  odata -= onch;
                                 for (c = onch; c > 0; c--)                                  for (c = onch; c > 0; c--)
                                         *odata++ += (*idata++ * scale)                                          *odata++ += ADATA_MUL(*idata++, scale);
                                             >> ADATA_SHIFT;  
                         }                          }
                         idata += inext;                          idata += inext;
                 }                  }
Line 2178 
Line 2176 
 {  {
         struct abuf *obuf = LIST_FIRST(&p->outs);          struct abuf *obuf = LIST_FIRST(&p->outs);
         unsigned scount, icount, ocount;          unsigned scount, icount, ocount;
         short *idata, *odata;          adata_t *idata, *odata;
   
 #ifdef DEBUG  #ifdef DEBUG
         if (debug_level >= 4) {          if (debug_level >= 4) {
Line 2197 
Line 2195 
                 /*                  /*
                  * Calculate max frames readable at once from the input buffer.                   * Calculate max frames readable at once from the input buffer.
                  */                   */
                 idata = (short *)abuf_rgetblk(ibuf, &icount, pos);                  idata = (adata_t *)abuf_rgetblk(ibuf, &icount, pos);
                 odata = (short *)abuf_wgetblk(obuf, &ocount, p->u.mon.pending);                  odata = (adata_t *)abuf_wgetblk(obuf, &ocount, p->u.mon.pending);
                 scount = (icount < ocount) ? icount : ocount;                  scount = (icount < ocount) ? icount : ocount;
 #ifdef DEBUG  #ifdef DEBUG
                 if (debug_level >= 4) {                  if (debug_level >= 4) {

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63