OpendTect  6.3
templ_wavlttransimpl.h
Go to the documentation of this file.
1 /*+
2 ________________________________________________________________________
3 
4  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
5  Author: K. Tingdahl
6  Date: 2001
7 ________________________________________________________________________
8 
9  This is part of another include file. Do not protect against multiple
10  inclusion.
11 
12 -*/
13 
14 template <class T> inline
15 void transform1Dt( const T* in, T* out, int space ) const
16 {
17  if ( in != out )
18  {
19  int end = sz_ * space;
20 
21  for ( int idx=0; idx<end; idx+=space )
22  out[idx] = in[idx];
23  }
24 
25  if ( forward_ )
26  {
27  for ( int nn=sz_; nn>=2; nn>>=1 )
28  {
29  mAllocLargeVarLenArr( T, wksp, nn );
30  OD::memZero( wksp, sizeof(T)*nn );
31  int nmod = nn*filtersz_;
32  int n1 = nn-1;
33  int nh = nn >> 1;
34 
35  int i = 1;
36  for ( int ii=0; i<=nn; i+=2, ii++ )
37  {
38  int ni=i+nmod+ioff_;
39  int nj=i+nmod+joff_;
40 
41  for ( int k=1; k<=filtersz_; k++ )
42  {
43  int jf = n1 & (ni+k);
44  int jr = n1 & (nj+k);
45 
46  wksp[ii] += cc_[k]*out[jf*space];
47  wksp[ii+nh] += cr_[k]*out[jr*space];
48  }
49  }
50 
51  for ( int j=0; j<nn; j++ )
52  out[j*space] = wksp[j];
53  }
54  }
55  else
56  {
57  for ( int nn=2; nn<=sz_; nn<<=1 )
58  {
59  mAllocLargeVarLenArr( T, wksp, nn );
60  OD::memZero( wksp, sizeof(T)*nn );
61  int nmod = nn*filtersz_;
62  int n1 = nn-1;
63  int nh = nn >> 1;
64 
65  int i = 1;
66  for ( int ii=0; i<nn; i+=2, ii++ )
67  {
68  T ai=out[ii*space];
69  T ai1=out[(ii+nh)*space];
70  int ni =i+nmod+ioff_;
71  int nj =i+nmod+joff_;
72 
73  for (int k=1; k<=filtersz_; k++ )
74  {
75  int jf = (n1 & (ni+k));
76  int jr = (n1 & (nj+k));
77 
78  wksp[jf] += cc_[k]*ai;
79  wksp[jr] += cr_[k]*ai1;
80  }
81  }
82 
83  for ( int j=0; j<nn; j++ )
84  out[j*space] = wksp[j];
85  }
86  }
87 }
void transform1Dt(const T *in, T *out, int space) const
Definition: templ_wavlttransimpl.h:15
#define mAllocLargeVarLenArr(type, varnm, __size)
Definition: varlenarray.h:29

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017