Skip to content

Commit b92e6d5

Browse files
enabled SAF_USE_INTERLEAVED_VDSP now that macos minimum target is 12.0
1 parent ce96b20 commit b92e6d5

8 files changed

Lines changed: 30 additions & 20 deletions

File tree

examples/src/dirass/dirass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void dirass_create
5555
pData->pmapAvgCoeff = 0.2f;
5656
pData->minFreq_hz = 100.0f;
5757
pData->maxFreq_hz = 8e3f;
58-
pData->dispWidth = 120;
58+
pData->dispWidth = 200;
5959
pData->chOrdering = CH_ACN;
6060
pData->norm = NORM_SN3D;
6161
pData->HFOVoption = HFOV_360;

examples/src/matrixconv/matrixconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void matrixconv_create
3535

3636
/* Default user parameters */
3737
pData->nInputChannels = 1;
38-
pData->enablePartitionedConv = 0;
38+
pData->enablePartitionedConv = 1;
3939

4040
/* internal values */
4141
pData->hostBlockSize = -1; /* force initialisation */

examples/src/multiconv/multiconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void multiconv_create
3535

3636
/* Default user parameters */
3737
pData->nChannels = 1;
38-
pData->enablePartitionedConv = 0;
38+
pData->enablePartitionedConv = 1;
3939

4040
/* internal values */
4141
pData->hostBlockSize = -1; /* force initialisation */

examples/src/powermap/powermap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void powermap_create
7777
strcpy(pData->progressBarText,"");
7878
pData->codecStatus = CODEC_STATUS_NOT_INITIALISED;
7979
pData->procStatus = PROC_STATUS_NOT_ONGOING;
80-
pData->dispWidth = 140;
80+
pData->dispWidth = 200;
8181

8282
/* display */
8383
pData->pmap = NULL;

framework/modules/saf_utilities/saf_utility_fft.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#if defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
4141
# include "AvailabilityVersions.h"
4242
# ifdef __MAC_12_0
43-
//# define SAF_USE_INTERLEAVED_VDSP /**< New interleaved implementation as of macOS 12.0+. UNFINISHED+UNTESTED! */
43+
# define SAF_USE_INTERLEAVED_VDSP /**< New interleaved implementation as of macOS 12.0+ */
4444
# endif
4545
#endif
4646

@@ -81,6 +81,7 @@ typedef struct _saf_rfft_data {
8181
# ifdef SAF_USE_INTERLEAVED_VDSP
8282
vDSP_DFT_Interleaved_Setup DFT_fwd;
8383
vDSP_DFT_Interleaved_Setup DFT_bwd;
84+
float* tempBuffer;
8485
# else
8586
vDSP_DFT_Setup DFT_fwd;
8687
vDSP_DFT_Setup DFT_bwd;
@@ -572,8 +573,8 @@ void saf_rfft_create
572573
ippFree(h->memInit);
573574
#elif defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
574575
# ifdef SAF_USE_INTERLEAVED_VDSP
575-
h->DFT_fwd = vDSP_DFT_Interleaved_CreateSetup(0, N, vDSP_DFT_FORWARD, vDSP_DFT_Interleaved_RealtoComplex);
576-
h->DFT_bwd = vDSP_DFT_Interleaved_CreateSetup(0, N, vDSP_DFT_INVERSE, vDSP_DFT_Interleaved_RealtoComplex);
576+
h->DFT_fwd = vDSP_DFT_Interleaved_CreateSetup(0, N/2, vDSP_DFT_FORWARD, vDSP_DFT_Interleaved_RealtoComplex);
577+
h->DFT_bwd = vDSP_DFT_Interleaved_CreateSetup(0, N/2, vDSP_DFT_INVERSE, vDSP_DFT_Interleaved_RealtoComplex);
577578
# else
578579
h->DFT_fwd = vDSP_DFT_zrop_CreateSetup(0, N, vDSP_DFT_FORWARD);
579580
h->DFT_bwd = vDSP_DFT_zrop_CreateSetup(0, N, vDSP_DFT_INVERSE);
@@ -583,7 +584,9 @@ void saf_rfft_create
583584
else{
584585
/* Note that DFT lengths must satisfy: f * 2.^g, where f is 1, 3, 5, or 15, and g >=4 */
585586
saf_assert(h->DFT_fwd!=0 && h->DFT_bwd!=0, "Failed to create vDSP DFT");
586-
# ifndef SAF_USE_INTERLEAVED_VDSP
587+
# ifdef SAF_USE_INTERLEAVED_VDSP
588+
h->tempBuffer = malloc1d(2*(h->N/2+1)*sizeof(float));
589+
# else
587590
h->VDSP_split_tmp.realp = malloc1d((h->N/2)*sizeof(float));
588591
h->VDSP_split_tmp.imagp = malloc1d((h->N/2)*sizeof(float));
589592
h->VDSP_split.realp = malloc1d((h->N/2)*sizeof(float));
@@ -643,6 +646,7 @@ void saf_rfft_destroy
643646
# ifdef SAF_USE_INTERLEAVED_VDSP
644647
vDSP_DFT_Interleaved_DestroySetup(h->DFT_fwd);
645648
vDSP_DFT_Interleaved_DestroySetup(h->DFT_bwd);
649+
free(h->tempBuffer);
646650
# else
647651
vDSP_DFT_DestroySetup(h->DFT_fwd);
648652
vDSP_DFT_DestroySetup(h->DFT_bwd);
@@ -687,7 +691,9 @@ void saf_rfft_forward
687691
#elif defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
688692
if(!h->useKissFFT_FLAG){
689693
# ifdef SAF_USE_INTERLEAVED_VDSP
690-
saf_print_error("Not implemented yet");
694+
vDSP_DFT_Interleaved_Execute(h->DFT_fwd, (DSPComplex*)inputTD, (DSPComplex*)outputFD);
695+
outputFD[h->N/2] = cmplxf(((float*)(&outputFD[0]))[1], 0.0f);
696+
outputFD[0] = cmplxf(((float*)(&outputFD[0]))[0], 0.0f);
691697
# else
692698
vDSP_ctoz((DSPComplex*)inputTD, 2, &(h->VDSP_split_tmp), 1, (h->N)/2);
693699
vDSP_DFT_Execute(h->DFT_fwd, h->VDSP_split_tmp.realp, h->VDSP_split_tmp.imagp, h->VDSP_split.realp, h->VDSP_split.imagp);
@@ -733,16 +739,19 @@ void saf_rfft_backward
733739
#elif defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
734740
if(!h->useKissFFT_FLAG){
735741
# ifdef SAF_USE_INTERLEAVED_VDSP
736-
saf_print_error("Not implemented yet");
742+
memcpy(h->tempBuffer, inputFD, (h->N/2+1)*sizeof(float_complex));
743+
h->tempBuffer[1/*imag*/] = crealf(inputFD[h->N/2]);
744+
vDSP_DFT_Interleaved_Execute(h->DFT_bwd, (DSPComplex*)h->tempBuffer, (DSPComplex*)outputTD);
737745
# else
738746
h->VDSP_split_tmp.realp[0] = crealf(inputFD[0]);
739747
h->VDSP_split_tmp.imagp[0] = crealf(inputFD[h->N/2]);
740748
cblas_scopy(h->N/2-1, &((float*)(inputFD))[2], 2, &h->VDSP_split_tmp.realp[1], 1);
741749
cblas_scopy(h->N/2-1, &((float*)(inputFD))[3], 2, &h->VDSP_split_tmp.imagp[1], 1);
742750
vDSP_DFT_Execute(h->DFT_bwd, h->VDSP_split_tmp.realp, h->VDSP_split_tmp.imagp, h->VDSP_split.realp, h->VDSP_split.imagp);
743751
vDSP_ztoc(&(h->VDSP_split), 1, (DSPComplex*)outputTD, 2, (h->N)/2);
744-
vDSP_vsmul(outputTD, 1, &(h->Scale), outputTD, 1, h->N);
752+
745753
# endif
754+
vDSP_vsmul(outputTD, 1, &(h->Scale), outputTD, 1, h->N);
746755
}
747756
#elif defined(SAF_USE_INTEL_MKL_LP64) || defined(SAF_USE_INTEL_MKL_ILP64)
748757
h->Status = DftiComputeBackward(h->MKL_FFT_Handle, inputFD, outputTD);
@@ -802,8 +811,8 @@ void saf_fft_create
802811
ippFree(h->memInit);
803812
#elif defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
804813
# ifdef SAF_USE_INTERLEAVED_VDSP
805-
h->DFT_fwd = vDSP_DFT_Interleaved_CreateSetup(0, N, vDSP_DFT_FORWARD, vDSP_DFT_Interleaved_RealtoComplex);
806-
h->DFT_bwd = vDSP_DFT_Interleaved_CreateSetup(0, N, vDSP_DFT_INVERSE, vDSP_DFT_Interleaved_RealtoComplex);
814+
h->DFT_fwd = vDSP_DFT_Interleaved_CreateSetup(0, N, vDSP_DFT_FORWARD, vDSP_DFT_Interleaved_ComplextoComplex);
815+
h->DFT_bwd = vDSP_DFT_Interleaved_CreateSetup(0, N, vDSP_DFT_INVERSE, vDSP_DFT_Interleaved_ComplextoComplex);
807816
# else
808817
h->DFT_fwd = vDSP_DFT_zop_CreateSetup(0, N, vDSP_DFT_FORWARD);
809818
h->DFT_bwd = vDSP_DFT_zop_CreateSetup(0, N, vDSP_DFT_INVERSE);
@@ -915,7 +924,7 @@ void saf_fft_forward
915924
#elif defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
916925
if(!h->useKissFFT_FLAG){
917926
# ifdef SAF_USE_INTERLEAVED_VDSP
918-
saf_print_error("Not implemented yet");
927+
vDSP_DFT_Interleaved_Execute(h->DFT_fwd, (DSPComplex*)inputTD, (DSPComplex*)outputFD);
919928
# else
920929
cblas_scopy(h->N, &((float*)(inputTD))[0], 2, h->VDSP_split_tmp.realp, 1);
921930
cblas_scopy(h->N, &((float*)(inputTD))[1], 2, h->VDSP_split_tmp.imagp, 1);
@@ -953,15 +962,15 @@ void saf_fft_backward
953962
#elif defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
954963
if(!h->useKissFFT_FLAG){
955964
# ifdef SAF_USE_INTERLEAVED_VDSP
956-
saf_print_error("Not implemented yet");
965+
vDSP_DFT_Interleaved_Execute(h->DFT_bwd, (DSPComplex*)inputFD, (DSPComplex*)outputTD);
957966
# else
958967
cblas_scopy(h->N, &((float*)(inputFD))[0], 2, h->VDSP_split_tmp.realp, 1);
959968
cblas_scopy(h->N, &((float*)(inputFD))[1], 2, h->VDSP_split_tmp.imagp, 1);
960969
vDSP_DFT_Execute(h->DFT_bwd, h->VDSP_split_tmp.realp, h->VDSP_split_tmp.imagp, h->VDSP_split.realp, h->VDSP_split.imagp);
961970
cblas_scopy(h->N, h->VDSP_split.realp, 1, &((float*)(outputTD))[0], 2);
962971
cblas_scopy(h->N, h->VDSP_split.imagp, 1, &((float*)(outputTD))[1], 2);
963-
cblas_sscal(/*re+im*/2*(h->N), 1.0f/(float)(h->N), (float*)outputTD, 1);
964972
# endif
973+
cblas_sscal(/*re+im*/2*(h->N), 1.0f/(float)(h->N), (float*)outputTD, 1);
965974
}
966975
#elif defined(SAF_USE_INTEL_MKL_LP64) || defined(SAF_USE_INTEL_MKL_ILP64)
967976
h->Status = DftiComputeBackward(h->MKL_FFT_Handle, inputFD, outputTD);

framework/modules/saf_utilities/saf_utility_matrixConv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,11 @@ void saf_TVConv_destroy
568568
free(h->Hpart_f[np][no]);
569569
}
570570
free(h->Hpart_f);
571-
}
571+
572572
free(h);
573573
h = NULL;
574574
*phTVC = NULL;
575+
}
575576
}
576577

577578
void saf_TVConv_apply

framework/modules/saf_utilities/saf_utility_veclib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ void utility_cvvmul
11371137
/* The operation: */
11381138
#if defined(SAF_USE_INTEL_IPP)
11391139
ippsMul_32fc((Ipp32fc*)a, (Ipp32fc*)b, (Ipp32fc*)c, len);
1140-
#elif defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)
1140+
#elif (defined(SAF_USE_APPLE_ACCELERATE_LP64) || defined(SAF_USE_APPLE_ACCELERATE_ILP64)) && 0
11411141
/* Imaginary part of the output */
11421142
vDSP_vmul((float*)a/*real*/, 2, (float*)b+1/*imag*/, 2, (float*)c+1/*imag*/, 2, (vDSP_Length)len);
11431143
vDSP_vma((float*)a+1/*imag*/, 2, (float*)b/*real*/, 2, (float*)c+1/*imag*/, 2, (float*)c/*real*/, 2, (vDSP_Length)len); /* Use the real part of c as a temporary buffer */

test/test.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@
12361236
./include/,
12371237
);
12381238
INSTALL_PATH = bin/;
1239-
MACOSX_DEPLOYMENT_TARGET = 11.5;
1239+
MACOSX_DEPLOYMENT_TARGET = 12.4;
12401240
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
12411241
MTL_FAST_MATH = YES;
12421242
ONLY_ACTIVE_ARCH = YES;
@@ -1302,7 +1302,7 @@
13021302
./include/,
13031303
);
13041304
INSTALL_PATH = bin/;
1305-
MACOSX_DEPLOYMENT_TARGET = 11.5;
1305+
MACOSX_DEPLOYMENT_TARGET = 12.4;
13061306
MTL_ENABLE_DEBUG_INFO = NO;
13071307
MTL_FAST_MATH = YES;
13081308
OTHER_CFLAGS = "";

0 commit comments

Comments
 (0)