FFmpeg
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"
25 #include "libavfilter/vf_pp7dsp.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/mem_internal.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 
37 static 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 {
62 
64 
66  report("dctB");
67 }
ff_pp7dsp_init
static void ff_pp7dsp_init(PP7DSPContext *pp7dsp)
Definition: vf_pp7dsp.h:56
mem_internal.h
PP7DSPContext::dctB
void(* dctB)(int16_t *restrict dst, const int16_t *restrict src)
Definition: vf_pp7dsp.h:30
check_func
#define check_func
Definition: test.h:481
bench_new
#define bench_new
Definition: test.h:487
call_ref
#define call_ref
Definition: test.h:485
checkasm_check_vf_pp7
void checkasm_check_vf_pp7(void)
Definition: vf_pp7.c:59
checkasm.h
intreadwrite.h
declare_func
#define declare_func
Definition: test.h:489
vf_pp7dsp.h
randomize_buffer
#define randomize_buffer(buf)
Definition: vf_pp7.c:29
fail
#define fail
Definition: test.h:479
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:104
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
PP7Context::pp7dsp
PP7DSPContext pp7dsp
Definition: vf_pp7.c:63
check_dctB
static void check_dctB(const PP7DSPContext *const pp7dsp)
Definition: vf_pp7.c:37
PP7DSPContext
Definition: vf_pp7dsp.h:29
call_new
#define call_new
Definition: test.h:486
report
#define report
Definition: test.h:480
src
#define src
Definition: vp8dsp.c:248