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
6ef2315a
Commit
6ef2315a
authored
Jan 25, 2014
by
Jean First
Committed by
Clément Bœsch
Feb 02, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/ebur128: print peak metering in dBFS
Signed-off-by:
Jean First
<
jeanfirst@gmail.com
>
parent
7f42bfad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
+30
-12
filters.texi
doc/filters.texi
+4
-3
f_ebur128.c
libavfilter/f_ebur128.c
+26
-9
No files found.
doc/filters.texi
View file @
6ef2315a
...
@@ -9334,13 +9334,14 @@ Disable any peak mode (default).
...
@@ -9334,13 +9334,14 @@ Disable any peak mode (default).
@item sample
@item sample
Enable sample-peak mode.
Enable sample-peak mode.
Simple peak mode looking for the higher sample value.
Simple peak mode looking for the higher sample value. It logs a message
for sample-peak (identified by @code{SPK}).
@item true
@item true
Enable true-peak mode.
Enable true-peak mode.
If enabled, the peak lookup is done on an over-sampled version of the input
If enabled, the peak lookup is done on an over-sampled version of the input
stream for better peak accuracy.
This mode requires a build with
stream for better peak accuracy.
It logs a message for true-peak.
@code{libswresample}.
(identified by @code{TPK}). This mode requires a build with
@code{libswresample}.
@end table
@end table
@end table
@end table
...
...
libavfilter/f_ebur128.c
View file @
6ef2315a
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
* EBU R.128 implementation
* EBU R.128 implementation
* @see http://tech.ebu.ch/loudness
* @see http://tech.ebu.ch/loudness
* @see https://www.youtube.com/watch?v=iuEtQqC-Sqo "EBU R128 Introduction - Florian Camerer"
* @see https://www.youtube.com/watch?v=iuEtQqC-Sqo "EBU R128 Introduction - Florian Camerer"
* @todo True Peak
* @todo implement start/stop/reset through filter command injection
* @todo implement start/stop/reset through filter command injection
* @todo support other frequencies to avoid resampling
* @todo support other frequencies to avoid resampling
*/
*/
...
@@ -443,6 +442,7 @@ static int config_audio_output(AVFilterLink *outlink)
...
@@ -443,6 +442,7 @@ static int config_audio_output(AVFilterLink *outlink)
#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
#define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
#define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
#define DBFS(energy) (20 * log10(energy))
static
struct
hist_entry
*
get_histogram
(
void
)
static
struct
hist_entry
*
get_histogram
(
void
)
{
{
...
@@ -791,13 +791,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
...
@@ -791,13 +791,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
loudness_400
,
loudness_3000
,
loudness_400
,
loudness_3000
,
ebur128
->
integrated_loudness
,
ebur128
->
loudness_range
);
ebur128
->
integrated_loudness
,
ebur128
->
loudness_range
);
#define PRINT_PEAKS(str, sp, ptype) do { \
#define PRINT_PEAKS(str, sp, ptype) do {
\
if (ebur128->peak_mode & PEAK_MODE_ ## ptype ## _PEAKS) { \
if (ebur128->peak_mode & PEAK_MODE_ ## ptype ## _PEAKS) {
\
av_log(ctx, ebur128->loglevel, "
[" str ":");
\
av_log(ctx, ebur128->loglevel, "
" str ":");
\
for (ch = 0; ch < nb_channels; ch++) \
for (ch = 0; ch < nb_channels; ch++)
\
av_log(ctx, ebur128->loglevel, " %
.5f", sp[ch]);
\
av_log(ctx, ebur128->loglevel, " %
5.1f", DBFS(sp[ch]));
\
av_log(ctx, ebur128->loglevel, "
]
"); \
av_log(ctx, ebur128->loglevel, "
dBFS
"); \
} \
}
\
} while (0)
} while (0)
PRINT_PEAKS
(
"SPK"
,
ebur128
->
sample_peaks
,
SAMPLES
);
PRINT_PEAKS
(
"SPK"
,
ebur128
->
sample_peaks
,
SAMPLES
);
...
@@ -867,11 +867,28 @@ static av_cold void uninit(AVFilterContext *ctx)
...
@@ -867,11 +867,28 @@ static av_cold void uninit(AVFilterContext *ctx)
" LRA: %5.1f LU
\n
"
" LRA: %5.1f LU
\n
"
" Threshold: %5.1f LUFS
\n
"
" Threshold: %5.1f LUFS
\n
"
" LRA low: %5.1f LUFS
\n
"
" LRA low: %5.1f LUFS
\n
"
" LRA high: %5.1f LUFS
\n
"
,
" LRA high: %5.1f LUFS"
,
ebur128
->
integrated_loudness
,
ebur128
->
i400
.
rel_threshold
,
ebur128
->
integrated_loudness
,
ebur128
->
i400
.
rel_threshold
,
ebur128
->
loudness_range
,
ebur128
->
i3000
.
rel_threshold
,
ebur128
->
loudness_range
,
ebur128
->
i3000
.
rel_threshold
,
ebur128
->
lra_low
,
ebur128
->
lra_high
);
ebur128
->
lra_low
,
ebur128
->
lra_high
);
#define PRINT_PEAK_SUMMARY(str, sp, ptype) do { \
int ch; \
double maxpeak; \
maxpeak = 0.0; \
if (ebur128->peak_mode & PEAK_MODE_ ## ptype ## _PEAKS) { \
for (ch = 0; ch < ebur128->nb_channels; ch++) \
maxpeak = FFMAX(maxpeak, sp[ch]); \
av_log(ctx, AV_LOG_INFO, "\n\n " str " peak:\n" \
" Peak: %5.1f dBFS", \
DBFS(maxpeak)); \
} \
} while (0)
PRINT_PEAK_SUMMARY
(
"Sample"
,
ebur128
->
sample_peaks
,
SAMPLES
);
PRINT_PEAK_SUMMARY
(
"True"
,
ebur128
->
true_peaks
,
TRUE
);
av_log
(
ctx
,
AV_LOG_INFO
,
"
\n
"
);
av_freep
(
&
ebur128
->
y_line_ref
);
av_freep
(
&
ebur128
->
y_line_ref
);
av_freep
(
&
ebur128
->
ch_weighting
);
av_freep
(
&
ebur128
->
ch_weighting
);
av_freep
(
&
ebur128
->
true_peaks
);
av_freep
(
&
ebur128
->
true_peaks
);
...
...
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