transform_functions.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. /******************************************************************************
  2. * @file transform_functions.h
  3. * @brief Public header file for CMSIS DSP Library
  4. * @version V1.9.0
  5. * @date 20. July 2020
  6. ******************************************************************************/
  7. /*
  8. * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: Apache-2.0
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the License); you may
  13. * not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  20. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. #ifndef _TRANSFORM_FUNCTIONS_H_
  25. #define _TRANSFORM_FUNCTIONS_H_
  26. #include "arm_math_types.h"
  27. #include "arm_math_memory.h"
  28. #include "dsp/none.h"
  29. #include "dsp/utils.h"
  30. #include "dsp/basic_math_functions.h"
  31. #include "dsp/complex_math_functions.h"
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. /**
  37. * @defgroup groupTransforms Transform Functions
  38. */
  39. /**
  40. * @brief Instance structure for the Q15 CFFT/CIFFT function.
  41. */
  42. typedef struct
  43. {
  44. uint16_t fftLen; /**< length of the FFT. */
  45. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  46. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  47. const q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
  48. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  49. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  50. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  51. } arm_cfft_radix2_instance_q15;
  52. /* Deprecated */
  53. arm_status arm_cfft_radix2_init_q15(
  54. arm_cfft_radix2_instance_q15 * S,
  55. uint16_t fftLen,
  56. uint8_t ifftFlag,
  57. uint8_t bitReverseFlag);
  58. /* Deprecated */
  59. void arm_cfft_radix2_q15(
  60. const arm_cfft_radix2_instance_q15 * S,
  61. q15_t * pSrc);
  62. /**
  63. * @brief Instance structure for the Q15 CFFT/CIFFT function.
  64. */
  65. typedef struct
  66. {
  67. uint16_t fftLen; /**< length of the FFT. */
  68. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  69. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  70. const q15_t *pTwiddle; /**< points to the twiddle factor table. */
  71. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  72. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  73. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  74. } arm_cfft_radix4_instance_q15;
  75. /* Deprecated */
  76. arm_status arm_cfft_radix4_init_q15(
  77. arm_cfft_radix4_instance_q15 * S,
  78. uint16_t fftLen,
  79. uint8_t ifftFlag,
  80. uint8_t bitReverseFlag);
  81. /* Deprecated */
  82. void arm_cfft_radix4_q15(
  83. const arm_cfft_radix4_instance_q15 * S,
  84. q15_t * pSrc);
  85. /**
  86. * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
  87. */
  88. typedef struct
  89. {
  90. uint16_t fftLen; /**< length of the FFT. */
  91. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  92. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  93. const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
  94. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  95. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  96. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  97. } arm_cfft_radix2_instance_q31;
  98. /* Deprecated */
  99. arm_status arm_cfft_radix2_init_q31(
  100. arm_cfft_radix2_instance_q31 * S,
  101. uint16_t fftLen,
  102. uint8_t ifftFlag,
  103. uint8_t bitReverseFlag);
  104. /* Deprecated */
  105. void arm_cfft_radix2_q31(
  106. const arm_cfft_radix2_instance_q31 * S,
  107. q31_t * pSrc);
  108. /**
  109. * @brief Instance structure for the Q31 CFFT/CIFFT function.
  110. */
  111. typedef struct
  112. {
  113. uint16_t fftLen; /**< length of the FFT. */
  114. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  115. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  116. const q31_t *pTwiddle; /**< points to the twiddle factor table. */
  117. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  118. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  119. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  120. } arm_cfft_radix4_instance_q31;
  121. /* Deprecated */
  122. void arm_cfft_radix4_q31(
  123. const arm_cfft_radix4_instance_q31 * S,
  124. q31_t * pSrc);
  125. /* Deprecated */
  126. arm_status arm_cfft_radix4_init_q31(
  127. arm_cfft_radix4_instance_q31 * S,
  128. uint16_t fftLen,
  129. uint8_t ifftFlag,
  130. uint8_t bitReverseFlag);
  131. /**
  132. * @brief Instance structure for the floating-point CFFT/CIFFT function.
  133. */
  134. typedef struct
  135. {
  136. uint16_t fftLen; /**< length of the FFT. */
  137. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  138. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  139. const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
  140. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  141. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  142. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  143. float32_t onebyfftLen; /**< value of 1/fftLen. */
  144. } arm_cfft_radix2_instance_f32;
  145. /* Deprecated */
  146. arm_status arm_cfft_radix2_init_f32(
  147. arm_cfft_radix2_instance_f32 * S,
  148. uint16_t fftLen,
  149. uint8_t ifftFlag,
  150. uint8_t bitReverseFlag);
  151. /* Deprecated */
  152. void arm_cfft_radix2_f32(
  153. const arm_cfft_radix2_instance_f32 * S,
  154. float32_t * pSrc);
  155. /**
  156. * @brief Instance structure for the floating-point CFFT/CIFFT function.
  157. */
  158. typedef struct
  159. {
  160. uint16_t fftLen; /**< length of the FFT. */
  161. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  162. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  163. const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
  164. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  165. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  166. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  167. float32_t onebyfftLen; /**< value of 1/fftLen. */
  168. } arm_cfft_radix4_instance_f32;
  169. /* Deprecated */
  170. arm_status arm_cfft_radix4_init_f32(
  171. arm_cfft_radix4_instance_f32 * S,
  172. uint16_t fftLen,
  173. uint8_t ifftFlag,
  174. uint8_t bitReverseFlag);
  175. /* Deprecated */
  176. void arm_cfft_radix4_f32(
  177. const arm_cfft_radix4_instance_f32 * S,
  178. float32_t * pSrc);
  179. /**
  180. * @brief Instance structure for the fixed-point CFFT/CIFFT function.
  181. */
  182. typedef struct
  183. {
  184. uint16_t fftLen; /**< length of the FFT. */
  185. const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
  186. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  187. uint16_t bitRevLength; /**< bit reversal table length. */
  188. #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE)
  189. const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \
  190. const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \
  191. const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \
  192. const q15_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \
  193. const q15_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \
  194. const q15_t *rearranged_twiddle_stride3;
  195. #endif
  196. } arm_cfft_instance_q15;
  197. arm_status arm_cfft_init_q15(
  198. arm_cfft_instance_q15 * S,
  199. uint16_t fftLen);
  200. void arm_cfft_q15(
  201. const arm_cfft_instance_q15 * S,
  202. q15_t * p1,
  203. uint8_t ifftFlag,
  204. uint8_t bitReverseFlag);
  205. /**
  206. * @brief Instance structure for the fixed-point CFFT/CIFFT function.
  207. */
  208. typedef struct
  209. {
  210. uint16_t fftLen; /**< length of the FFT. */
  211. const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
  212. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  213. uint16_t bitRevLength; /**< bit reversal table length. */
  214. #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE)
  215. const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \
  216. const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \
  217. const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \
  218. const q31_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \
  219. const q31_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \
  220. const q31_t *rearranged_twiddle_stride3;
  221. #endif
  222. } arm_cfft_instance_q31;
  223. arm_status arm_cfft_init_q31(
  224. arm_cfft_instance_q31 * S,
  225. uint16_t fftLen);
  226. void arm_cfft_q31(
  227. const arm_cfft_instance_q31 * S,
  228. q31_t * p1,
  229. uint8_t ifftFlag,
  230. uint8_t bitReverseFlag);
  231. /**
  232. * @brief Instance structure for the floating-point CFFT/CIFFT function.
  233. */
  234. typedef struct
  235. {
  236. uint16_t fftLen; /**< length of the FFT. */
  237. const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
  238. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  239. uint16_t bitRevLength; /**< bit reversal table length. */
  240. #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
  241. const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \
  242. const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \
  243. const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \
  244. const float32_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \
  245. const float32_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \
  246. const float32_t *rearranged_twiddle_stride3;
  247. #endif
  248. } arm_cfft_instance_f32;
  249. arm_status arm_cfft_init_f32(
  250. arm_cfft_instance_f32 * S,
  251. uint16_t fftLen);
  252. void arm_cfft_f32(
  253. const arm_cfft_instance_f32 * S,
  254. float32_t * p1,
  255. uint8_t ifftFlag,
  256. uint8_t bitReverseFlag);
  257. /**
  258. * @brief Instance structure for the Double Precision Floating-point CFFT/CIFFT function.
  259. */
  260. typedef struct
  261. {
  262. uint16_t fftLen; /**< length of the FFT. */
  263. const float64_t *pTwiddle; /**< points to the Twiddle factor table. */
  264. const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  265. uint16_t bitRevLength; /**< bit reversal table length. */
  266. } arm_cfft_instance_f64;
  267. arm_status arm_cfft_init_f64(
  268. arm_cfft_instance_f64 * S,
  269. uint16_t fftLen);
  270. void arm_cfft_f64(
  271. const arm_cfft_instance_f64 * S,
  272. float64_t * p1,
  273. uint8_t ifftFlag,
  274. uint8_t bitReverseFlag);
  275. /**
  276. * @brief Instance structure for the Q15 RFFT/RIFFT function.
  277. */
  278. typedef struct
  279. {
  280. uint32_t fftLenReal; /**< length of the real FFT. */
  281. uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
  282. uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
  283. uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  284. const q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
  285. const q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
  286. #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE)
  287. arm_cfft_instance_q15 cfftInst;
  288. #else
  289. const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
  290. #endif
  291. } arm_rfft_instance_q15;
  292. arm_status arm_rfft_init_q15(
  293. arm_rfft_instance_q15 * S,
  294. uint32_t fftLenReal,
  295. uint32_t ifftFlagR,
  296. uint32_t bitReverseFlag);
  297. void arm_rfft_q15(
  298. const arm_rfft_instance_q15 * S,
  299. q15_t * pSrc,
  300. q15_t * pDst);
  301. /**
  302. * @brief Instance structure for the Q31 RFFT/RIFFT function.
  303. */
  304. typedef struct
  305. {
  306. uint32_t fftLenReal; /**< length of the real FFT. */
  307. uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
  308. uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
  309. uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  310. const q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
  311. const q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
  312. #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE)
  313. arm_cfft_instance_q31 cfftInst;
  314. #else
  315. const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
  316. #endif
  317. } arm_rfft_instance_q31;
  318. arm_status arm_rfft_init_q31(
  319. arm_rfft_instance_q31 * S,
  320. uint32_t fftLenReal,
  321. uint32_t ifftFlagR,
  322. uint32_t bitReverseFlag);
  323. void arm_rfft_q31(
  324. const arm_rfft_instance_q31 * S,
  325. q31_t * pSrc,
  326. q31_t * pDst);
  327. /**
  328. * @brief Instance structure for the floating-point RFFT/RIFFT function.
  329. */
  330. typedef struct
  331. {
  332. uint32_t fftLenReal; /**< length of the real FFT. */
  333. uint16_t fftLenBy2; /**< length of the complex FFT. */
  334. uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
  335. uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
  336. uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  337. const float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
  338. const float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
  339. arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
  340. } arm_rfft_instance_f32;
  341. arm_status arm_rfft_init_f32(
  342. arm_rfft_instance_f32 * S,
  343. arm_cfft_radix4_instance_f32 * S_CFFT,
  344. uint32_t fftLenReal,
  345. uint32_t ifftFlagR,
  346. uint32_t bitReverseFlag);
  347. void arm_rfft_f32(
  348. const arm_rfft_instance_f32 * S,
  349. float32_t * pSrc,
  350. float32_t * pDst);
  351. /**
  352. * @brief Instance structure for the Double Precision Floating-point RFFT/RIFFT function.
  353. */
  354. typedef struct
  355. {
  356. arm_cfft_instance_f64 Sint; /**< Internal CFFT structure. */
  357. uint16_t fftLenRFFT; /**< length of the real sequence */
  358. const float64_t * pTwiddleRFFT; /**< Twiddle factors real stage */
  359. } arm_rfft_fast_instance_f64 ;
  360. arm_status arm_rfft_fast_init_f64 (
  361. arm_rfft_fast_instance_f64 * S,
  362. uint16_t fftLen);
  363. void arm_rfft_fast_f64(
  364. arm_rfft_fast_instance_f64 * S,
  365. float64_t * p, float64_t * pOut,
  366. uint8_t ifftFlag);
  367. /**
  368. * @brief Instance structure for the floating-point RFFT/RIFFT function.
  369. */
  370. typedef struct
  371. {
  372. arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
  373. uint16_t fftLenRFFT; /**< length of the real sequence */
  374. const float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
  375. } arm_rfft_fast_instance_f32 ;
  376. arm_status arm_rfft_fast_init_f32 (
  377. arm_rfft_fast_instance_f32 * S,
  378. uint16_t fftLen);
  379. void arm_rfft_fast_f32(
  380. const arm_rfft_fast_instance_f32 * S,
  381. float32_t * p, float32_t * pOut,
  382. uint8_t ifftFlag);
  383. /**
  384. * @brief Instance structure for the floating-point DCT4/IDCT4 function.
  385. */
  386. typedef struct
  387. {
  388. uint16_t N; /**< length of the DCT4. */
  389. uint16_t Nby2; /**< half of the length of the DCT4. */
  390. float32_t normalize; /**< normalizing factor. */
  391. const float32_t *pTwiddle; /**< points to the twiddle factor table. */
  392. const float32_t *pCosFactor; /**< points to the cosFactor table. */
  393. arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
  394. arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
  395. } arm_dct4_instance_f32;
  396. /**
  397. * @brief Initialization function for the floating-point DCT4/IDCT4.
  398. * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
  399. * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
  400. * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
  401. * @param[in] N length of the DCT4.
  402. * @param[in] Nby2 half of the length of the DCT4.
  403. * @param[in] normalize normalizing factor.
  404. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.
  405. */
  406. arm_status arm_dct4_init_f32(
  407. arm_dct4_instance_f32 * S,
  408. arm_rfft_instance_f32 * S_RFFT,
  409. arm_cfft_radix4_instance_f32 * S_CFFT,
  410. uint16_t N,
  411. uint16_t Nby2,
  412. float32_t normalize);
  413. /**
  414. * @brief Processing function for the floating-point DCT4/IDCT4.
  415. * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
  416. * @param[in] pState points to state buffer.
  417. * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
  418. */
  419. void arm_dct4_f32(
  420. const arm_dct4_instance_f32 * S,
  421. float32_t * pState,
  422. float32_t * pInlineBuffer);
  423. /**
  424. * @brief Instance structure for the Q31 DCT4/IDCT4 function.
  425. */
  426. typedef struct
  427. {
  428. uint16_t N; /**< length of the DCT4. */
  429. uint16_t Nby2; /**< half of the length of the DCT4. */
  430. q31_t normalize; /**< normalizing factor. */
  431. const q31_t *pTwiddle; /**< points to the twiddle factor table. */
  432. const q31_t *pCosFactor; /**< points to the cosFactor table. */
  433. arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
  434. arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
  435. } arm_dct4_instance_q31;
  436. /**
  437. * @brief Initialization function for the Q31 DCT4/IDCT4.
  438. * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
  439. * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
  440. * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
  441. * @param[in] N length of the DCT4.
  442. * @param[in] Nby2 half of the length of the DCT4.
  443. * @param[in] normalize normalizing factor.
  444. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
  445. */
  446. arm_status arm_dct4_init_q31(
  447. arm_dct4_instance_q31 * S,
  448. arm_rfft_instance_q31 * S_RFFT,
  449. arm_cfft_radix4_instance_q31 * S_CFFT,
  450. uint16_t N,
  451. uint16_t Nby2,
  452. q31_t normalize);
  453. /**
  454. * @brief Processing function for the Q31 DCT4/IDCT4.
  455. * @param[in] S points to an instance of the Q31 DCT4 structure.
  456. * @param[in] pState points to state buffer.
  457. * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
  458. */
  459. void arm_dct4_q31(
  460. const arm_dct4_instance_q31 * S,
  461. q31_t * pState,
  462. q31_t * pInlineBuffer);
  463. /**
  464. * @brief Instance structure for the Q15 DCT4/IDCT4 function.
  465. */
  466. typedef struct
  467. {
  468. uint16_t N; /**< length of the DCT4. */
  469. uint16_t Nby2; /**< half of the length of the DCT4. */
  470. q15_t normalize; /**< normalizing factor. */
  471. const q15_t *pTwiddle; /**< points to the twiddle factor table. */
  472. const q15_t *pCosFactor; /**< points to the cosFactor table. */
  473. arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
  474. arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
  475. } arm_dct4_instance_q15;
  476. /**
  477. * @brief Initialization function for the Q15 DCT4/IDCT4.
  478. * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
  479. * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
  480. * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
  481. * @param[in] N length of the DCT4.
  482. * @param[in] Nby2 half of the length of the DCT4.
  483. * @param[in] normalize normalizing factor.
  484. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
  485. */
  486. arm_status arm_dct4_init_q15(
  487. arm_dct4_instance_q15 * S,
  488. arm_rfft_instance_q15 * S_RFFT,
  489. arm_cfft_radix4_instance_q15 * S_CFFT,
  490. uint16_t N,
  491. uint16_t Nby2,
  492. q15_t normalize);
  493. /**
  494. * @brief Processing function for the Q15 DCT4/IDCT4.
  495. * @param[in] S points to an instance of the Q15 DCT4 structure.
  496. * @param[in] pState points to state buffer.
  497. * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
  498. */
  499. void arm_dct4_q15(
  500. const arm_dct4_instance_q15 * S,
  501. q15_t * pState,
  502. q15_t * pInlineBuffer);
  503. #ifdef __cplusplus
  504. }
  505. #endif
  506. #endif /* ifndef _TRANSFORM_FUNCTIONS_H_ */