FFmpeg
Loading...
Searching...
No Matches
llauddsp.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Alexandra Hájková
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <string.h>
22
23#include "libavutil/common.h"
25#include "libavutil/mem.h"
27
29
30#include "checkasm.h"
31
32#define randomize_buf(buf, len) \
33 do { \
34 for (int i = 0; i < len; i++) \
35 buf[i] = rnd(); \
36 } while (0)
37
39{
40#define BUF_SIZE 1088 // multiple of 16
41 LOCAL_ALIGNED_16(int16_t, v1, [BUF_SIZE]);
42 LOCAL_ALIGNED_16(int16_t, v2, [BUF_SIZE]);
43 LOCAL_ALIGNED_16(int16_t, v3, [BUF_SIZE]);
44 int mul;
45
46 declare_func(int32_t, int16_t *, const int16_t *, const int16_t *,
47 int, int);
48
52 mul = (int16_t)rnd();
53
54 if (check_func(c->scalarproduct_and_madd_int16,
55 "scalarproduct_and_madd_int16")) {
56 LOCAL_ALIGNED_16(int16_t, dst0, [BUF_SIZE]);
57 LOCAL_ALIGNED_16(int16_t, dst1, [BUF_SIZE]);
58 int ref, val;
59
60 memcpy(dst0, v1, sizeof (*dst0) * BUF_SIZE);
61 memcpy(dst1, v1, sizeof (*dst1) * BUF_SIZE);
62 ref = call_ref(dst0, v2, v3, BUF_SIZE, mul);
63 val = call_new(dst1, v2, v3, BUF_SIZE, mul);
64 if (memcmp(dst0, dst1, sizeof (*dst0) * BUF_SIZE) != 0 || ref != val)
65 fail();
66
67 bench_new(v1, v2, v3, BUF_SIZE, mul);
68 }
69
70 report("scalarproduct_and_madd_int16");
71}
72
74{
75#define BUF_SIZE 1088 // multiple of 16
76 LOCAL_ALIGNED_16(int16_t, v1, [BUF_SIZE]);
78 LOCAL_ALIGNED_16(int16_t, v3, [BUF_SIZE]);
79 int mul;
80
81 declare_func(int32_t, int16_t *, const int32_t *, const int16_t *,
82 int, int);
83
87 mul = (int16_t)rnd();
88
89 if (check_func(c->scalarproduct_and_madd_int32,
90 "scalarproduct_and_madd_int32")) {
91 LOCAL_ALIGNED_16(int16_t, dst0, [BUF_SIZE]);
92 LOCAL_ALIGNED_16(int16_t, dst1, [BUF_SIZE]);
93 int ref, val;
94
95 memcpy(dst0, v1, sizeof (*dst0) * BUF_SIZE);
96 memcpy(dst1, v1, sizeof (*dst1) * BUF_SIZE);
97 ref = call_ref(dst0, v2, v3, BUF_SIZE, mul);
98 val = call_new(dst1, v2, v3, BUF_SIZE, mul);
99 if (memcmp(dst0, dst1, sizeof (*dst0) * BUF_SIZE) != 0 || ref != val)
100 fail();
101
102 bench_new(v1, v2, v3, BUF_SIZE, mul);
103 }
104
105 report("scalarproduct_and_madd_int32");
106}
107
static double val(void *priv, double ch)
Definition aeval.c:77
int32_t
#define rnd
Definition checkasm.h:136
common internal and external API header
#define declare_func
Definition test.h:489
#define fail
Definition test.h:479
#define bench_new
Definition test.h:487
#define check_func
Definition test.h:481
#define call_new
Definition test.h:486
#define call_ref
Definition test.h:485
#define report
Definition test.h:480
static void check_scalarproduct_and_madd_int16(LLAudDSPContext *c)
Definition llauddsp.c:38
#define randomize_buf(buf, len)
Definition llauddsp.c:32
void checkasm_check_llauddsp(void)
Definition llauddsp.c:108
static void check_scalarproduct_and_madd_int32(LLAudDSPContext *c)
Definition llauddsp.c:73
av_cold void ff_llauddsp_init(LLAudDSPContext *c)
Memory handling functions.
#define LOCAL_ALIGNED_16(t, v,...)
#define BUF_SIZE
Definition setpts.c:159
static int ref[MAX_W *MAX_W]
static double c[64]