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
8dfc1227
Commit
8dfc1227
authored
Apr 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavr: add C functions for mixing 2 to 1 channels with s16p format
parent
52899558
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
audio_mix.c
libavresample/audio_mix.c
+50
-0
No files found.
libavresample/audio_mix.c
View file @
8dfc1227
...
...
@@ -115,6 +115,50 @@ static void mix_2_to_1_fltp_flt_c(float **samples, float **matrix, int len,
}
}
static
void
mix_2_to_1_s16p_flt_c
(
int16_t
**
samples
,
float
**
matrix
,
int
len
,
int
out_ch
,
int
in_ch
)
{
int16_t
*
src0
=
samples
[
0
];
int16_t
*
src1
=
samples
[
1
];
int16_t
*
dst
=
src0
;
float
m0
=
matrix
[
0
][
0
];
float
m1
=
matrix
[
0
][
1
];
while
(
len
>
4
)
{
*
dst
++
=
av_clip_int16
(
lrintf
(
*
src0
++
*
m0
+
*
src1
++
*
m1
));
*
dst
++
=
av_clip_int16
(
lrintf
(
*
src0
++
*
m0
+
*
src1
++
*
m1
));
*
dst
++
=
av_clip_int16
(
lrintf
(
*
src0
++
*
m0
+
*
src1
++
*
m1
));
*
dst
++
=
av_clip_int16
(
lrintf
(
*
src0
++
*
m0
+
*
src1
++
*
m1
));
len
-=
4
;
}
while
(
len
>
0
)
{
*
dst
++
=
av_clip_int16
(
lrintf
(
*
src0
++
*
m0
+
*
src1
++
*
m1
));
len
--
;
}
}
static
void
mix_2_to_1_s16p_q8_c
(
int16_t
**
samples
,
int16_t
**
matrix
,
int
len
,
int
out_ch
,
int
in_ch
)
{
int16_t
*
src0
=
samples
[
0
];
int16_t
*
src1
=
samples
[
1
];
int16_t
*
dst
=
src0
;
int16_t
m0
=
matrix
[
0
][
0
];
int16_t
m1
=
matrix
[
0
][
1
];
while
(
len
>
4
)
{
*
dst
++
=
(
*
src0
++
*
m0
+
*
src1
++
*
m1
)
>>
8
;
*
dst
++
=
(
*
src0
++
*
m0
+
*
src1
++
*
m1
)
>>
8
;
*
dst
++
=
(
*
src0
++
*
m0
+
*
src1
++
*
m1
)
>>
8
;
*
dst
++
=
(
*
src0
++
*
m0
+
*
src1
++
*
m1
)
>>
8
;
len
-=
4
;
}
while
(
len
>
0
)
{
*
dst
++
=
(
*
src0
++
*
m0
+
*
src1
++
*
m1
)
>>
8
;
len
--
;
}
}
static
void
mix_1_to_2_fltp_flt_c
(
float
**
samples
,
float
**
matrix
,
int
len
,
int
out_ch
,
int
in_ch
)
{
...
...
@@ -229,6 +273,12 @@ static int mix_function_init(AudioMix *am)
ff_audio_mix_set_func
(
am
,
AV_SAMPLE_FMT_FLTP
,
AV_MIX_COEFF_TYPE_FLT
,
2
,
1
,
1
,
1
,
"C"
,
mix_2_to_1_fltp_flt_c
);
ff_audio_mix_set_func
(
am
,
AV_SAMPLE_FMT_S16P
,
AV_MIX_COEFF_TYPE_FLT
,
2
,
1
,
1
,
1
,
"C"
,
mix_2_to_1_s16p_flt_c
);
ff_audio_mix_set_func
(
am
,
AV_SAMPLE_FMT_S16P
,
AV_MIX_COEFF_TYPE_Q8
,
2
,
1
,
1
,
1
,
"C"
,
mix_2_to_1_s16p_q8_c
);
ff_audio_mix_set_func
(
am
,
AV_SAMPLE_FMT_FLTP
,
AV_MIX_COEFF_TYPE_FLT
,
1
,
2
,
1
,
1
,
"C"
,
mix_1_to_2_fltp_flt_c
);
...
...
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