OpenDAFF C++ API  v1.7
Directional Audio File Format
Public Member Functions | List of all members
DAFFContentDFTRealization Class Reference
Inheritance diagram for DAFFContentDFTRealization:
DAFFContentDFT DAFFContent

Public Member Functions

 DAFFContentDFTRealization (DAFFTransformerIR2DFT *pParent, const DAFFContentIR *pInputContent)
 
virtual ~DAFFContentDFTRealization ()
 
int getTransformSize () const
 Returns the size of the transform (number of overall DFT coefficients) More...
 
int getNumDFTCoeffs () const
 Returns the number of DFT coefficients. More...
 
bool isSymmetric () const
 Returns whether the spectrum is complex-conjugated symmetric. More...
 
double getSamplerate () const
 Returns the correspondig sampling rate [in Hertz]. More...
 
double getFrequencyBandwidth () const
 Returns the frequency resolution [in Hertz]. More...
 
float getOverallMagnitudeMaximum () const
 Returns the overall greatest magnitude value. More...
 
int getDFTCoeff (int iRecordIndex, int iChannel, int iDFTCoeff, float &fReal, float &fImag) const
 Retrieve a single magnitude coefficient. More...
 
int getDFTCoeffs (int iRecordIndex, int iChannel, float *pfDest) const
 Retrieves magnitude coefficients. More...
 
DAFFReadergetParent () const
 Returns the parent reader. More...
 
const DAFFPropertiesImplgetProperties () const
 Returns the properties. More...
 
const DAFFMetadatagetRecordMetadata (int iRecordIndex) const
 Returns the metadata of a record. More...
 
int getRecordCoords (int iRecordIndex, int iView, float &fAngle1, float &fAngle2) const
 Determines the spherical coordinates of a record (grid point on spherical regular grid) More...
 
void getNearestNeighbour (int iView, float fAngle1, float fAngle2, int &iRecordIndex) const
 Determine the nearest neighbour record and return its index. More...
 
void getNearestNeighbour (int iView, float fAngle1, float fAngle2, int &iRecordIndex, bool &bOutOfBounds) const
 Determine the nearest neighbour record and return its index (with boundary validatsion) More...
 
void getCell (int iView, float fAngle1, float fAngle2, DAFFQuad &qIndices) const
 Determines the cell of a given direction on the sphere grid and delivers its surrounding record indices. More...
 
void transformAnglesD2O (float fAlpha, float fBeta, float &fAzimuth, float &fElevation) const
 Transforms data spherical coordinates into object spherical coordinates. More...
 
void transformAnglesO2D (float fAzimuth, float fElevation, float &fAlpha, float &fBeta) const
 Transforms object spherical coordinates into data spherical coordinates. More...
 
- Public Member Functions inherited from DAFFContentDFT
virtual ~DAFFContentDFT ()
 
- Public Member Functions inherited from DAFFContent
virtual ~DAFFContent ()
 

Detailed Description

Definition at line 14 of file DAFFTransformerIR2DFT.cpp.

Constructor & Destructor Documentation

DAFFContentDFTRealization::DAFFContentDFTRealization ( DAFFTransformerIR2DFT pParent,
const DAFFContentIR pInputContent 
)
inline

Definition at line 17 of file DAFFTransformerIR2DFT.cpp.

virtual DAFFContentDFTRealization::~DAFFContentDFTRealization ( )
inlinevirtual

Definition at line 24 of file DAFFTransformerIR2DFT.cpp.

Member Function Documentation

void DAFFContentDFTRealization::getCell ( int  iView,
float  fAngle1Deg,
float  fAngle2Deg,
DAFFQuad qIndices 
) const
inlinevirtual

Determines the cell of a given direction on the sphere grid and delivers its surrounding record indices.

This method takes a direction in form of an angular pair and searches for the valid surrounding grid points which are related to a record. In a full covered sphere, this means a rectangular cell at any point except of the area near the poles, where we obtain triangular cells. Nevertheless, the method will return four valid record indices in any given case. It makes heavy use of the getNearestNeighbour method (which does not make it that fast) and is invented for custom interpolation purposes.

Sequence convention

Imagine you are sitting at the origin of the sphere and you point in a random direction. What you prickle will be a cell similar to this one:

(3)--—(2) | | | | ^ (4)--—(1) | (direction beta increases)

       <--

(direction alpha increases)

The first index will always be the lower grid point of both given angles, the second is the first point increased by the beta resolution at beta angle. The third point is represented by both the increase of the alpha and beta angle each with their resolution steps. The fourth point is the first point only with an increase by alpha resolution of the alpha angle.

Let's discuss an example: Requested direction: alpha = 2°, beta = 2° object view coordinate system (front direction would be 0°,0°) Resolution: alpha = 10°, beta = 5° Index1 -> alpha = 0°, beta = 0° (object view) Index2 -> alpha = 0°, beta = 5° (object view) Index3 -> alpha = 10°, beta = 5° (object view) Index4 -> alpha = 10°, beta = 0° (object view)

Special cases

  • if a pole is directly hitten and the full sphere is covered, it will return 4 times the pole's record index.
  • if the requested direction is near a pole or out of boundaries, the method will simply search for the nearest neighbouring directions for each of the four cell points as if the cell would exists on a regular sphere grid. This will result in the return of at least two indices indicating the same record. You most certainly will discover something like that near north pole

    (3,2) / \ / \ (4)-—(1)

    or that near south pole
    

(3)-—(2) \ / \ / (4,1)

or, if out of bounds, something similar to

(3,4)--—(1,2)

or

(3,2)
  |
  |
(4,1)

Anyway, using getCell out of the boundaries does not make that much sense. In case you run
out of bounds onsider using getNearestNeighbour with boundary flag instead.
Parameters
[in]iViewView, one of DAFF_VIEWS
[in]fAngle1DegAngle of first value in degree
[in]fAngle2DegAngle of first value in degree
[out]qIndicesQuad struct with index values

Implements DAFFContent.

Definition at line 97 of file DAFFTransformerIR2DFT.cpp.

int DAFFContentDFTRealization::getDFTCoeff ( int  iRecordIndex,
int  iChannel,
int  iDFTCoeff,
float &  fReal,
float &  fImag 
) const
inlinevirtual

Retrieve a single magnitude coefficient.

This method retrives a single complex-valued DFT coefficient for the given direction (record index) and channel and stores them in the supplied destination variable.

Parameters
[in]iRecordIndexRecord index (direction)
[in]iChannelChannel index
[in]iDFTCoeffDFT coefficient index
[out]fRealReal part
[out]fImagImaginary part
Returns
DAFF_NO_ERROR on success, another DAFF_ERROR otherwise

Implements DAFFContentDFT.

Definition at line 60 of file DAFFTransformerIR2DFT.cpp.

int DAFFContentDFTRealization::getDFTCoeffs ( int  iRecordIndex,
int  iChannel,
float *  pfDest 
) const
inlinevirtual

Retrieves magnitude coefficients.

This method retrives the complex-valued DFT coefficients for the given direction (record index) and channel and stores them in the supplied destination buffer. The method writes exactly as many complex-valued coefficients as the function getNumDFTCoeffs() returns.

The output storage scheme is: pfDest = (Re[0], Im[0], Re[1], Im[1], ...)

Parameters
iRecordIndexRecord index (direction)
iChannelChannel index
pfDestDestination buffer (size >= 2*getNumDFTCoeffs())
Returns
DAFF_NO_ERROR on success, another DAFF_ERROR otherwise

Implements DAFFContentDFT.

Definition at line 64 of file DAFFTransformerIR2DFT.cpp.

double DAFFContentDFTRealization::getFrequencyBandwidth ( ) const
inlinevirtual

Returns the frequency resolution [in Hertz].

Returns
Linear frequency spacing in Hertz

Implements DAFFContentDFT.

Definition at line 52 of file DAFFTransformerIR2DFT.cpp.

void DAFFContentDFTRealization::getNearestNeighbour ( int  iView,
float  fAngle1Deg,
float  fAngle2Deg,
int &  iRecordIndex 
) const
inlinevirtual

Determine the nearest neighbour record and return its index.

This method takes a direction in form of an angular pair and searches the grid for the nearest neighbouring record (grid point). The distance measure is the angle on the great circle (spherical law of cosines).

Note: The method always returns a valid record index, even if the angular pair points outside the spherical grid (e.g. consider boundaries). Thereby we maintain a consistent behaviour. You can check if the point was within the boundaries using the bOutOfBounds argument.

Parameters
[in]iViewThe view that should be used for the given pair of angles, one of DAFF_VIEWS
[in]fAngle1DegFirst angle (Phi or Alpha, depending on view)
[in]fAngle2DegSecond angle (Theta or Beta, depending on view)
[out]iRecordIndexIndex that corresponds to this pair of angles

Implements DAFFContent.

Definition at line 89 of file DAFFTransformerIR2DFT.cpp.

void DAFFContentDFTRealization::getNearestNeighbour ( int  iView,
float  fAngle1Deg,
float  fAngle2Deg,
int &  iRecordIndex,
bool &  bOutOfBounds 
) const
inlinevirtual

Determine the nearest neighbour record and return its index (with boundary validatsion)

This method takes a direction in form of an angular pair and searches the grid for the nearest neighbouring record (grid point). The distance measure is the angle on the great circle (spherical law of cosines).

Note: The method always returns a valid record index, even if the angular pair points outside the spherical grid (e.g. consider boundaries). Thereby we maintain a consistent behaviour. You can check if the point was within the boundaries using the bOutOfBounds argument.

Parameters
[in]iViewThe view that should be used for the given pair of angles, one of DAFF_VIEWS
[in]fAngle1DegFirst angle (Phi or Alpha, depending on view)
[in]fAngle2DegSecond angle (Theta or Beta, depending on view)
[out]iRecordIndexIndex that corresponds to this pair of angles
[out]bOutOfBoundsIndicator if requested direction was out of bounds (true in this case)

Implements DAFFContent.

Definition at line 93 of file DAFFTransformerIR2DFT.cpp.

int DAFFContentDFTRealization::getNumDFTCoeffs ( ) const
inlinevirtual

Returns the number of DFT coefficients.

This functions returns the actually stored number of complex-valued DFT coefficients. Note: For real-valued time-domain data, this includes only the non-symmetric coefficients. Examplarily, for a transform size of N the function returns floor(N/2)+1. For arbitrary complex-valued time-domain data the returned number equals the transform size.

Returns
Number of DFT coefficients

Implements DAFFContentDFT.

Definition at line 33 of file DAFFTransformerIR2DFT.cpp.

float DAFFContentDFTRealization::getOverallMagnitudeMaximum ( ) const
inlinevirtual

Returns the overall greatest magnitude value.

This method returns the greatest magnitude value of the DFT coefficients over all directions, channels and frequencies.

Returns
Absolute maximum magnitude value

Implements DAFFContentDFT.

Definition at line 56 of file DAFFTransformerIR2DFT.cpp.

DAFFReader* DAFFContentDFTRealization::getParent ( ) const
inlinevirtual

Returns the parent reader.

Implements DAFFContent.

Definition at line 72 of file DAFFTransformerIR2DFT.cpp.

const DAFFPropertiesImpl* DAFFContentDFTRealization::getProperties ( ) const
inlinevirtual

Returns the properties.

Implements DAFFContent.

Definition at line 76 of file DAFFTransformerIR2DFT.cpp.

int DAFFContentDFTRealization::getRecordCoords ( int  iRecordIndex,
int  iView,
float &  fAngle1Deg,
float &  fAngle2Deg 
) const
inlinevirtual

Determines the spherical coordinates of a record (grid point on spherical regular grid)

Parameters
[in]iRecordIndexThe index of the record on regular spherical grid
[in]iViewThe view that should be used for the given pair of angles, one of DAFF_VIEWS
[out]fAngle1DegFirst angle that corresponds to this index (Phi or Alpha, depending on view)
[out]fAngle2DegSecond angle that corresponds to this index (Theta or Beta, depending on view)
Returns
DAFF_NO_ERROR on success, another DAFF_ERROR otherwise

Implements DAFFContent.

Definition at line 85 of file DAFFTransformerIR2DFT.cpp.

const DAFFMetadata* DAFFContentDFTRealization::getRecordMetadata ( int  iRecordIndex) const
inlinevirtual

Returns the metadata of a record.

Note: The method always returns a valid DAFFMetadata, even if there is none specified in the file. Thereby we maintain a consistent behaviour. Metadata may therefore be empty.

Parameters
[in]iRecordIndexThe index of the record on regular spherical grid
Returns
The const pointer to metadata

Implements DAFFContent.

Definition at line 81 of file DAFFTransformerIR2DFT.cpp.

double DAFFContentDFTRealization::getSamplerate ( ) const
inlinevirtual

Returns the correspondig sampling rate [in Hertz].

Returns
Sampling rate in Hertz

Implements DAFFContentDFT.

Definition at line 48 of file DAFFTransformerIR2DFT.cpp.

int DAFFContentDFTRealization::getTransformSize ( ) const
inlinevirtual

Returns the size of the transform (number of overall DFT coefficients)

This functions returns the overall number of complex-valued DFT coefficients. Note: For real-valued time-domain data, this also includes the symmetric coefficients.

Returns
DFT transform size

Implements DAFFContentDFT.

Definition at line 28 of file DAFFTransformerIR2DFT.cpp.

bool DAFFContentDFTRealization::isSymmetric ( ) const
inlinevirtual

Returns whether the spectrum is complex-conjugated symmetric.

Returns
True, if the DFT spectrum is complex-conjugated symmetric

Implements DAFFContentDFT.

Definition at line 44 of file DAFFTransformerIR2DFT.cpp.

void DAFFContentDFTRealization::transformAnglesD2O ( float  fAlphaDeg,
float  fBetaDeg,
float &  fAzimuthDeg,
float &  fElevationDeg 
) const
inlinevirtual

Transforms data spherical coordinates into object spherical coordinates.

This methods takes an angular pair (alpha, beta) in data spherical coordinates (DSC) and transforms it into the equivalent direction expressed in object spherical coordinates (OSC) as an angular pair (azimuth, elevation).

Parameters
[in]fAlphaDegAlpha angle in the DSC [degrees] (input)
[in]fBetaDegBeta angle in the DSC [degrees] (input)
[out]fAzimuthDegAzimuthal angle in the OSC [degrees] (output)
[out]fElevationDegElevation angle in the OSC [degrees] (output)

Implements DAFFContent.

Definition at line 101 of file DAFFTransformerIR2DFT.cpp.

void DAFFContentDFTRealization::transformAnglesO2D ( float  fAzimuthDeg,
float  fElevationDeg,
float &  fAlphaDeg,
float &  fBetaDeg 
) const
inlinevirtual

Transforms object spherical coordinates into data spherical coordinates.

This methods takes an angular pair (alpha, beta) in object spherical coordinates (OSC) and transforms it into the equivalent direction expressed in data spherical coordinates (DSC) as an angular pair (azimuth, elevation).

Parameters
[in]fAzimuthDegAzimuthal angle in the OSC [degrees] (input)
[in]fElevationDegElevation angle in the OSC [degrees] (input)
[out]fAlphaDegAlpha angle in the DSC [degrees] (output)
[out]fBetaDegBeta angle in the DSC [degrees] (output)

Implements DAFFContent.

Definition at line 108 of file DAFFTransformerIR2DFT.cpp.


The documentation for this class was generated from the following file:
OpenDAFF is a project from the Institute of Technical Acoustics, RWTH Aachen University, Germany.