SAF
Loading...
Searching...
No Matches
dirass_internal.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 Leo McCormack
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
15 */
16
37#ifndef __DIRASS_INTERNAL_H_INCLUDED__
38#define __DIRASS_INTERNAL_H_INCLUDED__
39
40#include "dirass.h" /* Include header for this example */
41#include "saf.h" /* Main include header for SAF */
42#include "saf_externals.h" /* To also include SAF dependencies (cblas etc.) */
43
44#ifdef __cplusplus
45extern "C" {
46#endif /* __cplusplus */
47
48/* ========================================================================== */
49/* Internal Parameters */
50/* ========================================================================== */
51
52#if !defined(DIRASS_FRAME_SIZE)
53# if defined(FRAME_SIZE) /* Use the global framesize if it is specified: */
54# define DIRASS_FRAME_SIZE ( FRAME_SIZE )
55# else /* Otherwise, the default framesize for this example is: */
56# define DIRASS_FRAME_SIZE ( 1024 )
57# endif
58#endif
59#define MAX_DISPLAY_SH_ORDER ( 20 )
60#define MAX_NUM_INPUT_SH_SIGNALS ( (MAX_SH_ORDER+1)*(MAX_SH_ORDER+1) )
61#define MAX_NUM_DISPLAY_SH_SIGNALS ( (MAX_DISPLAY_SH_ORDER+1)*(MAX_DISPLAY_SH_ORDER+1) )
62#define NUM_DISP_SLOTS ( 2 )
64/* ========================================================================== */
65/* Structures */
66/* ========================================================================== */
67
71typedef struct _dirass_codecPars
72{
73 /* scanning grid and intepolation table */
78 float* interp_table;
81 float* ss;
82 float* ssxyz;
85 float* prev_energy;
87 /* sector beamforming and upscaling */
88 float* Cxyz;
89 float* Cw;
90 float* Uw;
91 float* Y_up;
92 float* est_dirs;
94 /* regular beamforming */
95 float* w;
98
152
153
154/* ========================================================================== */
155/* Internal Functions */
156/* ========================================================================== */
157
159void dirass_setCodecStatus(void* const hDir, CODEC_STATUS newStatus);
160
162void dirass_initAna(void* const hDir);
163
164
165#ifdef __cplusplus
166} /* extern "C" */
167#endif /* __cplusplus */
168
169#endif /* __DIRASS_INTERNAL_H_INCLUDED__ */
STATIC_BEAM_TYPES
Available static beamforming approaches.
Definition _common.h:168
PROC_STATUS
Current status of the processing loop.
Definition _common.h:219
HFOV_OPTIONS
Available horizontal field-of-view (FOV) options.
Definition _common.h:179
NORM_TYPES
Available Ambisonic normalisation conventions.
Definition _common.h:74
CH_ORDER
Available Ambisonic channel ordering conventions.
Definition _common.h:59
CODEC_STATUS
Current status of the codec.
Definition _common.h:201
ASPECT_RATIO_OPTIONS
Available aspect ratios.
Definition _common.h:188
A sound-field visualiser based on the directional re-assignment of beamformer energy based on local D...
DIRASS_REASS_MODES
Available processing modes.
Definition dirass.h:110
DIRASS_GRID_OPTIONS
Available scanning grid options.
Definition dirass.h:86
#define MAX_NUM_DISPLAY_SH_SIGNALS
Maximum number of SH signals for the display/upscaling SH output.
#define MAX_NUM_INPUT_SH_SIGNALS
Maximum number of SH signals for the input.
void dirass_setCodecStatus(void *const hDir, CODEC_STATUS newStatus)
Sets codec status (see CODEC_STATUS enum)
void dirass_initAna(void *const hDir)
Intialises the codec variables, based on current global/user parameters.
#define DIRASS_FRAME_SIZE
Framesize, in time-domain samples.
#define NUM_DISP_SLOTS
Number of display slots.
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Contains variables for scanning grids, and sector beamforming.
float * ss
beamformer sector signals; FLAT: grid_nDirs x DIRASS_FRAME_SIZE
float * interp_table
interpolation table (spherical->rectangular grid); FLAT: interp_nDirs x grid_nDirs
float * interp_dirs_deg
interpolation directions, in degrees; FLAT: interp_nDirs x 2
float * grid_dirs_deg
scanning grid directions; FLAT: grid_nDirs x 2
float * est_dirs
estimated DoA per grid direction; grid_nDirs x 2
float * Cxyz
beamforming weights for velocity patterns; FLAT: nDirs x (order+1)^2 x 3
int interp_nTri
number of triangles in the spherical scanning grid mesh
float * prev_energy
previous energy (for averaging); FLAT: grid_nDirs x 1
int * est_dirs_idx
DoA indices, into the interpolation directions; grid_nDirs x 1.
float * prev_intensity
previous intensity vectors (for averaging); FLAT: grid_nDirs x 3
float * w
beamforming weights; FLAT: nDirs x (order+1)^2
float * Cw
beamforming weights; FLAT: nDirs x (order)^2
int grid_nDirs
number of grid directions
float * Uw
beamforming weights; FLAT: nDirs x (upscaleOrder+1)^2
int interp_nDirs
number of interpolation directions
float * interp_dirs_rad
interpolation directions, in radians; FLAT: interp_nDirs x 2
float * ssxyz
beamformer velocity signals; FLAT: 3 x DIRASS_FRAME_SIZE
float * Y_up
real SH weights for upscaling; FLAT: (upscaleOrder+1)^2 x grid_nDirs
Main structure for dirass.
float pmapAvgCoeff
averaging coefficient for the intensity vector per grid direction
DIRASS_REASS_MODES DirAssMode
see DIRASS_REASS_MODES enum
int inputOrder
Current input/analysis order.
float * pmap
grid_nDirs x 1
float fs
host sampling rate
int upscaleOrder
Current target upscale order.
STATIC_BEAM_TYPES beamType
beamformer type mode
float progressBar0_1
Current (re)initialisation progress, between [0..1].
float pmap_grid_maxVal
maximum value in pmap
int dispSlotIdx
current display slot index
int new_upscaleOrder
New target upscale order.
float pmap_grid_minVal
minimum value in pmap
int pmapReady
0: image generation not started yet, 1: image is ready for plotting
ASPECT_RATIO_OPTIONS aspectRatioOption
aspect ratio option
int new_inputOrder
New input/analysis order.
CODEC_STATUS codecStatus
see CODEC_STATUS
DIRASS_GRID_OPTIONS gridOption
grid option
float minFreq_hz
minimum frequency to include in pmap generation, Hz
int FIFO_idx
FIFO buffer index.
int dispWidth
number of interpolation points on the horizontal
PROC_STATUS procStatus
see PROC_STATUS
float maxFreq_hz
maximum frequency to include in pmap generation, Hz
int recalcPmap
set this to 1 to generate a new image
dirass_codecPars * pars
codec parameters
NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
char * progressBarText
Current (re)initialisation step, string.
CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
HFOV_OPTIONS HFOVoption
horizontal field-of-view option