FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
tests
checkasm
bswapdsp.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/bswapdsp.h
"
24
#include "
libavutil/common.h
"
25
#include "
libavutil/internal.h
"
26
#include "
libavutil/intreadwrite.h
"
27
28
#define BUF_SIZE 512
29
30
#define randomize_buffers() \
31
do { \
32
int i; \
33
for (i = 0; i < BUF_SIZE; i += 4) { \
34
uint32_t r = rnd(); \
35
AV_WN32A(src0 + i, r); \
36
AV_WN32A(src1 + i, r); \
37
r = rnd(); \
38
AV_WN32A(dst0 + i, r); \
39
AV_WN32A(dst1 + i, r); \
40
} \
41
} while (0)
42
43
#define check_bswap(type) \
44
do { \
45
int w; \
46
declare_func(void, type *dst, const type *src, int w); \
47
\
48
for (w = 0; w < BUF_SIZE / sizeof(type); w++) { \
49
int offset = (BUF_SIZE / sizeof(type) - w) & 15;
/* Test various alignments */
\
50
randomize_buffers(); \
51
call_ref((type *)dst0 + offset, (type *)src0 + offset, w); \
52
call_new((type *)dst1 + offset, (type *)src1 + offset, w); \
53
if (memcmp(src0, src1, BUF_SIZE) || memcmp(dst0, dst1, BUF_SIZE)) \
54
fail(); \
55
bench_new((type *)dst1 + offset, (type *)src1 + offset, w); \
56
} \
57
} while (0)
58
59
void
checkasm_check_bswapdsp
(
void
)
60
{
61
LOCAL_ALIGNED_16
(
uint8_t
,
src0
, [
BUF_SIZE
]);
62
LOCAL_ALIGNED_16
(
uint8_t
,
src1
, [
BUF_SIZE
]);
63
LOCAL_ALIGNED_16
(
uint8_t
, dst0, [
BUF_SIZE
]);
64
LOCAL_ALIGNED_16
(
uint8_t
, dst1, [
BUF_SIZE
]);
65
BswapDSPContext
h
;
66
67
ff_bswapdsp_init
(&h);
68
69
if
(
check_func
(h.
bswap_buf
,
"bswap_buf"
))
70
check_bswap
(uint32_t);
71
72
if
(
check_func
(h.
bswap16_buf
,
"bswap16_buf"
))
73
check_bswap
(uint16_t);
74
75
report
(
"bswap"
);
76
}
BswapDSPContext::bswap_buf
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
Definition:
bswapdsp.h:25
h
h
Definition:
vp9dsp_template.c:2038
BUF_SIZE
#define BUF_SIZE
Definition:
bswapdsp.c:28
BswapDSPContext::bswap16_buf
void(* bswap16_buf)(uint16_t *dst, const uint16_t *src, int len)
Definition:
bswapdsp.h:26
report
#define report
Definition:
checkasm.h:119
uint8_t
uint8_t
Definition:
audio_convert.c:194
checkasm.h
internal.h
common internal API header
intreadwrite.h
src1
#define src1
Definition:
h264pred.c:139
BswapDSPContext
Definition:
bswapdsp.h:24
check_func
#define check_func(func,...)
Definition:
checkasm.h:107
src0
#define src0
Definition:
h264pred.c:138
common.h
common internal and external API header
check_bswap
#define check_bswap(type)
Definition:
bswapdsp.c:43
ff_bswapdsp_init
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
Definition:
bswapdsp.c:49
bswapdsp.h
LOCAL_ALIGNED_16
#define LOCAL_ALIGNED_16(t, v,...)
Definition:
internal.h:131
checkasm_check_bswapdsp
void checkasm_check_bswapdsp(void)
Definition:
bswapdsp.c:59
Generated on Sun May 13 2018 02:03:43 for FFmpeg by
1.8.6