avfft.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVCODEC_AVFFT_H
  19. #define AVCODEC_AVFFT_H
  20. #include "libavutil/attributes.h"
  21. #include "version_major.h"
  22. #if FF_API_AVFFT
  23. /**
  24. * @file
  25. * @ingroup lavc_fft
  26. * FFT functions
  27. */
  28. /**
  29. * @defgroup lavc_fft FFT functions
  30. * @ingroup lavc_misc
  31. *
  32. * @{
  33. */
  34. typedef float FFTSample;
  35. typedef struct FFTComplex {
  36. FFTSample re, im;
  37. } FFTComplex;
  38. typedef struct FFTContext FFTContext;
  39. /**
  40. * Set up a complex FFT.
  41. * @param nbits log2 of the length of the input array
  42. * @param inverse if 0 perform the forward transform, if 1 perform the inverse
  43. * @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_FFT
  44. */
  45. attribute_deprecated
  46. FFTContext *av_fft_init(int nbits, int inverse);
  47. /**
  48. * Do the permutation needed BEFORE calling ff_fft_calc().
  49. * @deprecated without replacement
  50. */
  51. attribute_deprecated
  52. void av_fft_permute(FFTContext *s, FFTComplex *z);
  53. /**
  54. * Do a complex FFT with the parameters defined in av_fft_init(). The
  55. * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
  56. * @deprecated use the av_tx_fn value returned by av_tx_init, which also does permutation
  57. */
  58. attribute_deprecated
  59. void av_fft_calc(FFTContext *s, FFTComplex *z);
  60. attribute_deprecated
  61. void av_fft_end(FFTContext *s);
  62. /**
  63. * @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_MDCT,
  64. * with a flag of AV_TX_FULL_IMDCT for a replacement to av_imdct_calc.
  65. */
  66. attribute_deprecated
  67. FFTContext *av_mdct_init(int nbits, int inverse, double scale);
  68. attribute_deprecated
  69. void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
  70. attribute_deprecated
  71. void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
  72. attribute_deprecated
  73. void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
  74. attribute_deprecated
  75. void av_mdct_end(FFTContext *s);
  76. /* Real Discrete Fourier Transform */
  77. enum RDFTransformType {
  78. DFT_R2C,
  79. IDFT_C2R,
  80. IDFT_R2C,
  81. DFT_C2R,
  82. };
  83. typedef struct RDFTContext RDFTContext;
  84. /**
  85. * Set up a real FFT.
  86. * @param nbits log2 of the length of the input array
  87. * @param trans the type of transform
  88. *
  89. * @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_RDFT
  90. */
  91. attribute_deprecated
  92. RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
  93. attribute_deprecated
  94. void av_rdft_calc(RDFTContext *s, FFTSample *data);
  95. attribute_deprecated
  96. void av_rdft_end(RDFTContext *s);
  97. /* Discrete Cosine Transform */
  98. typedef struct DCTContext DCTContext;
  99. enum DCTTransformType {
  100. DCT_II = 0,
  101. DCT_III,
  102. DCT_I,
  103. DST_I,
  104. };
  105. /**
  106. * Set up DCT.
  107. *
  108. * @param nbits size of the input array:
  109. * (1 << nbits) for DCT-II, DCT-III and DST-I
  110. * (1 << nbits) + 1 for DCT-I
  111. * @param type the type of transform
  112. *
  113. * @note the first element of the input of DST-I is ignored
  114. *
  115. * @deprecated use av_tx_init from libavutil/tx.h with an appropriate type of AV_TX_FLOAT_DCT
  116. */
  117. attribute_deprecated
  118. DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
  119. attribute_deprecated
  120. void av_dct_calc(DCTContext *s, FFTSample *data);
  121. attribute_deprecated
  122. void av_dct_end (DCTContext *s);
  123. /**
  124. * @}
  125. */
  126. #endif /* FF_API_AVFFT */
  127. #endif /* AVCODEC_AVFFT_H */