 |
OpendTect
6.6
|
Go to the documentation of this file.
40 bool doPrepare(
int nrthreads);
44 void computeEnergyMute();
63 template <
class T>
inline
74 template <
class T>
inline
79 template <
class T>
inline
81 { input_ = &nvs; size_ = sz; }
84 template <
class T>
inline
89 template <
class T>
inline
94 template <
class T>
inline
99 template <
class T>
inline
102 if ( !input_ || !output_ ||
103 (output_->reSizeable() && !output_->setSize(size_)) )
106 energies_.setSize(
mCast(
int,size_),
mUdf(T) );
111 threadsinenergycalc_ = nrthreads;
114 {
delete lock_; lock_ = 0; }
120 template <
class T>
inline
124 if (
mIsUdf(mutefraction_) ||
129 if ( sample<0 || sample>=size_ )
133 OD::sysMemCopy( energies.ptr(), energies_.arr(), size_*
sizeof(T) );
134 sortFor( energies.ptr(), size_, sample );
135 energymute_ = energies[sample];
139 template <
class T>
inline
142 for (
int idx=0; idx<=stop; idx++ )
144 const T value = input_->value(idx);
145 energies_[idx] =
mIsUdf( value ) ?
mUdf(T) : value*value;
151 threadsinenergycalc_--;
152 if ( !threadsinenergycalc_ )
154 else while ( threadsinenergycalc_ )
161 threadsinenergycalc_--;
163 else while ( threadsinenergycalc_!=-1 )
173 for (
int idx=
mCast(
int,start); idx<=stop; idx++ )
177 for (
int energyidx=idx+samplerg_.start;
178 energyidx<=idx+samplerg_.stop;
181 if ( energyidx<0 || energyidx>=size_ )
184 const T energy = energies_[energyidx];
192 if ( nrenergies ) energysum /= nrenergies;
195 if ( energysum>=energymute_ && energysum>0 )
197 const T
inpval = input_->value(idx);
202 output_->setValue( idx, outputval );
bool doWork(od_int64, od_int64, int)
Definition: agc.h:140
TypeSet< T > energies_
Definition: agc.h:54
Interface to a series of values.
Definition: odmemory.h:16
ValueSeries< T > * output_
Definition: agc.h:51
void sortFor(T *arr, I sz, I itarget)
Definition: sorting.h:242
float mutefraction_
Definition: agc.h:53
void setOutput(ValueSeries< T > &)
Output can be the same as input.
Definition: agc.h:85
~AGC()
Definition: agc.h:75
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:289
#define od_int64
Definition: plftypes.h:35
od_int64 size_
Definition: agc.h:50
Interval< int > samplerg_
Definition: agc.h:52
od_int64 nrIterations() const
Definition: agc.h:47
int threadsinenergycalc_
Definition: agc.h:57
void computeEnergyMute()
Definition: agc.h:121
#define mIsZero(x, eps)
Definition: commondefs.h:66
#define mClass(module)
Definition: commondefs.h:181
void setSampleGate(const Interval< int > &)
Definition: agc.h:90
AGC()
Definition: agc.h:64
Is an object that faciliates many threads to wait for something to happen.
Definition: thread.h:110
const Interval< int > & getSampleGate() const
Definition: agc.h:95
T energymute_
Definition: agc.h:55
Threads::ConditionVar * lock_
Definition: agc.h:58
void sysMemCopy(void *, const void *, int64_t)
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
Computes an AGC over a ValueSeries.
Definition: agc.h:25
#define mCast(tp, v)
Definition: commondefs.h:137
#define mAllocLargeVarLenArr(type, varnm, __size)
Definition: varlenarray.h:30
float getMuteFraction() const
Definition: agc.h:38
const T inpval
Definition: arrayndalgo.h:1681
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
const ValueSeries< T > * input_
Definition: agc.h:49
void setMuteFraction(float lvmf)
The lowest fraction will be muted.
Definition: agc.h:36
int minThreadSize() const
Definition: agc.h:46
#define mNINT64(x)
Definition: commondefs.h:59
bool doPrepare(int nrthreads)
Definition: agc.h:100
void setInput(const ValueSeries< T > &, int sz)
Definition: agc.h:80
Sets of (small) copyable elements.
Definition: commontypes.h:29
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021