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
bbc7cfbf
Commit
bbc7cfbf
authored
Jul 20, 2017
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/testsrc2: fix completely transparent alpha.
parent
4a654be3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
filters.texi
doc/filters.texi
+5
-0
vsrc_testsrc.c
libavfilter/vsrc_testsrc.c
+9
-3
No files found.
doc/filters.texi
View file @
bbc7cfbf
...
...
@@ -16394,6 +16394,11 @@ The sources accept the following parameters:
@table @option
@item alpha
Specify the alpha (opacity) of the background, only available in the
@code{testsrc2} source. The value must be between 0 (fully transparent) and
255 (fully opaque, the default).
@item color, c
Specify the color of the source, only available in the @code{color}
source. For the syntax of this option, check the "Color" section in the
...
...
libavfilter/vsrc_testsrc.c
View file @
bbc7cfbf
...
...
@@ -66,6 +66,9 @@ typedef struct TestSourceContext {
/* only used by testsrc */
int
nb_decimals
;
/* only used by testsrc2 */
int
alpha
;
/* only used by color */
FFDrawContext
draw
;
FFDrawColor
color
;
...
...
@@ -685,6 +688,7 @@ AVFilter ff_vsrc_testsrc = {
static
const
AVOption
testsrc2_options
[]
=
{
COMMON_OPTIONS
{
"alpha"
,
"set global alpha (opacity)"
,
OFFSET
(
alpha
),
AV_OPT_TYPE_INT
,
{.
i64
=
255
},
0
,
255
,
FLAGS
},
{
NULL
}
};
...
...
@@ -735,6 +739,7 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame)
{
TestSourceContext
*
s
=
ctx
->
priv
;
FFDrawColor
color
;
unsigned
alpha
=
(
uint32_t
)
s
->
alpha
<<
24
;
/* colored background */
{
...
...
@@ -746,7 +751,8 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame)
x2
=
ff_draw_round_to_sub
(
&
s
->
draw
,
0
,
0
,
x2
);
set_color
(
s
,
&
color
,
((
i
&
1
)
?
0xFF0000
:
0
)
|
((
i
&
2
)
?
0x00FF00
:
0
)
|
((
i
&
4
)
?
0x0000FF
:
0
));
((
i
&
4
)
?
0x0000FF
:
0
)
|
alpha
);
ff_fill_rectangle
(
&
s
->
draw
,
&
color
,
frame
->
data
,
frame
->
linesize
,
x
,
0
,
x2
-
x
,
frame
->
height
);
x
=
x2
;
...
...
@@ -763,7 +769,7 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame)
g0
=
av_rescale_q
(
s
->
pts
,
s
->
time_base
,
av_make_q
(
1
,
128
));
for
(
x
=
0
;
x
<
s
->
w
;
x
+=
dx
)
{
g
=
(
av_rescale
(
x
,
6
*
256
,
s
->
w
)
+
g0
)
%
(
6
*
256
);
set_color
(
s
,
&
color
,
color_gradient
(
g
));
set_color
(
s
,
&
color
,
color_gradient
(
g
)
|
alpha
);
y
=
y0
+
av_rescale
(
x
,
s
->
h
/
2
,
s
->
w
);
y
%=
2
*
(
s
->
h
-
16
);
if
(
y
>
s
->
h
-
16
)
...
...
@@ -785,7 +791,7 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame)
int
c
,
i
;
for
(
c
=
0
;
c
<
3
;
c
++
)
{
set_color
(
s
,
&
color
,
0xBBBBBB
^
(
0xFF
<<
(
c
<<
3
))
);
set_color
(
s
,
&
color
,
(
0xBBBBBB
^
(
0xFF
<<
(
c
<<
3
)))
|
alpha
);
pos
=
av_rescale_q
(
s
->
pts
,
s
->
time_base
,
av_make_q
(
64
>>
(
c
<<
1
),
cycle
))
%
cycle
;
xh
=
pos
<
1
*
l
?
pos
:
pos
<
2
*
l
?
l
:
...
...
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