FFmpeg
Loading...
Searching...
No Matches
vf_pp7.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 <assert.h>
20#include <stddef.h>
21#include <stdint.h>
22#include <string.h>
23
24#include "checkasm.h"
28
29#define randomize_buffer(buf) \
30 do { \
31 static_assert(!(sizeof(buf) % 4), "Tail handling needed"); \
32 for (size_t k = 0; k < sizeof(buf); k += 4) { \
33 AV_WN32A((char*)buf + k, rnd()); \
34 } \
35 } while (0)
36
37static void check_dctB(const PP7DSPContext *const pp7dsp)
38{
39 declare_func(void, int16_t *dst, const int16_t *src);
40
41 if (!check_func(pp7dsp->dctB, "dctB"))
42 return;
43
44 DECLARE_ALIGNED(8, int16_t, src)[7 * 4];
45 DECLARE_ALIGNED(8, int16_t, dst_ref)[6 * 4];
46 DECLARE_ALIGNED(8, int16_t, dst_new)[6 * 4];
47
49 randomize_buffer(dst_ref);
50 memcpy(dst_new, dst_ref, sizeof(dst_new));
51 call_ref(dst_ref, src);
52 call_new(dst_new, src);
53 if (memcmp(dst_new, dst_ref, sizeof(dst_new)))
54 fail();
55
56 bench_new(dst_new, src);
57}
58
60{
61 PP7DSPContext pp7dsp;
62
63 ff_pp7dsp_init(&pp7dsp);
64
65 check_dctB(&pp7dsp);
66 report("dctB");
67}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#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
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
void(* dctB)(int16_t *restrict dst, const int16_t *restrict src)
Definition vf_pp7dsp.h:30
void checkasm_check_vf_pp7(void)
Definition vf_pp7.c:59
static void check_dctB(const PP7DSPContext *const pp7dsp)
Definition vf_pp7.c:37
#define randomize_buffer(buf)
Definition vf_pp7.c:29
#define src
Definition vp8dsp.c:248
static void ff_pp7dsp_init(PP7DSPContext *pp7dsp)
Definition vf_pp7dsp.h:56