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

MCFmp_Rtmra_int_scalar.h

Go to the documentation of this file.
00001 // MCFmp_Rtmra_int_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<int,scalar> >::encode( 
00009   Rtmra<int,scalar>& x, const char mcode
00010 ) 
00011 {
00012    int 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 ( abs(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 //      cout << "ENCODE " << tmp << " " << abs(tmp) << " " << _bplen_coef 
00033 //           << " " << int(bp) << endl;
00034    }
00035 
00036 };
00037 
00038 inline //template<>
00039 void MCFmp< Rtmra<int,scalar> >::replace( Rtmra<int,scalar>& x ) 
00040 {
00041    int tmp = 0;
00042    if ( !null() ) {
00043    if ( !empty() ) {
00044       bytepack bp;
00045 
00046 //      bp.read( (*_data), _bplen_coef );       HACK
00047       bp(0,_bplen_coef);
00048       for( int i = 0; i < _bplen_coef; ++i ) bp[i]=(*_data)[i];
00049       bp[_bplen_coef]='\0';
00050 
00051       tmp = int(bp);
00052 
00053 //      cout << "REPLACE " << int(bp) << " " << _bplen_coef << endl;
00054 
00055    }
00056 #ifdef STORM_DEBUG
00057    cout << "MCFmp.replace(): sw m coef "
00058         << sw() << ' ' << m() << ' ' << tmp << '\n';
00059 #endif
00060    if ( sw() == 1 ) { x.wav( m(), tmp ); } 
00061    else { x.scal( m(), tmp ); }
00062    } else { cout << "null in replace\n"; }
00063 };
00064 

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