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
2f86566a
Commit
2f86566a
authored
Oct 25, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rematrix: add parameter to tune volume
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
b1470d7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
rematrix.c
libswresample/rematrix.c
+12
-0
swresample.c
libswresample/swresample.c
+2
-1
swresample_internal.h
libswresample/swresample_internal.h
+1
-1
No files found.
libswresample/rematrix.c
View file @
2f86566a
...
...
@@ -210,6 +210,9 @@ int swr_rematrix_init(SwrContext *s){
if
(
s
->
out_ch_layout
&
(
1ULL
<<
i
))
out_i
++
;
}
if
(
s
->
rematrix_volume
<
0
)
maxcoef
=
-
s
->
rematrix_volume
;
if
((
s
->
out_sample_fmt
<
AV_SAMPLE_FMT_FLT
||
s
->
int_sample_fmt
<
AV_SAMPLE_FMT_FLT
)
&&
maxcoef
>
1
.
0
){
for
(
i
=
0
;
i
<
SWR_CH_MAX
;
i
++
)
...
...
@@ -218,6 +221,15 @@ int swr_rematrix_init(SwrContext *s){
s
->
matrix32
[
i
][
j
]
=
lrintf
(
s
->
matrix
[
i
][
j
]
*
32768
);
}
}
if
(
s
->
rematrix_volume
>
0
){
for
(
i
=
0
;
i
<
SWR_CH_MAX
;
i
++
)
for
(
j
=
0
;
j
<
SWR_CH_MAX
;
j
++
){
s
->
matrix
[
i
][
j
]
*=
s
->
rematrix_volume
;
s
->
matrix32
[
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
]);
...
...
libswresample/swresample.c
View file @
2f86566a
...
...
@@ -49,6 +49,7 @@ static const AVOption options[]={
{
"ocl"
,
"output channel layout"
,
OFFSET
(
out_ch_layout
),
AV_OPT_TYPE_INT64
,
{.
dbl
=
0
},
0
,
INT64_MAX
,
0
,
"channel_layout"
},
{
"clev"
,
"center mix level"
,
OFFSET
(
clev
)
,
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
C_30DB
},
0
,
4
,
0
},
{
"slev"
,
"sourround mix level"
,
OFFSET
(
slev
)
,
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
C_30DB
},
0
,
4
,
0
},
{
"rmvol"
,
"rematrix volume"
,
OFFSET
(
rematrix_volume
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
.
0
},
-
1000
,
1000
,
0
},
{
"flags"
,
NULL
,
OFFSET
(
flags
)
,
AV_OPT_TYPE_FLAGS
,
{.
dbl
=
0
},
0
,
UINT_MAX
,
0
,
"flags"
},
{
"res"
,
"force resampling"
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
SWR_FLAG_RESAMPLE
},
INT_MIN
,
INT_MAX
,
0
,
"flags"
},
...
...
@@ -176,7 +177,7 @@ int swr_init(SwrContext *s){
if
(
!
s
->
out_ch_layout
)
s
->
out_ch_layout
=
av_get_default_channel_layout
(
s
->
out
.
ch_count
);
s
->
rematrix
=
s
->
out_ch_layout
!=
s
->
in_ch_layout
;
s
->
rematrix
=
s
->
out_ch_layout
!=
s
->
in_ch_layout
||
s
->
rematrix_volume
!=
1
.
0
;
#define RSC 1 //FIXME finetune
if
(
!
s
->
in
.
ch_count
)
...
...
libswresample/swresample_internal.h
View file @
2f86566a
...
...
@@ -44,7 +44,7 @@ typedef struct SwrContext { //FIXME find unused fields
int
in_sample_rate
;
int
out_sample_rate
;
int
flags
;
float
slev
,
clev
;
float
slev
,
clev
,
rematrix_volume
;
//below are private
int
int_bps
;
...
...
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