00001
00002
00003
00004
00005
00006
00007
00008
00009 DCFmpacket< Rtmra<double,array> >::DCFmpacket(
00010 const int sizebmax,
00011 const int bplen_sizeb, const int bplen_n,
00012 DCFencode< Rtmra<double,array> >& enc
00013 ) : DCFmpacketBase(sizebmax, bplen_sizeb, bplen_n) {
00014
00015 _enc=enc;
00016
00017 };
00018
00019 void DCFmpacket< Rtmra<double,array> >::setencode(
00020 const int sizebmax,
00021 const int bplen_sizeb, const int bplen_n,
00022 DCFencode< Rtmra<double,array> >& enc
00023 ) {
00024
00025 setencode(sizebmax,bplen_sizeb, bplen_n );
00026 _enc=enc;
00027
00028 };
00029
00030 DCFmpacket< Rtmra<double,array> >&
00031 DCFmpacket< Rtmra<double,array> >::operator()(
00032 Rtmra<double,array>& x,
00033 const char mcode
00034 ) {
00035
00036 DCFmpacket< Rtmra<double,array> >::encode(x,mcode);
00037 return *this;
00038
00039 };
00040
00041 void DCFmpacket< Rtmra<double,array> >::encode(
00042 Rtmra<double,array>& x,
00043 const char mcode
00044 ) {
00045
00046 double tmp;
00047 bytepack bp;
00048
00049 int n;
00050
00051 int a;
00052
00053 if (sw(mcode)) { n=((( x.mrastep() )&( (1<<x.mmax()) -1 ) )>> m(mcode)); }
00054 else { n=0; }
00055
00056 clear();
00057 set(mcode,n);
00058
00059 for(a=0;a<=_enc.amax();a++) {
00060 if (sw(mcode)) { tmp=x.wav(a,m(mcode)); }
00061 else { tmp=x.scal(a,m(mcode)); }
00062 if (fabs(tmp)>=_enc.quantcoef()) {
00063 put( bp(a,_enc.bplen_a()) );
00064 put( bp(tmp,_enc.bplen_coef()) );
00065 }
00066 }
00067
00068 };
00069
00070
00071 void DCFmpacket< Rtmra<double,array> >::replace( Rtmra<double,array>& x ) {
00072
00073 int next;
00074 int i;
00075 int j;
00076 int a;
00077 int a1;
00078 double tmp;
00079 bytepack bp;
00080
00081 next=0;
00082 a=0;
00083 for(i=0;i<(sizeb()/(_enc.bplen_a()+_enc.bplen_coef()));i++) {
00084 bp(int(0),_enc.bplen_a());
00085 for(j=0;j<bp.size();j++) { bp[j]=_ptmpacket[next++]; }
00086 a1=int(bp);
00087
00088 bp(0,_enc.bplen_coef());
00089 for(j=0;j<bp.size();j++) { bp[j]=_ptmpacket[next++]; }
00090 tmp=double(bp);
00091
00092 while (a<a1) {
00093 if (sw()) { x.wav(a,m(),0); }
00094 else { x.scal(a,m(),0); }
00095 a++;
00096 }
00097 if (sw()) { x.wav(a,m(),tmp); }
00098 else { x.scal(a,m(),tmp); }
00099 a++;
00100 }
00101
00102 while (a<=_enc.amax()) {
00103 if (sw()) { x.wav(a,m(),0); }
00104 else { x.scal(a,m(),0); }
00105 a++;
00106 }
00107
00108 };
00109