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
b9d2085b
Commit
b9d2085b
authored
Jun 30, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
various resampling fixes
Originally committed as revision 3271 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
2d48eddd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
resample.c
libavcodec/resample.c
+1
-1
resample2.c
libavcodec/resample2.c
+7
-5
No files found.
libavcodec/resample.c
View file @
b9d2085b
...
@@ -175,7 +175,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
...
@@ -175,7 +175,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
short
*
buftmp2
[
2
],
*
buftmp3
[
2
];
short
*
buftmp2
[
2
],
*
buftmp3
[
2
];
int
lenout
;
int
lenout
;
if
(
s
->
input_channels
==
s
->
output_channels
&&
s
->
ratio
==
1
.
0
)
{
if
(
s
->
input_channels
==
s
->
output_channels
&&
s
->
ratio
==
1
.
0
&&
0
)
{
/* nothing to do */
/* nothing to do */
memcpy
(
output
,
input
,
nb_samples
*
s
->
input_channels
*
sizeof
(
short
));
memcpy
(
output
,
input
,
nb_samples
*
s
->
input_channels
*
sizeof
(
short
));
return
nb_samples
;
return
nb_samples
;
...
...
libavcodec/resample2.c
View file @
b9d2085b
...
@@ -123,8 +123,8 @@ AVResampleContext *av_resample_init(int out_rate, int in_rate){
...
@@ -123,8 +123,8 @@ AVResampleContext *av_resample_init(int out_rate, int in_rate){
c
->
filter_length
=
ceil
(
16
.
0
/
factor
);
c
->
filter_length
=
ceil
(
16
.
0
/
factor
);
c
->
filter_bank
=
av_mallocz
(
c
->
filter_length
*
(
PHASE_COUNT
+
1
)
*
sizeof
(
short
));
c
->
filter_bank
=
av_mallocz
(
c
->
filter_length
*
(
PHASE_COUNT
+
1
)
*
sizeof
(
short
));
av_build_filter
(
c
->
filter_bank
,
factor
,
c
->
filter_length
,
PHASE_COUNT
,
1
<<
FILTER_SHIFT
,
1
);
av_build_filter
(
c
->
filter_bank
,
factor
,
c
->
filter_length
,
PHASE_COUNT
,
1
<<
FILTER_SHIFT
,
1
);
c
->
filter_bank
[
c
->
filter_length
*
PHASE_COUNT
+
(
c
->
filter_length
-
1
)
+
1
]
=
(
1
<<
FILTER_SHIFT
)
-
1
;
c
->
filter_bank
[
c
->
filter_length
*
PHASE_COUNT
+
(
c
->
filter_length
-
1
)
/
2
+
1
]
=
(
1
<<
FILTER_SHIFT
)
-
1
;
c
->
filter_bank
[
c
->
filter_length
*
PHASE_COUNT
+
(
c
->
filter_length
-
1
)
+
2
]
=
1
;
c
->
filter_bank
[
c
->
filter_length
*
PHASE_COUNT
+
(
c
->
filter_length
-
1
)
/
2
+
2
]
=
1
;
c
->
src_incr
=
out_rate
;
c
->
src_incr
=
out_rate
;
c
->
ideal_dst_incr
=
c
->
dst_incr
=
in_rate
*
PHASE_COUNT
;
c
->
ideal_dst_incr
=
c
->
dst_incr
=
in_rate
*
PHASE_COUNT
;
...
@@ -170,7 +170,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
...
@@ -170,7 +170,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
if
(
sample_index
<
0
){
if
(
sample_index
<
0
){
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
val
+=
src
[
ABS
(
sample_index
+
i
)]
*
filter
[
i
];
val
+=
src
[
ABS
(
sample_index
+
i
)
%
src_size
]
*
filter
[
i
];
}
else
if
(
sample_index
+
c
->
filter_length
>
src_size
){
}
else
if
(
sample_index
+
c
->
filter_length
>
src_size
){
break
;
break
;
}
else
{
}
else
{
...
@@ -199,6 +199,9 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
...
@@ -199,6 +199,9 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
index
++
;
index
++
;
}
}
}
}
*
consumed
=
FFMAX
(
index
,
0
)
>>
PHASE_SHIFT
;
index
=
FFMIN
(
index
,
0
);
if
(
update_ctx
){
if
(
update_ctx
){
if
(
c
->
compensation_distance
){
if
(
c
->
compensation_distance
){
c
->
compensation_distance
-=
dst_index
;
c
->
compensation_distance
-=
dst_index
;
...
@@ -206,9 +209,8 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
...
@@ -206,9 +209,8 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
c
->
dst_incr
=
c
->
ideal_dst_incr
;
c
->
dst_incr
=
c
->
ideal_dst_incr
;
}
}
c
->
frac
=
frac
;
c
->
frac
=
frac
;
c
->
index
=
0
;
c
->
index
=
index
;
}
}
*
consumed
=
index
>>
PHASE_SHIFT
;
#if 0
#if 0
if(update_ctx && !c->compensation_distance){
if(update_ctx && !c->compensation_distance){
#undef rand
#undef rand
...
...
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