FFmpeg
Loading...
Searching...
No Matches
h263dsp.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Rémi Denis-Courmont
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <string.h>
22
23#include "checkasm.h"
24
25#include "libavcodec/h263dsp.h"
26#include "libavutil/mem.h"
28
29typedef void (*filter)(uint8_t *src, ptrdiff_t stride, int qscale);
30
31static void check_loop_filter(char dim, filter func)
32{
33 LOCAL_ALIGNED_16(uint8_t, buf0, [32 * 32]);
34 LOCAL_ALIGNED_16(uint8_t, buf1, [32 * 32]);
35 int qscale = rnd() % 32;
36
37 declare_func(void, uint8_t *, ptrdiff_t, int);
38
39 for (size_t y = 0; y < 32; y++)
40 for (size_t x = 0; x < 32; x++)
41 buf0[y * 32 + x] = buf1[y * 32 + x] = rnd();
42
43 if (check_func(func, "h263dsp.%c_loop_filter", dim)) {
44 call_ref(buf0 + 8 * 33, 32, qscale);
45 call_new(buf1 + 8 * 33, 32, qscale);
46
47 if (memcmp(buf0, buf1, 32 * 32))
48 fail();
49
50 bench_new(buf1 + 8 * 33, 32, 1);
51 }
52}
53
55{
57
59 check_loop_filter('h', ctx.h263_h_loop_filter);
60 check_loop_filter('v', ctx.h263_v_loop_filter);
61 report("loop_filter");
62}
#define rnd
Definition checkasm.h:136
#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
av_cold void ff_h263dsp_init(H263DSPContext *ctx)
Definition h263dsp.c:117
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition jacosubdec.c:66
Memory handling functions.
#define LOCAL_ALIGNED_16(t, v,...)
#define stride
void checkasm_check_h263dsp(void)
Definition h263dsp.c:54
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
static void check_loop_filter(void)
Definition h264dsp.c:375
#define src
Definition vp8dsp.c:248
static AVFormatContext * ctx
Definition movenc.c:49
int dim