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

MCFmp_Rtrsmra_int_array.h

Go to the documentation of this file.
00001 // MCFmp_Rtrsmra_int_array.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2001-2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 inline //template<>
00008 void MCFmp< Rtrsmra<int,array> >::encode( 
00009   Rtrsmra<int,array>& 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    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 ( abs(tmp) >= _threshold ) {
00027          push_back( bp( a, _bplen_a ) );
00028          push_back( bp( tmp, _bplen_coef ) );
00029       }
00030    }
00031 
00032 };
00033 
00034 inline //template<>
00035 void MCFmp< Rtrsmra<int,array> >::replace( Rtrsmra<int,array>& x ) 
00036 {
00037    int a=0;
00038 
00039    if ( !null() ) {
00040    if ( !empty() ) {
00041       int tmp;
00042       bytepack bp;
00043       int next=0;
00044       int a1;
00045 //      for(int i=0; i < ((*_data).size() / ( _bplen_a + _bplen_coef )); ++i ) {
00046       for(unsigned int i=0; i < (_data->size()/(_bplen_a+ _bplen_coef)); ++i) {
00047          bp( 0, _bplen_a );
00048          for( int j = 0; j < bp.size(); ++j ) { bp[j] = (*_data)[next++]; }
00049          a1=int(bp);
00050 
00051          bp( 0, _bplen_coef );
00052          for( int j = 0; j < bp.size(); ++j) { bp[j] = (*_data)[next++]; }
00053          tmp = int(bp);
00054 
00055          while ( a < a1 ) { 
00056             if ( sw() ) { x.wav( a, m(), 0 ); }
00057             else { x.scal( a, m(), 0 ); }
00058             ++a; 
00059          }
00060          if ( sw() ) { x.wav( a, m(), tmp ); }
00061          else { x.scal( a, m(), tmp ); }
00062          ++a;
00063       }
00064    }
00065 
00066    while ( a <= x.amax() ) {
00067       if ( sw() ) { x.wav( a, m(), 0 ); }
00068       else { x.scal( a, m(), 0 ); }
00069       ++a; 
00070    }
00071    }
00072 };
00073 

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