00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 DCFmpacket< Rtmra<double,scalar> >::DCFmpacket(
00013 const int sizebmax,
00014 const int bplen_sizeb, const int bplen_n,
00015 DCFencode< Rtmra<double,scalar> >& enc
00016 ) : DCFmpacketBase(sizebmax, bplen_sizeb, bplen_n) {
00017
00018 _enc=enc;
00019
00020 };
00021
00022 void DCFmpacket< Rtmra<double,scalar> >::setencode(
00023 const int sizebmax,
00024 const int bplen_sizeb, const int bplen_n,
00025 DCFencode< Rtmra<double,scalar> >& enc
00026 ) {
00027
00028 setencode(sizebmax, bplen_sizeb, bplen_n );
00029 _enc=enc;
00030
00031 };
00032
00033 DCFmpacket< Rtmra<double,scalar> >&
00034 DCFmpacket< Rtmra<double,scalar> >::operator()(
00035 Rtmra<double,scalar>& x,
00036 const char mcode
00037 ) {
00038 DCFmpacket< Rtmra<double,scalar> >::encode(x,mcode);
00039 return *this;
00040 };
00041
00042 void DCFmpacket< Rtmra<double,scalar> >::encode(
00043 Rtmra<double,scalar>& x,
00044 const char mcode
00045 ) {
00046
00047 double tmp;
00048 bytepack bp;
00049
00050 int n;
00051
00052 if (sw(mcode)) { n=((( x.mrastep() )&( (1<<x.mmax()) -1 ) )>> m(mcode)); }
00053 else { n=0; }
00054
00055 clear();
00056 set(mcode,n);
00057
00058 if (sw(mcode)) { tmp=x.wav(m(mcode)); }
00059 else {tmp=x.scal(m(mcode)); }
00060
00061 if (fabs(tmp)>=_enc.quantcoef()) put( bp(tmp,_enc.bplen_coef()) );
00062 };
00063
00064
00065 void DCFmpacket< Rtmra<double,scalar> >::replace( Rtmra<double,scalar>& x ) {
00066
00067 int j;
00068 double tmp;
00069 bytepack bp;
00070
00071 if (empty()) { tmp=0; }
00072 else {
00073 bp(0,_enc.bplen_coef());
00074 for(j=0;j<bp.size();j++) { bp[j]=_ptmpacket[j]; }
00075 tmp=double(bp);
00076 }
00077
00078 if (sw()) { x.wav(m(),tmp); }
00079 else { x.scal(m(),tmp); }
00080 };
00081