25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

119 lines
3.0 KiB

  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. /**
  21. * @file
  22. * @ingroup lavc_fft
  23. * FFT functions
  24. */
  25. /**
  26. * @defgroup lavc_fft FFT functions
  27. * @ingroup lavc_misc
  28. *
  29. * @{
  30. */
  31. typedef float FFTSample;
  32. typedef struct FFTComplex {
  33. FFTSample re, im;
  34. } FFTComplex;
  35. typedef struct FFTContext FFTContext;
  36. /**
  37. * Set up a complex FFT.
  38. * @param nbits log2 of the length of the input array
  39. * @param inverse if 0 perform the forward transform, if 1 perform the inverse
  40. */
  41. FFTContext *av_fft_init(int nbits, int inverse);
  42. /**
  43. * Do the permutation needed BEFORE calling ff_fft_calc().
  44. */
  45. void av_fft_permute(FFTContext *s, FFTComplex *z);
  46. /**
  47. * Do a complex FFT with the parameters defined in av_fft_init(). The
  48. * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
  49. */
  50. void av_fft_calc(FFTContext *s, FFTComplex *z);
  51. void av_fft_end(FFTContext *s);
  52. FFTContext *av_mdct_init(int nbits, int inverse, double scale);
  53. void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
  54. void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
  55. void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
  56. void av_mdct_end(FFTContext *s);
  57. /* Real Discrete Fourier Transform */
  58. enum RDFTransformType {
  59. DFT_R2C,
  60. IDFT_C2R,
  61. IDFT_R2C,
  62. DFT_C2R,
  63. };
  64. typedef struct RDFTContext RDFTContext;
  65. /**
  66. * Set up a real FFT.
  67. * @param nbits log2 of the length of the input array
  68. * @param trans the type of transform
  69. */
  70. RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
  71. void av_rdft_calc(RDFTContext *s, FFTSample *data);
  72. void av_rdft_end(RDFTContext *s);
  73. /* Discrete Cosine Transform */
  74. typedef struct DCTContext DCTContext;
  75. enum DCTTransformType {
  76. DCT_II = 0,
  77. DCT_III,
  78. DCT_I,
  79. DST_I,
  80. };
  81. /**
  82. * Set up DCT.
  83. *
  84. * @param nbits size of the input array:
  85. * (1 << nbits) for DCT-II, DCT-III and DST-I
  86. * (1 << nbits) + 1 for DCT-I
  87. * @param type the type of transform
  88. *
  89. * @note the first element of the input of DST-I is ignored
  90. */
  91. DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
  92. void av_dct_calc(DCTContext *s, FFTSample *data);
  93. void av_dct_end (DCTContext *s);
  94. /**
  95. * @}
  96. */
  97. #endif /* AVCODEC_AVFFT_H */