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

DCFmp_Rtmra_double_array.h

Go to the documentation of this file.
00001 // DCFmp_Rtmra_double_array.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2001-2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 template<>
00008 void DCFmp< Rtmra<double,array> >::encode( 
00009   Rtmra<double,array>& x, const char mcode
00010 ) 
00011 {
00012    double tmp;
00013    bytepack bp;
00014 
00015    int n = 0;
00016    if (mcode_to_sw(mcode)) { 
00017       n = ( (x.mrastep()) & ((1<<x.mmax())-1) ) >> mcode_to_m(mcode); 
00018    } 
00019 
00020    clear();
00021    set( mcode, n );
00022 
00023    for( int a = 0; a <= x.amax(); ++a ) {
00024       if ( mcode_to_sw(mcode) == 0 ) { tmp = x.scal( a, mcode_to_m(mcode) ); }
00025       else { tmp = x.wav( a, mcode_to_m(mcode) ); }
00026       if ( fabs(tmp) >= _threshold ) {
00027          push_back( bp( a, _bplen_a ) );
00028          push_back( bp( tmp, _bplen_coef ) );
00029       }
00030    }
00031 
00032 };
00033 
00034 template<>
00035 void DCFmp< Rtmra<double,array> >::replace( Rtmra<double,array>& x ) 
00036 {
00037    int a=0;
00038 
00039    if ( !null() && !empty() ) {
00040       double tmp;
00041       bytepack bp;
00042       int next=0;
00043       int a1;
00044       for(int i=0; i < ((*_data).size() / ( _bplen_a + _bplen_coef )); ++i ) {
00045          bp( 0, _bplen_a );
00046          for( int j = 0; j < bp.size(); ++j ) { bp[j] = (*_data)[next++]; }
00047          a1=int(bp);
00048 
00049          bp( 0, _bplen_coef );
00050          for( int j = 0; j < bp.size(); ++j) { bp[j] = (*_data)[next++]; }
00051          tmp = double(bp);
00052 
00053          while ( a < a1 ) { 
00054             if ( sw() ) { x.wav( a, m(), 0 ); }
00055             else { x.scal( a, m(), 0 ); }
00056             ++a; 
00057          }
00058          if ( sw() ) { x.wav( a, m(), tmp ); }
00059          else { x.scal( a, m(), tmp ); }
00060          ++a;
00061       }
00062    }
00063 
00064    while ( a <= x.amax() ) {
00065       if ( sw() ) { x.wav( a, m(), 0 ); }
00066       else { x.scal( a, m(), 0 ); }
00067       ++a; 
00068    }
00069 };
00070 

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