float_dsp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #ifndef AVUTIL_FLOAT_DSP_H
  19. #define AVUTIL_FLOAT_DSP_H
  20. typedef struct AVFloatDSPContext {
  21. /**
  22. * Calculate the product of two vectors of floats and store the result in
  23. * a vector of floats.
  24. *
  25. * @param dst output vector
  26. * constraints: 32-byte aligned
  27. * @param src0 first input vector
  28. * constraints: 32-byte aligned
  29. * @param src1 second input vector
  30. * constraints: 32-byte aligned
  31. * @param len number of elements in the input
  32. * constraints: multiple of 16
  33. */
  34. void (*vector_fmul)(float *dst, const float *src0, const float *src1,
  35. int len);
  36. /**
  37. * Multiply a vector of floats by a scalar float and add to
  38. * destination vector. Source and destination vectors must
  39. * overlap exactly or not at all.
  40. *
  41. * @param dst result vector
  42. * constraints: 32-byte aligned
  43. * @param src input vector
  44. * constraints: 32-byte aligned
  45. * @param mul scalar value
  46. * @param len length of vector
  47. * constraints: multiple of 16
  48. */
  49. void (*vector_fmac_scalar)(float *dst, const float *src, float mul,
  50. int len);
  51. /**
  52. * Multiply a vector of floats by a scalar float. Source and
  53. * destination vectors must overlap exactly or not at all.
  54. *
  55. * @param dst result vector
  56. * constraints: 16-byte aligned
  57. * @param src input vector
  58. * constraints: 16-byte aligned
  59. * @param mul scalar value
  60. * @param len length of vector
  61. * constraints: multiple of 4
  62. */
  63. void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
  64. int len);
  65. /**
  66. * Multiply a vector of double by a scalar double. Source and
  67. * destination vectors must overlap exactly or not at all.
  68. *
  69. * @param dst result vector
  70. * constraints: 32-byte aligned
  71. * @param src input vector
  72. * constraints: 32-byte aligned
  73. * @param mul scalar value
  74. * @param len length of vector
  75. * constraints: multiple of 8
  76. */
  77. void (*vector_dmul_scalar)(double *dst, const double *src, double mul,
  78. int len);
  79. } AVFloatDSPContext;
  80. /**
  81. * Initialize a float DSP context.
  82. *
  83. * @param fdsp float DSP context
  84. * @param strict setting to non-zero avoids using functions which may not be IEEE-754 compliant
  85. */
  86. void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int strict);
  87. void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp);
  88. void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict);
  89. void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp);
  90. void ff_float_dsp_init_mips(AVFloatDSPContext *fdsp);
  91. #endif /* AVUTIL_FLOAT_DSP_H */