Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
0c4af139
Commit
0c4af139
authored
Dec 19, 2018
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/tests/rangecoder: Test coder more completely
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
1be9a28f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
rangecoder.c
libavcodec/tests/rangecoder.c
+26
-17
No files found.
libavcodec/tests/rangecoder.c
View file @
0c4af139
...
...
@@ -24,41 +24,50 @@
#include "libavcodec/rangecoder.h"
#define SIZE 1
0
240
#define SIZE 1240
int
main
(
void
)
{
RangeCoder
c
;
uint8_t
b
[
9
*
SIZE
];
uint8_t
r
[
9
*
SIZE
];
int
i
;
int
i
,
p
,
actual_length
,
version
;
uint8_t
state
[
10
];
AVLFG
prng
;
av_lfg_init
(
&
prng
,
1
);
for
(
version
=
0
;
version
<
2
;
version
++
)
{
for
(
p
=
0
;
p
<
1024
;
p
++
)
{
ff_init_range_encoder
(
&
c
,
b
,
SIZE
);
ff_build_rac_states
(
&
c
,
(
1LL
<<
32
)
/
20
,
128
+
64
+
32
+
16
);
ff_init_range_encoder
(
&
c
,
b
,
SIZE
);
ff_build_rac_states
(
&
c
,
(
1LL
<<
32
)
/
20
,
128
+
64
+
32
+
16
);
memset
(
state
,
128
,
sizeof
(
state
));
memset
(
state
,
128
,
sizeof
(
state
));
for
(
i
=
0
;
i
<
SIZE
;
i
++
)
r
[
i
]
=
av_lfg_get
(
&
prng
)
%
7
;
for
(
i
=
0
;
i
<
SIZE
;
i
++
)
r
[
i
]
=
av_lfg_get
(
&
prng
)
%
7
;
for
(
i
=
0
;
i
<
SIZE
;
i
++
)
put_rac
(
&
c
,
state
,
r
[
i
]
&
1
)
;
for
(
i
=
0
;
i
<
SIZE
;
i
++
)
put_rac
(
&
c
,
state
,
r
[
i
]
&
1
);
actual_length
=
ff_rac_terminate
(
&
c
,
version
);
ff_rac_terminate
(
&
c
,
0
);
ff_init_range_decoder
(
&
c
,
b
,
version
?
SIZE
:
actual_length
);
ff_init_range_decoder
(
&
c
,
b
,
SIZE
);
memset
(
state
,
128
,
sizeof
(
state
)
);
memset
(
state
,
128
,
sizeof
(
state
));
for
(
i
=
0
;
i
<
SIZE
;
i
++
)
if
((
r
[
i
]
&
1
)
!=
get_rac
(
&
c
,
state
))
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"rac failure at %d
\n
"
,
i
);
return
1
;
for
(
i
=
0
;
i
<
SIZE
;
i
++
)
if
((
r
[
i
]
&
1
)
!=
get_rac
(
&
c
,
state
))
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"rac failure at %d pass %d version %d
\n
"
,
i
,
p
,
version
);
return
1
;
}
if
(
version
)
get_rac
(
&
c
,
(
uint8_t
[])
{
129
});
if
(
c
.
bytestream
-
c
.
bytestream_start
-
actual_length
!=
version
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"rac failure at pass %d version %d
\n
"
,
p
,
version
);
return
1
;
}
}
}
return
0
;
}
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