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
d492907e
Commit
d492907e
authored
Oct 03, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_amix: fix filtering if specified weights are negative
parent
2a546fb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
af_amix.c
libavfilter/af_amix.c
+8
-8
No files found.
libavfilter/af_amix.c
View file @
d492907e
...
...
@@ -212,21 +212,21 @@ static void calculate_scales(MixContext *s, int nb_samples)
for
(
i
=
0
;
i
<
s
->
nb_inputs
;
i
++
)
if
(
s
->
input_state
[
i
]
&
INPUT_ON
)
weight_sum
+=
s
->
weights
[
i
]
;
weight_sum
+=
FFABS
(
s
->
weights
[
i
])
;
for
(
i
=
0
;
i
<
s
->
nb_inputs
;
i
++
)
{
if
(
s
->
input_state
[
i
]
&
INPUT_ON
)
{
if
(
s
->
scale_norm
[
i
]
>
weight_sum
/
s
->
weights
[
i
]
)
{
s
->
scale_norm
[
i
]
-=
((
s
->
weight_sum
/
s
->
weights
[
i
]
)
/
s
->
nb_inputs
)
*
if
(
s
->
scale_norm
[
i
]
>
weight_sum
/
FFABS
(
s
->
weights
[
i
])
)
{
s
->
scale_norm
[
i
]
-=
((
s
->
weight_sum
/
FFABS
(
s
->
weights
[
i
])
)
/
s
->
nb_inputs
)
*
nb_samples
/
(
s
->
dropout_transition
*
s
->
sample_rate
);
s
->
scale_norm
[
i
]
=
FFMAX
(
s
->
scale_norm
[
i
],
weight_sum
/
s
->
weights
[
i
]
);
s
->
scale_norm
[
i
]
=
FFMAX
(
s
->
scale_norm
[
i
],
weight_sum
/
FFABS
(
s
->
weights
[
i
])
);
}
}
}
for
(
i
=
0
;
i
<
s
->
nb_inputs
;
i
++
)
{
if
(
s
->
input_state
[
i
]
&
INPUT_ON
)
s
->
input_scale
[
i
]
=
1
.
0
f
/
s
->
scale_norm
[
i
];
s
->
input_scale
[
i
]
=
1
.
0
f
/
s
->
scale_norm
[
i
]
*
FFSIGN
(
s
->
weights
[
i
])
;
else
s
->
input_scale
[
i
]
=
0
.
0
f
;
}
...
...
@@ -270,7 +270,7 @@ static int config_output(AVFilterLink *outlink)
if
(
!
s
->
input_scale
||
!
s
->
scale_norm
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
s
->
nb_inputs
;
i
++
)
s
->
scale_norm
[
i
]
=
s
->
weight_sum
/
s
->
weights
[
i
]
;
s
->
scale_norm
[
i
]
=
s
->
weight_sum
/
FFABS
(
s
->
weights
[
i
])
;
calculate_scales
(
s
,
0
);
av_get_channel_layout_string
(
buf
,
sizeof
(
buf
),
-
1
,
outlink
->
channel_layout
);
...
...
@@ -540,12 +540,12 @@ static av_cold int init(AVFilterContext *ctx)
p
=
NULL
;
sscanf
(
arg
,
"%f"
,
&
last_weight
);
s
->
weights
[
i
]
=
last_weight
;
s
->
weight_sum
+=
last_weight
;
s
->
weight_sum
+=
FFABS
(
last_weight
)
;
}
for
(;
i
<
s
->
nb_inputs
;
i
++
)
{
s
->
weights
[
i
]
=
last_weight
;
s
->
weight_sum
+=
last_weight
;
s
->
weight_sum
+=
FFABS
(
last_weight
)
;
}
return
0
;
...
...
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