Syllabear
Syllabear

Reputation: 203

vDSP.DCT unwraps to nil

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.

Upvotes: 1

Views: 278

Answers (1)

Flex Monkey
Flex Monkey

Reputation: 3643

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

Upvotes: 2

Related Questions