Skip to content

Commit 71484cc

Browse files
removed framesize worth of latency from beamformer rotator and ambienc examples
1 parent e872256 commit 71484cc

File tree

9 files changed

+13
-23
lines changed

9 files changed

+13
-23
lines changed

ChangeLog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
Major and/or breaking changes to the Spatial_Audio_Framework are listed here.
99
For descriptions of minor changes and bug fixes, please refer to the git log.
1010

11+
====================================================================================================
12+
v1.3.3
13+
- Removed a FRAME_SIZE worth of latency from the rotator, ambi_enc and beamformer examples
14+
- The Xcode test project now uses Apple Accelerate as the default performance lib
15+
1116
====================================================================================================
1217
v1.3.2 (2nd February 2024)
1318
- Reverted a change made to the getBinDecoder_MAGLS() function in the previous release

examples/src/ambi_enc/ambi_enc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ void ambi_enc_init
8080
pData->interpolator_fadeOut[i-1] = 1.0f - pData->interpolator_fadeIn[i-1];
8181
}
8282
memset(pData->prev_Y, 0, MAX_NUM_SH_SIGNALS*MAX_NUM_INPUTS*sizeof(float));
83-
memset(pData->prev_inputFrameTD, 0, MAX_NUM_INPUTS*AMBI_ENC_FRAME_SIZE*sizeof(float));
8483
for(i=0; i<MAX_NUM_INPUTS; i++)
8584
pData->recalc_SH_FLAG[i] = 1;
8685
}
@@ -141,14 +140,14 @@ void ambi_enc_process
141140
/* spatially encode the input signals into spherical harmonic signals */
142141
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nSH, AMBI_ENC_FRAME_SIZE, nSources, 1.0f,
143142
(float*)pData->Y, MAX_NUM_INPUTS,
144-
(float*)pData->prev_inputFrameTD, AMBI_ENC_FRAME_SIZE, 0.0f,
143+
(float*)pData->inputFrameTD, AMBI_ENC_FRAME_SIZE, 0.0f,
145144
(float*)pData->outputFrameTD, AMBI_ENC_FRAME_SIZE);
146145

147146
/* Fade between (linearly inerpolate) the new gains and the previous gains (only if the new gains are different) */
148147
if(mixWithPreviousFLAG){
149148
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nSH, AMBI_ENC_FRAME_SIZE, nSources, 1.0f,
150149
(float*)pData->prev_Y, MAX_NUM_INPUTS,
151-
(float*)pData->prev_inputFrameTD, AMBI_ENC_FRAME_SIZE, 0.0f,
150+
(float*)pData->inputFrameTD, AMBI_ENC_FRAME_SIZE, 0.0f,
152151
(float*)pData->tempFrame, AMBI_ENC_FRAME_SIZE);
153152

154153
/* Apply the linear interpolation */
@@ -163,9 +162,6 @@ void ambi_enc_process
163162
utility_svvcopy((const float*)pData->Y, MAX_NUM_INPUTS*MAX_NUM_SH_SIGNALS, (float*)pData->prev_Y);
164163
}
165164

166-
/* for next frame */
167-
utility_svvcopy((const float*)pData->inputFrameTD, MAX_NUM_INPUTS*AMBI_ENC_FRAME_SIZE, (float*)pData->prev_inputFrameTD);
168-
169165
/* scale by 1/sqrt(nSources) */
170166
if(pData->enablePostScaling){
171167
scale = 1.0f/sqrtf((float)nSources);

examples/src/ambi_enc/ambi_enc_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ typedef struct _ambi_enc
5858
{
5959
/* Internal audio buffers */
6060
float inputFrameTD[MAX_NUM_INPUTS][AMBI_ENC_FRAME_SIZE]; /**< Input frame of signals */
61-
float prev_inputFrameTD[MAX_NUM_INPUTS][AMBI_ENC_FRAME_SIZE]; /**< Previous frame of signals */
6261
float tempFrame_fadeOut[MAX_NUM_SH_SIGNALS][AMBI_ENC_FRAME_SIZE]; /**< Temporary frame with linear interpolation (fade-out) applied */
6362
float tempFrame[MAX_NUM_SH_SIGNALS][AMBI_ENC_FRAME_SIZE]; /**< Temporary frame */
6463
float outputFrameTD_fadeIn[MAX_NUM_SH_SIGNALS][AMBI_ENC_FRAME_SIZE]; /**< Output frame of SH signals with linear interpolation (fade-in) applied */

examples/src/beamformer/beamformer.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ void beamformer_init
8282

8383
/* defaults */
8484
memset(pData->beamWeights, 0, MAX_NUM_BEAMS*MAX_NUM_SH_SIGNALS*sizeof(float));
85-
memset(pData->prev_SHFrameTD, 0, MAX_NUM_SH_SIGNALS*BEAMFORMER_FRAME_SIZE*sizeof(float));
8685
memset(pData->prev_beamWeights, 0, MAX_NUM_BEAMS*MAX_NUM_SH_SIGNALS*sizeof(float));
8786
for(ch=0; ch<MAX_NUM_BEAMS; ch++)
8887
pData->recalc_beamWeights[ch] = 1;
@@ -157,14 +156,14 @@ void beamformer_process
157156
/* Apply beam weights */
158157
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nBeams, BEAMFORMER_FRAME_SIZE, nSH, 1.0f,
159158
(const float*)pData->beamWeights, MAX_NUM_SH_SIGNALS,
160-
(const float*)pData->prev_SHFrameTD, BEAMFORMER_FRAME_SIZE, 0.0f,
159+
(const float*)pData->SHFrameTD, BEAMFORMER_FRAME_SIZE, 0.0f,
161160
(float*)pData->outputFrameTD, BEAMFORMER_FRAME_SIZE);
162161

163162
/* Fade between (linearly inerpolate) the new weights and the previous weights (only if the new weights are different) */
164163
if(mixWithPreviousFLAG){
165164
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nBeams, BEAMFORMER_FRAME_SIZE, nSH, 1.0f,
166165
(float*)pData->prev_beamWeights, MAX_NUM_SH_SIGNALS,
167-
(float*)pData->prev_SHFrameTD, BEAMFORMER_FRAME_SIZE, 0.0f,
166+
(float*)pData->SHFrameTD, BEAMFORMER_FRAME_SIZE, 0.0f,
168167
(float*)pData->tempFrame, BEAMFORMER_FRAME_SIZE);
169168

170169
/* Apply the linear interpolation */
@@ -178,9 +177,6 @@ void beamformer_process
178177
/* for next frame */
179178
utility_svvcopy((const float*)pData->beamWeights, MAX_NUM_BEAMS*MAX_NUM_SH_SIGNALS, (float*)pData->prev_beamWeights);
180179
}
181-
182-
/* for next frame */
183-
utility_svvcopy((const float*)pData->SHFrameTD, MAX_NUM_SH_SIGNALS*BEAMFORMER_FRAME_SIZE, (float*)pData->prev_SHFrameTD);
184180

185181
/* copy to output buffer */
186182
for(ch = 0; ch < SAF_MIN(nBeams, nOutputs); ch++)

examples/src/beamformer/beamformer_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ typedef struct _beamformer
6060
{
6161
/* Internal audio buffers */
6262
float SHFrameTD[MAX_NUM_SH_SIGNALS][BEAMFORMER_FRAME_SIZE]; /**< Input frame of SH signals */
63-
float prev_SHFrameTD[MAX_NUM_SH_SIGNALS][BEAMFORMER_FRAME_SIZE]; /**< Previous frame of SH signals */
6463
float tempFrame[MAX_NUM_BEAMS][BEAMFORMER_FRAME_SIZE]; /**< Temporary frame */
6564
float tempFrame_fadeOut[MAX_NUM_SH_SIGNALS][BEAMFORMER_FRAME_SIZE]; /**< Temporary frame with linear interpolation (fade-out) applied */
6665
float outputFrameTD[MAX_NUM_BEAMS][BEAMFORMER_FRAME_SIZE]; /**< Output frame of beam signals */

examples/src/rotator/rotator.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ void rotator_init
9494
}
9595
memset(pData->M_rot, 0, MAX_NUM_SH_SIGNALS*MAX_NUM_SH_SIGNALS*sizeof(float));
9696
memset(pData->prev_M_rot, 0, MAX_NUM_SH_SIGNALS*MAX_NUM_SH_SIGNALS*sizeof(float));
97-
memset(pData->prev_inputFrameTD, 0, MAX_NUM_SH_SIGNALS*ROTATOR_FRAME_SIZE*sizeof(float));
9897
pData->M_rot_status = M_ROT_RECOMPUTE_EULER;//M_ROT_RECOMPUTE_QUATERNION;
9998
}
10099

@@ -159,14 +158,14 @@ void rotator_process
159158
/* apply rotation */
160159
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nSH, ROTATOR_FRAME_SIZE, nSH, 1.0f,
161160
(float*)(pData->M_rot), MAX_NUM_SH_SIGNALS,
162-
(float*)pData->prev_inputFrameTD, ROTATOR_FRAME_SIZE, 0.0f,
161+
(float*)pData->inputFrameTD, ROTATOR_FRAME_SIZE, 0.0f,
163162
(float*)pData->outputFrameTD, ROTATOR_FRAME_SIZE);
164163

165164
/* Fade between (linearly inerpolate) the new rotation matrix and the previous rotation matrix (only if the new rotation matrix is different) */
166165
if(mixWithPreviousFLAG){
167166
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nSH, ROTATOR_FRAME_SIZE, nSH, 1.0f,
168167
(float*)pData->prev_M_rot, MAX_NUM_SH_SIGNALS,
169-
(float*)pData->prev_inputFrameTD, ROTATOR_FRAME_SIZE, 0.0f,
168+
(float*)pData->inputFrameTD, ROTATOR_FRAME_SIZE, 0.0f,
170169
(float*)pData->tempFrame, ROTATOR_FRAME_SIZE);
171170

172171
/* Apply the linear interpolation */
@@ -180,9 +179,6 @@ void rotator_process
180179
/* for next frame */
181180
utility_svvcopy((const float*)pData->M_rot, MAX_NUM_SH_SIGNALS*MAX_NUM_SH_SIGNALS, (float*)pData->prev_M_rot);
182181
}
183-
184-
/* for next frame */
185-
utility_svvcopy((const float*)pData->inputFrameTD, MAX_NUM_SH_SIGNALS*ROTATOR_FRAME_SIZE, (float*)pData->prev_inputFrameTD);
186182
}
187183
else /* Pass-through the omni (cannot be rotated...) */
188184
utility_svvcopy((const float*)pData->inputFrameTD[0], ROTATOR_FRAME_SIZE, (float*)pData->outputFrameTD[0]);

examples/src/rotator/rotator_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ typedef struct _rotator
7070
{
7171
/* Internal buffers */
7272
float inputFrameTD[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE]; /**< Input frame of signals */
73-
float prev_inputFrameTD[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE]; /**< Previous frame of signals */
7473
float tempFrame[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE]; /**< Temporary frame */
7574
float tempFrame_fadeOut[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE]; /**< Temporary frame with linear interpolation (fade-out) applied */
7675
float outputFrameTD[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE]; /**< Output frame of SH signals */

framework/include/saf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
#define SAF_VERSION_MAJOR 1 /**< Major version */
9595
#define SAF_VERSION_MINOR 3 /**< Minor version */
96-
#define SAF_VERSION_PATCH 2 /**< Patch version */
96+
#define SAF_VERSION_PATCH 3 /**< Patch version */
9797
#define SAF_VERSION_SPECIAL "" /**< Append text ("alpha", "beta", "") */
9898
#define MKSTRING_(s) #s /**< Stringify */
9999
#define MKSTRING(s) MKSTRING_(s) /**< Stringify */

framework/modules/saf_utilities/saf_utility_loudspeaker_presets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22084,7 +22084,7 @@ const float __Tdesign_degree_100_dirs_deg[5100][2] =
2208422084
{ 124.357880979874f, -18.3503649952846f},
2208522085
{ 141.956042666620f, 51.2854250417478f},
2208622086
{ -19.6080400447921f, 0.590889931370865f},
22087-
{ 147.304059964494f, -15.7984645909217}};
22087+
{ 147.304059964494f, -15.7984645909217f}};
2208822088

2208922089
/* Minimum T-design of degree 124 (7812 points) */
2209022090
const int __Tdesign_degree_124_nPoints = 7812;

0 commit comments

Comments
 (0)