Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
5943d41e
Commit
5943d41e
authored
Nov 03, 2016
by
Alex Converse
Browse files
ans: Factor out refill_state
Change-Id: I648f4eb2954b2d138c2128bbf3f638eea31ec28f
parent
6fdc853e
Changes
1
Hide whitespace changes
Inline
Side-by-side
aom_dsp/ansreader.h
View file @
5943d41e
...
...
@@ -37,14 +37,19 @@ struct AnsDecoder {
#endif
};
static
INLINE
unsigned
refill_state
(
struct
AnsDecoder
*
const
ans
,
unsigned
state
)
{
while
(
state
<
L_BASE
&&
ans
->
buf_offset
>
0
)
{
state
=
state
*
IO_BASE
+
ans
->
buf
[
--
ans
->
buf_offset
];
}
return
state
;
}
static
INLINE
int
uabs_read
(
struct
AnsDecoder
*
ans
,
AnsP8
p0
)
{
AnsP8
p
=
ANS_P8_PRECISION
-
p0
;
int
s
;
unsigned
xp
,
sp
;
unsigned
state
=
ans
->
state
;
while
(
state
<
L_BASE
&&
ans
->
buf_offset
>
0
)
{
state
=
state
*
IO_BASE
+
ans
->
buf
[
--
ans
->
buf_offset
];
}
unsigned
state
=
refill_state
(
ans
,
ans
->
state
);
sp
=
state
*
p
;
xp
=
sp
/
ANS_P8_PRECISION
;
s
=
(
sp
&
0xFF
)
>=
p0
;
...
...
@@ -57,10 +62,7 @@ static INLINE int uabs_read(struct AnsDecoder *ans, AnsP8 p0) {
static
INLINE
int
uabs_read_bit
(
struct
AnsDecoder
*
ans
)
{
int
s
;
unsigned
state
=
ans
->
state
;
while
(
state
<
L_BASE
&&
ans
->
buf_offset
>
0
)
{
state
=
state
*
IO_BASE
+
ans
->
buf
[
--
ans
->
buf_offset
];
}
unsigned
state
=
refill_state
(
ans
,
ans
->
state
);
s
=
(
int
)(
state
&
1
);
ans
->
state
=
state
>>
1
;
return
s
;
...
...
@@ -90,9 +92,7 @@ static INLINE int rans_read(struct AnsDecoder *ans, const aom_cdf_prob *tab) {
unsigned
rem
;
unsigned
quo
;
struct
rans_dec_sym
sym
;
while
(
ans
->
state
<
L_BASE
&&
ans
->
buf_offset
>
0
)
{
ans
->
state
=
ans
->
state
*
IO_BASE
+
ans
->
buf
[
--
ans
->
buf_offset
];
}
ans
->
state
=
refill_state
(
ans
,
ans
->
state
);
quo
=
ans
->
state
/
RANS_PRECISION
;
rem
=
ans
->
state
%
RANS_PRECISION
;
fetch_sym
(
&
sym
,
tab
,
rem
);
...
...
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