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

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