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
feb2ea6e
Commit
feb2ea6e
authored
Aug 24, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: add yuvtestsrc source filter
parent
5d774301
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
184 additions
and
1 deletion
+184
-1
Changelog
Changelog
+1
-0
filters.texi
doc/filters.texi
+5
-1
Makefile
libavfilter/Makefile
+1
-0
allfilters.c
libavfilter/allfilters.c
+1
-0
vsrc_testsrc.c
libavfilter/vsrc_testsrc.c
+176
-0
No files found.
Changelog
View file @
feb2ea6e
...
...
@@ -21,6 +21,7 @@ version <next>:
- maskedclamp filter
- hysteresis filter
- lut2 filter
- yuvtestsrc filter
version 3.1:
...
...
doc/filters.texi
View file @
feb2ea6e
...
...
@@ -14867,7 +14867,8 @@ ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_c
@anchor{smptehdbars}
@anchor{testsrc}
@anchor{testsrc2}
@section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
@anchor{yuvtestsrc}
@section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
...
...
@@ -14900,6 +14901,9 @@ The @code{testsrc2} source is similar to testsrc, but supports more
pixel formats instead of just @code{rgb24}. This allows using it as an
input for other tests without requiring a format conversion.
The @code{yuvtestsrc} source generates an YUV test pattern. You should
see a y, cb and cr stripe from top to bottom.
The sources accept the following parameters:
@table @option
...
...
libavfilter/Makefile
View file @
feb2ea6e
...
...
@@ -315,6 +315,7 @@ OBJS-$(CONFIG_SMPTEBARS_FILTER) += vsrc_testsrc.o
OBJS-$(CONFIG_SMPTEHDBARS_FILTER)
+=
vsrc_testsrc.o
OBJS-$(CONFIG_TESTSRC_FILTER)
+=
vsrc_testsrc.o
OBJS-$(CONFIG_TESTSRC2_FILTER)
+=
vsrc_testsrc.o
OBJS-$(CONFIG_YUVTESTSRC_FILTER)
+=
vsrc_testsrc.o
# multimedia filters
OBJS-$(CONFIG_ADRAWGRAPH_FILTER)
+=
f_drawgraph.o
...
...
libavfilter/allfilters.c
View file @
feb2ea6e
...
...
@@ -330,6 +330,7 @@ void avfilter_register_all(void)
REGISTER_FILTER
(
SMPTEHDBARS
,
smptehdbars
,
vsrc
);
REGISTER_FILTER
(
TESTSRC
,
testsrc
,
vsrc
);
REGISTER_FILTER
(
TESTSRC2
,
testsrc2
,
vsrc
);
REGISTER_FILTER
(
YUVTESTSRC
,
yuvtestsrc
,
vsrc
);
REGISTER_FILTER
(
NULLSINK
,
nullsink
,
vsink
);
...
...
libavfilter/vsrc_testsrc.c
View file @
feb2ea6e
...
...
@@ -1070,6 +1070,182 @@ AVFilter ff_vsrc_rgbtestsrc = {
#endif
/* CONFIG_RGBTESTSRC_FILTER */
#if CONFIG_YUVTESTSRC_FILTER
#define yuvtestsrc_options options
AVFILTER_DEFINE_CLASS
(
yuvtestsrc
);
static
void
yuvtest_fill_picture8
(
AVFilterContext
*
ctx
,
AVFrame
*
frame
)
{
int
x
,
y
,
w
=
frame
->
width
,
h
=
frame
->
height
/
3
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
frame
->
format
);
const
int
factor
=
1
<<
desc
->
comp
[
0
].
depth
;
const
int
mid
=
1
<<
(
desc
->
comp
[
0
].
depth
-
1
);
uint8_t
*
ydst
=
frame
->
data
[
0
];
uint8_t
*
udst
=
frame
->
data
[
1
];
uint8_t
*
vdst
=
frame
->
data
[
2
];
int
ylinesize
=
frame
->
linesize
[
0
];
int
ulinesize
=
frame
->
linesize
[
1
];
int
vlinesize
=
frame
->
linesize
[
2
];
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
int
c
=
factor
*
x
/
w
;
ydst
[
x
]
=
c
;
udst
[
x
]
=
mid
;
vdst
[
x
]
=
mid
;
}
ydst
+=
ylinesize
;
udst
+=
ulinesize
;
vdst
+=
vlinesize
;
}
h
+=
h
;
for
(;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
int
c
=
factor
*
x
/
w
;
ydst
[
x
]
=
mid
;
udst
[
x
]
=
c
;
vdst
[
x
]
=
mid
;
}
ydst
+=
ylinesize
;
udst
+=
ulinesize
;
vdst
+=
vlinesize
;
}
for
(;
y
<
frame
->
height
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
int
c
=
factor
*
x
/
w
;
ydst
[
x
]
=
mid
;
udst
[
x
]
=
mid
;
vdst
[
x
]
=
c
;
}
ydst
+=
ylinesize
;
udst
+=
ulinesize
;
vdst
+=
vlinesize
;
}
}
static
void
yuvtest_fill_picture16
(
AVFilterContext
*
ctx
,
AVFrame
*
frame
)
{
int
x
,
y
,
w
=
frame
->
width
,
h
=
frame
->
height
/
3
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
frame
->
format
);
const
int
factor
=
1
<<
desc
->
comp
[
0
].
depth
;
const
int
mid
=
1
<<
(
desc
->
comp
[
0
].
depth
-
1
);
uint16_t
*
ydst
=
(
uint16_t
*
)
frame
->
data
[
0
];
uint16_t
*
udst
=
(
uint16_t
*
)
frame
->
data
[
1
];
uint16_t
*
vdst
=
(
uint16_t
*
)
frame
->
data
[
2
];
int
ylinesize
=
frame
->
linesize
[
0
]
/
2
;
int
ulinesize
=
frame
->
linesize
[
1
]
/
2
;
int
vlinesize
=
frame
->
linesize
[
2
]
/
2
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
int
c
=
factor
*
x
/
w
;
ydst
[
x
]
=
c
;
udst
[
x
]
=
mid
;
vdst
[
x
]
=
mid
;
}
ydst
+=
ylinesize
;
udst
+=
ulinesize
;
vdst
+=
vlinesize
;
}
h
+=
h
;
for
(;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
int
c
=
factor
*
x
/
w
;
ydst
[
x
]
=
mid
;
udst
[
x
]
=
c
;
vdst
[
x
]
=
mid
;
}
ydst
+=
ylinesize
;
udst
+=
ulinesize
;
vdst
+=
vlinesize
;
}
for
(;
y
<
frame
->
height
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
int
c
=
factor
*
x
/
w
;
ydst
[
x
]
=
mid
;
udst
[
x
]
=
mid
;
vdst
[
x
]
=
c
;
}
ydst
+=
ylinesize
;
udst
+=
ulinesize
;
vdst
+=
vlinesize
;
}
}
static
av_cold
int
yuvtest_init
(
AVFilterContext
*
ctx
)
{
TestSourceContext
*
test
=
ctx
->
priv
;
test
->
draw_once
=
1
;
return
init
(
ctx
);
}
static
int
yuvtest_query_formats
(
AVFilterContext
*
ctx
)
{
static
const
enum
AVPixelFormat
pix_fmts
[]
=
{
AV_PIX_FMT_YUV444P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_YUV444P9
,
AV_PIX_FMT_YUV444P10
,
AV_PIX_FMT_YUV444P12
,
AV_PIX_FMT_YUV444P14
,
AV_PIX_FMT_YUV444P16
,
AV_PIX_FMT_NONE
};
AVFilterFormats
*
fmts_list
=
ff_make_format_list
(
pix_fmts
);
if
(
!
fmts_list
)
return
AVERROR
(
ENOMEM
);
return
ff_set_common_formats
(
ctx
,
fmts_list
);
}
static
int
yuvtest_config_props
(
AVFilterLink
*
outlink
)
{
TestSourceContext
*
test
=
outlink
->
src
->
priv
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
outlink
->
format
);
test
->
fill_picture_fn
=
desc
->
comp
[
0
].
depth
>
8
?
yuvtest_fill_picture16
:
yuvtest_fill_picture8
;
return
config_props
(
outlink
);
}
static
const
AVFilterPad
avfilter_vsrc_yuvtestsrc_outputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
request_frame
=
request_frame
,
.
config_props
=
yuvtest_config_props
,
},
{
NULL
}
};
AVFilter
ff_vsrc_yuvtestsrc
=
{
.
name
=
"yuvtestsrc"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Generate YUV test pattern."
),
.
priv_size
=
sizeof
(
TestSourceContext
),
.
priv_class
=
&
yuvtestsrc_class
,
.
init
=
yuvtest_init
,
.
uninit
=
uninit
,
.
query_formats
=
yuvtest_query_formats
,
.
inputs
=
NULL
,
.
outputs
=
avfilter_vsrc_yuvtestsrc_outputs
,
};
#endif
/* CONFIG_YUVTESTSRC_FILTER */
#if CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
static
const
uint8_t
rainbow
[
7
][
4
]
=
{
...
...
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