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
d3621b23
Commit
d3621b23
authored
Nov 17, 2018
by
Martin Vignali
Committed by
Paul B Mahol
Nov 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: use av_clip_uintp2 instead of av_clip for 10b and 12b
parent
420ab946
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
vf_blend.c
libavfilter/vf_blend.c
+10
-10
No files found.
libavfilter/vf_blend.c
View file @
d3621b23
...
...
@@ -326,15 +326,15 @@ DEFINE_BLEND16(linearlight,av_clip_uint16((B < 32768) ? B + 2 * A - 65535 : B +
#define DODGE(a, b) (((a) == 1023) ? (a) : FFMIN(1023, (((b) << 10) / (1023 - (a)))))
DEFINE_BLEND16
(
addition
,
FFMIN
(
1023
,
A
+
B
),
10
)
DEFINE_BLEND16
(
grainmerge
,
av_clip
(
A
+
B
-
512
,
0
,
1023
),
10
)
DEFINE_BLEND16
(
grainmerge
,
(
int
)
av_clip_uintp2
(
A
+
B
-
512
,
10
),
10
)
DEFINE_BLEND16
(
average
,
(
A
+
B
)
/
2
,
10
)
DEFINE_BLEND16
(
subtract
,
FFMAX
(
0
,
A
-
B
),
10
)
DEFINE_BLEND16
(
multiply
,
MULTIPLY
(
1
,
A
,
B
),
10
)
DEFINE_BLEND16
(
multiply128
,
av_clip
((
A
-
512
)
*
B
/
128
.
+
512
,
0
,
1023
),
10
)
DEFINE_BLEND16
(
multiply128
,
(
int
)
av_clip_uintp2
((
A
-
512
)
*
B
/
128
.
+
512
,
10
),
10
)
DEFINE_BLEND16
(
negation
,
1023
-
FFABS
(
1023
-
A
-
B
),
10
)
DEFINE_BLEND16
(
extremity
,
FFABS
(
1023
-
A
-
B
),
10
)
DEFINE_BLEND16
(
difference
,
FFABS
(
A
-
B
),
10
)
DEFINE_BLEND16
(
grainextract
,
av_clip
(
512
+
A
-
B
,
0
,
1023
),
10
)
DEFINE_BLEND16
(
grainextract
,
(
int
)
av_clip_uintp2
(
512
+
A
-
B
,
10
),
10
)
DEFINE_BLEND16
(
screen
,
SCREEN
(
1
,
A
,
B
),
10
)
DEFINE_BLEND16
(
overlay
,
(
A
<
512
)
?
MULTIPLY
(
2
,
A
,
B
)
:
SCREEN
(
2
,
A
,
B
),
10
)
DEFINE_BLEND16
(
hardlight
,
(
B
<
512
)
?
MULTIPLY
(
2
,
B
,
A
)
:
SCREEN
(
2
,
B
,
A
),
10
)
...
...
@@ -343,7 +343,7 @@ DEFINE_BLEND16(heat, (A == 0) ? 0 : 1023 - FFMIN(((1023 - B) * (1023 - B))
DEFINE_BLEND16
(
freeze
,
(
B
==
0
)
?
0
:
1023
-
FFMIN
(((
1023
-
A
)
*
(
1023
-
A
))
/
B
,
1023
),
10
)
DEFINE_BLEND16
(
darken
,
FFMIN
(
A
,
B
),
10
)
DEFINE_BLEND16
(
lighten
,
FFMAX
(
A
,
B
),
10
)
DEFINE_BLEND16
(
divide
,
av_clip
(
B
==
0
?
1023
:
1023
*
A
/
B
,
0
,
1023
),
10
)
DEFINE_BLEND16
(
divide
,
(
int
)
av_clip_uintp2
(
B
==
0
?
1023
:
1023
*
A
/
B
,
10
),
10
)
DEFINE_BLEND16
(
dodge
,
DODGE
(
A
,
B
),
10
)
DEFINE_BLEND16
(
burn
,
BURN
(
A
,
B
),
10
)
DEFINE_BLEND16
(
softlight
,
(
A
>
511
)
?
B
+
(
1023
-
B
)
*
(
A
-
511
.
5
)
/
511
.
5
*
(
0
.
5
-
fabs
(
B
-
511
.
5
)
/
1023
)
:
B
-
B
*
((
511
.
5
-
A
)
/
511
.
5
)
*
(
0
.
5
-
fabs
(
B
-
511
.
5
)
/
1023
),
10
)
...
...
@@ -356,7 +356,7 @@ DEFINE_BLEND16(and, A & B, 10)
DEFINE_BLEND16
(
or
,
A
|
B
,
10
)
DEFINE_BLEND16
(
xor
,
A
^
B
,
10
)
DEFINE_BLEND16
(
vividlight
,
(
A
<
512
)
?
BURN
(
2
*
A
,
B
)
:
DODGE
(
2
*
(
A
-
512
),
B
),
10
)
DEFINE_BLEND16
(
linearlight
,
av_clip
((
B
<
512
)
?
B
+
2
*
A
-
1023
:
B
+
2
*
(
A
-
512
),
0
,
1023
),
10
)
DEFINE_BLEND16
(
linearlight
,
(
int
)
av_clip_uintp2
((
B
<
512
)
?
B
+
2
*
A
-
1023
:
B
+
2
*
(
A
-
512
),
10
),
10
)
#undef MULTIPLY
#undef SCREEN
...
...
@@ -369,15 +369,15 @@ DEFINE_BLEND16(linearlight,av_clip((B < 512) ? B + 2 * A - 1023 : B + 2 * (A - 5
#define DODGE(a, b) (((a) == 4095) ? (a) : FFMIN(4095, (((b) << 12) / (4095 - (a)))))
DEFINE_BLEND16
(
addition
,
FFMIN
(
4095
,
A
+
B
),
12
)
DEFINE_BLEND16
(
grainmerge
,
av_clip
(
A
+
B
-
2048
,
0
,
4095
),
12
)
DEFINE_BLEND16
(
grainmerge
,
(
int
)
av_clip_uintp2
(
A
+
B
-
2048
,
12
),
12
)
DEFINE_BLEND16
(
average
,
(
A
+
B
)
/
2
,
12
)
DEFINE_BLEND16
(
subtract
,
FFMAX
(
0
,
A
-
B
),
12
)
DEFINE_BLEND16
(
multiply
,
MULTIPLY
(
1
,
A
,
B
),
12
)
DEFINE_BLEND16
(
multiply128
,
av_clip
((
A
-
2048
)
*
B
/
512
.
+
2048
,
0
,
4095
),
12
)
DEFINE_BLEND16
(
multiply128
,
(
int
)
av_clip_uintp2
((
A
-
2048
)
*
B
/
512
.
+
2048
,
12
),
12
)
DEFINE_BLEND16
(
negation
,
4095
-
FFABS
(
4095
-
A
-
B
),
12
)
DEFINE_BLEND16
(
extremity
,
FFABS
(
4095
-
A
-
B
),
12
)
DEFINE_BLEND16
(
difference
,
FFABS
(
A
-
B
),
12
)
DEFINE_BLEND16
(
grainextract
,
av_clip
(
2048
+
A
-
B
,
0
,
4095
),
12
)
DEFINE_BLEND16
(
grainextract
,
(
int
)
av_clip_uintp2
(
2048
+
A
-
B
,
12
),
12
)
DEFINE_BLEND16
(
screen
,
SCREEN
(
1
,
A
,
B
),
12
)
DEFINE_BLEND16
(
overlay
,
(
A
<
2048
)
?
MULTIPLY
(
2
,
A
,
B
)
:
SCREEN
(
2
,
A
,
B
),
12
)
DEFINE_BLEND16
(
hardlight
,
(
B
<
2048
)
?
MULTIPLY
(
2
,
B
,
A
)
:
SCREEN
(
2
,
B
,
A
),
12
)
...
...
@@ -386,7 +386,7 @@ DEFINE_BLEND16(heat, (A == 0) ? 0 : 4095 - FFMIN(((4095 - B) * (4095 - B))
DEFINE_BLEND16
(
freeze
,
(
B
==
0
)
?
0
:
4095
-
FFMIN
(((
4095
-
A
)
*
(
4095
-
A
))
/
B
,
4095
),
12
)
DEFINE_BLEND16
(
darken
,
FFMIN
(
A
,
B
),
12
)
DEFINE_BLEND16
(
lighten
,
FFMAX
(
A
,
B
),
12
)
DEFINE_BLEND16
(
divide
,
av_clip
(
B
==
0
?
4095
:
4095
*
A
/
B
,
0
,
4095
),
12
)
DEFINE_BLEND16
(
divide
,
(
int
)
av_clip_uintp2
(
B
==
0
?
4095
:
4095
*
A
/
B
,
12
),
12
)
DEFINE_BLEND16
(
dodge
,
DODGE
(
A
,
B
),
12
)
DEFINE_BLEND16
(
burn
,
BURN
(
A
,
B
),
12
)
DEFINE_BLEND16
(
softlight
,
(
A
>
2047
)
?
B
+
(
4095
-
B
)
*
(
A
-
2047
.
5
)
/
2047
.
5
*
(
0
.
5
-
fabs
(
B
-
2047
.
5
)
/
4095
)
:
B
-
B
*
((
2047
.
5
-
A
)
/
2047
.
5
)
*
(
0
.
5
-
fabs
(
B
-
2047
.
5
)
/
4095
),
12
)
...
...
@@ -399,7 +399,7 @@ DEFINE_BLEND16(and, A & B, 12)
DEFINE_BLEND16
(
or
,
A
|
B
,
12
)
DEFINE_BLEND16
(
xor
,
A
^
B
,
12
)
DEFINE_BLEND16
(
vividlight
,
(
A
<
2048
)
?
BURN
(
2
*
A
,
B
)
:
DODGE
(
2
*
(
A
-
2048
),
B
),
12
)
DEFINE_BLEND16
(
linearlight
,
av_clip
((
B
<
2048
)
?
B
+
2
*
A
-
4095
:
B
+
2
*
(
A
-
2048
),
0
,
4095
),
12
)
DEFINE_BLEND16
(
linearlight
,
(
int
)
av_clip_uintp2
((
B
<
2048
)
?
B
+
2
*
A
-
4095
:
B
+
2
*
(
A
-
2048
),
12
),
12
)
#define DEFINE_BLEND_EXPR(type, name, div) \
static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize, \
...
...
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