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
9719f25e
Commit
9719f25e
authored
Oct 10, 2011
by
Clément Bœsch
Committed by
Clément Bœsch
Oct 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swresample: fix broken indent.
parent
0a23067a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
44 deletions
+44
-44
rematrix.c
libswresample/rematrix.c
+7
-7
resample2.c
libswresample/resample2.c
+37
-37
No files found.
libswresample/rematrix.c
View file @
9719f25e
...
...
@@ -215,20 +215,20 @@ int swr_rematrix_init(SwrContext *s){
s
->
matrix16
[
i
][
j
]
=
lrintf
(
s
->
matrix
[
i
][
j
]
*
32768
);
}
}
for
(
i
=
0
;
i
<
av_get_channel_layout_nb_channels
(
s
->
out_ch_layout
);
i
++
){
for
(
j
=
0
;
j
<
av_get_channel_layout_nb_channels
(
s
->
in_ch_layout
);
j
++
){
av_log
(
NULL
,
AV_LOG_DEBUG
,
"%f "
,
s
->
matrix
[
i
][
j
]);
}
av_log
(
NULL
,
AV_LOG_DEBUG
,
"
\n
"
);
for
(
i
=
0
;
i
<
av_get_channel_layout_nb_channels
(
s
->
out_ch_layout
);
i
++
){
for
(
j
=
0
;
j
<
av_get_channel_layout_nb_channels
(
s
->
in_ch_layout
);
j
++
){
av_log
(
NULL
,
AV_LOG_DEBUG
,
"%f "
,
s
->
matrix
[
i
][
j
]);
}
av_log
(
NULL
,
AV_LOG_DEBUG
,
"
\n
"
);
}
return
0
;
}
int
swr_rematrix
(
SwrContext
*
s
,
AudioData
*
out
,
AudioData
*
in
,
int
len
,
int
mustcopy
){
int
out_i
,
in_i
,
i
,
j
;
av_assert0
(
out
->
ch_count
==
av_get_channel_layout_nb_channels
(
s
->
out_ch_layout
));
av_assert0
(
in
->
ch_count
==
av_get_channel_layout_nb_channels
(
s
->
in_ch_layout
));
av_assert0
(
out
->
ch_count
==
av_get_channel_layout_nb_channels
(
s
->
out_ch_layout
));
av_assert0
(
in
->
ch_count
==
av_get_channel_layout_nb_channels
(
s
->
in_ch_layout
));
for
(
out_i
=
0
;
out_i
<
out
->
ch_count
;
out_i
++
){
switch
(
s
->
matrix_ch
[
out_i
][
0
]){
...
...
libswresample/resample2.c
View file @
9719f25e
...
...
@@ -259,7 +259,7 @@ int swr_resample(AVResampleContext *c, short *dst, short *src, int *consumed, in
int
dst_incr
=
c
->
dst_incr
/
c
->
src_incr
;
int
compensation_distance
=
c
->
compensation_distance
;
if
(
compensation_distance
==
0
&&
c
->
filter_length
==
1
&&
c
->
phase_shift
==
0
){
if
(
compensation_distance
==
0
&&
c
->
filter_length
==
1
&&
c
->
phase_shift
==
0
){
int64_t
index2
=
((
int64_t
)
index
)
<<
32
;
int64_t
incr
=
(
1LL
<<
32
)
*
c
->
dst_incr
/
c
->
src_incr
;
dst_size
=
FFMIN
(
dst_size
,
(
src_size
-
1
-
index
)
*
(
int64_t
)
c
->
src_incr
/
c
->
dst_incr
);
...
...
@@ -272,51 +272,51 @@ int swr_resample(AVResampleContext *c, short *dst, short *src, int *consumed, in
index
+=
dst_index
*
dst_incr
;
index
+=
frac
/
c
->
src_incr
;
frac
%=
c
->
src_incr
;
}
else
{
for
(
dst_index
=
0
;
dst_index
<
dst_size
;
dst_index
++
){
FELEM
*
filter
=
c
->
filter_bank
+
c
->
filter_length
*
(
index
&
c
->
phase_mask
);
int
sample_index
=
index
>>
c
->
phase_shift
;
FELEM2
val
=
0
;
if
(
sample_index
<
0
){
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
val
+=
src
[
FFABS
(
sample_index
+
i
)
%
src_size
]
*
filter
[
i
];
}
else
if
(
sample_index
+
c
->
filter_length
>
src_size
){
break
;
}
else
if
(
c
->
linear
){
FELEM2
v2
=
0
;
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
){
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
v2
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
+
c
->
filter_length
];
}
val
+=
(
v2
-
val
)
*
(
FELEML
)
frac
/
c
->
src_incr
;
}
else
{
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
){
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
}
else
{
for
(
dst_index
=
0
;
dst_index
<
dst_size
;
dst_index
++
){
FELEM
*
filter
=
c
->
filter_bank
+
c
->
filter_length
*
(
index
&
c
->
phase_mask
);
int
sample_index
=
index
>>
c
->
phase_shift
;
FELEM2
val
=
0
;
if
(
sample_index
<
0
){
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
val
+=
src
[
FFABS
(
sample_index
+
i
)
%
src_size
]
*
filter
[
i
];
}
else
if
(
sample_index
+
c
->
filter_length
>
src_size
){
break
;
}
else
if
(
c
->
linear
){
FELEM2
v2
=
0
;
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
){
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
v2
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
+
c
->
filter_length
];
}
val
+=
(
v2
-
val
)
*
(
FELEML
)
frac
/
c
->
src_incr
;
}
else
{
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
){
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
}
}
}
#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE
dst
[
dst_index
]
=
av_clip_int16
(
lrintf
(
val
));
dst
[
dst_index
]
=
av_clip_int16
(
lrintf
(
val
));
#else
val
=
(
val
+
(
1
<<
(
FILTER_SHIFT
-
1
)))
>>
FILTER_SHIFT
;
dst
[
dst_index
]
=
(
unsigned
)(
val
+
32768
)
>
65535
?
(
val
>>
31
)
^
32767
:
val
;
val
=
(
val
+
(
1
<<
(
FILTER_SHIFT
-
1
)))
>>
FILTER_SHIFT
;
dst
[
dst_index
]
=
(
unsigned
)(
val
+
32768
)
>
65535
?
(
val
>>
31
)
^
32767
:
val
;
#endif
frac
+=
dst_incr_frac
;
index
+=
dst_incr
;
if
(
frac
>=
c
->
src_incr
){
frac
-=
c
->
src_incr
;
index
++
;
}
frac
+=
dst_incr_frac
;
index
+=
dst_incr
;
if
(
frac
>=
c
->
src_incr
){
frac
-=
c
->
src_incr
;
index
++
;
}
if
(
dst_index
+
1
==
compensation_distance
){
compensation_distance
=
0
;
dst_incr_frac
=
c
->
ideal_dst_incr
%
c
->
src_incr
;
dst_incr
=
c
->
ideal_dst_incr
/
c
->
src_incr
;
if
(
dst_index
+
1
==
compensation_distance
){
compensation_distance
=
0
;
dst_incr_frac
=
c
->
ideal_dst_incr
%
c
->
src_incr
;
dst_incr
=
c
->
ideal_dst_incr
/
c
->
src_incr
;
}
}
}
}
*
consumed
=
FFMAX
(
index
,
0
)
>>
c
->
phase_shift
;
if
(
index
>=
0
)
index
&=
c
->
phase_mask
;
...
...
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