46 double bmg[2], stddev = 10.0, mean = 0.0;
48 for (i = 0; i <
len; i += 2) {
50 a[i] = bmg[0] * stddev + mean;
51 a[i + 1] = bmg[1] * stddev + mean;
58 for (i = 0; i <
len; i++) {
59 if (fabsf(a[i] - b[i]) > max_diff) {
61 i, a[i], b[i], a[i] - b[i]);
71 double bmg[2], stddev = 10.0, mean = 0.0;
73 for (i = 0; i <
len; i += 2) {
75 a[i] = bmg[0] * stddev + mean;
76 a[i + 1] = bmg[1] * stddev + mean;
85 for (i = 0; i <
len; i++) {
86 if (fabs(a[i] - b[i]) > max_diff) {
88 i, a[i], b[i], a[i] - b[i]);
96 const float *v1,
const float *v2)
111 #define ARBITRARY_FMAC_SCALAR_CONST 0.005
113 const float *v1,
const float *
src0,
float scale)
119 memcpy(cdst, v1,
LEN *
sizeof(*v1));
120 memcpy(odst, v1,
LEN *
sizeof(*v1));
132 const float *v1,
float scale)
147 #define ARBITRARY_DMAC_SCALAR_CONST 0.005
149 const double *v1,
const double *
src0,
double scale)
155 memcpy(cdst, v1,
LEN *
sizeof(*v1));
156 memcpy(odst, v1,
LEN *
sizeof(*v1));
168 const double *v1,
double scale)
183 #define ARBITRARY_FMUL_WINDOW_CONST 0.008
185 const float *v1,
const float *v2,
const float *v3)
200 #define ARBITRARY_FMUL_ADD_CONST 0.005
202 const float *v1,
const float *v2,
const float *v3)
218 const float *v1,
const float *v2)
234 const float *v1,
const float *v2)
242 memcpy(cv1, v1,
LEN *
sizeof(*v1));
243 memcpy(cv2, v2,
LEN *
sizeof(*v2));
244 memcpy(ov1, v1,
LEN *
sizeof(*v1));
245 memcpy(ov2, v2,
LEN *
sizeof(*v2));
257 #define ARBITRARY_SCALARPRODUCT_CONST 0.2
259 const float *v1,
const float *v2)
273 int main(
int argc,
char **argv)
275 int ret = 0, seeded = 0;
317 if (!fdsp || !cdsp) {
#define ARBITRARY_FMUL_WINDOW_CONST
static int test_scalarproduct_float(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2)
float(* scalarproduct_float)(const float *v1, const float *v2, int len)
Calculate the scalar product of two vectors of floats.
int main(int argc, char **argv)
void(* vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len)
Calculate the entry wise product of two vectors of floats, and store the result in a vector of floats...
static int test_vector_fmul(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2)
static int test_vector_fmac_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *src0, float scale)
void(* vector_fmac_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float and add to destination vector.
void(* vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len)
Overlap/add with window function.
#define ARBITRARY_DMAC_SCALAR_CONST
static av_cold int end(AVCodecContext *avctx)
static int test_vector_fmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, float scale)
#define ARBITRARY_SCALARPRODUCT_CONST
void(* vector_dmac_scalar)(double *dst, const double *src, double mul, int len)
Multiply a vector of doubles by a scalar double and add to destination vector.
void av_bmg_get(AVLFG *lfg, double out[2])
Get the next two numbers generated by a Box-Muller Gaussian generator using the random numbers issued...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
Calculate the entry wise product of two vectors of floats and store the result in a vector of floats...
void(* butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len)
Calculate the sum and difference of two vectors of floats.
void(* vector_dmul_scalar)(double *dst, const double *src, double mul, int len)
Multiply a vector of double by a scalar double.
int av_parse_cpu_caps(unsigned *flags, const char *s)
Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
common internal API header
static int test_vector_dmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const double *v1, double scale)
static int test_vector_fmul_reverse(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2)
static int compare_floats(const float *a, const float *b, int len, float max_diff)
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
static int compare_doubles(const double *a, const double *b, int len, double max_diff)
#define AV_LOG_INFO
Standard information.
static void fill_double_array(AVLFG *lfg, double *a, int len)
static int getopt(int argc, char *argv[], char *opts)
void(* vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len)
Calculate the entry wise product of two vectors of floats, add a third vector of floats and store the...
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static int test_vector_fmul_window(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2, const float *v3)
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
static int test_vector_fmul_add(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2, const float *v3)
common internal and external API header
#define ARBITRARY_FMUL_ADD_CONST
#define LOCAL_ALIGNED(a, t, v,...)
static int test_vector_dmac_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const double *v1, const double *src0, double scale)
#define ARBITRARY_FMAC_SCALAR_CONST
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
void av_force_cpu_flags(int arg)
Disables cpu detection and forces the specified flags.
static void fill_float_array(AVLFG *lfg, float *a, int len)
static int test_butterflies_float(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2)