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
f53fc935
Commit
f53fc935
authored
Apr 26, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_pixscope: also show standard deviation of zoomed area
parent
cca0436e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
vf_datascope.c
libavfilter/vf_datascope.c
+28
-3
No files found.
libavfilter/vf_datascope.c
View file @
f53fc935
...
...
@@ -452,6 +452,8 @@ typedef struct PixscopeContext {
FFDrawColor
red
;
FFDrawColor
*
colors
[
4
];
uint16_t
values
[
4
][
80
][
80
];
void
(
*
pick_color
)(
FFDrawContext
*
draw
,
FFDrawColor
*
color
,
AVFrame
*
in
,
int
x
,
int
y
,
int
*
value
);
}
PixscopeContext
;
...
...
@@ -526,6 +528,8 @@ static int pixscope_config_input(AVFilterLink *inlink)
return
0
;
}
#define SQR(x) ((x)*(x))
static
int
pixscope_filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
in
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
...
...
@@ -534,7 +538,7 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFrame
*
out
=
ff_get_video_buffer
(
outlink
,
in
->
width
,
in
->
height
);
int
max
[
4
]
=
{
0
},
min
[
4
]
=
{
INT_MAX
,
INT_MAX
,
INT_MAX
,
INT_MAX
};
float
average
[
4
]
=
{
0
};
double
rms
[
4
]
=
{
0
};
double
std
[
4
]
=
{
0
},
rms
[
4
]
=
{
0
};
const
char
rgba
[
4
]
=
{
'R'
,
'G'
,
'B'
,
'A'
};
const
char
yuva
[
4
]
=
{
'Y'
,
'U'
,
'V'
,
'A'
};
int
x
,
y
,
X
,
Y
,
i
,
w
,
h
;
...
...
@@ -591,6 +595,7 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
ff_fill_rectangle
(
&
s
->
draw
,
&
color
,
out
->
data
,
out
->
linesize
,
x
*
w
+
(
s
->
ww
-
4
-
(
s
->
w
*
w
))
/
2
+
X
,
y
*
h
+
2
+
Y
,
w
,
h
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
s
->
values
[
i
][
x
][
y
]
=
value
[
i
];
rms
[
i
]
+=
(
double
)
value
[
i
]
*
(
double
)
value
[
i
];
average
[
i
]
+=
value
[
i
];
min
[
i
]
=
FFMIN
(
min
[
i
],
value
[
i
]);
...
...
@@ -637,13 +642,33 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
average
[
i
]
/=
s
->
w
*
s
->
h
;
}
for
(
y
=
0
;
y
<
s
->
h
;
y
++
)
{
for
(
x
=
0
;
x
<
s
->
w
;
x
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
std
[
i
]
+=
SQR
(
s
->
values
[
i
][
x
][
y
]
-
average
[
i
]);
}
}
for
(
i
=
0
;
i
<
4
;
i
++
)
{
std
[
i
]
/=
s
->
w
*
s
->
h
;
std
[
i
]
=
sqrt
(
std
[
i
]);
}
snprintf
(
text
,
sizeof
(
text
),
"CH AVG MIN MAX RMS
\n
"
);
draw_text
(
&
s
->
draw
,
out
,
&
s
->
white
,
X
+
28
,
Y
+
s
->
ww
+
20
,
text
,
0
);
draw_text
(
&
s
->
draw
,
out
,
&
s
->
white
,
X
+
28
,
Y
+
s
->
ww
+
5
,
text
,
0
);
for
(
i
=
0
;
i
<
s
->
nb_comps
;
i
++
)
{
int
c
=
s
->
rgba_map
[
i
];
snprintf
(
text
,
sizeof
(
text
),
"%c %07.1f %05d %05d %07.1f
\n
"
,
s
->
is_rgb
?
rgba
[
i
]
:
yuva
[
i
],
average
[
c
],
min
[
c
],
max
[
c
],
rms
[
c
]);
draw_text
(
&
s
->
draw
,
out
,
s
->
colors
[
i
],
X
+
28
,
Y
+
s
->
ww
+
20
*
(
i
+
2
),
text
,
0
);
draw_text
(
&
s
->
draw
,
out
,
s
->
colors
[
i
],
X
+
28
,
Y
+
s
->
ww
+
15
*
(
i
+
1
),
text
,
0
);
}
snprintf
(
text
,
sizeof
(
text
),
"CH STD
\n
"
);
draw_text
(
&
s
->
draw
,
out
,
&
s
->
white
,
X
+
28
,
Y
+
s
->
ww
+
15
*
(
0
+
5
),
text
,
0
);
for
(
i
=
0
;
i
<
s
->
nb_comps
;
i
++
)
{
int
c
=
s
->
rgba_map
[
i
];
snprintf
(
text
,
sizeof
(
text
),
"%c %07.2f
\n
"
,
s
->
is_rgb
?
rgba
[
i
]
:
yuva
[
i
],
std
[
c
]);
draw_text
(
&
s
->
draw
,
out
,
s
->
colors
[
i
],
X
+
28
,
Y
+
s
->
ww
+
15
*
(
i
+
6
),
text
,
0
);
}
av_frame_free
(
&
in
);
...
...
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