annotate ffmpeg/libavutil/float_dsp.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents f445c3017523
children
rev   line source
yading@11 1 /*
yading@11 2 * This file is part of FFmpeg.
yading@11 3 *
yading@11 4 * FFmpeg is free software; you can redistribute it and/or
yading@11 5 * modify it under the terms of the GNU Lesser General Public
yading@11 6 * License as published by the Free Software Foundation; either
yading@11 7 * version 2.1 of the License, or (at your option) any later version.
yading@11 8 *
yading@11 9 * FFmpeg is distributed in the hope that it will be useful,
yading@11 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 12 * Lesser General Public License for more details.
yading@11 13 *
yading@11 14 * You should have received a copy of the GNU Lesser General Public
yading@11 15 * License along with FFmpeg; if not, write to the Free Software
yading@11 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 17 */
yading@11 18
yading@11 19 #ifndef AVUTIL_FLOAT_DSP_H
yading@11 20 #define AVUTIL_FLOAT_DSP_H
yading@11 21
yading@11 22 #include "config.h"
yading@11 23
yading@11 24 typedef struct AVFloatDSPContext {
yading@11 25 /**
yading@11 26 * Calculate the product of two vectors of floats and store the result in
yading@11 27 * a vector of floats.
yading@11 28 *
yading@11 29 * @param dst output vector
yading@11 30 * constraints: 32-byte aligned
yading@11 31 * @param src0 first input vector
yading@11 32 * constraints: 32-byte aligned
yading@11 33 * @param src1 second input vector
yading@11 34 * constraints: 32-byte aligned
yading@11 35 * @param len number of elements in the input
yading@11 36 * constraints: multiple of 16
yading@11 37 */
yading@11 38 void (*vector_fmul)(float *dst, const float *src0, const float *src1,
yading@11 39 int len);
yading@11 40
yading@11 41 /**
yading@11 42 * Multiply a vector of floats by a scalar float and add to
yading@11 43 * destination vector. Source and destination vectors must
yading@11 44 * overlap exactly or not at all.
yading@11 45 *
yading@11 46 * @param dst result vector
yading@11 47 * constraints: 32-byte aligned
yading@11 48 * @param src input vector
yading@11 49 * constraints: 32-byte aligned
yading@11 50 * @param mul scalar value
yading@11 51 * @param len length of vector
yading@11 52 * constraints: multiple of 16
yading@11 53 */
yading@11 54 void (*vector_fmac_scalar)(float *dst, const float *src, float mul,
yading@11 55 int len);
yading@11 56
yading@11 57 /**
yading@11 58 * Multiply a vector of floats by a scalar float. Source and
yading@11 59 * destination vectors must overlap exactly or not at all.
yading@11 60 *
yading@11 61 * @param dst result vector
yading@11 62 * constraints: 16-byte aligned
yading@11 63 * @param src input vector
yading@11 64 * constraints: 16-byte aligned
yading@11 65 * @param mul scalar value
yading@11 66 * @param len length of vector
yading@11 67 * constraints: multiple of 4
yading@11 68 */
yading@11 69 void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
yading@11 70 int len);
yading@11 71
yading@11 72 /**
yading@11 73 * Multiply a vector of double by a scalar double. Source and
yading@11 74 * destination vectors must overlap exactly or not at all.
yading@11 75 *
yading@11 76 * @param dst result vector
yading@11 77 * constraints: 32-byte aligned
yading@11 78 * @param src input vector
yading@11 79 * constraints: 32-byte aligned
yading@11 80 * @param mul scalar value
yading@11 81 * @param len length of vector
yading@11 82 * constraints: multiple of 8
yading@11 83 */
yading@11 84 void (*vector_dmul_scalar)(double *dst, const double *src, double mul,
yading@11 85 int len);
yading@11 86
yading@11 87 /**
yading@11 88 * Overlap/add with window function.
yading@11 89 * Used primarily by MDCT-based audio codecs.
yading@11 90 * Source and destination vectors must overlap exactly or not at all.
yading@11 91 *
yading@11 92 * @param dst result vector
yading@11 93 * constraints: 16-byte aligned
yading@11 94 * @param src0 first source vector
yading@11 95 * constraints: 16-byte aligned
yading@11 96 * @param src1 second source vector
yading@11 97 * constraints: 16-byte aligned
yading@11 98 * @param win half-window vector
yading@11 99 * constraints: 16-byte aligned
yading@11 100 * @param len length of vector
yading@11 101 * constraints: multiple of 4
yading@11 102 */
yading@11 103 void (*vector_fmul_window)(float *dst, const float *src0,
yading@11 104 const float *src1, const float *win, int len);
yading@11 105
yading@11 106 /**
yading@11 107 * Calculate the product of two vectors of floats, add a third vector of
yading@11 108 * floats and store the result in a vector of floats.
yading@11 109 *
yading@11 110 * @param dst output vector
yading@11 111 * constraints: 32-byte aligned
yading@11 112 * @param src0 first input vector
yading@11 113 * constraints: 32-byte aligned
yading@11 114 * @param src1 second input vector
yading@11 115 * constraints: 32-byte aligned
yading@11 116 * @param src1 third input vector
yading@11 117 * constraints: 32-byte aligned
yading@11 118 * @param len number of elements in the input
yading@11 119 * constraints: multiple of 16
yading@11 120 */
yading@11 121 void (*vector_fmul_add)(float *dst, const float *src0, const float *src1,
yading@11 122 const float *src2, int len);
yading@11 123
yading@11 124 /**
yading@11 125 * Calculate the product of two vectors of floats, and store the result
yading@11 126 * in a vector of floats. The second vector of floats is iterated over
yading@11 127 * in reverse order.
yading@11 128 *
yading@11 129 * @param dst output vector
yading@11 130 * constraints: 32-byte aligned
yading@11 131 * @param src0 first input vector
yading@11 132 * constraints: 32-byte aligned
yading@11 133 * @param src1 second input vector
yading@11 134 * constraints: 32-byte aligned
yading@11 135 * @param src1 third input vector
yading@11 136 * constraints: 32-byte aligned
yading@11 137 * @param len number of elements in the input
yading@11 138 * constraints: multiple of 16
yading@11 139 */
yading@11 140 void (*vector_fmul_reverse)(float *dst, const float *src0,
yading@11 141 const float *src1, int len);
yading@11 142
yading@11 143 /**
yading@11 144 * Calculate the sum and difference of two vectors of floats.
yading@11 145 *
yading@11 146 * @param v1 first input vector, sum output, 16-byte aligned
yading@11 147 * @param v2 second input vector, difference output, 16-byte aligned
yading@11 148 * @param len length of vectors, multiple of 4
yading@11 149 */
yading@11 150 void (*butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len);
yading@11 151
yading@11 152 /**
yading@11 153 * Calculate the scalar product of two vectors of floats.
yading@11 154 *
yading@11 155 * @param v1 first vector, 16-byte aligned
yading@11 156 * @param v2 second vector, 16-byte aligned
yading@11 157 * @param len length of vectors, multiple of 4
yading@11 158 *
yading@11 159 * @return sum of elementwise products
yading@11 160 */
yading@11 161 float (*scalarproduct_float)(const float *v1, const float *v2, int len);
yading@11 162 } AVFloatDSPContext;
yading@11 163
yading@11 164 /**
yading@11 165 * Return the scalar product of two vectors.
yading@11 166 *
yading@11 167 * @param v1 first input vector
yading@11 168 * @param v2 first input vector
yading@11 169 * @param len number of elements
yading@11 170 *
yading@11 171 * @return sum of elementwise products
yading@11 172 */
yading@11 173 float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len);
yading@11 174
yading@11 175 /**
yading@11 176 * Initialize a float DSP context.
yading@11 177 *
yading@11 178 * @param fdsp float DSP context
yading@11 179 * @param strict setting to non-zero avoids using functions which may not be IEEE-754 compliant
yading@11 180 */
yading@11 181 void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int strict);
yading@11 182
yading@11 183
yading@11 184 void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp);
yading@11 185 void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict);
yading@11 186 void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp);
yading@11 187 void ff_float_dsp_init_mips(AVFloatDSPContext *fdsp);
yading@11 188
yading@11 189 #endif /* AVUTIL_FLOAT_DSP_H */