Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
9fa02487
Commit
9fa02487
authored
May 03, 2017
by
Yaowu Xu
Browse files
Repalce rand_r() to fix MSVC compiling
BUG=aomedia:500 Change-Id: I8fc3b76925543da6928bf9c20c314dfe5f349317
parent
7c6d292e
Changes
1
Hide whitespace changes
Inline
Side-by-side
av1/encoder/ransac.c
View file @
9fa02487
...
...
@@ -8,7 +8,6 @@
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#define _POSIX_C_SOURCE 200112L // rand_r()
#include
<memory.h>
#include
<math.h>
#include
<time.h>
...
...
@@ -890,16 +889,22 @@ static int find_homography(int np, double *pts1, double *pts2, double *mat) {
return
0
;
}
// Generate a random number in the range [0, 32768).
static
unsigned
int
lcg_rand16
(
unsigned
int
*
state
)
{
*
state
=
(
unsigned
int
)(
*
state
*
1103515245ULL
+
12345
);
return
*
state
/
65536
%
32768
;
}
static
int
get_rand_indices
(
int
npoints
,
int
minpts
,
int
*
indices
,
unsigned
int
*
seed
)
{
int
i
,
j
;
int
ptr
=
rand
_r
(
seed
)
%
npoints
;
int
ptr
=
lcg_
rand
16
(
seed
)
%
npoints
;
if
(
minpts
>
npoints
)
return
0
;
indices
[
0
]
=
ptr
;
ptr
=
(
ptr
==
npoints
-
1
?
0
:
ptr
+
1
);
i
=
1
;
while
(
i
<
minpts
)
{
int
index
=
rand
_r
(
seed
)
%
npoints
;
int
index
=
lcg_
rand
16
(
seed
)
%
npoints
;
while
(
index
)
{
ptr
=
(
ptr
==
npoints
-
1
?
0
:
ptr
+
1
);
for
(
j
=
0
;
j
<
i
;
++
j
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment