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

MCFmp_Rtmra_double_scalar.h

Go to the documentation of this file.
00001 // MCFmp_Rtmra_double_scalar.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2001-2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 inline //template<>
00008 void MCFmp< Rtmra<double,scalar> >::encode( 
00009   Rtmra<double,scalar>& 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    if ( mcode_to_sw(mcode) ) { tmp = x.wav( mcode_to_m(mcode) ); } 
00024    else { tmp = x.scal( mcode_to_m(mcode) ); }
00025 
00026    if ( fabs(tmp) >= _threshold ) {
00027 #ifdef STORM_DEBUG
00028    cout << "MCFmp.encode(): push_back() : mcode, n, tmp = "
00029         << int( (unsigned char)(mcode) ) << ' ' << n << ' ' << tmp << '\n';
00030 #endif
00031       push_back( bp( tmp, _bplen_coef ) );
00032    }
00033 
00034 };
00035 
00036 inline //template<>
00037 void MCFmp< Rtmra<double,scalar> >::replace( Rtmra<double,scalar>& x ) 
00038 {
00039    double tmp = 0;
00040    if ( !null() ) {
00041    if ( !empty() ) {
00042       bytepack bp;
00043 
00044 //      bp.read( (*_data), _bplen_coef );       HACK
00045       bp(0,_bplen_coef);
00046       for( int i = 0; i < _bplen_coef; ++i ) bp[i]=(*_data)[i];
00047       bp[_bplen_coef]='\0';
00048 
00049       tmp = double(bp);
00050 
00051    }
00052 #ifdef STORM_DEBUG
00053    cout << "MCFmp.replace(): sw m coef "
00054         << sw() << ' ' << m() << ' ' << tmp << '\n';
00055 #endif
00056    if ( sw() == 1 ) { x.wav( m(), tmp ); } 
00057    else { x.scal( m(), tmp ); }
00058    }
00059 };

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