Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
ac0fdac0
Commit
ac0fdac0
authored
Feb 20, 2022
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_maskedmerge: refactor slice function
parent
95427956
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
43 deletions
+30
-43
vf_maskedmerge.c
libavfilter/vf_maskedmerge.c
+30
-43
No files found.
libavfilter/vf_maskedmerge.c
View file @
ac0fdac0
...
...
@@ -137,51 +137,38 @@ static int process_frame(FFFrameSync *fs)
return
ff_filter_frame
(
outlink
,
out
);
}
static
void
maskedmerge8
(
const
uint8_t
*
bsrc
,
const
uint8_t
*
osrc
,
const
uint8_t
*
msrc
,
uint8_t
*
dst
,
ptrdiff_t
blinesize
,
ptrdiff_t
olinesize
,
ptrdiff_t
mlinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
shift
)
{
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
dst
[
x
]
=
bsrc
[
x
]
+
((
msrc
[
x
]
*
(
osrc
[
x
]
-
bsrc
[
x
])
+
128
)
>>
8
);
}
dst
+=
dlinesize
;
bsrc
+=
blinesize
;
osrc
+=
olinesize
;
msrc
+=
mlinesize
;
}
#define MASKEDMERGE(n, type, half, shift) \
static void maskedmerge##n(const uint8_t *bbsrc, const uint8_t *oosrc, \
const uint8_t *mmsrc, uint8_t *ddst, \
ptrdiff_t blinesize, ptrdiff_t olinesize, \
ptrdiff_t mlinesize, ptrdiff_t dlinesize, \
int w, int h, \
int hhalf, int sshift) \
{ \
const type *bsrc = (const type *)bbsrc; \
const type *osrc = (const type *)oosrc; \
const type *msrc = (const type *)mmsrc; \
type *dst = (type *)ddst; \
\
dlinesize /= sizeof(type); \
blinesize /= sizeof(type); \
olinesize /= sizeof(type); \
mlinesize /= sizeof(type); \
\
for (int y = 0; y < h; y++) { \
for (int x = 0; x < w; x++) { \
dst[x] = bsrc[x] + ((msrc[x] * (osrc[x] - bsrc[x]) + half) >> shift); \
} \
\
dst += dlinesize; \
bsrc += blinesize; \
osrc += olinesize; \
msrc += mlinesize; \
} \
}
static
void
maskedmerge16
(
const
uint8_t
*
bbsrc
,
const
uint8_t
*
oosrc
,
const
uint8_t
*
mmsrc
,
uint8_t
*
ddst
,
ptrdiff_t
blinesize
,
ptrdiff_t
olinesize
,
ptrdiff_t
mlinesize
,
ptrdiff_t
dlinesize
,
int
w
,
int
h
,
int
half
,
int
shift
)
{
const
uint16_t
*
bsrc
=
(
const
uint16_t
*
)
bbsrc
;
const
uint16_t
*
osrc
=
(
const
uint16_t
*
)
oosrc
;
const
uint16_t
*
msrc
=
(
const
uint16_t
*
)
mmsrc
;
uint16_t
*
dst
=
(
uint16_t
*
)
ddst
;
int
x
,
y
;
for
(
y
=
0
;
y
<
h
;
y
++
)
{
for
(
x
=
0
;
x
<
w
;
x
++
)
{
dst
[
x
]
=
bsrc
[
x
]
+
((
msrc
[
x
]
*
(
osrc
[
x
]
-
bsrc
[
x
])
+
half
)
>>
shift
);
}
dst
+=
dlinesize
/
2
;
bsrc
+=
blinesize
/
2
;
osrc
+=
olinesize
/
2
;
msrc
+=
mlinesize
/
2
;
}
}
MASKEDMERGE
(
8
,
uint8_t
,
128
,
8
)
MASKEDMERGE
(
16
,
uint16_t
,
hhalf
,
sshift
)
static
int
config_input
(
AVFilterLink
*
inlink
)
{
...
...
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