FFmpeg
Loading...
Searching...
No Matches
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"
23#include <stddef.h>
24#include <stdint.h>
25
26#define WIDTH 256
27#define HEIGHT 16
28#define WIDTH_PADDED (WIDTH + 32)
29
30static void check_limiter(int depth)
31{
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
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);
53
56
57 if (memcmp(dst_ref, dst_new, HEIGHT * WIDTH_PADDED))
58 fail();
59
61 }
62}
63
65{
67 report("limiter8");
68
69 check_limiter(16);
70 report("limiter16");
71}
#define s(width, name)
Definition cbs_vp9.c:198
#define min(a, b)
#define max(a, b)
#define declare_func
Definition test.h:489
#define fail
Definition test.h:479
#define bench_new
Definition test.h:487
#define check_func
Definition test.h:481
#define call_new
Definition test.h:486
#define call_ref
Definition test.h:485
#define report
Definition test.h:480
CHECKASM_API void checkasm_randomize(void *buf, size_t bytes)
Fill a buffer with uniformly chosen random bytes.
Definition utils.c:290
#define WIDTH
Definition c93.c:45
#define HEIGHT
Definition c93.c:46
uint8_t w
Definition llvidencdsp.c:39
#define LOCAL_ALIGNED_32(t, v,...)
#define WIDTH_PADDED
Definition utvideodsp.c:30
void checkasm_check_vf_limiter(void)
Definition vf_limiter.c:64
static void check_limiter(int depth)
Definition vf_limiter.c:30
#define src
Definition vp8dsp.c:248
static av_unused void ff_limiter_init(LimiterDSPContext *s, int depth)