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
4f721bfd
Commit
4f721bfd
authored
Sep 30, 2015
by
Kyle Swanson
Committed by
Clément Bœsch
Oct 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/ebur128: add dualmono measurement option
parent
a2b8b163
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
filters.texi
doc/filters.texi
+9
-0
f_ebur128.c
libavfilter/f_ebur128.c
+22
-0
No files found.
doc/filters.texi
View file @
4f721bfd
...
@@ -12685,6 +12685,15 @@ stream for better peak accuracy. It logs a message for true-peak.
...
@@ -12685,6 +12685,15 @@ stream for better peak accuracy. It logs a message for true-peak.
This mode requires a build with @code{libswresample}.
This mode requires a build with @code{libswresample}.
@end table
@end table
@item dualmono
Treat mono input files as "dual mono". If a mono file is intended for playback
on a stereo system, its EBU R128 measurement will be perceptually incorrect.
If set to @code{true}, this option will compensate for this effect.
Multi-channel input files are not effected by this option.
@item panlaw
Set a specific pan law to be used for the measurement of dual mono files.
This parameter is optional, and has a default value of -3.01dB.
@end table
@end table
@subsection Examples
@subsection Examples
...
...
libavfilter/f_ebur128.c
View file @
4f721bfd
...
@@ -139,6 +139,8 @@ typedef struct {
...
@@ -139,6 +139,8 @@ typedef struct {
/* misc */
/* misc */
int
loglevel
;
///< log level for frame logging
int
loglevel
;
///< log level for frame logging
int
metadata
;
///< whether or not to inject loudness results in frames
int
metadata
;
///< whether or not to inject loudness results in frames
int
dual_mono
;
///< whether or not to treat single channel input files as dual-mono
double
pan_law
;
///< pan law value used to calulate dual-mono measurements
}
EBUR128Context
;
}
EBUR128Context
;
enum
{
enum
{
...
@@ -163,6 +165,8 @@ static const AVOption ebur128_options[] = {
...
@@ -163,6 +165,8 @@ static const AVOption ebur128_options[] = {
{
"none"
,
"disable any peak mode"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PEAK_MODE_NONE
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"mode"
},
{
"none"
,
"disable any peak mode"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PEAK_MODE_NONE
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"mode"
},
{
"sample"
,
"enable peak-sample mode"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PEAK_MODE_SAMPLES_PEAKS
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"mode"
},
{
"sample"
,
"enable peak-sample mode"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PEAK_MODE_SAMPLES_PEAKS
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"mode"
},
{
"true"
,
"enable true-peak mode"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PEAK_MODE_TRUE_PEAKS
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"mode"
},
{
"true"
,
"enable true-peak mode"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PEAK_MODE_TRUE_PEAKS
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"mode"
},
{
"dualmono"
,
"treat mono input files as dual-mono"
,
OFFSET
(
dual_mono
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
A
|
F
},
{
"panlaw"
,
"set a specific pan law for dual-mono files"
,
OFFSET
(
pan_law
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
-
3
.
0102
9995663978
},
-
10
.
0
,
0
.
0
,
A
|
F
},
{
NULL
},
{
NULL
},
};
};
...
@@ -661,6 +665,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
...
@@ -661,6 +665,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
}
}
if
(
nb_integrated
)
if
(
nb_integrated
)
ebur128
->
integrated_loudness
=
LOUDNESS
(
integrated_sum
/
nb_integrated
);
ebur128
->
integrated_loudness
=
LOUDNESS
(
integrated_sum
/
nb_integrated
);
/* dual-mono correction */
if
(
nb_channels
==
1
&&
ebur128
->
dual_mono
)
{
ebur128
->
integrated_loudness
-=
ebur128
->
pan_law
;
}
}
}
/* LRA */
/* LRA */
...
@@ -707,6 +715,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
...
@@ -707,6 +715,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
}
}
}
}
/* dual-mono correction */
if
(
nb_channels
==
1
&&
ebur128
->
dual_mono
)
{
loudness_400
-=
ebur128
->
pan_law
;
loudness_3000
-=
ebur128
->
pan_law
;
}
#define LOG_FMT "M:%6.1f S:%6.1f I:%6.1f LUFS LRA:%6.1f LU"
#define LOG_FMT "M:%6.1f S:%6.1f I:%6.1f LUFS LRA:%6.1f LU"
/* push one video frame */
/* push one video frame */
...
@@ -855,6 +869,14 @@ static av_cold void uninit(AVFilterContext *ctx)
...
@@ -855,6 +869,14 @@ static av_cold void uninit(AVFilterContext *ctx)
int
i
;
int
i
;
EBUR128Context
*
ebur128
=
ctx
->
priv
;
EBUR128Context
*
ebur128
=
ctx
->
priv
;
/* dual-mono correction */
if
(
ebur128
->
nb_channels
==
1
&&
ebur128
->
dual_mono
)
{
ebur128
->
i400
.
rel_threshold
-=
ebur128
->
pan_law
;
ebur128
->
i3000
.
rel_threshold
-=
ebur128
->
pan_law
;
ebur128
->
lra_low
-=
ebur128
->
pan_law
;
ebur128
->
lra_high
-=
ebur128
->
pan_law
;
}
av_log
(
ctx
,
AV_LOG_INFO
,
"Summary:
\n\n
"
av_log
(
ctx
,
AV_LOG_INFO
,
"Summary:
\n\n
"
" Integrated loudness:
\n
"
" Integrated loudness:
\n
"
" I: %5.1f LUFS
\n
"
" I: %5.1f LUFS
\n
"
...
...
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