Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
285e41c3
Commit
285e41c3
authored
Oct 06, 2015
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkasm: add alacdsp tests
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
72254b19
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
0 deletions
+124
-0
Makefile
tests/checkasm/Makefile
+1
-0
alacdsp.c
tests/checkasm/alacdsp.c
+119
-0
checkasm.c
tests/checkasm/checkasm.c
+3
-0
checkasm.h
tests/checkasm/checkasm.h
+1
-0
No files found.
tests/checkasm/Makefile
View file @
285e41c3
# libavcodec tests
AVCODECOBJS-$(CONFIG_ALAC_DECODER)
+=
alacdsp.o
AVCODECOBJS-$(CONFIG_BSWAPDSP)
+=
bswapdsp.o
AVCODECOBJS-$(CONFIG_FLACDSP)
+=
flacdsp.o
AVCODECOBJS-$(CONFIG_H264PRED)
+=
h264pred.o
...
...
tests/checkasm/alacdsp.c
0 → 100644
View file @
285e41c3
/*
* Copyright (c) 2015 James Almer
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string.h>
#include "checkasm.h"
#include "libavcodec/alacdsp.h"
#include "libavcodec/mathops.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#define BUF_SIZE 256
#define MAX_CHANNELS 2
#define randomize_buffers() \
do { \
int i; \
for (i = 0; i < BUF_SIZE*MAX_CHANNELS; i++) { \
int32_t r = sign_extend(rnd(), 24); \
ref_buf[i] = r; \
new_buf[i] = r; \
} \
} while (0)
static
void
check_decorrelate_stereo
(
void
)
{
LOCAL_ALIGNED_16
(
int32_t
,
ref_buf
,
[
BUF_SIZE
*
MAX_CHANNELS
]);
LOCAL_ALIGNED_16
(
int32_t
,
new_buf
,
[
BUF_SIZE
*
MAX_CHANNELS
]);
int32_t
*
ref
[
2
]
=
{
&
ref_buf
[
BUF_SIZE
*
0
],
&
ref_buf
[
BUF_SIZE
*
1
]
};
int32_t
*
new
[
2
]
=
{
&
new_buf
[
BUF_SIZE
*
0
],
&
new_buf
[
BUF_SIZE
*
1
]
};
ALACDSPContext
c
;
ff_alacdsp_init
(
&
c
);
if
(
check_func
(
c
.
decorrelate_stereo
,
"alac_decorrelate_stereo"
))
{
int
len
=
(
rnd
()
&
0xFF
)
+
1
;
int
shift
=
rnd
()
&
0x1F
;
int
weight
=
rnd
()
&
0xFF
;
declare_func
(
void
,
int32_t
*
buf
[
2
],
int
len
,
int
shift
,
int
weight
);
randomize_buffers
();
call_ref
(
ref
,
len
,
shift
,
weight
);
call_new
(
new
,
len
,
shift
,
weight
);
if
(
memcmp
(
ref
[
0
],
new
[
0
],
len
*
sizeof
(
int32_t
))
||
memcmp
(
ref
[
1
],
new
[
1
],
len
*
sizeof
(
int32_t
)))
fail
();
bench_new
(
new
,
BUF_SIZE
,
shift
,
weight
);
}
report
(
"decorrelate_stereo"
);
}
#undef randomize_buffers
#define randomize_buffers() \
do { \
int i, j; \
for (i = 0; i < BUF_SIZE; i++) { \
for (j = 0; j < ch; j++) { \
int32_t r = sign_extend(rnd(), 24); \
ref[j][i] = r; \
new[j][i] = r; \
r = rnd() & 0xFF; \
ref_ebb[j][i] = r; \
new_ebb[j][i] = r; \
} \
} \
} while (0)
static
void
check_append_extra_bits
(
void
)
{
LOCAL_ALIGNED_16
(
int32_t
,
ref_buf
,
[
BUF_SIZE
*
MAX_CHANNELS
*
2
]);
LOCAL_ALIGNED_16
(
int32_t
,
new_buf
,
[
BUF_SIZE
*
MAX_CHANNELS
*
2
]);
int32_t
*
ref
[
2
]
=
{
&
ref_buf
[
BUF_SIZE
*
0
],
&
ref_buf
[
BUF_SIZE
*
1
]
};
int32_t
*
new
[
2
]
=
{
&
new_buf
[
BUF_SIZE
*
0
],
&
new_buf
[
BUF_SIZE
*
1
]
};
int32_t
*
ref_ebb
[
2
]
=
{
&
ref_buf
[
BUF_SIZE
*
2
],
&
ref_buf
[
BUF_SIZE
*
3
]
};
int32_t
*
new_ebb
[
2
]
=
{
&
new_buf
[
BUF_SIZE
*
2
],
&
new_buf
[
BUF_SIZE
*
3
]
};
ALACDSPContext
c
;
static
const
char
*
const
channels
[
2
]
=
{
"mono"
,
"stereo"
};
int
ch
;
ff_alacdsp_init
(
&
c
);
for
(
ch
=
1
;
ch
<=
2
;
ch
++
)
{
if
(
check_func
(
c
.
append_extra_bits
[
ch
-
1
],
"alac_append_extra_bits_%s"
,
channels
[
ch
-
1
]))
{
int
len
=
(
rnd
()
&
0xFF
)
+
1
;
declare_func
(
void
,
int32_t
*
buf
[
2
],
int32_t
*
ebb
[
2
],
int
ebits
,
int
ch
,
int
len
);
randomize_buffers
();
call_ref
(
ref
,
ref_ebb
,
8
,
ch
,
len
);
call_new
(
new
,
new_ebb
,
8
,
ch
,
len
);
if
(
memcmp
(
ref
[
0
],
new
[
0
],
len
*
sizeof
(
int32_t
))
||
(
ch
==
2
&&
memcmp
(
ref
[
1
],
new
[
1
],
len
*
sizeof
(
int32_t
))))
fail
();
bench_new
(
new
,
new_ebb
,
8
,
ch
,
BUF_SIZE
);
}
}
report
(
"append_extra_bits"
);
}
void
checkasm_check_alacdsp
(
void
)
{
check_decorrelate_stereo
();
check_append_extra_bits
();
}
tests/checkasm/checkasm.c
View file @
285e41c3
...
...
@@ -58,6 +58,9 @@ static const struct {
void
(
*
func
)(
void
);
}
tests
[]
=
{
#if CONFIG_AVCODEC
#if CONFIG_ALAC_DECODER
{
"alacdsp"
,
checkasm_check_alacdsp
},
#endif
#if CONFIG_BSWAPDSP
{
"bswapdsp"
,
checkasm_check_bswapdsp
},
#endif
...
...
tests/checkasm/checkasm.h
View file @
285e41c3
...
...
@@ -29,6 +29,7 @@
#include "libavutil/lfg.h"
#include "libavutil/timer.h"
void
checkasm_check_alacdsp
(
void
);
void
checkasm_check_bswapdsp
(
void
);
void
checkasm_check_flacdsp
(
void
);
void
checkasm_check_h264pred
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment