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
6cb5dcb3
Commit
6cb5dcb3
authored
Dec 31, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
special case for filter_length==1
Originally committed as revision 3787 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
579448a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
resample2.c
libavcodec/resample2.c
+18
-1
No files found.
libavcodec/resample2.c
View file @
6cb5dcb3
...
...
@@ -141,7 +141,7 @@ AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size,
c
->
phase_mask
=
phase_count
-
1
;
c
->
linear
=
linear
;
c
->
filter_length
=
ceil
(
filter_size
/
factor
);
c
->
filter_length
=
FFMAX
(
ceil
(
filter_size
/
factor
),
1
);
c
->
filter_bank
=
av_mallocz
(
c
->
filter_length
*
(
phase_count
+
1
)
*
sizeof
(
FELEM
));
av_build_filter
(
c
->
filter_bank
,
factor
,
c
->
filter_length
,
phase_count
,
1
<<
FILTER_SHIFT
,
1
);
memcpy
(
&
c
->
filter_bank
[
c
->
filter_length
*
phase_count
+
1
],
c
->
filter_bank
,
(
c
->
filter_length
-
1
)
*
sizeof
(
FELEM
));
...
...
@@ -194,6 +194,22 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
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
){
assert
(
index
>=
0
);
for
(
dst_index
=
0
;
dst_index
<
dst_size
;
dst_index
++
){
if
(
index
<
src_size
)
dst
[
dst_index
]
=
src
[
index
];
else
break
;
frac
+=
dst_incr_frac
;
index
+=
dst_incr
;
if
(
frac
>=
c
->
src_incr
){
frac
-=
c
->
src_incr
;
index
++
;
}
}
}
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
;
...
...
@@ -234,6 +250,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
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