Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
b60dfc25
Commit
b60dfc25
authored
Oct 14, 2016
by
Alex Converse
Committed by
Gerrit Code Review
Oct 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Switch rANS to 15 bit precision, and adjust L_BASE." into nextgenv2
parents
b100db7c
62a94a64
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
272 additions
and
261 deletions
+272
-261
aom_dsp/ans.h
aom_dsp/ans.h
+5
-3
aom_dsp/ansreader.h
aom_dsp/ansreader.h
+5
-1
aom_dsp/answriter.h
aom_dsp/answriter.h
+3
-0
av1/common/entropy.c
av1/common/entropy.c
+255
-255
test/ans_test.cc
test/ans_test.cc
+4
-2
No files found.
aom_dsp/ans.h
View file @
b60dfc25
...
...
@@ -26,10 +26,12 @@ extern "C" {
typedef
uint8_t
AnsP8
;
#define ANS_P8_PRECISION 256u
#define ANS_P8_SHIFT 8
#define RANS_PR
ECISION 1024u
#define RANS_PROB_BITS
10
#define RANS_PR
OB_BITS 15
#define
RANS_PRECISION (1u <<
RANS_PROB_BITS
)
#define L_BASE (RANS_PRECISION * 4) // L_BASE % precision must be 0
// L_BASE % PRECISION must be 0. Increasing L_BASE beyond 2**15 will cause uabs
// to overflow.
#define L_BASE (RANS_PRECISION)
#define IO_BASE 256
// Range I = { L_BASE, L_BASE + 1, ..., L_BASE * IO_BASE - 1 }
...
...
aom_dsp/ansreader.h
View file @
b60dfc25
...
...
@@ -111,8 +111,12 @@ static INLINE int ans_read_init(struct AnsDecoder *const ans,
if
(
offset
<
3
)
return
1
;
ans
->
buf_offset
=
offset
-
3
;
ans
->
state
=
mem_get_le24
(
buf
+
offset
-
3
)
&
0x3FFFFF
;
}
else
if
((
buf
[
offset
-
1
]
&
0xE0
)
==
0xE0
)
{
if
(
offset
<
4
)
return
1
;
ans
->
buf_offset
=
offset
-
4
;
ans
->
state
=
mem_get_le32
(
buf
+
offset
-
4
)
&
0x1FFFFFFF
;
}
else
{
//
x == 3
implies this byte is a superframe marker
//
110xxxxx
implies this byte is a superframe marker
return
1
;
}
ans
->
state
+=
L_BASE
;
...
...
aom_dsp/answriter.h
View file @
b60dfc25
...
...
@@ -54,6 +54,9 @@ static INLINE int ans_write_end(struct AnsCoder *const ans) {
}
else
if
(
state
<
(
1
<<
22
))
{
mem_put_le24
(
ans
->
buf
+
ans
->
buf_offset
,
(
0x02
<<
22
)
+
state
);
return
ans
->
buf_offset
+
3
;
}
else
if
(
state
<
(
1
<<
29
))
{
mem_put_le32
(
ans
->
buf
+
ans
->
buf_offset
,
(
0x07
<<
29
)
+
state
);
return
ans
->
buf_offset
+
4
;
}
else
{
assert
(
0
&&
"State is too large to be serialized"
);
return
ans
->
buf_offset
;
...
...
av1/common/entropy.c
View file @
b60dfc25
This diff is collapsed.
Click to expand it.
test/ans_test.cc
View file @
b60dfc25
...
...
@@ -74,7 +74,8 @@ bool check_uabs(const PvVec &pv_vec, uint8_t *buf) {
return
ans_read_end
(
&
d
);
}
const
aom_cdf_prob
spareto65
[]
=
{
260
,
188
,
138
,
102
,
133
,
122
,
64
,
15
,
1
,
1
};
const
aom_cdf_prob
spareto65
[]
=
{
8320
,
6018
,
4402
,
3254
,
4259
,
3919
,
2057
,
492
,
45
,
2
};
const
int
kRansSymbols
=
static_cast
<
int
>
(
sizeof
(
spareto65
)
/
sizeof
(
spareto65
[
0
]));
...
...
@@ -94,7 +95,8 @@ std::vector<int> ans_encode_build_vals(rans_sym *const tab, int iters) {
std
::
vector
<
int
>
ret
;
libaom_test
::
ACMRandom
gen
(
18543637
);
for
(
int
i
=
0
;
i
<
iters
;
++
i
)
{
int
sym
=
p_to_sym
[
gen
.
Rand8
()
*
4
];
int
sym
=
p_to_sym
[((
gen
.
Rand8
()
<<
8
)
+
gen
.
Rand8
())
&
(
RANS_PRECISION
-
1
)];
ret
.
push_back
(
sym
);
}
return
ret
;
...
...
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