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

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