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