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
1fc4ff22
Commit
1fc4ff22
authored
Apr 11, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swr: generate more dither noise to improve quality.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
22057e8e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
swresample.c
libswresample/swresample.c
+8
-4
swresample_internal.h
libswresample/swresample_internal.h
+1
-0
No files found.
libswresample/swresample.c
View file @
1fc4ff22
...
...
@@ -519,18 +519,22 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
if
(
preout
!=
out
&&
out_count
){
if
(
s
->
dither_method
){
int
ch
;
int
dither_count
=
FFMAX
(
out_count
,
1
<<
16
);
av_assert0
(
preout
!=
in
);
if
((
ret
=
realloc_audio
(
&
s
->
dither
,
out
_count
))
<
0
)
if
((
ret
=
realloc_audio
(
&
s
->
dither
,
dither
_count
))
<
0
)
return
ret
;
if
(
ret
)
for
(
ch
=
0
;
ch
<
s
->
dither
.
ch_count
;
ch
++
)
swri_get_dither
(
s
->
dither
.
ch
[
ch
],
s
->
dither
.
count
,
12345678913579
<<
ch
,
s
->
out_sample_fmt
,
s
->
int_sample_fmt
,
s
->
dither_method
);
av_assert0
(
s
->
dither
.
ch_count
==
preout
->
ch_count
);
for
(
ch
=
0
;
ch
<
preout
->
ch_count
;
ch
++
){
swri_sum2
(
s
->
int_sample_fmt
,
preout
->
ch
[
ch
],
preout
->
ch
[
ch
],
s
->
dither
.
ch
[
ch
],
1
,
1
,
out_count
);
}
if
(
s
->
dither_pos
+
out_count
>
s
->
dither
.
count
)
s
->
dither_pos
=
0
;
for
(
ch
=
0
;
ch
<
preout
->
ch_count
;
ch
++
)
swri_sum2
(
s
->
int_sample_fmt
,
preout
->
ch
[
ch
],
preout
->
ch
[
ch
],
s
->
dither
.
ch
[
ch
]
+
s
->
dither
.
bps
*
s
->
dither_pos
,
1
,
1
,
out_count
);
s
->
dither_pos
+=
out_count
;
}
//FIXME packed doesnt need more than 1 chan here!
swri_audio_convert
(
s
->
out_convert
,
out
,
preout
,
out_count
);
...
...
libswresample/swresample_internal.h
View file @
1fc4ff22
...
...
@@ -50,6 +50,7 @@ struct SwrContext {
const
int
*
channel_map
;
///< channel index (or -1 if muted channel) map
int
used_ch_count
;
///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
enum
SwrDitherType
dither_method
;
int
dither_pos
;
int
int_bps
;
///< internal bytes per sample
int
resample_first
;
///< 1 if resampling must come first, 0 if rematrixing
...
...
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