FFmpeg
Loading...
Searching...
No Matches
ttadsp.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#include <string.h>
20
21#include "config_components.h"
22
23#include "checkasm.h"
24
25#include "libavcodec/ttadata.h"
26#include "libavcodec/ttadsp.h"
29
30#define randomize_buffer(NAME) \
31do { \
32 checkasm_randomize(NAME ## _ref, sizeof(NAME ## _ref)); \
33 memcpy(NAME ## _new, NAME ## _ref, sizeof(NAME ## _new)); \
34} while (0)
35
36static void check_filter_process(void)
37{
44 int bps = 1 + rnd() % 3;
46 int32_t in = rnd(), error_ref = rnd(), error_new = error_ref;
47
50
54
55 int32_t out_ref = call_ref(qm_ref, dx_ref, dl_ref, &error_ref, in, shift, round);
56 int32_t out_new = call_new(qm_new, dx_new, dl_new, &error_new, in, shift, round);
57
58 if (out_ref != out_new || error_ref != error_new ||
59 memcmp(qm_ref, qm_new, sizeof(qm_ref)) ||
60 memcmp(dx_ref, dx_new, sizeof(dx_ref)) ||
61 memcmp(dl_ref, dl_new, sizeof(dl_ref)))
62 fail();
63#define alt(var) checkasm_alternate(var ## _ref, var ## _new)
64 bench_new(alt(qm), alt(dx), alt(dl), alt(&error), in, shift, round);
65}
66
67#if CONFIG_TTA_DECODER
68void checkasm_check_ttadsp(void)
69{
70 TTADSPContext ttadsp;
71
72 ff_ttadsp_init(&ttadsp);
73
74 if (check_func(ttadsp.filter_process, "filter_process"))
76 report("filter_process");
77}
78#endif
79
80#if CONFIG_TTA_ENCODER
82{
83 TTAEncDSPContext ttaencdsp;
84
85 ff_ttaencdsp_init(&ttaencdsp);
86
87 if (check_func(ttaencdsp.filter_process, "enc_filter_process"))
89 report("filter_process");
90}
91#endif
int32_t
void checkasm_check_ttaencdsp(void)
#define rnd
Definition checkasm.h:136
void checkasm_check_ttadsp(void)
#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 int shift(int a, int b)
Definition bonk.c:261
av_cold void ff_ttadsp_init(TTADSPContext *c)
Definition ttadsp.c:58
static av_always_inline av_const double round(double x)
Definition libm.h:446
#define DECLARE_ALIGNED_16(t, v)
unsigned bps
Definition movenc.c:2074
int32_t(* filter_process)(int32_t *qm, int32_t *dx, int32_t *dl, int32_t *error, int32_t in, int32_t shift, int32_t round)
Definition ttadsp.h:25
int32_t(* filter_process)(int32_t *qm, int32_t *dx, int32_t *dl, int32_t *error, int32_t in, int32_t shift, int32_t round)
Definition ttaencdsp.h:25
static void error(const char *err)
#define alt(var)
static void check_filter_process(void)
Definition ttadsp.c:36
#define randomize_buffer(NAME)
Definition ttadsp.c:30
const uint32_t ff_tta_shift_1[]
Definition ttadata.c:24
const uint8_t ff_tta_filter_configs[]
Definition ttadata.c:40
#define MAX_ORDER
Definition ttadata.h:28
av_cold void ff_ttaencdsp_init(TTAEncDSPContext *c)
Definition ttaencdsp.c:58