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

DCFmp_Rtrsmra_float_scalar.h

Go to the documentation of this file.
00001 // DCFmp_Rtrsmra_float_scalar.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2001-2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 template<>
00008 void DCFmp< Rtrsmra<float,scalar> >::encode( 
00009   Rtrsmra<float,scalar>& x, const char mcode
00010 ) 
00011 {
00012    float 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 << "DCFmp.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 template<>
00037 void DCFmp< Rtrsmra<float,scalar> >::replace( Rtrsmra<float,scalar>& x ) 
00038 {
00039    float tmp = 0;
00040    if ( !null() && !empty() ) {
00041       bytepack bp;
00042 
00043 //      bp.read( (*_data), _bplen_coef );       HACK
00044       bp(0,_bplen_coef);
00045       for( int i = 0; i < _bplen_coef; ++i ) bp[i]=(*_data)[i];
00046       bp[_bplen_coef]='\0';
00047 
00048       tmp = float(bp);
00049 //for(int i = 0; i < bp.size(); ++i) cout << int(bp[i]) << ' ';
00050 //cout << tmp << '\n';
00051 
00052    }
00053 #ifdef STORM_DEBUG
00054    cout << "DCFmp.replace(): sw m coef "
00055         << sw() << ' ' << m() << ' ' << tmp << '\n';
00056 #endif
00057    if ( sw() == 1 ) { x.wav( m(), tmp ); } 
00058    else { x.scal( m(), tmp ); }
00059 };
00060 

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