vDSP.DCT unwraps to nil

253 Views Asked by At

When I execute this line of code:

self.forwardDCTSetup = vDSP.DCT(count: 40, transformType: vDSP.DCTTransformType.II)!

I get:

Fatal error: Unexpectedly found nil while unwrapping an Optional value

I am following this tutorial almost exactly: https://developer.apple.com/documentation/accelerate/signal_extraction_from_noise.

1

There are 1 best solutions below

2
Flex Monkey On BEST ANSWER

The vDSP.DCT follows the same rules as vDSP_DCT_CreateSetup with regard to length / count:

The supported values are Length = f * 2**n, where f is 1, 3, 5, or 15 and n is at least 4. 

See: https://developer.apple.com/documentation/accelerate/1449930-vdsp_dct_createsetup