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
7e91f775
Commit
7e91f775
authored
Nov 13, 2014
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/xbr: refactor src/dst pointers definitions into a macro
parent
18e4bf4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
80 deletions
+25
-80
vf_xbr.c
libavfilter/vf_xbr.c
+25
-80
No files found.
libavfilter/vf_xbr.c
View file @
7e91f775
...
...
@@ -96,6 +96,28 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y)
#define eq(A, B)\
(df(A, B) < 155)\
#define INIT_SRC_DST_POINTERS(level) \
uint32_t *E = (uint32_t *)(output->data[0] + y * output->linesize[0] * (level)); \
const uint32_t *sa2 = (uint32_t *)(input->data[0] + y * input->linesize[0] - 8);
/* center */
\
const uint32_t *sa1 = sa2 - (input->linesize[0]>>2);
/* up x1 */
\
const uint32_t *sa0 = sa1 - (input->linesize[0]>>2);
/* up x2 */
\
const uint32_t *sa3 = sa2 + (input->linesize[0]>>2);
/* down x1 */
\
const uint32_t *sa4 = sa3 + (input->linesize[0]>>2);
/* down x2 */
\
\
if (y <= 1) { \
sa0 = sa1; \
if (y == 0) { \
sa0 = sa1 = sa2; \
} \
} \
\
if (y >= input->height - 2) { \
sa4 = sa3; \
if (y == input->height - 1) { \
sa4 = sa3 = sa2; \
} \
}
#define INIT_21_PIXELS \
const uint32_t B1 = sa0[2]; \
const uint32_t PB = sa1[2]; \
...
...
@@ -167,32 +189,7 @@ static void xbr2x(AVFrame * input, AVFrame * output, const uint32_t * r2y)
int
next_line
=
output
->
linesize
[
0
]
>>
2
;
for
(
y
=
0
;
y
<
input
->
height
;
y
++
)
{
uint32_t
*
E
=
(
uint32_t
*
)(
output
->
data
[
0
]
+
y
*
output
->
linesize
[
0
]
*
2
);
/* middle. Offset of -8 is given */
const
uint32_t
*
sa2
=
(
uint32_t
*
)(
input
->
data
[
0
]
+
y
*
input
->
linesize
[
0
]
-
8
);
/* up one */
const
uint32_t
*
sa1
=
sa2
-
(
input
->
linesize
[
0
]
>>
2
);
/* up two */
const
uint32_t
*
sa0
=
sa1
-
(
input
->
linesize
[
0
]
>>
2
);
/* down one */
const
uint32_t
*
sa3
=
sa2
+
(
input
->
linesize
[
0
]
>>
2
);
/* down two */
const
uint32_t
*
sa4
=
sa3
+
(
input
->
linesize
[
0
]
>>
2
);
if
(
y
<=
1
)
{
sa0
=
sa1
;
if
(
y
==
0
)
{
sa0
=
sa1
=
sa2
;
}
}
if
(
y
>=
input
->
height
-
2
)
{
sa4
=
sa3
;
if
(
y
==
input
->
height
-
1
)
{
sa4
=
sa3
=
sa2
;
}
}
INIT_SRC_DST_POINTERS
(
2
)
for
(
x
=
0
;
x
<
input
->
width
;
x
++
)
{
INIT_21_PIXELS
...
...
@@ -264,33 +261,7 @@ static void xbr3x(AVFrame *input, AVFrame *output, const uint32_t *r2y)
int
x
,
y
;
for
(
y
=
0
;
y
<
input
->
height
;
y
++
)
{
uint32_t
*
E
=
(
uint32_t
*
)(
output
->
data
[
0
]
+
y
*
output
->
linesize
[
0
]
*
3
);
/* middle. Offset of -8 is given */
const
uint32_t
*
sa2
=
(
uint32_t
*
)(
input
->
data
[
0
]
+
y
*
input
->
linesize
[
0
]
-
8
);
/* up one */
const
uint32_t
*
sa1
=
sa2
-
(
input
->
linesize
[
0
]
>>
2
);
/* up two */
const
uint32_t
*
sa0
=
sa1
-
(
input
->
linesize
[
0
]
>>
2
);
/* down one */
const
uint32_t
*
sa3
=
sa2
+
(
input
->
linesize
[
0
]
>>
2
);
/* down two */
const
uint32_t
*
sa4
=
sa3
+
(
input
->
linesize
[
0
]
>>
2
);
if
(
y
<=
1
){
sa0
=
sa1
;
if
(
y
==
0
){
sa0
=
sa1
=
sa2
;
}
}
if
(
y
>=
input
->
height
-
2
){
sa4
=
sa3
;
if
(
y
==
input
->
height
-
1
){
sa4
=
sa3
=
sa2
;
}
}
INIT_SRC_DST_POINTERS
(
3
)
for
(
x
=
0
;
x
<
input
->
width
;
x
++
){
INIT_21_PIXELS
...
...
@@ -370,33 +341,7 @@ static void xbr4x(AVFrame *input, AVFrame *output, const uint32_t *r2y)
int
x
,
y
;
for
(
y
=
0
;
y
<
input
->
height
;
y
++
)
{
uint32_t
*
E
=
(
uint32_t
*
)(
output
->
data
[
0
]
+
y
*
output
->
linesize
[
0
]
*
4
);
/* middle. Offset of -8 is given */
const
uint32_t
*
sa2
=
(
uint32_t
*
)(
input
->
data
[
0
]
+
y
*
input
->
linesize
[
0
]
-
8
);
/* up one */
const
uint32_t
*
sa1
=
sa2
-
(
input
->
linesize
[
0
]
>>
2
);
/* up two */
const
uint32_t
*
sa0
=
sa1
-
(
input
->
linesize
[
0
]
>>
2
);
/* down one */
const
uint32_t
*
sa3
=
sa2
+
(
input
->
linesize
[
0
]
>>
2
);
/* down two */
const
uint32_t
*
sa4
=
sa3
+
(
input
->
linesize
[
0
]
>>
2
);
if
(
y
<=
1
)
{
sa0
=
sa1
;
if
(
y
==
0
)
{
sa0
=
sa1
=
sa2
;
}
}
if
(
y
>=
input
->
height
-
2
)
{
sa4
=
sa3
;
if
(
y
==
input
->
height
-
1
)
{
sa4
=
sa3
=
sa2
;
}
}
INIT_SRC_DST_POINTERS
(
4
)
for
(
x
=
0
;
x
<
input
->
width
;
x
++
)
{
INIT_21_PIXELS
...
...
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