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
5e0abf59
Commit
5e0abf59
authored
Oct 09, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_blend: fix normal mode with opacity != 1
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
f00ec7eb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
vf_blend.c
libavfilter/vf_blend.c
+46
-1
No files found.
libavfilter/vf_blend.c
View file @
5e0abf59
...
@@ -126,6 +126,50 @@ static void blend_normal(const uint8_t *top, ptrdiff_t top_linesize,
...
@@ -126,6 +126,50 @@ static void blend_normal(const uint8_t *top, ptrdiff_t top_linesize,
av_image_copy_plane
(
dst
,
dst_linesize
,
top
,
top_linesize
,
width
,
end
-
start
);
av_image_copy_plane
(
dst
,
dst_linesize
,
top
,
top_linesize
,
width
,
end
-
start
);
}
}
static
void
blend_normal_8bit
(
const
uint8_t
*
top
,
ptrdiff_t
top_linesize
,
const
uint8_t
*
bottom
,
ptrdiff_t
bottom_linesize
,
uint8_t
*
dst
,
ptrdiff_t
dst_linesize
,
ptrdiff_t
width
,
ptrdiff_t
start
,
ptrdiff_t
end
,
FilterParams
*
param
,
double
*
values
)
{
const
double
opacity
=
param
->
opacity
;
int
i
,
j
;
for
(
i
=
start
;
i
<
end
;
i
++
)
{
for
(
j
=
0
;
j
<
width
;
j
++
)
{
dst
[
j
]
=
top
[
j
]
*
opacity
+
bottom
[
j
]
*
(
1
.
-
opacity
);
}
dst
+=
dst_linesize
;
top
+=
top_linesize
;
bottom
+=
bottom_linesize
;
}
}
static
void
blend_normal_16bit
(
const
uint8_t
*
_top
,
ptrdiff_t
top_linesize
,
const
uint8_t
*
_bottom
,
ptrdiff_t
bottom_linesize
,
uint8_t
*
_dst
,
ptrdiff_t
dst_linesize
,
ptrdiff_t
width
,
ptrdiff_t
start
,
ptrdiff_t
end
,
FilterParams
*
param
,
double
*
values
)
{
const
uint16_t
*
top
=
(
uint16_t
*
)
_top
;
const
uint16_t
*
bottom
=
(
uint16_t
*
)
_bottom
;
uint16_t
*
dst
=
(
uint16_t
*
)
_dst
;
const
double
opacity
=
param
->
opacity
;
int
i
,
j
;
dst_linesize
/=
2
;
top_linesize
/=
2
;
bottom_linesize
/=
2
;
for
(
i
=
start
;
i
<
end
;
i
++
)
{
for
(
j
=
0
;
j
<
width
;
j
++
)
{
dst
[
j
]
=
top
[
j
]
*
opacity
+
bottom
[
j
]
*
(
1
.
-
opacity
);
}
dst
+=
dst_linesize
;
top
+=
top_linesize
;
bottom
+=
bottom_linesize
;
}
}
#define DEFINE_BLEND8(name, expr) \
#define DEFINE_BLEND8(name, expr) \
static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize, \
static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize, \
const uint8_t *bottom, ptrdiff_t bottom_linesize, \
const uint8_t *bottom, ptrdiff_t bottom_linesize, \
...
@@ -457,7 +501,8 @@ static int config_output(AVFilterLink *outlink)
...
@@ -457,7 +501,8 @@ static int config_output(AVFilterLink *outlink)
case
BLEND_LINEARLIGHT
:
param
->
blend
=
is_16bit
?
blend_linearlight_16bit
:
blend_linearlight_8bit
;
break
;
case
BLEND_LINEARLIGHT
:
param
->
blend
=
is_16bit
?
blend_linearlight_16bit
:
blend_linearlight_8bit
;
break
;
case
BLEND_MULTIPLY
:
param
->
blend
=
is_16bit
?
blend_multiply_16bit
:
blend_multiply_8bit
;
break
;
case
BLEND_MULTIPLY
:
param
->
blend
=
is_16bit
?
blend_multiply_16bit
:
blend_multiply_8bit
;
break
;
case
BLEND_NEGATION
:
param
->
blend
=
is_16bit
?
blend_negation_16bit
:
blend_negation_8bit
;
break
;
case
BLEND_NEGATION
:
param
->
blend
=
is_16bit
?
blend_negation_16bit
:
blend_negation_8bit
;
break
;
case
BLEND_NORMAL
:
param
->
blend
=
blend_normal
;
break
;
case
BLEND_NORMAL
:
param
->
blend
=
param
->
opacity
==
1
?
blend_normal
:
is_16bit
?
blend_normal_16bit
:
blend_normal_8bit
;
break
;
case
BLEND_OR
:
param
->
blend
=
is_16bit
?
blend_or_16bit
:
blend_or_8bit
;
break
;
case
BLEND_OR
:
param
->
blend
=
is_16bit
?
blend_or_16bit
:
blend_or_8bit
;
break
;
case
BLEND_OVERLAY
:
param
->
blend
=
is_16bit
?
blend_overlay_16bit
:
blend_overlay_8bit
;
break
;
case
BLEND_OVERLAY
:
param
->
blend
=
is_16bit
?
blend_overlay_16bit
:
blend_overlay_8bit
;
break
;
case
BLEND_PHOENIX
:
param
->
blend
=
is_16bit
?
blend_phoenix_16bit
:
blend_phoenix_8bit
;
break
;
case
BLEND_PHOENIX
:
param
->
blend
=
is_16bit
?
blend_phoenix_16bit
:
blend_phoenix_8bit
;
break
;
...
...
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