Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
7e91f775
Commit
7e91f775
authored
10 years ago
by
Clément Bœsch
Browse files
Options
Downloads
Patches
Plain Diff
avfilter/xbr: refactor src/dst pointers definitions into a macro
parent
18e4bf4f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavfilter/vf_xbr.c
+25
-80
25 additions, 80 deletions
libavfilter/vf_xbr.c
with
25 additions
and
80 deletions
libavfilter/vf_xbr.c
+
25
−
80
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment