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.

70 lines
2.4KB

  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 "resample.h"
  27. #define DO_RESAMPLE_ONE 1
  28. #define TEMPLATE_RESAMPLE_S16
  29. #include "resample_template.c"
  30. #undef TEMPLATE_RESAMPLE_S16
  31. #define TEMPLATE_RESAMPLE_S32
  32. #include "resample_template.c"
  33. #undef TEMPLATE_RESAMPLE_S32
  34. #define TEMPLATE_RESAMPLE_FLT
  35. #include "resample_template.c"
  36. #undef TEMPLATE_RESAMPLE_FLT
  37. #define TEMPLATE_RESAMPLE_DBL
  38. #include "resample_template.c"
  39. #undef TEMPLATE_RESAMPLE_DBL
  40. #undef DO_RESAMPLE_ONE
  41. void swresample_dsp_init(ResampleContext *c)
  42. {
  43. #define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P)
  44. c->dsp.resample_one[FNIDX(S16P)] = (resample_one_fn) resample_one_int16;
  45. c->dsp.resample_one[FNIDX(S32P)] = (resample_one_fn) resample_one_int32;
  46. c->dsp.resample_one[FNIDX(FLTP)] = (resample_one_fn) resample_one_float;
  47. c->dsp.resample_one[FNIDX(DBLP)] = (resample_one_fn) resample_one_double;
  48. c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16;
  49. c->dsp.resample_common[FNIDX(S32P)] = (resample_fn) resample_common_int32;
  50. c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float;
  51. c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double;
  52. c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16;
  53. c->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) resample_linear_int32;
  54. c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float;
  55. c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double;
  56. if (ARCH_X86) swresample_dsp_x86_init(c);
  57. }