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
80dacbed
Commit
80dacbed
authored
Jul 13, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_aiir: calculate group delay too
parent
18c808ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
filters.texi
doc/filters.texi
+1
-1
af_aiir.c
libavfilter/af_aiir.c
+30
-3
No files found.
doc/filters.texi
View file @
80dacbed
...
...
@@ -1397,7 +1397,7 @@ How much to use filtered signal in output. Default is 1.
Range
is
between
0
and
1.
@
item
response
Show
IR
frequency
response
,
magnitude
and
phase
in
additional
video
stream
.
Show
IR
frequency
response
,
magnitude
(
magenta
),
phase
(
green
)
and
group
delay
(
yellow
)
in
additional
video
stream
.
By
default
it
is
disabled
.
@
item
channel
...
...
libavfilter/af_aiir.c
View file @
80dacbed
...
...
@@ -721,8 +721,9 @@ static void draw_line(AVFrame *out, int x0, int y0, int x1, int y1, uint32_t col
static
void
draw_response
(
AVFilterContext
*
ctx
,
AVFrame
*
out
)
{
AudioIIRContext
*
s
=
ctx
->
priv
;
float
*
mag
,
*
phase
,
min
=
FLT_MAX
,
max
=
FLT_MIN
;
int
prev_ymag
=
-
1
,
prev_yphase
=
-
1
;
float
*
mag
,
*
phase
,
*
delay
,
min
=
FLT_MAX
,
max
=
FLT_MIN
;
float
min_delay
=
FLT_MAX
,
max_delay
=
FLT_MIN
;
int
prev_ymag
=
-
1
,
prev_yphase
=
-
1
,
prev_ydelay
=
-
1
;
char
text
[
32
];
int
ch
,
i
,
x
;
...
...
@@ -730,7 +731,8 @@ static void draw_response(AVFilterContext *ctx, AVFrame *out)
phase
=
av_malloc_array
(
s
->
w
,
sizeof
(
*
phase
));
mag
=
av_malloc_array
(
s
->
w
,
sizeof
(
*
mag
));
if
(
!
mag
||
!
phase
)
delay
=
av_malloc_array
(
s
->
w
,
sizeof
(
*
delay
));
if
(
!
mag
||
!
phase
||
!
delay
)
goto
end
;
ch
=
av_clip
(
s
->
ir_channel
,
0
,
s
->
channels
-
1
);
...
...
@@ -795,23 +797,39 @@ static void draw_response(AVFilterContext *ctx, AVFrame *out)
max
=
fmaxf
(
max
,
mag
[
i
]);
}
for
(
i
=
0
;
i
<
s
->
w
-
1
;
i
++
)
{
float
dw
=
M_PI
/
(
s
->
w
-
1
);
delay
[
i
]
=
-
(
phase
[
i
+
1
]
-
phase
[
i
])
/
dw
;
min_delay
=
fminf
(
min_delay
,
delay
[
i
]);
max_delay
=
fmaxf
(
max_delay
,
delay
[
i
]);
}
delay
[
i
]
=
delay
[
i
-
1
];
for
(
i
=
0
;
i
<
s
->
w
;
i
++
)
{
int
ymag
=
mag
[
i
]
/
max
*
(
s
->
h
-
1
);
int
ydelay
=
(
delay
[
i
]
-
min_delay
)
/
(
max_delay
-
min_delay
)
*
(
s
->
h
-
1
);
int
yphase
=
(
0
.
5
*
(
1
.
+
phase
[
i
]
/
M_PI
))
*
(
s
->
h
-
1
);
ymag
=
s
->
h
-
1
-
av_clip
(
ymag
,
0
,
s
->
h
-
1
);
yphase
=
s
->
h
-
1
-
av_clip
(
yphase
,
0
,
s
->
h
-
1
);
ydelay
=
s
->
h
-
1
-
av_clip
(
ydelay
,
0
,
s
->
h
-
1
);
if
(
prev_ymag
<
0
)
prev_ymag
=
ymag
;
if
(
prev_yphase
<
0
)
prev_yphase
=
yphase
;
if
(
prev_ydelay
<
0
)
prev_ydelay
=
ydelay
;
draw_line
(
out
,
i
,
ymag
,
FFMAX
(
i
-
1
,
0
),
prev_ymag
,
0xFFFF00FF
);
draw_line
(
out
,
i
,
yphase
,
FFMAX
(
i
-
1
,
0
),
prev_yphase
,
0xFF00FF00
);
draw_line
(
out
,
i
,
ydelay
,
FFMAX
(
i
-
1
,
0
),
prev_ydelay
,
0xFF00FFFF
);
prev_ymag
=
ymag
;
prev_yphase
=
yphase
;
prev_ydelay
=
ydelay
;
}
if
(
s
->
w
>
400
&&
s
->
h
>
100
)
{
...
...
@@ -822,9 +840,18 @@ static void draw_response(AVFilterContext *ctx, AVFrame *out)
drawtext
(
out
,
2
,
12
,
"Min Magnitude:"
,
0xDDDDDDDD
);
snprintf
(
text
,
sizeof
(
text
),
"%.2f"
,
min
);
drawtext
(
out
,
15
*
8
+
2
,
12
,
text
,
0xDDDDDDDD
);
drawtext
(
out
,
2
,
22
,
"Max Delay:"
,
0xDDDDDDDD
);
snprintf
(
text
,
sizeof
(
text
),
"%.2f"
,
max_delay
);
drawtext
(
out
,
11
*
8
+
2
,
22
,
text
,
0xDDDDDDDD
);
drawtext
(
out
,
2
,
32
,
"Min Delay:"
,
0xDDDDDDDD
);
snprintf
(
text
,
sizeof
(
text
),
"%.2f"
,
min_delay
);
drawtext
(
out
,
11
*
8
+
2
,
32
,
text
,
0xDDDDDDDD
);
}
end:
av_free
(
delay
);
av_free
(
phase
);
av_free
(
mag
);
}
...
...
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