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
4e4dd717
Commit
4e4dd717
authored
Apr 20, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavr: Add x86-optimized function for flt to s32 conversion
parent
6c63cbfe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
audio_convert.asm
libavresample/x86/audio_convert.asm
+42
-0
audio_convert_init.c
libavresample/x86/audio_convert_init.c
+7
-0
No files found.
libavresample/x86/audio_convert.asm
View file @
4e4dd717
...
...
@@ -27,6 +27,7 @@
SECTION_RODATA
32
pf_s32_inv_scale
:
times
8
dd
0x30000000
pf_s32_scale
:
times
8
dd
0x4f000000
pf_s16_inv_scale
:
times
4
dd
0x38000000
pf_s16_scale
:
times
4
dd
0x47000000
...
...
@@ -191,6 +192,47 @@ cglobal conv_flt_to_s16, 3,3,5, dst, src, len
jl
.
loop
REP_RET
;------------------------------------------------------------------------------
; void ff_conv_flt_to_s32(int32_t *dst, const float *src, int len);
;------------------------------------------------------------------------------
%macro
CONV_FLT_TO_S32
0
cglobal
conv_flt_to_s32
,
3
,
3
,
5
,
dst
,
src
,
len
lea
lenq
,
[
lend
*
4
]
add
srcq
,
lenq
add
dstq
,
lenq
neg
lenq
mova
m4
,
[
pf_s32_scale
]
.
loop
:
mulps
m0
,
m4
,
[
srcq
+
lenq
]
mulps
m1
,
m4
,
[
srcq
+
lenq
+
1
*
mmsize
]
mulps
m2
,
m4
,
[
srcq
+
lenq
+
2
*
mmsize
]
mulps
m3
,
m4
,
[
srcq
+
lenq
+
3
*
mmsize
]
cvtps2dq
m0
,
m0
cvtps2dq
m1
,
m1
cvtps2dq
m2
,
m2
cvtps2dq
m3
,
m3
mova
[
dstq
+
lenq
]
,
m0
mova
[
dstq
+
lenq
+
1
*
mmsize
]
,
m1
mova
[
dstq
+
lenq
+
2
*
mmsize
]
,
m2
mova
[
dstq
+
lenq
+
3
*
mmsize
]
,
m3
add
lenq
,
mmsize
*
4
jl
.
loop
%if
mmsize
==
32
vzeroupper
RET
%else
REP_RET
%endif
%endmacro
INIT_XMM
sse2
CONV_FLT_TO_S32
%if
HAVE_AVX
INIT_YMM
avx
CONV_FLT_TO_S32
%endif
;-----------------------------------------------------------------------------
; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len,
; int channels);
...
...
libavresample/x86/audio_convert_init.c
View file @
4e4dd717
...
...
@@ -35,6 +35,9 @@ extern void ff_conv_s32_to_flt_avx (float *dst, const int32_t *src, int len);
extern
void
ff_conv_flt_to_s16_sse2
(
int16_t
*
dst
,
const
float
*
src
,
int
len
);
extern
void
ff_conv_flt_to_s32_sse2
(
int32_t
*
dst
,
const
float
*
src
,
int
len
);
extern
void
ff_conv_flt_to_s32_avx
(
int32_t
*
dst
,
const
float
*
src
,
int
len
);
extern
void
ff_conv_fltp_to_flt_6ch_mmx
(
float
*
dst
,
float
*
const
*
src
,
int
len
);
extern
void
ff_conv_fltp_to_flt_6ch_sse4
(
float
*
dst
,
float
*
const
*
src
,
int
len
);
extern
void
ff_conv_fltp_to_flt_6ch_avx
(
float
*
dst
,
float
*
const
*
src
,
int
len
);
...
...
@@ -71,6 +74,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
0
,
16
,
8
,
"SSE2"
,
ff_conv_s32_to_flt_sse2
);
ff_audio_convert_set_func
(
ac
,
AV_SAMPLE_FMT_S16
,
AV_SAMPLE_FMT_FLT
,
0
,
16
,
16
,
"SSE2"
,
ff_conv_flt_to_s16_sse2
);
ff_audio_convert_set_func
(
ac
,
AV_SAMPLE_FMT_S32
,
AV_SAMPLE_FMT_FLT
,
0
,
16
,
16
,
"SSE2"
,
ff_conv_flt_to_s32_sse2
);
}
if
(
mm_flags
&
AV_CPU_FLAG_SSE4
&&
HAVE_SSE
)
{
ff_audio_convert_set_func
(
ac
,
AV_SAMPLE_FMT_FLT
,
AV_SAMPLE_FMT_S16
,
...
...
@@ -79,6 +84,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
if
(
mm_flags
&
AV_CPU_FLAG_AVX
&&
HAVE_AVX
)
{
ff_audio_convert_set_func
(
ac
,
AV_SAMPLE_FMT_FLT
,
AV_SAMPLE_FMT_S32
,
0
,
32
,
16
,
"AVX"
,
ff_conv_s32_to_flt_avx
);
ff_audio_convert_set_func
(
ac
,
AV_SAMPLE_FMT_S32
,
AV_SAMPLE_FMT_FLT
,
0
,
32
,
32
,
"AVX"
,
ff_conv_flt_to_s32_avx
);
}
#endif
}
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