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
715da295
Commit
715da295
authored
Apr 16, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_astats: add slice threading support
parent
87b4fb65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
14 deletions
+29
-14
af_astats.c
libavfilter/af_astats.c
+29
-14
No files found.
libavfilter/af_astats.c
View file @
715da295
...
...
@@ -539,7 +539,7 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)
}
#define UPDATE_STATS_P(type, update_func, update_float, channel_func) \
for (int c =
0; c < channels; c++) {
\
for (int c =
start; c < end; c++) {
\
ChannelStats *p = &s->chstats[c]; \
const type *src = (const type *)data[c]; \
const type * const srcend = src + samples; \
...
...
@@ -551,7 +551,7 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)
}
#define UPDATE_STATS_I(type, update_func, update_float, channel_func) \
for (int c =
0; c < channels; c++) {
\
for (int c =
start; c < end; c++) {
\
ChannelStats *p = &s->chstats[c]; \
const type *src = (const type *)data[0]; \
const type * const srcend = src + samples * channels; \
...
...
@@ -569,21 +569,16 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)
UPDATE_STATS_##planar(type, update_minmax(s, p, sample), , p->nmin = p->min normalizer_suffix; p->nmax = p->max normalizer_suffix;); \
}
static
int
filter_
frame
(
AVFilterLink
*
inlink
,
AVFrame
*
buf
)
static
int
filter_
channel
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
AudioStatsContext
*
s
=
inlink
->
dst
->
priv
;
AVDictionary
**
metadata
=
&
buf
->
metadata
;
AudioStatsContext
*
s
=
ctx
->
priv
;
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AVFrame
*
buf
=
arg
;
const
uint8_t
*
const
*
const
data
=
(
const
uint8_t
*
const
*
)
buf
->
extended_data
;
const
int
channels
=
s
->
nb_channels
;
const
int
samples
=
buf
->
nb_samples
;
const
uint8_t
*
const
*
const
data
=
(
const
uint8_t
*
const
*
)
buf
->
extended_data
;
if
(
s
->
reset_count
>
0
)
{
if
(
s
->
nb_frames
>=
s
->
reset_count
)
{
reset_stats
(
s
);
s
->
nb_frames
=
0
;
}
s
->
nb_frames
++
;
}
const
int
start
=
(
buf
->
channels
*
jobnr
)
/
nb_jobs
;
const
int
end
=
(
buf
->
channels
*
(
jobnr
+
1
))
/
nb_jobs
;
switch
(
inlink
->
format
)
{
case
AV_SAMPLE_FMT_DBLP
:
...
...
@@ -618,6 +613,25 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
break
;
}
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
buf
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AudioStatsContext
*
s
=
ctx
->
priv
;
AVDictionary
**
metadata
=
&
buf
->
metadata
;
if
(
s
->
reset_count
>
0
)
{
if
(
s
->
nb_frames
>=
s
->
reset_count
)
{
reset_stats
(
s
);
s
->
nb_frames
=
0
;
}
s
->
nb_frames
++
;
}
ctx
->
internal
->
execute
(
ctx
,
filter_channel
,
buf
,
NULL
,
FFMIN
(
inlink
->
channels
,
ff_filter_get_nb_threads
(
ctx
)));
if
(
s
->
metadata
)
set_metadata
(
s
,
metadata
);
...
...
@@ -812,4 +826,5 @@ AVFilter ff_af_astats = {
.
uninit
=
uninit
,
.
inputs
=
astats_inputs
,
.
outputs
=
astats_outputs
,
.
flags
=
AVFILTER_FLAG_SLICE_THREADS
,
};
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