FFmpeg
4.0
tests
checkasm
vf_hflip.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
#include "
checkasm.h
"
21
#include "
libavfilter/hflip.h
"
22
#include "
libavutil/intreadwrite.h
"
23
24
#define WIDTH 256
25
#define WIDTH_PADDED 256 + 32
26
27
#define randomize_buffers(buf, size) \
28
do { \
29
int j; \
30
uint8_t *tmp_buf = (uint8_t *)buf;\
31
for (j = 0; j < size; j++) \
32
tmp_buf[j] = rnd() & 0xFF; \
33
} while (0)
34
35
static
void
check_hflip
(
int
step,
const
char
* report_name){
36
LOCAL_ALIGNED_32
(
uint8_t
,
src
, [
WIDTH_PADDED
]);
37
LOCAL_ALIGNED_32
(
uint8_t
, dst_ref, [
WIDTH_PADDED
]);
38
LOCAL_ALIGNED_32
(
uint8_t
, dst_new, [
WIDTH_PADDED
]);
39
int
w
=
WIDTH
;
40
int
i;
41
int
step_array[4] = {1, 1, 1, 1};
42
FlipContext
s
;
43
44
declare_func
(
void
,
const
uint8_t
*
src
,
uint8_t
*dst,
int
w);
45
46
memset(src, 0,
WIDTH_PADDED
);
47
memset(dst_ref, 0,
WIDTH_PADDED
);
48
memset(dst_new, 0,
WIDTH_PADDED
);
49
randomize_buffers
(src,
WIDTH_PADDED
);
50
51
if
(step == 2) {
52
w /= 2;
53
for
(i = 0; i < 4; i++)
54
step_array[i] = step;
55
}
56
57
ff_hflip_init
(&s, step_array, 4);
58
59
if
(
check_func
(s.
flip_line
[0],
"hflip_%s"
, report_name)) {
60
for
(i = 1; i <
w
; i++) {
61
call_ref
(src + (w - 1) * step, dst_ref, i);
62
call_new
(src + (w - 1) * step, dst_new, i);
63
if
(memcmp(dst_ref, dst_new, i * step))
64
fail
();
65
}
66
bench_new
(src + (w - 1) * step, dst_new, w);
67
}
68
}
69
void
checkasm_check_vf_hflip
(
void
)
70
{
71
check_hflip
(1,
"byte"
);
72
report
(
"hflip_byte"
);
73
74
check_hflip
(2,
"short"
);
75
report
(
"hflip_short"
);
76
}
s
const char * s
Definition:
avisynth_c.h:768
randomize_buffers
#define randomize_buffers(buf, size)
Definition:
vf_hflip.c:27
checkasm_check_vf_hflip
void checkasm_check_vf_hflip(void)
Definition:
vf_hflip.c:69
WIDTH_PADDED
#define WIDTH_PADDED
Definition:
vf_hflip.c:25
src
#define src
Definition:
vp8dsp.c:254
report
#define report
Definition:
checkasm.h:119
uint8_t
uint8_t
Definition:
audio_convert.c:194
FlipContext
Definition:
hflip.h:27
checkasm.h
declare_func
#define declare_func(ret,...)
Definition:
checkasm.h:111
fail
#define fail()
Definition:
checkasm.h:116
intreadwrite.h
w
uint8_t w
Definition:
llviddspenc.c:38
hflip.h
call_ref
#define call_ref(...)
Definition:
checkasm.h:122
WIDTH
#define WIDTH
Definition:
vf_hflip.c:24
ff_hflip_init
int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
Definition:
vf_hflip.c:147
check_func
#define check_func(func,...)
Definition:
checkasm.h:107
FlipContext::flip_line
void(* flip_line[4])(const uint8_t *src, uint8_t *dst, int w)
Definition:
hflip.h:33
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition:
internal.h:137
check_hflip
static void check_hflip(int step, const char *report_name)
Definition:
vf_hflip.c:35
bench_new
#define bench_new(...)
Definition:
checkasm.h:249
call_new
#define call_new(...)
Definition:
checkasm.h:189
Generated on Tue May 22 2018 07:06:49 for FFmpeg by
1.8.13