Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

DCFmpacket_Rtrsmra_double_array.cpp

Go to the documentation of this file.
00001 //DCFmpacket_Rtrsmra_double_array.cpp
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2001-2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 //              Created:                Aug 27, 2001
00007 //              Last Modified:          May 2, 2002
00008 //////////////////////////////////////////////////////////////////////
00009 
00010 // specialization DCFmpacket< Rtrsmra<double,array> >
00011 
00012 DCFmpacket< Rtrsmra<double,array> >::DCFmpacket( 
00013   const int sizebmax,
00014   const int bplen_sizeb, const int bplen_n,
00015   DCFencode< Rtrsmra<double,array> >& enc
00016   ) : DCFmpacketBase(sizebmax, bplen_sizeb, bplen_n) {
00017 
00018    _enc=enc;
00019 
00020 };
00021 
00022 void DCFmpacket< Rtrsmra<double,array> >::setencode( 
00023   const int sizebmax,
00024   const int bplen_sizeb, const int bplen_n,
00025   DCFencode< Rtrsmra<double,array> >& enc
00026   ) {
00027 
00028    setencode(sizebmax,bplen_sizeb, bplen_n );
00029    _enc=enc;
00030 
00031 };
00032 
00033 DCFmpacket< Rtrsmra<double,array> >& 
00034   DCFmpacket< Rtrsmra<double,array> >::operator()(
00035     Rtrsmra<double,array>& x,
00036     const char mcode
00037     ) {
00038 
00039      DCFmpacket< Rtrsmra<double,array> >::encode(x,mcode);
00040      return *this;
00041 
00042 };
00043 
00044 void DCFmpacket< Rtrsmra<double,array> >::encode(
00045     Rtrsmra<double,array>& x,
00046     const char mcode
00047     ) {
00048 
00049    double tmp;
00050    bytepack bp;
00051 
00052    int n;
00053 
00054    int a;
00055 
00056    if (sw(mcode)) { n=((( x.mrastep() )&( (1<<x.mmax()) -1 ) )>> m(mcode)); }
00057    else { n=0; }
00058 
00059    clear();
00060    set(mcode,n);
00061 
00062    for(a=0;a<=_enc.amax();a++) {
00063       if (sw(mcode)) { tmp=x.wav(a,m(mcode)); }
00064       else { tmp=x.scal(a,m(mcode)); }
00065       if (fabs(tmp)>=_enc.quantcoef()) {
00066          put( bp(a,_enc.bplen_a()) );
00067          put( bp(tmp,_enc.bplen_coef()) );
00068       }
00069    }
00070 
00071 };
00072 
00073 
00074 void DCFmpacket< Rtrsmra<double,array> >::replace( Rtrsmra<double,array>& x ) {
00075 
00076    int next;
00077    int i;
00078    int j;
00079    int a;
00080    int a1;
00081    double tmp;
00082    bytepack bp;
00083 
00084    next=0;
00085    a=0;
00086    for(i=0;i<(sizeb()/(_enc.bplen_a()+_enc.bplen_coef()));i++) {
00087       bp(int(0),_enc.bplen_a());
00088       for(j=0;j<bp.size();j++) { bp[j]=_ptmpacket[next++]; }
00089       a1=int(bp);
00090 
00091       bp(0,_enc.bplen_coef());
00092       for(j=0;j<bp.size();j++) { bp[j]=_ptmpacket[next++]; }
00093       tmp=double(bp);
00094 
00095       while (a<a1) { 
00096          if (sw()) {  x.wav(a,m(),0); }
00097          else { x.scal(a,m(),0); }
00098          a++; 
00099       }
00100       if (sw()) { x.wav(a,m(),tmp); }
00101       else { x.scal(a,m(),tmp); }
00102       a++;
00103    }
00104 
00105    while (a<=_enc.amax()) {
00106       if (sw()) { x.wav(a,m(),0); }
00107       else { x.scal(a,m(),0); }
00108       a++; 
00109    }
00110 
00111 };
00112 

Generated on Mon May 31 21:38:44 2004 for SR2k4 Assembler by doxygen 1.3.6