OpendTect  7.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
SincInterpolator Class Reference

A sinc interpolator for bandlimited uniformly-sampled functions y(x). More...

Inheritance diagram for SincInterpolator:
[legend]

Public Types

enum  Extrapolation { NONE =0 , ZERO =1 , CONSTANT =2 }
 

Public Member Functions

 ~SincInterpolator ()
 
Extrapolation getExtrapolation ()
 
float getMaximumError () const
 
float getMaximumFrequency () const
 
int getMaximumLength () const
 
od_int64 getTableBytes () const
 
virtual bool initTable (float fmax, int lmax)
 
bool isTableOK () const
 
void setExtrapolation (Extrapolation)
 

Protected Member Functions

 SincInterpolator ()
 
float getTableVal (int idx, int idy) const
 
bool init ()
 
template<class RT >
bool initUndefTable (const RT *, od_int64 sz)
 

Protected Attributes

const float ** asinc_
 
bool extrapcst_
 
bool extrapzero_
 
int ishift_
 
bool * isudfarr_
 
int lsinc_
 
int nsincm1_
 
const SincTableManager::Tabletable_
 

Static Protected Attributes

static const float snapdist
 

Detailed Description

A sinc interpolator for bandlimited uniformly-sampled functions y(x).

Interpolators can be designed for any two of three parameters: maximum error (emax), maximum frequency (fmax) and maximum length (lmax). The parameter not specified is computed when an interpolator is designed.

Below the specified (or computed) maximum frequency fmax, the maximum interpolation error should be less than the specified (or computed) maximum error emax. For frequencies above fmax, interpolation error may be much greater. Therefore, sequences to be interpolated should be bandlimited to frequencies less than fmax.

The maximum length lmax of an interpolator is an even positive integer. It is the number of uniform samples required to interpolate a single value y(x). Ideally, the weights applied to each uniform sample are values of a sinc function. Although the ideal sinc function yields zero interpolation error for all frequencies up to the Nyquist frequency (0.5 cycles/sample), it has infinite length.

With recursive filtering, infinite-length approximations to the sinc function are feasible and, in some applications, most efficient. When the number of interpolated values is large relative to the number of uniform samples, the cost of recursive filtering is amortized over those many interpolated values, and can be negligible. However, this cost becomes significant when only a few values are interpolated for each sequence of uniform samples.

This interpolator is based on a finite-length approximation to the sinc function. The efficiency of finite-length interpolators like this one does not depend on the number of samples interpolated. Also, this interpolator is robust in the presence of noise spikes, which affect only nearby samples.

Finite-length interpolators present a tradeoff between cost and accuracy. Interpolators with small maximum lengths are most efficient, and those with high maximum frequencies and small maximum errors are most accurate.

When interpolating multiple values of y(x) from a single sequence of uniformly sampled values, efficiency may be improved by using one of the methods that enables specification of multiple x values at which to interpolate.

author: Dave Hale, Colorado School of Mines author: Bill Harlan, Landmark Graphics version 2012.12.21

<>

Member Enumeration Documentation

◆ Extrapolation

Enumerator
NONE 
ZERO 
CONSTANT 

Constructor & Destructor Documentation

◆ ~SincInterpolator()

SincInterpolator::~SincInterpolator ( )

◆ SincInterpolator()

SincInterpolator::SincInterpolator ( )
protected

Member Function Documentation

◆ getExtrapolation()

Extrapolation SincInterpolator::getExtrapolation ( )

◆ getMaximumError()

float SincInterpolator::getMaximumError ( ) const
inline

◆ getMaximumFrequency()

float SincInterpolator::getMaximumFrequency ( ) const
inline

◆ getMaximumLength()

int SincInterpolator::getMaximumLength ( ) const
inline

◆ getTableBytes()

od_int64 SincInterpolator::getTableBytes ( ) const
inline

◆ getTableVal()

float SincInterpolator::getTableVal ( int  idx,
int  idy 
) const
inlineprotected

◆ init()

bool SincInterpolator::init ( )
inlineprotected

◆ initTable()

virtual bool SincInterpolator::initTable ( float  fmax,
int  lmax 
)
virtual
Parameters
fmaxMaximum frequency in input dataset
lmaxMaximum length of the interpolator

Reimplemented in SincInterpolator3D< RT, PT >, SincInterpolator2D< RT, PT >, and SincInterpolator1D< RT, PT >.

◆ initUndefTable()

template<class RT >
bool SincInterpolator::initUndefTable ( const RT *  vals,
od_int64  sz 
)
protected

◆ isTableOK()

bool SincInterpolator::isTableOK ( ) const
inline

◆ setExtrapolation()

void SincInterpolator::setExtrapolation ( Extrapolation  )

Member Data Documentation

◆ asinc_

const float** SincInterpolator::asinc_
protected

◆ extrapcst_

bool SincInterpolator::extrapcst_
protected

◆ extrapzero_

bool SincInterpolator::extrapzero_
protected

◆ ishift_

int SincInterpolator::ishift_
protected

◆ isudfarr_

bool* SincInterpolator::isudfarr_
protected

◆ lsinc_

int SincInterpolator::lsinc_
protected

◆ nsincm1_

int SincInterpolator::nsincm1_
protected

◆ snapdist

const float SincInterpolator::snapdist
staticprotected

relative distance from a sample below which no interpolation is done. 99.9% chance default is OK.

◆ table_

const SincTableManager::Table* SincInterpolator::table_
protected

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