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

DCFmpacket_Rtmra_double_scalar.cpp

Go to the documentation of this file.
00001 //DCFmpacket_Rtmra_double_scalar.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 // speciaalization DCFmpacket< Rtmra<double,scalar> >
00011 
00012 DCFmpacket< Rtmra<double,scalar> >::DCFmpacket( 
00013   const int sizebmax,
00014   const int bplen_sizeb, const int bplen_n,
00015   DCFencode< Rtmra<double,scalar> >& enc
00016   ) : DCFmpacketBase(sizebmax, bplen_sizeb, bplen_n) {
00017 
00018    _enc=enc;
00019 
00020 };
00021 
00022 void DCFmpacket< Rtmra<double,scalar> >::setencode( 
00023   const int sizebmax,
00024   const int bplen_sizeb, const int bplen_n,
00025   DCFencode< Rtmra<double,scalar> >& enc
00026   ) {
00027 
00028    setencode(sizebmax, bplen_sizeb, bplen_n );
00029    _enc=enc;
00030 
00031 };
00032 
00033 DCFmpacket< Rtmra<double,scalar> >& 
00034   DCFmpacket< Rtmra<double,scalar> >::operator()(
00035     Rtmra<double,scalar>& x,
00036     const char mcode
00037     ) {
00038      DCFmpacket< Rtmra<double,scalar> >::encode(x,mcode);
00039      return *this;
00040 };
00041 
00042 void DCFmpacket< Rtmra<double,scalar> >::encode(
00043     Rtmra<double,scalar>& x,
00044     const char mcode
00045     ) {
00046 
00047    double tmp;
00048    bytepack bp;
00049 
00050    int n;
00051 
00052    if (sw(mcode)) { n=((( x.mrastep() )&( (1<<x.mmax()) -1 ) )>> m(mcode)); }
00053    else { n=0; }
00054 
00055    clear();
00056    set(mcode,n);
00057 
00058    if (sw(mcode)) { tmp=x.wav(m(mcode)); }
00059    else {tmp=x.scal(m(mcode)); }
00060 
00061    if (fabs(tmp)>=_enc.quantcoef()) put( bp(tmp,_enc.bplen_coef()) );
00062 };
00063 
00064 
00065 void DCFmpacket< Rtmra<double,scalar> >::replace( Rtmra<double,scalar>& x ) {
00066 
00067    int j;
00068    double tmp;
00069    bytepack bp;
00070 
00071    if (empty()) { tmp=0; }
00072    else {
00073       bp(0,_enc.bplen_coef());
00074       for(j=0;j<bp.size();j++) { bp[j]=_ptmpacket[j]; }
00075       tmp=double(bp);
00076    }
00077 
00078    if (sw()) { x.wav(m(),tmp); }
00079    else { x.scal(m(),tmp); }
00080 };
00081 

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