[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.17 and 1.18

version 1.17, 2008/11/04 17:51:46 version 1.18, 2008/11/04 18:24:06
Line 791 
Line 791 
 conv_bcopy(struct aconv *ist, struct aconv *ost,  conv_bcopy(struct aconv *ist, struct aconv *ost,
     struct abuf *ibuf, struct abuf *obuf)      struct abuf *ibuf, struct abuf *obuf)
 {  {
         unsigned inch, ibps;          unsigned nch, ibps;
         unsigned char *idata;          unsigned char *idata;
         int ibnext, isigbit;          int ibnext;
         unsigned ishift;          unsigned i;
         int isnext;          int s;
         unsigned onch, oshift;  
         int osigbit;  
         unsigned obps;          unsigned obps;
         unsigned char *odata;          unsigned char *odata;
         int obnext, osnext;          int obnext;
         unsigned c, i, f;          int isigbit;
         int ctxbuf[NCHAN_MAX], *ctx, s;          unsigned ishift;
         unsigned icount, ocount, scount;          unsigned oshift;
           int osigbit;
           int isnext;
           int osnext;
           unsigned f, scount, icount, ocount;
   
         /*          /*
          * It's ok to have s uninitialized, but we dont want the compiler to           * It's ok to have s uninitialized, but we dont want the compiler to
Line 823 
Line 825 
         if (ocount == 0)          if (ocount == 0)
                 return;                  return;
         scount = (icount < ocount) ? icount : ocount;          scount = (icount < ocount) ? icount : ocount;
         DPRINTFN(4, "conv_bcopy: scount=%u\n", scount);          nch = ibuf->cmax - ibuf->cmin + 1;
           DPRINTFN(4, "conv_bcopy: scount = %u, nch = %u\n", scount, nch);
   
         /*          /*
          * Partially copy structures into local variables, to avoid           * Partially copy structures into local variables, to avoid
          * unnecessary indirections; this also allows the compiler to           * unnecessary indirections; this also allows the compiler to
          * order local variables more "cache-friendly".           * order local variables more "cache-friendly".
          */           */
         inch = ist->nch;  
         ibps = ist->bps;          ibps = ist->bps;
         ibnext = ist->bnext;          ibnext = ist->bnext;
         isigbit = ist->sigbit;          isigbit = ist->sigbit;
         ishift = ist->shift;          ishift = ist->shift;
         isnext = ist->snext;          isnext = ist->snext;
         onch = ost->nch;  
         oshift = ost->shift;          oshift = ost->shift;
         osigbit = ost->sigbit;          osigbit = ost->sigbit;
         obps = ost->bps;          obps = ost->bps;
Line 848 
Line 849 
          */           */
         idata += ist->bfirst;          idata += ist->bfirst;
         odata += ost->bfirst;          odata += ost->bfirst;
         for (f = scount; f > 0; f--) {          for (f = scount * nch; f > 0; f--) {
                 ctx = ctxbuf;                  for (i = ibps; i > 0; i--) {
                 for (c = inch; c > 0; c--) {                          s <<= 8;
                         for (i = ibps; i > 0; i--) {                          s |= *idata;
                                 s <<= 8;                          idata += ibnext;
                                 s |= *idata;  
                                 idata += ibnext;  
                         }  
                         s ^= isigbit;  
                         s <<= ishift;  
                         *ctx++ = (short)(s >> 16);  
                         idata += isnext;  
                 }                  }
                 ctx = ctxbuf;                  s ^= isigbit;
                 for (c = onch; c > 0; c--) {                  s <<= ishift;
                         s = *ctx++ << 16;                  s >>= 16;
                         s >>= oshift;  
                         s ^= osigbit;                  /* XXX: don't simplify, useful to split conv */
                         for (i = obps; i > 0; i--) {  
                                 *odata = (unsigned char)s;                  s <<= 16;
                                 s >>= 8;                  s >>= oshift;
                                 odata += obnext;                  s ^= osigbit;
                         }                  for (i = obps; i > 0; i--) {
                         odata += osnext;                          *odata = (unsigned char)s;
                           s >>= 8;
                           odata += obnext;
                 }                  }
                   idata += isnext;
                   odata += osnext;
         }          }
   
         /*          /*
Line 947 
Line 945 
                 st->bnext = 1;                  st->bnext = 1;
                 st->snext = 0;                  st->snext = 0;
         }          }
         st->cmin = par->cmin;  
         st->nch = par->cmax - par->cmin + 1;  
         st->bpf = st->nch * st->bps;  
 }  }
   
 struct aproc_ops conv_ops = {  struct aproc_ops conv_ops = {
Line 970 
Line 965 
 {  {
         struct aproc *p;          struct aproc *p;
   
           if (ipar->cmax - ipar->cmin != opar->cmax - opar->cmin) {
                   fprintf(stderr, "conv_new: channel count mismatch\n");
                   abort();
           }
         p = aproc_new(&conv_ops, name);          p = aproc_new(&conv_ops, name);
         aconv_init(&p->u.conv.ist, ipar, 1);          aconv_init(&p->u.conv.ist, ipar, 1);
         aconv_init(&p->u.conv.ost, opar, 0);          aconv_init(&p->u.conv.ost, opar, 0);

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18