FFmpeg
tests
checkasm
v210enc.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Henrik Gramner
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
#include "
checkasm.h
"
23
#include "
libavcodec/v210enc_init.h
"
24
#include "
libavutil/common.h
"
25
#include "
libavutil/internal.h
"
26
#include "
libavutil/intreadwrite.h
"
27
#include "
libavutil/mem_internal.h
"
28
29
#define BUF_SIZE 512
30
31
#define randomize_buffers(mask) \
32
do { \
33
int i, size = sizeof(*y0); \
34
for (i = 0; i < BUF_SIZE; i += 4 / size) { \
35
uint32_t r = rnd() & mask; \
36
AV_WN32A(y0 + i, r); \
37
AV_WN32A(y1 + i, r); \
38
} \
39
for (i = 0; i < BUF_SIZE / 2; i += 4 / size) { \
40
uint32_t r = rnd() & mask; \
41
AV_WN32A(u0 + i, r); \
42
AV_WN32A(u1 + i, r); \
43
r = rnd() & mask; \
44
AV_WN32A(v0 + i, r); \
45
AV_WN32A(v1 + i, r); \
46
} \
47
for (i = 0; i < width * 8 / 3; i += 4) { \
48
uint32_t r = rnd(); \
49
AV_WN32A(dst0 + i, r); \
50
AV_WN32A(dst1 + i, r); \
51
} \
52
} while (0)
53
54
#define check_pack_line(type, mask) \
55
do { \
56
LOCAL_ALIGNED_16(type, y0, [BUF_SIZE]); \
57
LOCAL_ALIGNED_16(type, y1, [BUF_SIZE]); \
58
LOCAL_ALIGNED_16(type, u0, [BUF_SIZE / 2]); \
59
LOCAL_ALIGNED_16(type, u1, [BUF_SIZE / 2]); \
60
LOCAL_ALIGNED_16(type, v0, [BUF_SIZE / 2]); \
61
LOCAL_ALIGNED_16(type, v1, [BUF_SIZE / 2]); \
62
LOCAL_ALIGNED_16(uint8_t, dst0, [BUF_SIZE * 8 / 3]); \
63
LOCAL_ALIGNED_16(uint8_t, dst1, [BUF_SIZE * 8 / 3]); \
64
\
65
declare_func(void, const type * y, const type * u, const type * v, \
66
uint8_t * dst, ptrdiff_t width); \
67
ptrdiff_t width, step = 12 / sizeof(type); \
68
\
69
for (width = step; width < BUF_SIZE - 15; width += step) { \
70
int y_offset = rnd() & 15; \
71
int uv_offset = y_offset / 2; \
72
randomize_buffers(mask); \
73
call_ref(y0 + y_offset, u0 + uv_offset, v0 + uv_offset, dst0, width); \
74
call_new(y1 + y_offset, u1 + uv_offset, v1 + uv_offset, dst1, width); \
75
if (memcmp(y0, y1, BUF_SIZE * sizeof(type)) \
76
|| memcmp(u0, u1, BUF_SIZE * sizeof(type) / 2) \
77
|| memcmp(v0, v1, BUF_SIZE * sizeof(type) / 2) \
78
|| memcmp(dst0, dst1, width * 8 / 3)) \
79
fail(); \
80
bench_new(y1 + y_offset, u1 + uv_offset, v1 + uv_offset, dst1, width); \
81
} \
82
} while (0)
83
84
void
checkasm_check_v210enc
(
void
)
85
{
86
V210EncContext
h
;
87
88
ff_v210enc_init
(&
h
);
89
90
if
(
check_func
(
h
.pack_line_8,
"v210_planar_pack_8"
))
91
check_pack_line
(uint8_t, 0xffffffff);
92
93
if
(
check_func
(
h
.pack_line_10,
"v210_planar_pack_10"
))
94
check_pack_line
(uint16_t, 0x03ff03ff);
95
96
report
(
"planar_pack"
);
97
}
mem_internal.h
check_func
#define check_func(func,...)
Definition:
checkasm.h:129
check_pack_line
#define check_pack_line(type, mask)
Definition:
v210enc.c:54
checkasm.h
intreadwrite.h
V210EncContext
Definition:
v210enc.h:26
checkasm_check_v210enc
void checkasm_check_v210enc(void)
Definition:
v210enc.c:84
v210enc_init.h
report
#define report
Definition:
checkasm.h:141
internal.h
common.h
ff_v210enc_init
static av_cold av_unused void ff_v210enc_init(V210EncContext *s)
Definition:
v210enc_init.h:79
h
h
Definition:
vp9dsp_template.c:2038
Generated on Thu Apr 18 2024 22:42:11 for FFmpeg by
1.8.17