yading@11: /* yading@11: * This file is part of FFmpeg. yading@11: * yading@11: * FFmpeg is free software; you can redistribute it and/or yading@11: * modify it under the terms of the GNU Lesser General Public yading@11: * License as published by the Free Software Foundation; either yading@11: * version 2.1 of the License, or (at your option) any later version. yading@11: * yading@11: * FFmpeg is distributed in the hope that it will be useful, yading@11: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@11: * Lesser General Public License for more details. yading@11: * yading@11: * You should have received a copy of the GNU Lesser General Public yading@11: * License along with FFmpeg; if not, write to the Free Software yading@11: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@11: */ yading@11: yading@11: #ifndef AVUTIL_FLOAT_DSP_H yading@11: #define AVUTIL_FLOAT_DSP_H yading@11: yading@11: #include "config.h" yading@11: yading@11: typedef struct AVFloatDSPContext { yading@11: /** yading@11: * Calculate the product of two vectors of floats and store the result in yading@11: * a vector of floats. yading@11: * yading@11: * @param dst output vector yading@11: * constraints: 32-byte aligned yading@11: * @param src0 first input vector yading@11: * constraints: 32-byte aligned yading@11: * @param src1 second input vector yading@11: * constraints: 32-byte aligned yading@11: * @param len number of elements in the input yading@11: * constraints: multiple of 16 yading@11: */ yading@11: void (*vector_fmul)(float *dst, const float *src0, const float *src1, yading@11: int len); yading@11: yading@11: /** yading@11: * Multiply a vector of floats by a scalar float and add to yading@11: * destination vector. Source and destination vectors must yading@11: * overlap exactly or not at all. yading@11: * yading@11: * @param dst result vector yading@11: * constraints: 32-byte aligned yading@11: * @param src input vector yading@11: * constraints: 32-byte aligned yading@11: * @param mul scalar value yading@11: * @param len length of vector yading@11: * constraints: multiple of 16 yading@11: */ yading@11: void (*vector_fmac_scalar)(float *dst, const float *src, float mul, yading@11: int len); yading@11: yading@11: /** yading@11: * Multiply a vector of floats by a scalar float. Source and yading@11: * destination vectors must overlap exactly or not at all. yading@11: * yading@11: * @param dst result vector yading@11: * constraints: 16-byte aligned yading@11: * @param src input vector yading@11: * constraints: 16-byte aligned yading@11: * @param mul scalar value yading@11: * @param len length of vector yading@11: * constraints: multiple of 4 yading@11: */ yading@11: void (*vector_fmul_scalar)(float *dst, const float *src, float mul, yading@11: int len); yading@11: yading@11: /** yading@11: * Multiply a vector of double by a scalar double. Source and yading@11: * destination vectors must overlap exactly or not at all. yading@11: * yading@11: * @param dst result vector yading@11: * constraints: 32-byte aligned yading@11: * @param src input vector yading@11: * constraints: 32-byte aligned yading@11: * @param mul scalar value yading@11: * @param len length of vector yading@11: * constraints: multiple of 8 yading@11: */ yading@11: void (*vector_dmul_scalar)(double *dst, const double *src, double mul, yading@11: int len); yading@11: yading@11: /** yading@11: * Overlap/add with window function. yading@11: * Used primarily by MDCT-based audio codecs. yading@11: * Source and destination vectors must overlap exactly or not at all. yading@11: * yading@11: * @param dst result vector yading@11: * constraints: 16-byte aligned yading@11: * @param src0 first source vector yading@11: * constraints: 16-byte aligned yading@11: * @param src1 second source vector yading@11: * constraints: 16-byte aligned yading@11: * @param win half-window vector yading@11: * constraints: 16-byte aligned yading@11: * @param len length of vector yading@11: * constraints: multiple of 4 yading@11: */ yading@11: void (*vector_fmul_window)(float *dst, const float *src0, yading@11: const float *src1, const float *win, int len); yading@11: yading@11: /** yading@11: * Calculate the product of two vectors of floats, add a third vector of yading@11: * floats and store the result in a vector of floats. yading@11: * yading@11: * @param dst output vector yading@11: * constraints: 32-byte aligned yading@11: * @param src0 first input vector yading@11: * constraints: 32-byte aligned yading@11: * @param src1 second input vector yading@11: * constraints: 32-byte aligned yading@11: * @param src1 third input vector yading@11: * constraints: 32-byte aligned yading@11: * @param len number of elements in the input yading@11: * constraints: multiple of 16 yading@11: */ yading@11: void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, yading@11: const float *src2, int len); yading@11: yading@11: /** yading@11: * Calculate the product of two vectors of floats, and store the result yading@11: * in a vector of floats. The second vector of floats is iterated over yading@11: * in reverse order. yading@11: * yading@11: * @param dst output vector yading@11: * constraints: 32-byte aligned yading@11: * @param src0 first input vector yading@11: * constraints: 32-byte aligned yading@11: * @param src1 second input vector yading@11: * constraints: 32-byte aligned yading@11: * @param src1 third input vector yading@11: * constraints: 32-byte aligned yading@11: * @param len number of elements in the input yading@11: * constraints: multiple of 16 yading@11: */ yading@11: void (*vector_fmul_reverse)(float *dst, const float *src0, yading@11: const float *src1, int len); yading@11: yading@11: /** yading@11: * Calculate the sum and difference of two vectors of floats. yading@11: * yading@11: * @param v1 first input vector, sum output, 16-byte aligned yading@11: * @param v2 second input vector, difference output, 16-byte aligned yading@11: * @param len length of vectors, multiple of 4 yading@11: */ yading@11: void (*butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len); yading@11: yading@11: /** yading@11: * Calculate the scalar product of two vectors of floats. yading@11: * yading@11: * @param v1 first vector, 16-byte aligned yading@11: * @param v2 second vector, 16-byte aligned yading@11: * @param len length of vectors, multiple of 4 yading@11: * yading@11: * @return sum of elementwise products yading@11: */ yading@11: float (*scalarproduct_float)(const float *v1, const float *v2, int len); yading@11: } AVFloatDSPContext; yading@11: yading@11: /** yading@11: * Return the scalar product of two vectors. yading@11: * yading@11: * @param v1 first input vector yading@11: * @param v2 first input vector yading@11: * @param len number of elements yading@11: * yading@11: * @return sum of elementwise products yading@11: */ yading@11: float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len); yading@11: yading@11: /** yading@11: * Initialize a float DSP context. yading@11: * yading@11: * @param fdsp float DSP context yading@11: * @param strict setting to non-zero avoids using functions which may not be IEEE-754 compliant yading@11: */ yading@11: void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int strict); yading@11: yading@11: yading@11: void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp); yading@11: void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict); yading@11: void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp); yading@11: void ff_float_dsp_init_mips(AVFloatDSPContext *fdsp); yading@11: yading@11: #endif /* AVUTIL_FLOAT_DSP_H */