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
c45b823b
Commit
c45b823b
authored
May 15, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/histogram: logarithmic mode for levels
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
fa23f94e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
filters.texi
doc/filters.texi
+4
-0
vf_histogram.c
libavfilter/vf_histogram.c
+10
-1
No files found.
doc/filters.texi
View file @
c45b823b
...
...
@@ -4294,6 +4294,10 @@ components that are supposed to be identical, such as neutral whites, grays,
or blacks.
@end table
Default is @code{parade}.
@item levels_mode
Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
Default is @code{linear}.
@end table
@subsection Examples
...
...
libavfilter/vf_histogram.c
View file @
c45b823b
...
...
@@ -48,6 +48,7 @@ typedef struct HistogramContext {
int
step
;
int
waveform_mode
;
int
display_mode
;
int
levels_mode
;
}
HistogramContext
;
#define OFFSET(x) offsetof(HistogramContext, x)
...
...
@@ -68,6 +69,9 @@ static const AVOption histogram_options[] = {
{
"display_mode"
,
"set display mode"
,
OFFSET
(
display_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
1
,
FLAGS
,
"display_mode"
},
{
"parade"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"display_mode"
},
{
"overlay"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"display_mode"
},
{
"levels_mode"
,
"set levels mode"
,
OFFSET
(
levels_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"levels_mode"
},
{
"linear"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"levels_mode"
},
{
"logarithmic"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"levels_mode"
},
{
NULL
},
};
...
...
@@ -198,7 +202,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
h
->
max_hval
=
FFMAX
(
h
->
max_hval
,
h
->
histogram
[
i
]);
for
(
i
=
0
;
i
<
outlink
->
w
;
i
++
)
{
int
col_height
=
h
->
level_height
-
(
h
->
histogram
[
i
]
*
(
int64_t
)
h
->
level_height
+
h
->
max_hval
-
1
)
/
h
->
max_hval
;
int
col_height
;
if
(
h
->
levels_mode
)
col_height
=
round
(
h
->
level_height
*
(
1
.
-
(
log2
(
h
->
histogram
[
i
]
+
1
)
/
log2
(
h
->
max_hval
+
1
))));
else
col_height
=
h
->
level_height
-
(
h
->
histogram
[
i
]
*
(
int64_t
)
h
->
level_height
+
h
->
max_hval
-
1
)
/
h
->
max_hval
;
for
(
j
=
h
->
level_height
-
1
;
j
>=
col_height
;
j
--
)
{
if
(
h
->
display_mode
)
{
...
...
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