You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.5KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVCODEC_FFT_INTERNAL_H
  19. #define AVCODEC_FFT_INTERNAL_H
  20. #if FFT_FLOAT
  21. #define FIX15(v) (v)
  22. #define sqrthalf (float)M_SQRT1_2
  23. #define BF(x, y, a, b) do { \
  24. x = a - b; \
  25. y = a + b; \
  26. } while (0)
  27. #define CMUL(dre, dim, are, aim, bre, bim) do { \
  28. (dre) = (are) * (bre) - (aim) * (bim); \
  29. (dim) = (are) * (bim) + (aim) * (bre); \
  30. } while (0)
  31. #else
  32. #include "fft.h"
  33. #include "mathops.h"
  34. void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input);
  35. #define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits)))
  36. #define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767)
  37. #define sqrthalf ((int16_t)((1<<15)*M_SQRT1_2))
  38. #define BF(x, y, a, b) do { \
  39. x = (a - b) >> 1; \
  40. y = (a + b) >> 1; \
  41. } while (0)
  42. #define CMULS(dre, dim, are, aim, bre, bim, sh) do { \
  43. (dre) = (MUL16(are, bre) - MUL16(aim, bim)) >> sh; \
  44. (dim) = (MUL16(are, bim) + MUL16(aim, bre)) >> sh; \
  45. } while (0)
  46. #define CMUL(dre, dim, are, aim, bre, bim) \
  47. CMULS(dre, dim, are, aim, bre, bim, 15)
  48. #define CMULL(dre, dim, are, aim, bre, bim) \
  49. CMULS(dre, dim, are, aim, bre, bim, 0)
  50. #endif /* FFT_FLOAT */
  51. #define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c)
  52. #define ff_imdct_half_c FFT_NAME(ff_imdct_half_c)
  53. #define ff_mdct_calc_c FFT_NAME(ff_mdct_calc_c)
  54. void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
  55. void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
  56. void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
  57. #endif /* AVCODEC_FFT_INTERNAL_H */