cfg->soundspeed->mu = parameters_lookup_float(fileConfig, "general.speedofsound.mu");
cfg->soundspeed->sigma2 = parameters_lookup_float(fileConfig, "general.speedofsound.sigma2");
+ // +----------------------------------------------------------+
+ // | Interpolation |
+ // +----------------------------------------------------------+
+
+ cfg->interpRate = parameters_lookup_int(fileConfig, "ssl.interpRate");
+
// +----------------------------------------------------------+
// | Epsilon |
// +----------------------------------------------------------+
#include "delay.h"
- tdoas_obj * delay_tdoas(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize) {
+ tdoas_obj * delay_tdoas(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize, const unsigned int interpRate) {
tdoas_obj * obj;
for (iPair = 0; iPair < nPairs; iPair++) {
- obj->min[iPair] = frameSize - 1;
+ obj->min[iPair] = frameSize * interpRate - 1;
obj->max[iPair] = 0;
}
dist += (mics->mu[iChannel1*3+1] - mics->mu[iChannel2*3+1]) * points->array[iPoint*3+1];
dist += (mics->mu[iChannel1*3+2] - mics->mu[iChannel2*3+2]) * points->array[iPoint*3+2];
- tau = -1.0f * (((float) fS) / soundspeed->mu) * dist;
+ tau = -1.0f * (((float) fS * interpRate) / soundspeed->mu) * dist;
- tdoa = (unsigned int) (roundf(tau)+(float) (frameSize/2));
+ tdoa = (unsigned int) (roundf(tau)+(float) (interpRate * frameSize/2));
obj->array[iPoint*nPairs+iPair] = tdoa;
if (tdoa < obj->min[iPair]) {
}
- taus_obj * delay_taus(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize) {
+ taus_obj * delay_taus(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize, const unsigned int interpRate) {
taus_obj * obj;
obj = taus_construct_zero(points->nPoints, nPairs);
- mu_t = -1.0f * ((float) fS) / soundspeed->mu;
- sigma2_t = ((float) fS) * soundspeed->sigma2 / (soundspeed->mu * soundspeed->mu);
+ mu_t = -1.0f * ((float) fS * interpRate) / soundspeed->mu;
+ sigma2_t = ((float) fS * interpRate) * soundspeed->sigma2 / (soundspeed->mu * soundspeed->mu);
iPair = 0;
mu_tau = mu_t * mu_d;
sigma2_tau = mu_t*mu_t*sigma2_d + mu_d*mu_d*sigma2_t;
- obj->mu[iPoint*nPairs+iPair] = mu_tau + (float) (frameSize/2);
+ obj->mu[iPoint*nPairs+iPair] = mu_tau + (float) (interpRate*frameSize/2);
obj->sigma2[iPoint*nPairs+iPair] = sigma2_tau;
}
#include "../signal/tdoa.h"
#include "../signal/tau.h"
- tdoas_obj * delay_tdoas(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize);
+ tdoas_obj * delay_tdoas(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize, const unsigned int interpRate);
//tdoas_obj * delay_tdoas_minmax(const tdoas_obj * tdoas, const deltas_obj * deltas);
//void delay_tdoas_allminmax(tdoas_obj * tdoas, const tdoas_obj * minmax);
- taus_obj * delay_taus(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize);
+ taus_obj * delay_taus(const points_obj * points, const mics_obj * mics, const soundspeed_obj * soundspeed, const unsigned int fS, const unsigned int frameSize, const unsigned int interpRate);
#endif
#include "scanning.h"
- scans_obj * scanning_init_scans(const mics_obj * mics, const spatialfilter_obj * spatialfilter, const unsigned int nLevels, const unsigned int * levels, const unsigned int fS, const soundspeed_obj * soundspeed, const unsigned int nMatches, const unsigned int frameSize, const signed int * deltas, const float probMin, const unsigned int nRefineLevels, const unsigned int nThetas, const float gainMin) {
+ scans_obj * scanning_init_scans(const mics_obj * mics, const spatialfilter_obj * spatialfilter, const unsigned int nLevels, const unsigned int * levels, const unsigned int fS, const soundspeed_obj * soundspeed, const unsigned int nMatches, const unsigned int frameSize, const signed int * deltas, const float probMin, const unsigned int nRefineLevels, const unsigned int nThetas, const float gainMin, const unsigned int interpRate) {
scans_obj * obj;
unsigned int iLevel;
mics,
soundspeed,
fS,
- frameSize);
+ frameSize,
+ interpRate);
// Generate gains in space
spatialgains = directivity_spatialgains(mics,
mics,
soundspeed,
fS,
- frameSize);
+ frameSize,
+ interpRate);
obj->deltas[iLevel] = hit_train(taus,
obj->tdoas[iLevel],
#include "../init/linking.h"
#include "../init/space.h"
- scans_obj * scanning_init_scans(const mics_obj * mics, const spatialfilter_obj * spatialfilter, const unsigned int nLevels, const unsigned int * levels, const unsigned int fS, const soundspeed_obj * soundspeed, const unsigned int nMatches, const unsigned int frameSize, const signed int * deltas, const float probMin, const unsigned int nRefineLevels, const unsigned int nThetas, const float gainMin);
+ scans_obj * scanning_init_scans(const mics_obj * mics, const spatialfilter_obj * spatialfilter, const unsigned int nLevels, const unsigned int * levels, const unsigned int fS, const soundspeed_obj * soundspeed, const unsigned int nMatches, const unsigned int frameSize, const signed int * deltas, const float probMin, const unsigned int nRefineLevels, const unsigned int nThetas, const float gainMin, const unsigned int interpRate);
#endif
\ No newline at end of file
obj->framesAnalysis = frames_construct_zero(obj->nChannels, obj->frameSize);
obj->frame2freq = frame2freq_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->freqsAnalysis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
- obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, obj-> lowPassCut, 0.0f, 0.0f, 0.0f, 0.0f);
+ obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, 0, obj->lowPassCut, 0.0f, 0.0f, 0.0f, 0.0f);
obj->freqsSynthesis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
obj->freq2frame = freq2frame_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->framesSynthesis = frames_construct_zero(obj->nChannels, obj->frameSize);
obj->framesAnalysis = frames_construct_zero(obj->nChannels, obj->frameSize);
obj->frame2freq = frame2freq_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->freqsAnalysis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
- obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, obj-> lowPassCut, 0.0f, 0.0f, 0.0f, 0.0f);
+ obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, 0, obj-> lowPassCut, 0.0f, 0.0f, 0.0f, 0.0f);
obj->freqsSynthesis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
obj->freq2frame = freq2frame_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->framesSynthesis = frames_construct_zero(obj->nChannels, obj->frameSize);
- #include "mod_ssl.h"
+ #include "mod_ssl.h"
// +----------------------------------------------------------+
// | Object - Constructor |
obj->nLevels = mod_ssl_config->nLevels;
obj->frameSize = 2 * (msg_spectra_config->halfFrameSize - 1);
obj->halfFrameSize = msg_spectra_config->halfFrameSize;
+ obj->frameSizeInterp = obj->frameSize * mod_ssl_config->interpRate;
+ obj->halfFrameSizeInterp = (obj->halfFrameSize - 1) * mod_ssl_config->interpRate + 1;
+ obj->interpRate = mod_ssl_config->interpRate;
obj->scans = scanning_init_scans(mod_ssl_config->mics,
mod_ssl_config->spatialfilter,
mod_ssl_config->samplerate->mu,
mod_ssl_config->soundspeed,
mod_ssl_config->nMatches,
- 2 * (msg_spectra_config->halfFrameSize - 1),
+ obj->frameSize,
mod_ssl_config->deltas,
mod_ssl_config->probMin,
mod_ssl_config->nRefinedLevels,
mod_ssl_config->nThetas,
- mod_ssl_config->gainMin);
+ mod_ssl_config->gainMin,
+ mod_ssl_config->interpRate);
- obj->freq2freq = freq2freq_construct_zero(msg_spectra_config->halfFrameSize,
+ obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize,
+ obj->halfFrameSizeInterp,
0,
mod_ssl_config->epsilon,
0.0f,
0.0f,
- 0.0f);
+ 0.0f);
obj->phasors = freqs_construct_zero(mod_ssl_config->mics->nChannels,
msg_spectra_config->halfFrameSize);
obj->products = freqs_construct_zero(mod_ssl_config->mics->nPairs,
msg_spectra_config->halfFrameSize);
- obj->freq2xcorr = freq2xcorr_construct_zero(2 * (msg_spectra_config->halfFrameSize - 1),
- msg_spectra_config->halfFrameSize);
+ obj->productsInterp = freqs_construct_zero(mod_ssl_config->mics->nPairs,
+ obj->halfFrameSizeInterp);
+
+ obj->freq2xcorr = freq2xcorr_construct_zero(obj->frameSizeInterp,
+ obj->halfFrameSizeInterp);
obj->xcorrs = xcorrs_construct_zero(mod_ssl_config->mics->nPairs,
- 2 * (msg_spectra_config->halfFrameSize - 1));
+ obj->frameSizeInterp);
obj->xcorrsMax = xcorrs_construct_zero(mod_ssl_config->mics->nPairs,
- 2 * (msg_spectra_config->halfFrameSize - 1));
+ obj->frameSizeInterp);
obj->aimgs = (aimg_obj **) malloc(sizeof(aimg_obj *) * msg_pots_config->nPots);
}
- obj->xcorr2xcorr = xcorr2xcorr_construct_zero(2 * (msg_spectra_config->halfFrameSize - 1));
-
+ obj->xcorr2xcorr = xcorr2xcorr_construct_zero(obj->frameSizeInterp);
+
obj->xcorr2aimg = (xcorr2aimg_obj **) malloc(sizeof(xcorr2aimg_obj *) * mod_ssl_config->nLevels);
for (iLevel = 0; iLevel < mod_ssl_config->nLevels; iLevel++) {
freq2freq_destroy(obj->freq2freq);
freqs_destroy(obj->phasors);
freqs_destroy(obj->products);
+ freqs_destroy(obj->productsInterp);
freq2xcorr_destroy(obj->freq2xcorr);
xcorrs_destroy(obj->xcorrs);
xcorrs_destroy(obj->xcorrsMax);
obj->scans->pairs,
obj->products);
+ freq2freq_process_interpolate(obj->freq2freq,
+ obj->products,
+ obj->productsInterp);
+
freq2xcorr_process(obj->freq2xcorr,
- obj->products,
+ obj->productsInterp,
obj->scans->pairs,
- obj->xcorrs);
+ obj->xcorrs);
for (iPot = 0; iPot < obj->nPots; iPot++) {
obj->pots->array[iPot * 4 + 0] = obj->scans->points[obj->nLevels-1]->array[maxIndex * 3 + 0];
obj->pots->array[iPot * 4 + 1] = obj->scans->points[obj->nLevels-1]->array[maxIndex * 3 + 1];
obj->pots->array[iPot * 4 + 2] = obj->scans->points[obj->nLevels-1]->array[maxIndex * 3 + 2];
- obj->pots->array[iPot * 4 + 3] = maxValue;
+ obj->pots->array[iPot * 4 + 3] = maxValue * ((float) obj->interpRate);
}
unsigned int nLevels;
unsigned int frameSize;
unsigned int halfFrameSize;
+ unsigned int frameSizeInterp;
+ unsigned int halfFrameSizeInterp;
+ unsigned int interpRate;
scans_obj * scans;
freqs_obj * phasors;
freqs_obj * products;
+ freqs_obj * productsInterp;
xcorrs_obj * xcorrs;
xcorrs_obj * xcorrsMax;
soundspeed_obj * soundspeed;
spatialfilter_obj * spatialfilter;
+ unsigned int interpRate;
float epsilon;
unsigned int nLevels;
unsigned int * levels;
obj->freq2env = freq2env_construct_zero(obj->halfFrameSize, obj->nSeps);
obj->envs = envs_construct_zero(obj->nSeps, obj->halfFrameSize);
- obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, 0, obj->epsilon, obj->alpha, obj->beta, obj->Ginterf);
+ obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, 0, 0, obj->epsilon, obj->alpha, obj->beta, obj->Ginterf);
obj->in1 = (msg_spectra_obj *) NULL;
obj->in2 = (msg_envs_obj *) NULL;
}
freq2env_process(obj->freq2env, obj->in1->freqs, obj->envs);
- freq2freq_process_postfilter(obj->freq2freq, obj->in3->tracks, obj->in1->freqs, obj->envs, obj->in2->envs, obj->out->freqs);
+ freq2freq_process_postfilter(obj->freq2freq, obj->in3->tracks, obj->in1->freqs, obj->envs, obj->in2->envs, obj->out->freqs);
obj->out->timeStamp = obj->in1->timeStamp;
#include "freq2freq.h"
- freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int lowPassCut, const float epsilon, const float alpha, const float beta, const float Ginterf) {
+ freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int halfFrameSizeInterp, const unsigned int lowPassCut, const float epsilon, const float alpha, const float beta, const float Ginterf) {
freq2freq_obj * obj;
obj = (freq2freq_obj *) malloc(sizeof(freq2freq_obj));
obj->halfFrameSize = halfFrameSize;
+ obj->halfFrameSizeInterp = halfFrameSizeInterp;
obj->lowPassCut = lowPassCut;
obj->epsilon = epsilon;
}
+ }
+
+ void freq2freq_process_interpolate(freq2freq_obj * obj, const freqs_obj * freqs, const freqs_obj * freqsInterp) {
+
+ unsigned int iSignal;
+
+ for (iSignal = 0; iSignal < freqs->nSignals; iSignal++) {
+
+ memset(freqsInterp->array[iSignal], 0x00, sizeof(float) * 2 * obj->halfFrameSizeInterp);
+ memcpy(freqsInterp->array[iSignal], freqs->array[iSignal], sizeof(float) * 2 * obj->halfFrameSize);
+
+ }
+
}
\ No newline at end of file
#include "../signal/env.h"
#include "../signal/freq.h"
- #include "../signal/gain.h"
- #include "../signal/mask.h"
#include "../signal/pair.h"
#include "../signal/track.h"
typedef struct freq2freq_obj {
unsigned int halfFrameSize;
+ unsigned int halfFrameSizeInterp;
unsigned int lowPassCut;
float epsilon;
float alpha;
} freq2freq_obj;
- freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int lowPassCut, const float epsilon, const float alpha, const float beta, const float Ginterf);
+ freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int halfFrameSizeInterp, const unsigned int lowPassCut, const float epsilon, const float alpha, const float beta, const float Ginterf);
void freq2freq_destroy(freq2freq_obj * obj);
void freq2freq_process_postfilter(freq2freq_obj * obj, const tracks_obj * tracks, const freqs_obj * freqsSeps, const envs_obj * envsSeps, const envs_obj * envsDiffuse, freqs_obj * freqsPosts);
+ void freq2freq_process_interpolate(freq2freq_obj * obj, const freqs_obj * freqs, const freqs_obj * freqsInterp);
+
#endif
\ No newline at end of file
}
- aimg->array[iPoint] /= ((float) spatialindexes->count[iPoint]);
+ aimg->array[iPoint] /= ((float) spatialindexes->count[iPoint]);
}
+
+
}
\ No newline at end of file