FFmpeg
4.4.5
tests
checkasm
llviddspenc.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 Alexandra Hájková
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 "
libavutil/common.h
"
24
#include "
libavutil/intreadwrite.h
"
25
#include "
libavutil/mem.h
"
26
#include "
libavutil/mem_internal.h
"
27
28
#include "
libavcodec/lossless_videoencdsp.h
"
29
30
#include "
checkasm.h
"
31
32
#define randomize_buffers(buf, size) \
33
do { \
34
int j; \
35
for (j = 0; j < size; j+=4) \
36
AV_WN32(buf + j, rnd()); \
37
} while (0)
38
39
static
const
struct
{
uint8_t
w
,
h
,
s
;}
planes
[] = {
40
{16,16,16}, {21,23,25}, {32,17,48}, {15,128,16}, {128,127,128}
41
};
42
43
#define MAX_STRIDE 128
44
#define MAX_HEIGHT 127
45
46
static
void
check_diff_bytes
(
LLVidEncDSPContext
*
c
)
47
{
48
int
i
;
49
LOCAL_ALIGNED_32
(
uint8_t
, dst0, [
MAX_STRIDE
]);
50
LOCAL_ALIGNED_32
(
uint8_t
, dst1, [
MAX_STRIDE
]);
51
LOCAL_ALIGNED_32
(
uint8_t
,
src0
, [
MAX_STRIDE
]);
52
LOCAL_ALIGNED_32
(
uint8_t
,
src1
, [
MAX_STRIDE
]);
53
LOCAL_ALIGNED_32
(
uint8_t
, src2, [
MAX_STRIDE
]);
54
LOCAL_ALIGNED_32
(
uint8_t
, src3, [
MAX_STRIDE
]);
55
56
declare_func_emms
(
AV_CPU_FLAG_MMX
,
void
,
uint8_t
*dst,
const
uint8_t
*
src1
,
57
const
uint8_t
*src2, intptr_t
w
);
58
59
memset(dst0, 0,
MAX_STRIDE
);
60
memset(dst1, 0,
MAX_STRIDE
);
61
randomize_buffers
(
src0
,
MAX_STRIDE
);
62
memcpy(
src1
,
src0
,
MAX_STRIDE
);
63
randomize_buffers
(src2,
MAX_STRIDE
);
64
memcpy(src3, src2,
MAX_STRIDE
);
65
66
if
(
check_func
(
c
->diff_bytes,
"diff_bytes"
)) {
67
for
(
i
= 0;
i
< 5;
i
++) {
68
call_ref
(dst0,
src0
, src2,
planes
[
i
].
w
);
69
call_new
(dst1,
src1
, src3,
planes
[
i
].
w
);
70
if
(memcmp(dst0, dst1,
planes
[
i
].
w
))
71
fail
();
72
}
73
bench_new
(dst1,
src0
, src2,
planes
[4].
w
);
74
}
75
}
76
77
static
void
check_sub_left_pred
(
LLVidEncDSPContext
*
c
)
78
{
79
int
i
;
80
LOCAL_ALIGNED_32
(
uint8_t
, dst0, [
MAX_STRIDE
*
MAX_HEIGHT
]);
81
LOCAL_ALIGNED_32
(
uint8_t
, dst1, [
MAX_STRIDE
*
MAX_HEIGHT
]);
82
LOCAL_ALIGNED_32
(
uint8_t
,
src0
, [
MAX_STRIDE
*
MAX_HEIGHT
]);
83
LOCAL_ALIGNED_32
(
uint8_t
,
src1
, [
MAX_STRIDE
*
MAX_HEIGHT
]);
84
85
declare_func_emms
(
AV_CPU_FLAG_MMX
,
void
,
uint8_t
*dst,
const
uint8_t
*
src
,
86
ptrdiff_t
stride
, ptrdiff_t
width
,
int
height
);
87
88
memset(dst0, 0,
MAX_STRIDE
*
MAX_HEIGHT
);
89
memset(dst1, 0,
MAX_STRIDE
*
MAX_HEIGHT
);
90
randomize_buffers
(
src0
,
MAX_STRIDE
*
MAX_HEIGHT
);
91
memcpy(
src1
,
src0
,
MAX_STRIDE
*
MAX_HEIGHT
);
92
93
if
(
check_func
(
c
->sub_left_predict,
"sub_left_predict"
)) {
94
for
(
i
= 0;
i
< 5;
i
++) {
95
call_ref
(dst0,
src0
,
planes
[
i
].
s
,
planes
[
i
].
w
,
planes
[
i
].
h
);
96
call_new
(dst1,
src1
,
planes
[
i
].
s
,
planes
[
i
].
w
,
planes
[
i
].
h
);
97
if
(memcmp(dst0, dst1,
planes
[
i
].
w
*
planes
[
i
].
h
))
98
fail
();
99
break
;
100
}
101
bench_new
(dst1,
src0
,
planes
[4].
s
,
planes
[4].
w
,
planes
[4].
h
);
102
}
103
}
104
105
void
checkasm_check_llviddspenc
(
void
)
106
{
107
LLVidEncDSPContext
c
;
108
ff_llvidencdsp_init
(&
c
);
109
110
check_diff_bytes
(&
c
);
111
report
(
"diff_bytes"
);
112
113
check_sub_left_pred
(&
c
);
114
report
(
"sub_left_predict"
);
115
}
uint8_t
uint8_t
Definition:
audio_convert.c:194
checkasm.h
call_new
#define call_new(...)
Definition:
checkasm.h:211
declare_func_emms
#define declare_func_emms(cpu_flags, ret,...)
Definition:
checkasm.h:130
check_func
#define check_func(func,...)
Definition:
checkasm.h:124
call_ref
#define call_ref(...)
Definition:
checkasm.h:139
fail
#define fail()
Definition:
checkasm.h:133
report
#define report
Definition:
checkasm.h:136
bench_new
#define bench_new(...)
Definition:
checkasm.h:271
common.h
common internal and external API header
AV_CPU_FLAG_MMX
#define AV_CPU_FLAG_MMX
standard MMX
Definition:
cpu.h:31
i
int i
Definition:
input.c:407
intreadwrite.h
check_sub_left_pred
static void check_sub_left_pred(LLVidEncDSPContext *c)
Definition:
llviddspenc.c:77
h
uint8_t h
Definition:
llviddspenc.c:39
checkasm_check_llviddspenc
void checkasm_check_llviddspenc(void)
Definition:
llviddspenc.c:105
s
uint8_t s
Definition:
llviddspenc.c:39
randomize_buffers
#define randomize_buffers(buf, size)
Definition:
llviddspenc.c:32
check_diff_bytes
static void check_diff_bytes(LLVidEncDSPContext *c)
Definition:
llviddspenc.c:46
MAX_HEIGHT
#define MAX_HEIGHT
Definition:
llviddspenc.c:44
w
uint8_t w
Definition:
llviddspenc.c:39
MAX_STRIDE
#define MAX_STRIDE
Definition:
llviddspenc.c:43
planes
static const struct @322 planes[]
ff_llvidencdsp_init
av_cold void ff_llvidencdsp_init(LLVidEncDSPContext *c)
Definition:
lossless_videoencdsp.c:91
lossless_videoencdsp.h
stride
int stride
Definition:
mace.c:144
mem.h
Memory handling functions.
mem_internal.h
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition:
mem_internal.h:136
LLVidEncDSPContext
Definition:
lossless_videoencdsp.h:26
src1
#define src1
Definition:
h264pred.c:140
src0
#define src0
Definition:
h264pred.c:139
src
#define src
Definition:
vp8dsp.c:255
height
#define height
width
#define width
c
static double c[64]
Definition:
vsrc_mptestsrc.c:92
Generated on Mon Jul 29 2024 05:33:29 for FFmpeg by
1.9.1