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
4d6247fd
Commit
4d6247fd
authored
Mar 06, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use vlc_mrand48() instead of rand()
parent
ac824333
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
modules/access/vcdx/vcdplayer.c
modules/access/vcdx/vcdplayer.c
+2
-1
modules/video_filter/grain.c
modules/video_filter/grain.c
+2
-1
modules/video_filter/noise.c
modules/video_filter/noise.c
+5
-4
modules/video_filter/puzzle.c
modules/video_filter/puzzle.c
+6
-5
No files found.
modules/access/vcdx/vcdplayer.c
View file @
4d6247fd
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_input.h>
#include <vlc_input.h>
#include <vlc_interface.h>
#include <vlc_interface.h>
#include <vlc_rand.h>
#include "vcd.h"
#include "vcd.h"
#include "vcdplayer.h"
#include "vcdplayer.h"
...
@@ -538,7 +539,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
...
@@ -538,7 +539,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
/* Pick a random selection. */
/* Pick a random selection. */
unsigned
int
bsn
=
vcdinf_get_bsn
(
p_vcdplayer
->
pxd
.
psd
);
unsigned
int
bsn
=
vcdinf_get_bsn
(
p_vcdplayer
->
pxd
.
psd
);
int
rand_selection
=
bsn
+
int
rand_selection
=
bsn
+
(
int
)
((
i_selections
+
0
.
0
)
*
rand
()
/
(
RAND_MAX
+
1
.
0
)
);
(
(
unsigned
)
vlc_lrand48
()
%
(
unsigned
)
i_selections
);
lid_t
rand_lid
=
vcdinfo_selection_get_lid
(
p_vcdplayer
->
vcd
,
lid_t
rand_lid
=
vcdinfo_selection_get_lid
(
p_vcdplayer
->
vcd
,
p_vcdplayer
->
i_lid
,
p_vcdplayer
->
i_lid
,
rand_selection
);
rand_selection
);
...
...
modules/video_filter/grain.c
View file @
4d6247fd
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_rand.h>
#include <vlc_filter.h>
#include <vlc_filter.h>
#include "filter_picture.h"
#include "filter_picture.h"
...
@@ -135,7 +136,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -135,7 +136,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
{
for
(
i_col
=
0
;
i_col
<
i_num_cols
;
i_col
++
)
for
(
i_col
=
0
;
i_col
<
i_num_cols
;
i_col
++
)
{
{
p_noise
[
i_line
*
i_pitch
+
i_col
]
=
((
rand
()
&
0x1f
)
-
0x0f
);
p_noise
[
i_line
*
i_pitch
+
i_col
]
=
((
vlc_mrand48
()
&
0x1f
)
-
0x0f
);
}
}
}
}
...
...
modules/video_filter/noise.c
View file @
4d6247fd
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_rand.h>
#include <vlc_filter.h>
#include <vlc_filter.h>
#include "filter_picture.h"
#include "filter_picture.h"
...
@@ -105,7 +106,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -105,7 +106,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
for
(
i_line
=
0
;
i_line
<
i_num_lines
;
i_line
++
)
for
(
i_line
=
0
;
i_line
<
i_num_lines
;
i_line
++
)
{
{
if
(
rand
()
%
8
)
if
(
vlc_mrand48
()
&
7
)
{
{
/* line isn't noisy */
/* line isn't noisy */
vlc_memcpy
(
p_out
+
i_line
*
i_pitch
,
p_in
+
i_line
*
i_pitch
,
vlc_memcpy
(
p_out
+
i_line
*
i_pitch
,
p_in
+
i_line
*
i_pitch
,
...
@@ -114,17 +115,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -114,17 +115,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
else
else
{
{
/* this line is noisy */
/* this line is noisy */
int
noise_level
=
rand
()
%
8
+
2
;
unsigned
noise_level
=
(
vlc_mrand48
()
&
7
)
+
2
;
for
(
i_col
=
0
;
i_col
<
i_num_cols
;
i_col
++
)
for
(
i_col
=
0
;
i_col
<
i_num_cols
;
i_col
++
)
{
{
if
(
rand
(
)
%
noise_level
)
if
(
((
unsigned
)
vlc_mrand48
()
)
%
noise_level
)
{
{
p_out
[
i_line
*
i_pitch
+
i_col
]
=
p_out
[
i_line
*
i_pitch
+
i_col
]
=
p_in
[
i_line
*
i_pitch
+
i_col
];
p_in
[
i_line
*
i_pitch
+
i_col
];
}
}
else
else
{
{
p_out
[
i_line
*
i_pitch
+
i_col
]
=
(
rand
()
%
3
)
*
0x7f
;
p_out
[
i_line
*
i_pitch
+
i_col
]
=
(
vlc_mrand48
()
&
3
)
*
0x7f
;
}
}
}
}
}
}
...
...
modules/video_filter/puzzle.c
View file @
4d6247fd
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_filter.h>
#include <vlc_rand.h>
#include "filter_picture.h"
#include "filter_picture.h"
...
@@ -429,19 +430,19 @@ static bool IsValid( filter_sys_t *p_sys )
...
@@ -429,19 +430,19 @@ static bool IsValid( filter_sys_t *p_sys )
static
void
Shuffle
(
filter_sys_t
*
p_sys
)
static
void
Shuffle
(
filter_sys_t
*
p_sys
)
{
{
const
int
i_count
=
p_sys
->
i_cols
*
p_sys
->
i_rows
;
const
unsigned
i_count
=
p_sys
->
i_cols
*
p_sys
->
i_rows
;
free
(
p_sys
->
pi_order
);
free
(
p_sys
->
pi_order
);
p_sys
->
pi_order
=
calloc
(
i_count
,
sizeof
(
*
p_sys
->
pi_order
)
);
p_sys
->
pi_order
=
calloc
(
i_count
,
sizeof
(
*
p_sys
->
pi_order
)
);
do
do
{
{
for
(
int
i
=
0
;
i
<
i_count
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
i_count
;
i
++
)
p_sys
->
pi_order
[
i
]
=
-
1
;
p_sys
->
pi_order
[
i
]
=
-
1
;
for
(
int
c
=
0
;
c
<
i_count
;
)
for
(
unsigned
c
=
0
;
c
<
i_count
;
)
{
{
int
i
=
rand
(
)
%
i_count
;
unsigned
i
=
((
unsigned
)
vlc_mrand48
()
)
%
i_count
;
if
(
p_sys
->
pi_order
[
i
]
==
-
1
)
if
(
p_sys
->
pi_order
[
i
]
==
-
1
)
p_sys
->
pi_order
[
i
]
=
c
++
;
p_sys
->
pi_order
[
i
]
=
c
++
;
}
}
...
@@ -451,7 +452,7 @@ static void Shuffle( filter_sys_t *p_sys )
...
@@ -451,7 +452,7 @@ static void Shuffle( filter_sys_t *p_sys )
if
(
p_sys
->
b_blackslot
)
if
(
p_sys
->
b_blackslot
)
{
{
for
(
int
i
=
0
;
i
<
i_count
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
i_count
;
i
++
)
{
{
if
(
p_sys
->
pi_order
[
i
]
==
i_count
-
1
)
if
(
p_sys
->
pi_order
[
i
]
==
i_count
-
1
)
{
{
...
...
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