resample_init.c 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #include <stdint.h>
  19. #include "config.h"
  20. #include "libavutil/cpu.h"
  21. #include "libavutil/aarch64/cpu.h"
  22. #include "libavutil/internal.h"
  23. #include "libavutil/samplefmt.h"
  24. #include "libavresample/resample.h"
  25. #include "asm-offsets.h"
  26. AV_CHECK_OFFSET(struct ResampleContext, filter_bank, FILTER_BANK);
  27. AV_CHECK_OFFSET(struct ResampleContext, filter_length, FILTER_LENGTH);
  28. AV_CHECK_OFFSET(struct ResampleContext, phase_shift, PHASE_SHIFT);
  29. AV_CHECK_OFFSET(struct ResampleContext, phase_mask, PHASE_MASK);
  30. void ff_resample_one_dbl_neon(struct ResampleContext *c, void *dst0,
  31. int dst_index, const void *src0,
  32. unsigned int index, int frac);
  33. void ff_resample_one_flt_neon(struct ResampleContext *c, void *dst0,
  34. int dst_index, const void *src0,
  35. unsigned int index, int frac);
  36. void ff_resample_one_s16_neon(struct ResampleContext *c, void *dst0,
  37. int dst_index, const void *src0,
  38. unsigned int index, int frac);
  39. void ff_resample_one_s32_neon(struct ResampleContext *c, void *dst0,
  40. int dst_index, const void *src0,
  41. unsigned int index, int frac);
  42. av_cold void ff_audio_resample_init_aarch64(ResampleContext *c,
  43. enum AVSampleFormat sample_fmt)
  44. {
  45. int cpu_flags = av_get_cpu_flags();
  46. if (have_neon(cpu_flags)) {
  47. if (!c->linear) {
  48. switch (sample_fmt) {
  49. case AV_SAMPLE_FMT_DBLP:
  50. c->resample_one = ff_resample_one_dbl_neon;
  51. break;
  52. case AV_SAMPLE_FMT_FLTP:
  53. c->resample_one = ff_resample_one_flt_neon;
  54. break;
  55. case AV_SAMPLE_FMT_S16P:
  56. c->resample_one = ff_resample_one_s16_neon;
  57. break;
  58. case AV_SAMPLE_FMT_S32P:
  59. c->resample_one = ff_resample_one_s32_neon;
  60. break;
  61. }
  62. }
  63. }
  64. }