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
3181fcc5
Commit
3181fcc5
authored
Aug 31, 2015
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video_filter: motiondetect: use C99 loop declarations
parent
caa0d1e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
modules/video_filter/motiondetect.c
modules/video_filter/motiondetect.c
+14
-16
No files found.
modules/video_filter/motiondetect.c
View file @
3181fcc5
...
@@ -209,11 +209,10 @@ static void PreparePlanar( filter_t *p_filter, picture_t *p_inpic )
...
@@ -209,11 +209,10 @@ static void PreparePlanar( filter_t *p_filter, picture_t *p_inpic )
{
{
const
int
d
=
abs
(
p_inpix_u
[
y
*
i_src_pitch_u
+
x
]
-
p_oldpix_u
[
y
*
i_old_pitch_u
+
x
]
)
+
const
int
d
=
abs
(
p_inpix_u
[
y
*
i_src_pitch_u
+
x
]
-
p_oldpix_u
[
y
*
i_old_pitch_u
+
x
]
)
+
abs
(
p_inpix_v
[
y
*
i_src_pitch_v
+
x
]
-
p_oldpix_v
[
y
*
i_old_pitch_v
+
x
]
);
abs
(
p_inpix_v
[
y
*
i_src_pitch_v
+
x
]
-
p_oldpix_v
[
y
*
i_old_pitch_v
+
x
]
);
int
i
,
j
;
for
(
j
=
0
;
j
<
i_chroma_dy
;
j
++
)
for
(
int
j
=
0
;
j
<
i_chroma_dy
;
j
++
)
{
{
for
(
i
=
0
;
i
<
i_chroma_dx
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
i_chroma_dx
;
i
++
)
p_sys
->
p_buf2
[
i_chroma_dy
*
p_fmt
->
i_width
*
j
+
i_chroma_dx
*
i
]
=
d
;
p_sys
->
p_buf2
[
i_chroma_dy
*
p_fmt
->
i_width
*
j
+
i_chroma_dx
*
i
]
=
d
;
}
}
}
}
...
@@ -335,14 +334,12 @@ static void GaussianConvolution( uint32_t *p_inpix, uint32_t *p_smooth,
...
@@ -335,14 +334,12 @@ static void GaussianConvolution( uint32_t *p_inpix, uint32_t *p_smooth,
int
i_src_pitch
,
int
i_num_lines
,
int
i_src_pitch
,
int
i_num_lines
,
int
i_src_visible
)
int
i_src_visible
)
{
{
int
x
,
y
;
/* A bit overkill but ... simpler */
/* A bit overkill but ... simpler */
memset
(
p_smooth
,
0
,
sizeof
(
*
p_smooth
)
*
i_src_pitch
*
i_num_lines
);
memset
(
p_smooth
,
0
,
sizeof
(
*
p_smooth
)
*
i_src_pitch
*
i_num_lines
);
for
(
y
=
2
;
y
<
i_num_lines
-
2
;
y
++
)
for
(
int
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 */
...
@@ -390,7 +387,6 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
...
@@ -390,7 +387,6 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
int
*
color_y_min
,
int
*
color_y_max
)
int
*
color_y_min
,
int
*
color_y_max
)
{
{
int
last
=
1
;
int
last
=
1
;
int
i
,
j
;
/**
/**
* Apply some smoothing to remove noise
* Apply some smoothing to remove noise
...
@@ -400,13 +396,14 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
...
@@ -400,13 +396,14 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
/**
/**
* Label the shapes and build the labels dependencies list
* Label the shapes and build the labels dependencies list
*/
*/
for
(
j
=
0
;
j
<
i_pitch
;
j
++
)
for
(
int
j
=
0
;
j
<
i_pitch
;
j
++
)
{
{
p_smooth
[
j
]
=
0
;
p_smooth
[
j
]
=
0
;
p_smooth
[(
i_lines
-
1
)
*
i_pitch
+
j
]
=
0
;
p_smooth
[(
i_lines
-
1
)
*
i_pitch
+
j
]
=
0
;
}
}
for
(
i
=
1
;
i
<
i_lines
-
1
;
i
++
)
for
(
i
nt
i
=
1
;
i
<
i_lines
-
1
;
i
++
)
{
{
int
j
;
p_smooth
[
i
*
i_pitch
]
=
0
;
p_smooth
[
i
*
i_pitch
]
=
0
;
for
(
j
=
1
;
j
<
i_pitch
-
1
;
j
++
)
for
(
j
=
1
;
j
<
i_pitch
-
1
;
j
++
)
{
{
...
@@ -454,7 +451,7 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
...
@@ -454,7 +451,7 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
/**
/**
* Initialise empty rectangle list
* Initialise empty rectangle list
*/
*/
for
(
i
=
1
;
i
<
last
;
i
++
)
for
(
i
nt
i
=
1
;
i
<
last
;
i
++
)
{
{
color_x_min
[
i
]
=
-
1
;
color_x_min
[
i
]
=
-
1
;
color_x_max
[
i
]
=
-
1
;
color_x_max
[
i
]
=
-
1
;
...
@@ -465,7 +462,7 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
...
@@ -465,7 +462,7 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
/**
/**
* Compute rectangle coordinates
* Compute rectangle coordinates
*/
*/
for
(
i
=
0
;
i
<
i_pitch
*
i_lines
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
i_pitch
*
i_lines
;
i
++
)
{
{
if
(
p_smooth
[
i
]
)
if
(
p_smooth
[
i
]
)
{
{
...
@@ -496,11 +493,11 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
...
@@ -496,11 +493,11 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
/**
/**
* Merge overlaping rectangles
* Merge overlaping rectangles
*/
*/
for
(
i
=
1
;
i
<
last
;
i
++
)
for
(
i
nt
i
=
1
;
i
<
last
;
i
++
)
{
{
if
(
colors
[
i
]
!=
i
)
continue
;
if
(
colors
[
i
]
!=
i
)
continue
;
if
(
color_x_min
[
i
]
==
-
1
)
continue
;
if
(
color_x_min
[
i
]
==
-
1
)
continue
;
for
(
j
=
i
+
1
;
j
<
last
;
j
++
)
for
(
int
j
=
i
+
1
;
j
<
last
;
j
++
)
{
{
if
(
colors
[
j
]
!=
j
)
continue
;
if
(
colors
[
j
]
!=
j
)
continue
;
if
(
color_x_min
[
j
]
==
-
1
)
continue
;
if
(
color_x_min
[
j
]
==
-
1
)
continue
;
...
@@ -523,9 +520,10 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
...
@@ -523,9 +520,10 @@ static int FindShapes( uint32_t *p_diff, uint32_t *p_smooth,
static
void
Draw
(
filter_t
*
p_filter
,
uint8_t
*
p_pix
,
int
i_pix_pitch
,
int
i_pix_size
)
static
void
Draw
(
filter_t
*
p_filter
,
uint8_t
*
p_pix
,
int
i_pix_pitch
,
int
i_pix_size
)
{
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
int
i
,
j
;
for
(
i
=
1
,
j
=
0
;
i
<
p_sys
->
i_colors
;
i
++
)
int
j
=
0
;
for
(
int
i
=
1
;
i
<
p_sys
->
i_colors
;
i
++
)
{
{
int
x
,
y
;
int
x
,
y
;
...
...
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