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
3a81775b
Commit
3a81775b
authored
Aug 11, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_signalstats: measure video bitdepth
parent
ee56d9bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
filters.texi
doc/filters.texi
+12
-0
vf_signalstats.c
libavfilter/vf_signalstats.c
+25
-0
No files found.
doc/filters.texi
View file @
3a81775b
...
...
@@ -11946,6 +11946,18 @@ Expressed in range of [0-255].
Display the average of sample value difference between all values of the V
plane in the current frame and corresponding values of the previous input frame.
Expressed in range of [0-255].
@item YBITDEPTH
Display bit depth of Y plane in current frame.
Expressed in range of [0-16].
@item UBITDEPTH
Display bit depth of U plane in current frame.
Expressed in range of [0-16].
@item VBITDEPTH
Display bit depth of V plane in current frame.
Expressed in range of [0-16].
@end table
The filter accepts the following options:
...
...
libavfilter/vf_signalstats.c
View file @
3a81775b
...
...
@@ -541,6 +541,11 @@ static int compute_sat_hue_metrics16(AVFilterContext *ctx, void *arg, int jobnr,
return
0
;
}
static
unsigned
compute_bit_depth
(
uint16_t
mask
)
{
return
av_popcount
(
mask
);
}
static
int
filter_frame8
(
AVFilterLink
*
link
,
AVFrame
*
in
)
{
AVFilterContext
*
ctx
=
link
->
dst
;
...
...
@@ -569,6 +574,7 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in)
int
toty
=
0
,
totu
=
0
,
totv
=
0
,
totsat
=
0
;
int
tothue
=
0
;
int
dify
=
0
,
difu
=
0
,
difv
=
0
;
uint16_t
masky
=
0
,
masku
=
0
,
maskv
=
0
;
int
filtot
[
FILT_NUMB
]
=
{
0
};
AVFrame
*
prev
;
...
...
@@ -602,6 +608,8 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in)
for
(
j
=
0
;
j
<
link
->
h
;
j
++
)
{
for
(
i
=
0
;
i
<
link
->
w
;
i
++
)
{
const
int
yuv
=
in
->
data
[
0
][
w
+
i
];
masky
|=
yuv
;
histy
[
yuv
]
++
;
dify
+=
abs
(
yuv
-
prev
->
data
[
0
][
pw
+
i
]);
}
...
...
@@ -614,6 +622,9 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in)
for
(
i
=
0
;
i
<
s
->
chromaw
;
i
++
)
{
const
int
yuvu
=
in
->
data
[
1
][
cw
+
i
];
const
int
yuvv
=
in
->
data
[
2
][
cw
+
i
];
masku
|=
yuvu
;
maskv
|=
yuvv
;
histu
[
yuvu
]
++
;
difu
+=
abs
(
yuvu
-
prev
->
data
[
1
][
cpw
+
i
]);
histv
[
yuvv
]
++
;
...
...
@@ -735,6 +746,10 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in)
SET_META
(
"UDIF"
,
"%g"
,
1
.
0
*
difu
/
s
->
cfs
);
SET_META
(
"VDIF"
,
"%g"
,
1
.
0
*
difv
/
s
->
cfs
);
SET_META
(
"YBITDEPTH"
,
"%d"
,
compute_bit_depth
(
masky
));
SET_META
(
"UBITDEPTH"
,
"%d"
,
compute_bit_depth
(
masku
));
SET_META
(
"VBITDEPTH"
,
"%d"
,
compute_bit_depth
(
maskv
));
for
(
fil
=
0
;
fil
<
FILT_NUMB
;
fil
++
)
{
if
(
s
->
filters
&
1
<<
fil
)
{
char
metaname
[
128
];
...
...
@@ -777,6 +792,7 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in)
int64_t
toty
=
0
,
totu
=
0
,
totv
=
0
,
totsat
=
0
;
int64_t
tothue
=
0
;
int64_t
dify
=
0
,
difu
=
0
,
difv
=
0
;
uint16_t
masky
=
0
,
masku
=
0
,
maskv
=
0
;
int
filtot
[
FILT_NUMB
]
=
{
0
};
AVFrame
*
prev
;
...
...
@@ -811,6 +827,8 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in)
for
(
j
=
0
;
j
<
link
->
h
;
j
++
)
{
for
(
i
=
0
;
i
<
link
->
w
;
i
++
)
{
const
int
yuv
=
AV_RN16
(
in
->
data
[
0
]
+
w
+
i
*
2
);
masky
|=
yuv
;
histy
[
yuv
]
++
;
dify
+=
abs
(
yuv
-
AV_RN16
(
prev
->
data
[
0
]
+
pw
+
i
*
2
));
}
...
...
@@ -826,6 +844,9 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in)
for
(
i
=
0
;
i
<
s
->
chromaw
;
i
++
)
{
const
int
yuvu
=
AV_RN16
(
in
->
data
[
1
]
+
cw
+
i
*
2
);
const
int
yuvv
=
AV_RN16
(
in
->
data
[
2
]
+
cw
+
i
*
2
);
masku
|=
yuvu
;
maskv
|=
yuvv
;
histu
[
yuvu
]
++
;
difu
+=
abs
(
yuvu
-
AV_RN16
(
prev
->
data
[
1
]
+
cpw
+
i
*
2
));
histv
[
yuvv
]
++
;
...
...
@@ -942,6 +963,10 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in)
SET_META
(
"UDIF"
,
"%g"
,
1
.
0
*
difu
/
s
->
cfs
);
SET_META
(
"VDIF"
,
"%g"
,
1
.
0
*
difv
/
s
->
cfs
);
SET_META
(
"YBITDEPTH"
,
"%d"
,
compute_bit_depth
(
masky
));
SET_META
(
"UBITDEPTH"
,
"%d"
,
compute_bit_depth
(
masku
));
SET_META
(
"VBITDEPTH"
,
"%d"
,
compute_bit_depth
(
maskv
));
for
(
fil
=
0
;
fil
<
FILT_NUMB
;
fil
++
)
{
if
(
s
->
filters
&
1
<<
fil
)
{
char
metaname
[
128
];
...
...
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