FFmpeg
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"
27 #include "libavutil/mem_internal.h"
28 
29 typedef void (*filter)(uint8_t *src, int stride, int qscale);
30 
31 static 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_emms(AV_CPU_FLAG_MMX, void, uint8_t *, int, 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 }
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
declare_func_emms
#define declare_func_emms(cpu_flags, ret,...)
Definition: checkasm.h:181
mem_internal.h
h263dsp.h
check_func
#define check_func(func,...)
Definition: checkasm.h:175
filter
void(* filter)(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:29
call_ref
#define call_ref(...)
Definition: checkasm.h:190
fail
#define fail()
Definition: checkasm.h:184
checkasm.h
rnd
#define rnd()
Definition: checkasm.h:168
H263DSPContext
Definition: h263dsp.h:26
LOCAL_ALIGNED_16
#define LOCAL_ALIGNED_16(t, v,...)
Definition: mem_internal.h:150
ctx
AVFormatContext * ctx
Definition: movenc.c:49
call_new
#define call_new(...)
Definition: checkasm.h:293
check_loop_filter
static void check_loop_filter(char dim, filter func)
Definition: h263dsp.c:31
ff_h263dsp_init
av_cold void ff_h263dsp_init(H263DSPContext *ctx)
Definition: h263dsp.c:117
report
#define report
Definition: checkasm.h:187
bench_new
#define bench_new(...)
Definition: checkasm.h:364
stride
#define stride
Definition: h264pred_template.c:537
dim
int dim
Definition: vorbis_enc_data.h:425
AV_CPU_FLAG_MMX
#define AV_CPU_FLAG_MMX
standard MMX
Definition: cpu.h:29
mem.h
checkasm_check_h263dsp
void checkasm_check_h263dsp(void)
Definition: h263dsp.c:54
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418