Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
95390bac
Commit
95390bac
authored
Aug 31, 2015
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video_filter: gradient: use C99 loop declarations
parent
7cea41c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
modules/video_filter/gradient.c
modules/video_filter/gradient.c
+16
-21
No files found.
modules/video_filter/gradient.c
View file @
95390bac
...
@@ -294,10 +294,9 @@ static void GaussianConvolution( picture_t *p_inpic, uint32_t *p_smooth )
...
@@ -294,10 +294,9 @@ static void GaussianConvolution( picture_t *p_inpic, uint32_t *p_smooth )
const
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
const
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
const
int
i_num_lines
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_lines
;
const
int
i_num_lines
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_lines
;
int
x
,
y
;
for
(
int
y
=
2
;
y
<
i_num_lines
-
2
;
y
++
)
for
(
y
=
2
;
y
<
i_num_lines
-
2
;
y
++
)
{
{
for
(
x
=
2
;
x
<
i_src_visible
-
2
;
x
++
)
for
(
int
x
=
2
;
x
<
i_src_visible
-
2
;
x
++
)
{
{
p_smooth
[
y
*
i_src_visible
+
x
]
=
(
uint32_t
)(
p_smooth
[
y
*
i_src_visible
+
x
]
=
(
uint32_t
)(
/* 2 rows up */
/* 2 rows up */
...
@@ -341,7 +340,6 @@ static void GaussianConvolution( picture_t *p_inpic, uint32_t *p_smooth )
...
@@ -341,7 +340,6 @@ static void GaussianConvolution( picture_t *p_inpic, uint32_t *p_smooth )
static
void
FilterGradient
(
filter_t
*
p_filter
,
picture_t
*
p_inpic
,
static
void
FilterGradient
(
filter_t
*
p_filter
,
picture_t
*
p_inpic
,
picture_t
*
p_outpic
)
picture_t
*
p_outpic
)
{
{
int
x
,
y
;
const
int
i_src_pitch
=
p_inpic
->
p
[
Y_PLANE
].
i_pitch
;
const
int
i_src_pitch
=
p_inpic
->
p
[
Y_PLANE
].
i_pitch
;
const
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
const
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
const
int
i_dst_pitch
=
p_outpic
->
p
[
Y_PLANE
].
i_pitch
;
const
int
i_dst_pitch
=
p_outpic
->
p
[
Y_PLANE
].
i_pitch
;
...
@@ -380,9 +378,9 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
...
@@ -380,9 +378,9 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
| -1 0 1 | | -1 -2 -1 | */
| -1 0 1 | | -1 -2 -1 | */
#define FOR \
#define FOR \
for(
y = 1; y < i_num_lines - 1; y++ )
\
for(
int y = 1; y < i_num_lines - 1; y++ )
\
{ \
{ \
for(
x = 1; x < i_src_visible - 1; x++ )
\
for(
int x = 1; x < i_src_visible - 1; x++ )
\
{ \
{ \
const uint32_t a = \
const uint32_t a = \
( \
( \
...
@@ -467,8 +465,6 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
...
@@ -467,8 +465,6 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
static
void
FilterEdge
(
filter_t
*
p_filter
,
picture_t
*
p_inpic
,
static
void
FilterEdge
(
filter_t
*
p_filter
,
picture_t
*
p_inpic
,
picture_t
*
p_outpic
)
picture_t
*
p_outpic
)
{
{
int
x
,
y
;
const
int
i_src_pitch
=
p_inpic
->
p
[
Y_PLANE
].
i_pitch
;
const
int
i_src_pitch
=
p_inpic
->
p
[
Y_PLANE
].
i_pitch
;
const
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
const
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
const
int
i_dst_pitch
=
p_outpic
->
p
[
Y_PLANE
].
i_pitch
;
const
int
i_dst_pitch
=
p_outpic
->
p
[
Y_PLANE
].
i_pitch
;
...
@@ -521,9 +517,9 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
...
@@ -521,9 +517,9 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
| -2 0 2 | and | 0 0 0 |
| -2 0 2 | and | 0 0 0 |
| -1 0 1 | | -1 -2 -1 | */
| -1 0 1 | | -1 -2 -1 | */
for
(
y
=
1
;
y
<
i_num_lines
-
1
;
y
++
)
for
(
int
y
=
1
;
y
<
i_num_lines
-
1
;
y
++
)
{
{
for
(
x
=
1
;
x
<
i_src_visible
-
1
;
x
++
)
for
(
int
x
=
1
;
x
<
i_src_visible
-
1
;
x
++
)
{
{
const
int
gradx
=
const
int
gradx
=
...
@@ -559,9 +555,9 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
...
@@ -559,9 +555,9 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
}
}
/* edge computing */
/* edge computing */
for
(
y
=
1
;
y
<
i_num_lines
-
1
;
y
++
)
for
(
int
y
=
1
;
y
<
i_num_lines
-
1
;
y
++
)
{
{
for
(
x
=
1
;
x
<
i_src_visible
-
1
;
x
++
)
for
(
int
x
=
1
;
x
<
i_src_visible
-
1
;
x
++
)
{
{
if
(
p_grad
[
y
*
i_src_visible
+
x
]
>
40
)
if
(
p_grad
[
y
*
i_src_visible
+
x
]
>
40
)
{
{
...
@@ -627,7 +623,6 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
...
@@ -627,7 +623,6 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
static
void
FilterHough
(
filter_t
*
p_filter
,
picture_t
*
p_inpic
,
static
void
FilterHough
(
filter_t
*
p_filter
,
picture_t
*
p_inpic
,
picture_t
*
p_outpic
)
picture_t
*
p_outpic
)
{
{
int
x
,
y
,
i
;
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
int
i_src_visible
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_pitch
;
int
i_dst_pitch
=
p_outpic
->
p
[
Y_PLANE
].
i_pitch
;
int
i_dst_pitch
=
p_outpic
->
p
[
Y_PLANE
].
i_pitch
;
int
i_num_lines
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_lines
;
int
i_num_lines
=
p_inpic
->
p
[
Y_PLANE
].
i_visible_lines
;
...
@@ -663,12 +658,12 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
...
@@ -663,12 +658,12 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
free
(
p_hough
);
free
(
p_hough
);
return
;
return
;
}
}
for
(
i
=
0
;
i
<
i_nb_steps
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
i_nb_steps
;
i
++
)
{
{
d_sin
=
sin
(
d_step
*
i
);
d_sin
=
sin
(
d_step
*
i
);
d_cos
=
cos
(
d_step
*
i
);
d_cos
=
cos
(
d_step
*
i
);
for
(
y
=
0
;
y
<
i_num_lines
;
y
++
)
for
(
int
y
=
0
;
y
<
i_num_lines
;
y
++
)
for
(
x
=
0
;
x
<
i_src_visible
;
x
++
)
for
(
int
x
=
0
;
x
<
i_src_visible
;
x
++
)
{
{
p_pre_hough
[(
i
*
i_num_lines
+
y
)
*
i_src_visible
+
x
]
=
p_pre_hough
[(
i
*
i_num_lines
+
y
)
*
i_src_visible
+
x
]
=
ceil
(
x
*
d_sin
+
y
*
d_cos
);
ceil
(
x
*
d_sin
+
y
*
d_cos
);
...
@@ -694,9 +689,9 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
...
@@ -694,9 +689,9 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
i_max
=
0
;
i_max
=
0
;
i_rho_max
=
0
;
i_rho_max
=
0
;
i_phi_max
=
0
;
i_phi_max
=
0
;
for
(
y
=
4
;
y
<
i_num_lines
-
4
;
y
++
)
for
(
int
y
=
4
;
y
<
i_num_lines
-
4
;
y
++
)
{
{
for
(
x
=
4
;
x
<
i_src_visible
-
4
;
x
++
)
for
(
int
x
=
4
;
x
<
i_src_visible
-
4
;
x
++
)
{
{
uint32_t
a
=
uint32_t
a
=
(
(
...
@@ -720,7 +715,7 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
...
@@ -720,7 +715,7 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
);
);
if
(
a
>>
8
)
if
(
a
>>
8
)
{
{
for
(
i
=
0
;
i
<
i_nb_steps
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
i_nb_steps
;
i
++
)
{
{
i_rho
=
p_pre_hough
[(
i
*
i_num_lines
+
y
)
*
i_src_visible
+
x
];
i_rho
=
p_pre_hough
[(
i
*
i_num_lines
+
y
)
*
i_src_visible
+
x
];
if
(
p_hough
[
i_rho
+
i_diag
/
2
+
i
*
i_diag
]
++
>
i_max
)
if
(
p_hough
[
i_rho
+
i_diag
/
2
+
i
*
i_diag
]
++
>
i_max
)
...
@@ -738,9 +733,9 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
...
@@ -738,9 +733,9 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
d_cos
=
cos
(
i_phi_max
*
d_step
);
d_cos
=
cos
(
i_phi_max
*
d_step
);
if
(
d_cos
!=
0
)
if
(
d_cos
!=
0
)
{
{
for
(
x
=
0
;
x
<
i_src_visible
;
x
++
)
for
(
int
x
=
0
;
x
<
i_src_visible
;
x
++
)
{
{
y
=
(
i_rho_max
-
x
*
d_sin
)
/
d_cos
;
int
y
=
(
i_rho_max
-
x
*
d_sin
)
/
d_cos
;
if
(
y
>=
0
&&
y
<
i_num_lines
)
if
(
y
>=
0
&&
y
<
i_num_lines
)
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
255
;
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
255
;
}
}
...
...
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