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 
23 #include "checkasm.h"
24 #include "libavfilter/vf_pp7dsp.h"
25 #include "libavutil/intreadwrite.h"
26 #include "libavutil/mem_internal.h"
27 
28 #define randomize_buffer(buf) \
29  do { \
30  static_assert(!(sizeof(buf) % 4), "Tail handling needed"); \
31  for (size_t k = 0; k < sizeof(buf); k += 4) { \
32  AV_WN32A((char*)buf + k, rnd()); \
33  } \
34  } while (0)
35 
36 static void check_dctB(const PP7DSPContext *const pp7dsp)
37 {
38  declare_func(void, int16_t *dst, const int16_t *src);
39 
40  if (!check_func(pp7dsp->dctB, "dctB"))
41  return;
42 
43  DECLARE_ALIGNED(8, int16_t, src)[7 * 4];
44  DECLARE_ALIGNED(8, int16_t, dst_ref)[6 * 4];
45  DECLARE_ALIGNED(8, int16_t, dst_new)[6 * 4];
46 
48  randomize_buffer(dst_ref);
49  memcpy(dst_new, dst_ref, sizeof(dst_new));
50  call_ref(dst_ref, src);
51  call_new(dst_new, src);
52  if (memcmp(dst_new, dst_ref, sizeof(dst_new)))
53  fail();
54 
55  bench_new(dst_new, src);
56 }
57 
59 {
61 
63 
65  report("dctB");
66 }
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(func,...)
Definition: checkasm.h:215
call_ref
#define call_ref(...)
Definition: checkasm.h:231
fail
#define fail()
Definition: checkasm.h:225
checkasm_check_vf_pp7
void checkasm_check_vf_pp7(void)
Definition: vf_pp7.c:58
checkasm.h
intreadwrite.h
vf_pp7dsp.h
randomize_buffer
#define randomize_buffer(buf)
Definition: vf_pp7.c:28
call_new
#define call_new(...)
Definition: checkasm.h:239
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:36
PP7DSPContext
Definition: vf_pp7dsp.h:29
report
#define report
Definition: checkasm.h:228
bench_new
#define bench_new(...)
Definition: checkasm.h:430
declare_func
#define declare_func(ret,...)
Definition: checkasm.h:220
src
#define src
Definition: vp8dsp.c:248