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.

67 lines
2.1KB

  1. /*
  2. * Format Conversion Utils
  3. * Copyright (c) 2000, 2001 Fabrice Bellard
  4. * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  5. *
  6. * This file is part of Libav.
  7. *
  8. * Libav is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * Libav is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with Libav; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #include "avcodec.h"
  23. #include "fmtconvert.h"
  24. #include "libavutil/common.h"
  25. static void int32_to_float_fmul_scalar_c(float *dst, const int32_t *src,
  26. float mul, int len)
  27. {
  28. int i;
  29. for(i=0; i<len; i++)
  30. dst[i] = src[i] * mul;
  31. }
  32. static void int32_to_float_c(float *dst, const int32_t *src, intptr_t len)
  33. {
  34. int i;
  35. for (i = 0; i < len; i++)
  36. dst[i] = (float)src[i];
  37. }
  38. static void int32_to_float_fmul_array8_c(FmtConvertContext *c, float *dst,
  39. const int32_t *src, const float *mul,
  40. int len)
  41. {
  42. int i;
  43. for (i = 0; i < len; i += 8)
  44. c->int32_to_float_fmul_scalar(&dst[i], &src[i], *mul++, 8);
  45. }
  46. av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
  47. {
  48. c->int32_to_float = int32_to_float_c;
  49. c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
  50. c->int32_to_float_fmul_array8 = int32_to_float_fmul_array8_c;
  51. if (ARCH_AARCH64)
  52. ff_fmt_convert_init_aarch64(c, avctx);
  53. if (ARCH_ARM)
  54. ff_fmt_convert_init_arm(c, avctx);
  55. if (ARCH_PPC)
  56. ff_fmt_convert_init_ppc(c, avctx);
  57. if (ARCH_X86)
  58. ff_fmt_convert_init_x86(c, avctx);
  59. }