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.

80 lines
3.5KB

  1. /*
  2. * audio resampling
  3. * Copyright (c) 2004-2012 Michael Niedermayer <michaelni@gmx.at>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * audio resampling
  24. * @author Michael Niedermayer <michaelni@gmx.at>
  25. */
  26. #include "libswresample/resample.h"
  27. int ff_resample_common_int16_mmxext(ResampleContext *c, uint8_t *dst,
  28. const uint8_t *src, int sz, int upd);
  29. int ff_resample_linear_int16_mmxext(ResampleContext *c, uint8_t *dst,
  30. const uint8_t *src, int sz, int upd);
  31. int ff_resample_common_int16_sse2(ResampleContext *c, uint8_t *dst,
  32. const uint8_t *src, int sz, int upd);
  33. int ff_resample_linear_int16_sse2(ResampleContext *c, uint8_t *dst,
  34. const uint8_t *src, int sz, int upd);
  35. int ff_resample_common_float_sse(ResampleContext *c, uint8_t *dst,
  36. const uint8_t *src, int sz, int upd);
  37. int ff_resample_linear_float_sse(ResampleContext *c, uint8_t *dst,
  38. const uint8_t *src, int sz, int upd);
  39. int ff_resample_common_float_avx(ResampleContext *c, uint8_t *dst,
  40. const uint8_t *src, int sz, int upd);
  41. int ff_resample_linear_float_avx(ResampleContext *c, uint8_t *dst,
  42. const uint8_t *src, int sz, int upd);
  43. int ff_resample_common_double_sse2(ResampleContext *c, uint8_t *dst,
  44. const uint8_t *src, int sz, int upd);
  45. int ff_resample_linear_double_sse2(ResampleContext *c, uint8_t *dst,
  46. const uint8_t *src, int sz, int upd);
  47. void swresample_dsp_x86_init(ResampleContext *c)
  48. {
  49. int av_unused mm_flags = av_get_cpu_flags();
  50. #define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P)
  51. if (ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL && mm_flags & AV_CPU_FLAG_MMX2) {
  52. c->dsp.resample_common[FNIDX(S16P)] = ff_resample_common_int16_mmxext;
  53. c->dsp.resample_linear[FNIDX(S16P)] = ff_resample_linear_int16_mmxext;
  54. }
  55. if (HAVE_SSE_EXTERNAL && mm_flags & AV_CPU_FLAG_SSE) {
  56. c->dsp.resample_common[FNIDX(FLTP)] = ff_resample_common_float_sse;
  57. c->dsp.resample_linear[FNIDX(FLTP)] = ff_resample_linear_float_sse;
  58. }
  59. if (HAVE_SSE2_EXTERNAL && mm_flags & AV_CPU_FLAG_SSE2) {
  60. c->dsp.resample_common[FNIDX(S16P)] = ff_resample_common_int16_sse2;
  61. c->dsp.resample_linear[FNIDX(S16P)] = ff_resample_linear_int16_sse2;
  62. c->dsp.resample_common[FNIDX(DBLP)] = ff_resample_common_double_sse2;
  63. c->dsp.resample_linear[FNIDX(DBLP)] = ff_resample_linear_double_sse2;
  64. }
  65. if (HAVE_AVX_EXTERNAL && mm_flags & AV_CPU_FLAG_AVX) {
  66. c->dsp.resample_common[FNIDX(FLTP)] = ff_resample_common_float_avx;
  67. c->dsp.resample_linear[FNIDX(FLTP)] = ff_resample_linear_float_avx;
  68. }
  69. }