Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
f9f1b2a9
Commit
f9f1b2a9
authored
7 years ago
by
Paul B Mahol
Browse files
Options
Downloads
Patches
Plain Diff
avfilter/vf_convolve: split input/output operations from fft
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
86e3eebf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavfilter/vf_convolve.c
+31
-16
31 additions, 16 deletions
libavfilter/vf_convolve.c
with
31 additions
and
16 deletions
libavfilter/vf_convolve.c
+
31
−
16
View file @
f9f1b2a9
...
@@ -153,7 +153,18 @@ static int config_input_impulse(AVFilterLink *inlink)
...
@@ -153,7 +153,18 @@ static int config_input_impulse(AVFilterLink *inlink)
}
}
static
void
fft_horizontal
(
ConvolveContext
*
s
,
FFTComplex
*
fft_hdata
,
static
void
fft_horizontal
(
ConvolveContext
*
s
,
FFTComplex
*
fft_hdata
,
AVFrame
*
in
,
int
w
,
int
h
,
int
n
,
int
plane
,
float
scale
)
int
n
,
int
plane
)
{
int
y
;
for
(
y
=
0
;
y
<
n
;
y
++
)
{
av_fft_permute
(
s
->
fft
[
plane
],
fft_hdata
+
y
*
n
);
av_fft_calc
(
s
->
fft
[
plane
],
fft_hdata
+
y
*
n
);
}
}
static
void
get_input
(
ConvolveContext
*
s
,
FFTComplex
*
fft_hdata
,
AVFrame
*
in
,
int
w
,
int
h
,
int
n
,
int
plane
,
float
scale
)
{
{
const
int
iw
=
(
n
-
w
)
/
2
,
ih
=
(
n
-
h
)
/
2
;
const
int
iw
=
(
n
-
w
)
/
2
,
ih
=
(
n
-
h
)
/
2
;
int
y
,
x
;
int
y
,
x
;
...
@@ -225,11 +236,6 @@ static void fft_horizontal(ConvolveContext *s, FFTComplex *fft_hdata,
...
@@ -225,11 +236,6 @@ static void fft_horizontal(ConvolveContext *s, FFTComplex *fft_hdata,
}
}
}
}
}
}
for
(
y
=
0
;
y
<
n
;
y
++
)
{
av_fft_permute
(
s
->
fft
[
plane
],
fft_hdata
+
y
*
n
);
av_fft_calc
(
s
->
fft
[
plane
],
fft_hdata
+
y
*
n
);
}
}
}
static
void
fft_vertical
(
ConvolveContext
*
s
,
FFTComplex
*
fft_hdata
,
FFTComplex
*
fft_vdata
,
static
void
fft_vertical
(
ConvolveContext
*
s
,
FFTComplex
*
fft_hdata
,
FFTComplex
*
fft_vdata
,
...
@@ -263,20 +269,26 @@ static void ifft_vertical(ConvolveContext *s, int n, int plane)
...
@@ -263,20 +269,26 @@ static void ifft_vertical(ConvolveContext *s, int n, int plane)
}
}
}
}
static
void
ifft_horizontal
(
ConvolveContext
*
s
,
AVFrame
*
out
,
static
void
ifft_horizontal
(
ConvolveContext
*
s
,
int
n
,
int
plane
)
int
w
,
int
h
,
int
n
,
int
plane
)
{
{
FFTComplex
*
input
=
s
->
fft_hdata
[
plane
];
FFTComplex
*
input
=
s
->
fft_hdata
[
plane
];
const
float
scale
=
1
.
f
/
(
n
*
n
);
int
y
;
const
int
max
=
(
1
<<
s
->
depth
)
-
1
;
const
int
hh
=
h
/
2
;
const
int
hw
=
w
/
2
;
int
y
,
x
;
for
(
y
=
0
;
y
<
n
;
y
++
)
{
for
(
y
=
0
;
y
<
n
;
y
++
)
{
av_fft_permute
(
s
->
ifft
[
plane
],
input
+
y
*
n
);
av_fft_permute
(
s
->
ifft
[
plane
],
input
+
y
*
n
);
av_fft_calc
(
s
->
ifft
[
plane
],
input
+
y
*
n
);
av_fft_calc
(
s
->
ifft
[
plane
],
input
+
y
*
n
);
}
}
}
static
void
get_output
(
ConvolveContext
*
s
,
AVFrame
*
out
,
int
w
,
int
h
,
int
n
,
int
plane
)
{
FFTComplex
*
input
=
s
->
fft_hdata
[
plane
];
const
float
scale
=
1
.
f
/
(
n
*
n
);
const
int
max
=
(
1
<<
s
->
depth
)
-
1
;
const
int
hh
=
h
/
2
;
const
int
hw
=
w
/
2
;
int
y
,
x
;
if
(
s
->
depth
==
8
)
{
if
(
s
->
depth
==
8
)
{
for
(
y
=
0
;
y
<
hh
;
y
++
)
{
for
(
y
=
0
;
y
<
hh
;
y
++
)
{
...
@@ -349,7 +361,8 @@ static int do_convolve(FFFrameSync *fs)
...
@@ -349,7 +361,8 @@ static int do_convolve(FFFrameSync *fs)
continue
;
continue
;
}
}
fft_horizontal
(
s
,
s
->
fft_hdata
[
plane
],
mainpic
,
w
,
h
,
n
,
plane
,
1
.
f
);
get_input
(
s
,
s
->
fft_hdata
[
plane
],
mainpic
,
w
,
h
,
n
,
plane
,
1
.
f
);
fft_horizontal
(
s
,
s
->
fft_hdata
[
plane
],
n
,
plane
);
fft_vertical
(
s
,
s
->
fft_hdata
[
plane
],
s
->
fft_vdata
[
plane
],
fft_vertical
(
s
,
s
->
fft_hdata
[
plane
],
s
->
fft_vdata
[
plane
],
n
,
plane
);
n
,
plane
);
...
@@ -371,7 +384,8 @@ static int do_convolve(FFFrameSync *fs)
...
@@ -371,7 +384,8 @@ static int do_convolve(FFFrameSync *fs)
}
}
total
=
FFMAX
(
1
,
total
);
total
=
FFMAX
(
1
,
total
);
fft_horizontal
(
s
,
s
->
fft_hdata_impulse
[
plane
],
impulsepic
,
w
,
h
,
n
,
plane
,
1
/
total
);
get_input
(
s
,
s
->
fft_hdata_impulse
[
plane
],
impulsepic
,
w
,
h
,
n
,
plane
,
1
/
total
);
fft_horizontal
(
s
,
s
->
fft_hdata_impulse
[
plane
],
n
,
plane
);
fft_vertical
(
s
,
s
->
fft_hdata_impulse
[
plane
],
s
->
fft_vdata_impulse
[
plane
],
fft_vertical
(
s
,
s
->
fft_hdata_impulse
[
plane
],
s
->
fft_vdata_impulse
[
plane
],
n
,
plane
);
n
,
plane
);
...
@@ -395,7 +409,8 @@ static int do_convolve(FFFrameSync *fs)
...
@@ -395,7 +409,8 @@ static int do_convolve(FFFrameSync *fs)
}
}
ifft_vertical
(
s
,
n
,
plane
);
ifft_vertical
(
s
,
n
,
plane
);
ifft_horizontal
(
s
,
mainpic
,
w
,
h
,
n
,
plane
);
ifft_horizontal
(
s
,
n
,
plane
);
get_output
(
s
,
mainpic
,
w
,
h
,
n
,
plane
);
}
}
return
ff_filter_frame
(
outlink
,
mainpic
);
return
ff_filter_frame
(
outlink
,
mainpic
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment