FFmpeg
Loading...
Searching...
No Matches
tests
checkasm
vf_limiter.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 "
checkasm.h
"
20
#include "
libavfilter/limiter.h
"
21
#include "
libavfilter/vf_limiter_init.h
"
22
#include "
libavutil/mem_internal.h
"
23
#include <stddef.h>
24
#include <stdint.h>
25
26
#define WIDTH 256
27
#define HEIGHT 16
28
#define WIDTH_PADDED (WIDTH + 32)
29
30
static
void
check_limiter
(
int
depth)
31
{
32
LOCAL_ALIGNED_32
(uint8_t,
src
, [
HEIGHT
*
WIDTH_PADDED
]);
33
LOCAL_ALIGNED_32
(uint8_t, dst_ref, [
HEIGHT
*
WIDTH_PADDED
]);
34
LOCAL_ALIGNED_32
(uint8_t, dst_new, [
HEIGHT
*
WIDTH_PADDED
]);
35
36
declare_func
(
void
,
const
uint8_t *, uint8_t *,
37
ptrdiff_t, ptrdiff_t,
int
,
int
,
int
,
int
);
38
39
const
int
min
= 16 << (depth - 8);
40
const
int
max
= 235 << (depth - 8);
41
42
int
w
=
WIDTH
;
43
if
(depth == 16)
44
w
/= 2;
45
46
LimiterDSPContext
s
;
47
ff_limiter_init
(&
s
, depth);
48
49
if
(
check_func
(
s
.limiter,
"limiter%d"
, depth)) {
50
memset(dst_ref, 0,
HEIGHT
*
WIDTH_PADDED
);
51
memset(dst_new, 0,
HEIGHT
*
WIDTH_PADDED
);
52
checkasm_randomize
(
src
,
HEIGHT
*
WIDTH_PADDED
);
53
54
call_ref
(
src
, dst_ref,
WIDTH_PADDED
,
WIDTH_PADDED
,
w
,
HEIGHT
,
min
,
max
);
55
call_new
(
src
, dst_new,
WIDTH_PADDED
,
WIDTH_PADDED
,
w
,
HEIGHT
,
min
,
max
);
56
57
if
(memcmp(dst_ref, dst_new,
HEIGHT
*
WIDTH_PADDED
))
58
fail
();
59
60
bench_new
(
src
, dst_new,
WIDTH_PADDED
,
WIDTH_PADDED
,
w
,
HEIGHT
,
min
,
max
);
61
}
62
}
63
64
void
checkasm_check_vf_limiter
(
void
)
65
{
66
check_limiter
(8);
67
report
(
"limiter8"
);
68
69
check_limiter
(16);
70
report
(
"limiter16"
);
71
}
s
#define s(width, name)
Definition
cbs_vp9.c:198
checkasm.h
min
#define min(a, b)
Definition
cuda_runtime.h:34
max
#define max(a, b)
Definition
cuda_runtime.h:33
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
checkasm_randomize
CHECKASM_API void checkasm_randomize(void *buf, size_t bytes)
Fill a buffer with uniformly chosen random bytes.
Definition
utils.c:290
WIDTH
#define WIDTH
Definition
c93.c:45
HEIGHT
#define HEIGHT
Definition
c93.c:46
limiter.h
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
LimiterDSPContext
Definition
limiter.h:25
WIDTH_PADDED
#define WIDTH_PADDED
Definition
utvideodsp.c:30
checkasm_check_vf_limiter
void checkasm_check_vf_limiter(void)
Definition
vf_limiter.c:64
check_limiter
static void check_limiter(int depth)
Definition
vf_limiter.c:30
src
#define src
Definition
vp8dsp.c:248
vf_limiter_init.h
ff_limiter_init
static av_unused void ff_limiter_init(LimiterDSPContext *s, int depth)
Definition
vf_limiter_init.h:47
Generated on Fri Nov 13 2026 19:21:04 for FFmpeg by
1.13.2