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
8d2da093
Commit
8d2da093
authored
Aug 15, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_datascope: make it possible to change pixscope window position
parent
b9ce4362
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
37 deletions
+49
-37
filters.texi
doc/filters.texi
+8
-2
vf_datascope.c
libavfilter/vf_datascope.c
+41
-35
No files found.
doc/filters.texi
View file @
8d2da093
...
@@ -11527,10 +11527,10 @@ The filters accept the following options:
...
@@ -11527,10 +11527,10 @@ The filters accept the following options:
@table @option
@table @option
@item x
@item x
Set scope X position, offset on X axis.
Set scope X position,
relative
offset on X axis.
@item y
@item y
Set scope Y position, offset on Y axis.
Set scope Y position,
relative
offset on Y axis.
@item w
@item w
Set scope width.
Set scope width.
...
@@ -11540,6 +11540,12 @@ Set scope height.
...
@@ -11540,6 +11540,12 @@ Set scope height.
@item o
@item o
Set window opacity. This window also holds statistics about pixel area.
Set window opacity. This window also holds statistics about pixel area.
@item wx
Set window X position, relative offset on X axis.
@item wy
Set window Y position, relative offset on Y axis.
@end table
@end table
@section pp
@section pp
...
...
libavfilter/vf_datascope.c
View file @
8d2da093
...
@@ -424,6 +424,7 @@ typedef struct PixscopeContext {
...
@@ -424,6 +424,7 @@ typedef struct PixscopeContext {
const
AVClass
*
class
;
const
AVClass
*
class
;
float
xpos
,
ypos
;
float
xpos
,
ypos
;
float
wx
,
wy
;
int
w
,
h
;
int
w
,
h
;
float
o
;
float
o
;
...
@@ -449,11 +450,13 @@ typedef struct PixscopeContext {
...
@@ -449,11 +450,13 @@ typedef struct PixscopeContext {
#define POFFSET(x) offsetof(PixscopeContext, x)
#define POFFSET(x) offsetof(PixscopeContext, x)
static
const
AVOption
pixscope_options
[]
=
{
static
const
AVOption
pixscope_options
[]
=
{
{
"x"
,
"set scope x offset"
,
POFFSET
(
xpos
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
5
},
0
,
1
,
FLAGS
},
{
"x"
,
"set scope x offset"
,
POFFSET
(
xpos
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
5
},
0
,
1
,
FLAGS
},
{
"y"
,
"set scope y offset"
,
POFFSET
(
ypos
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
5
},
0
,
1
,
FLAGS
},
{
"y"
,
"set scope y offset"
,
POFFSET
(
ypos
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
5
},
0
,
1
,
FLAGS
},
{
"w"
,
"set scope width"
,
POFFSET
(
w
),
AV_OPT_TYPE_INT
,
{.
i64
=
7
},
1
,
80
,
FLAGS
},
{
"w"
,
"set scope width"
,
POFFSET
(
w
),
AV_OPT_TYPE_INT
,
{.
i64
=
7
},
1
,
80
,
FLAGS
},
{
"h"
,
"set scope height"
,
POFFSET
(
h
),
AV_OPT_TYPE_INT
,
{.
i64
=
7
},
1
,
80
,
FLAGS
},
{
"h"
,
"set scope height"
,
POFFSET
(
h
),
AV_OPT_TYPE_INT
,
{.
i64
=
7
},
1
,
80
,
FLAGS
},
{
"o"
,
"set window opacity"
,
POFFSET
(
o
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
5
},
0
,
1
,
FLAGS
},
{
"o"
,
"set window opacity"
,
POFFSET
(
o
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
5
},
0
,
1
,
FLAGS
},
{
"wx"
,
"set window x offset"
,
POFFSET
(
wx
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"wy"
,
"set window y offset"
,
POFFSET
(
wy
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
},
0
,
1
,
FLAGS
},
{
NULL
}
{
NULL
}
};
};
...
@@ -520,6 +523,7 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
...
@@ -520,6 +523,7 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
PixscopeContext
*
s
=
ctx
->
priv
;
PixscopeContext
*
s
=
ctx
->
priv
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
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
};
int
max
[
4
]
=
{
0
},
min
[
4
]
=
{
INT_MAX
,
INT_MAX
,
INT_MAX
,
INT_MAX
};
float
average
[
4
]
=
{
0
};
float
average
[
4
]
=
{
0
};
double
rms
[
4
]
=
{
0
};
double
rms
[
4
]
=
{
0
};
...
@@ -528,19 +532,21 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
...
@@ -528,19 +532,21 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
int
x
,
y
,
X
,
Y
,
i
,
w
,
h
;
int
x
,
y
,
X
,
Y
,
i
,
w
,
h
;
char
text
[
128
];
char
text
[
128
];
if
(
!
out
)
{
av_frame_free
(
&
in
);
return
AVERROR
(
ENOMEM
);
}
av_frame_copy_props
(
out
,
in
);
av_frame_copy
(
out
,
in
);
w
=
s
->
ww
/
s
->
w
;
w
=
s
->
ww
/
s
->
w
;
h
=
s
->
ww
/
s
->
h
;
h
=
s
->
ww
/
s
->
h
;
if
(
s
->
x
<=
s
->
ww
&&
s
->
y
<=
s
->
wh
)
{
X
=
(
in
->
width
-
s
->
ww
)
*
s
->
wx
;
X
=
in
->
width
-
s
->
ww
;
Y
=
(
in
->
height
-
s
->
wh
)
*
s
->
wy
;
Y
=
in
->
height
-
s
->
wh
;
}
else
{
X
=
0
;
Y
=
0
;
}
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
dark
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
dark
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
X
,
X
,
Y
,
Y
,
s
->
ww
,
s
->
ww
,
...
@@ -552,7 +558,7 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
...
@@ -552,7 +558,7 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
int
value
[
4
]
=
{
0
};
int
value
[
4
]
=
{
0
};
s
->
pick_color
(
&
s
->
draw
,
&
color
,
in
,
x
+
s
->
x
,
y
+
s
->
y
,
value
);
s
->
pick_color
(
&
s
->
draw
,
&
color
,
in
,
x
+
s
->
x
,
y
+
s
->
y
,
value
);
ff_fill_rectangle
(
&
s
->
draw
,
&
color
,
in
->
data
,
in
->
linesize
,
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
);
x
*
w
+
(
s
->
ww
-
4
-
(
s
->
w
*
w
))
/
2
+
X
,
y
*
h
+
2
+
Y
,
w
,
h
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
rms
[
i
]
+=
(
double
)
value
[
i
]
*
(
double
)
value
[
i
];
rms
[
i
]
+=
(
double
)
value
[
i
]
*
(
double
)
value
[
i
];
...
@@ -563,36 +569,36 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
...
@@ -563,36 +569,36 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
}
}
}
}
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
-
2
,
s
->
y
-
2
,
s
->
w
+
4
,
1
);
s
->
x
-
2
,
s
->
y
-
2
,
s
->
w
+
4
,
1
);
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
-
1
,
s
->
y
-
1
,
s
->
w
+
2
,
1
);
s
->
x
-
1
,
s
->
y
-
1
,
s
->
w
+
2
,
1
);
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
-
1
,
s
->
y
-
1
,
1
,
s
->
h
+
2
);
s
->
x
-
1
,
s
->
y
-
1
,
1
,
s
->
h
+
2
);
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
-
2
,
s
->
y
-
2
,
1
,
s
->
h
+
4
);
s
->
x
-
2
,
s
->
y
-
2
,
1
,
s
->
h
+
4
);
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
-
1
,
s
->
y
+
1
+
s
->
h
,
s
->
w
+
3
,
1
);
s
->
x
-
1
,
s
->
y
+
1
+
s
->
h
,
s
->
w
+
3
,
1
);
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
-
2
,
s
->
y
+
2
+
s
->
h
,
s
->
w
+
4
,
1
);
s
->
x
-
2
,
s
->
y
+
2
+
s
->
h
,
s
->
w
+
4
,
1
);
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
white
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
+
1
+
s
->
w
,
s
->
y
-
1
,
1
,
s
->
h
+
2
);
s
->
x
+
1
+
s
->
w
,
s
->
y
-
1
,
1
,
s
->
h
+
2
);
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
in
->
data
,
in
->
linesize
,
ff_blend_rectangle
(
&
s
->
draw
,
&
s
->
black
,
out
->
data
,
out
->
linesize
,
in
->
width
,
in
->
height
,
out
->
width
,
out
->
height
,
s
->
x
+
2
+
s
->
w
,
s
->
y
-
2
,
1
,
s
->
h
+
5
);
s
->
x
+
2
+
s
->
w
,
s
->
y
-
2
,
1
,
s
->
h
+
5
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
...
@@ -602,15 +608,16 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
...
@@ -602,15 +608,16 @@ static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
}
}
snprintf
(
text
,
sizeof
(
text
),
"CH AVG MIN MAX RMS
\n
"
);
snprintf
(
text
,
sizeof
(
text
),
"CH AVG MIN MAX RMS
\n
"
);
draw_text
(
&
s
->
draw
,
in
,
&
s
->
white
,
X
+
28
,
Y
+
s
->
ww
+
20
,
text
,
0
);
draw_text
(
&
s
->
draw
,
out
,
&
s
->
white
,
X
+
28
,
Y
+
s
->
ww
+
20
,
text
,
0
);
for
(
i
=
0
;
i
<
s
->
nb_comps
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
nb_comps
;
i
++
)
{
int
c
=
s
->
rgba_map
[
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
]);
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
,
in
,
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
+
20
*
(
i
+
2
),
text
,
0
);
}
}
return
ff_filter_frame
(
outlink
,
in
);
av_frame_free
(
&
in
);
return
ff_filter_frame
(
outlink
,
out
);
}
}
static
const
AVFilterPad
pixscope_inputs
[]
=
{
static
const
AVFilterPad
pixscope_inputs
[]
=
{
...
@@ -619,7 +626,6 @@ static const AVFilterPad pixscope_inputs[] = {
...
@@ -619,7 +626,6 @@ static const AVFilterPad pixscope_inputs[] = {
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
filter_frame
=
pixscope_filter_frame
,
.
filter_frame
=
pixscope_filter_frame
,
.
config_props
=
pixscope_config_input
,
.
config_props
=
pixscope_config_input
,
.
needs_writable
=
1
,
},
},
{
NULL
}
{
NULL
}
};
};
...
...
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