Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
7b2851b2
Commit
7b2851b2
authored
Apr 30, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_asdr: add support for threads
parent
4f63e049
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
af_asdr.c
libavfilter/af_asdr.c
+19
-9
No files found.
libavfilter/af_asdr.c
View file @
7b2851b2
...
@@ -37,24 +37,32 @@ typedef struct AudioSDRContext {
...
@@ -37,24 +37,32 @@ typedef struct AudioSDRContext {
AVFrame
*
cache
[
2
];
AVFrame
*
cache
[
2
];
}
AudioSDRContext
;
}
AudioSDRContext
;
static
void
sdr
(
AVFilterContext
*
ctx
,
const
AVFrame
*
u
,
const
AVFrame
*
v
)
static
int
sdr
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
{
AudioSDRContext
*
s
=
ctx
->
priv
;
AudioSDRContext
*
s
=
ctx
->
priv
;
AVFrame
*
u
=
s
->
cache
[
0
];
for
(
int
ch
=
0
;
ch
<
u
->
ch_layout
.
nb_channels
;
ch
++
)
{
AVFrame
*
v
=
s
->
cache
[
1
];
const
int
channels
=
u
->
ch_layout
.
nb_channels
;
const
int
start
=
(
channels
*
jobnr
)
/
nb_jobs
;
const
int
end
=
(
channels
*
(
jobnr
+
1
))
/
nb_jobs
;
const
int
nb_samples
=
u
->
nb_samples
;
for
(
int
ch
=
start
;
ch
<
end
;
ch
++
)
{
const
double
*
const
us
=
(
double
*
)
u
->
extended_data
[
ch
];
const
double
*
const
us
=
(
double
*
)
u
->
extended_data
[
ch
];
const
double
*
const
vs
=
(
double
*
)
v
->
extended_data
[
ch
];
const
double
*
const
vs
=
(
double
*
)
v
->
extended_data
[
ch
];
double
sum_uv
=
s
->
sum_uv
[
ch
]
;
double
sum_uv
=
0
.
;
double
sum_u
=
s
->
sum_u
[
ch
]
;
double
sum_u
=
0
.
;
for
(
int
n
=
0
;
n
<
u
->
nb_samples
;
n
++
)
{
for
(
int
n
=
0
;
n
<
nb_samples
;
n
++
)
{
sum_u
+=
us
[
n
]
*
us
[
n
];
sum_u
+=
us
[
n
]
*
us
[
n
];
sum_uv
+=
(
us
[
n
]
-
vs
[
n
])
*
(
us
[
n
]
-
vs
[
n
]);
sum_uv
+=
(
us
[
n
]
-
vs
[
n
])
*
(
us
[
n
]
-
vs
[
n
]);
}
}
s
->
sum_uv
[
ch
]
=
sum_uv
;
s
->
sum_uv
[
ch
]
+
=
sum_uv
;
s
->
sum_u
[
ch
]
=
sum_u
;
s
->
sum_u
[
ch
]
+
=
sum_u
;
}
}
return
0
;
}
}
static
int
activate
(
AVFilterContext
*
ctx
)
static
int
activate
(
AVFilterContext
*
ctx
)
...
@@ -80,7 +88,8 @@ static int activate(AVFilterContext *ctx)
...
@@ -80,7 +88,8 @@ static int activate(AVFilterContext *ctx)
}
}
if
(
!
ctx
->
is_disabled
)
if
(
!
ctx
->
is_disabled
)
sdr
(
ctx
,
s
->
cache
[
0
],
s
->
cache
[
1
]);
ff_filter_execute
(
ctx
,
sdr
,
NULL
,
NULL
,
FFMIN
(
outlink
->
ch_layout
.
nb_channels
,
ff_filter_get_nb_threads
(
ctx
)));
av_frame_free
(
&
s
->
cache
[
1
]);
av_frame_free
(
&
s
->
cache
[
1
]);
out
=
s
->
cache
[
0
];
out
=
s
->
cache
[
0
];
...
@@ -170,6 +179,7 @@ const AVFilter ff_af_asdr = {
...
@@ -170,6 +179,7 @@ const AVFilter ff_af_asdr = {
.
activate
=
activate
,
.
activate
=
activate
,
.
uninit
=
uninit
,
.
uninit
=
uninit
,
.
flags
=
AVFILTER_FLAG_METADATA_ONLY
|
.
flags
=
AVFILTER_FLAG_METADATA_ONLY
|
AVFILTER_FLAG_SLICE_THREADS
|
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
,
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
,
FILTER_INPUTS
(
inputs
),
FILTER_INPUTS
(
inputs
),
FILTER_OUTPUTS
(
outputs
),
FILTER_OUTPUTS
(
outputs
),
...
...
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