FFmpeg
Loading...
Searching...
No Matches
tests
checkasm
vf_eq.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/avfilter.h
"
22
#include "
libavfilter/vf_eq.h
"
23
#include "
libavutil/intreadwrite.h
"
24
#include "
libavutil/mem_internal.h
"
25
26
#define WIDTH 256
27
#define HEIGHT 256
28
#define SRC_STRIDE 256
29
#define PIXELS (WIDTH * HEIGHT)
30
#define RANDOM_RANGE 80000
31
#define SCALE 10000
32
33
#define randomize_buffers(buf, size) \
34
do { \
35
int j; \
36
uint8_t *tmp_buf = (uint8_t *)buf;\
37
for (j = 0; j< size; j++) \
38
tmp_buf[j] = rnd() & 0xFF; \
39
} while (0)
40
41
static
void
check_eq
(
void
)
42
{
43
LOCAL_ALIGNED_32
(uint8_t,
src
, [
PIXELS
]);
44
LOCAL_ALIGNED_32
(uint8_t, dst_ref, [
PIXELS
]);
45
LOCAL_ALIGNED_32
(uint8_t, dst_new, [
PIXELS
]);
46
int
w
=
WIDTH
;
47
int
h
=
HEIGHT
;
48
int
src_stride =
SRC_STRIDE
;
49
int
dst_stride =
SRC_STRIDE
;
50
EQParameters
pa;
51
EQContext
eq
;
52
declare_func
(
void
,
EQParameters
*param, uint8_t *
dst
,
int
dst_stride,
53
const
uint8_t *
src
,
int
src_stride,
int
w
,
int
h
);
54
55
double
rand_contrast = (int)(
rnd
() % (
RANDOM_RANGE
* 2) -
RANDOM_RANGE
) /
56
(
SCALE
* 1.0);
57
double
rand_brightness = (int)(
rnd
() % (
SCALE
* 2) -
SCALE
) /
58
(
SCALE
* 1.0);
59
pa.
contrast
= rand_contrast;
60
pa.
brightness
= rand_brightness;
61
62
memset(dst_ref, 0,
PIXELS
);
63
memset(dst_new, 0,
PIXELS
);
64
randomize_buffers
(
src
,
PIXELS
);
65
ff_eq_init
(&
eq
);
66
67
if
(
check_func
(
eq
.process,
"process"
)) {
68
call_ref
(&pa, dst_ref, dst_stride,
src
, src_stride,
w
,
h
);
69
call_new
(&pa, dst_new, dst_stride,
src
, src_stride,
w
,
h
);
70
if
(memcmp(dst_ref, dst_new,
PIXELS
))
71
fail
();
72
bench_new
(&pa, dst_new, dst_stride,
src
, src_stride,
w
,
h
);
73
}
74
}
75
76
void
checkasm_check_vf_eq
(
void
)
77
{
78
check_eq
();
79
report
(
"eq"
);
80
}
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition
dsp.h:87
avfilter.h
Main libavfilter public API header.
checkasm.h
rnd
#define rnd
Definition
checkasm.h:136
SCALE
#define SCALE(c)
Definition
dcadata.c:7338
declare_func
#define declare_func
Definition
test.h:489
fail
#define fail
Definition
test.h:479
bench_new
#define bench_new
Definition
test.h:487
check_func
#define check_func
Definition
test.h:481
call_new
#define call_new
Definition
test.h:486
call_ref
#define call_ref
Definition
test.h:485
report
#define report
Definition
test.h:480
intreadwrite.h
WIDTH
#define WIDTH
Definition
c93.c:45
HEIGHT
#define HEIGHT
Definition
c93.c:46
w
uint8_t w
Definition
llvidencdsp.c:39
mem_internal.h
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition
mem_internal.h:132
EQContext
Definition
vf_eq.h:56
EQParameters
Definition
vf_eq.h:45
EQParameters::contrast
double contrast
Definition
vf_eq.h:51
EQParameters::brightness
double brightness
Definition
vf_eq.h:51
SRC_STRIDE
#define SRC_STRIDE
Definition
vf_convolution.c:28
PIXELS
#define PIXELS
Definition
vf_convolution.c:29
RANDOM_RANGE
#define RANDOM_RANGE
Definition
vf_eq.c:30
randomize_buffers
#define randomize_buffers(buf, size)
Definition
vf_eq.c:33
check_eq
static void check_eq(void)
Definition
vf_eq.c:41
checkasm_check_vf_eq
void checkasm_check_vf_eq(void)
Definition
vf_eq.c:76
src
#define src
Definition
vp8dsp.c:248
vf_eq.h
ff_eq_init
static av_unused void ff_eq_init(EQContext *eq)
Definition
vf_eq.h:121
eq
#define eq(A, B)
Definition
vf_xbr.c:92
h
h
Definition
vp9dsp_template.c:2070
Generated on Sun Aug 16 2026 20:20:57 for FFmpeg by
1.13.2