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
2ce4bd42
Commit
2ce4bd42
authored
Feb 01, 2017
by
Alex Converse
Committed by
Thomas Davies
Feb 02, 2017
Browse files
ec_multisymbol: Add defines CDF_PROB_BITS, CDF_PROB_TOP
Change-Id: I6c1717ad82d05ebe22327aec6989af2c0db336e3
parent
8e0b8697
Changes
3
Hide whitespace changes
Inline
Side-by-side
aom_dsp/prob.c
View file @
2ce4bd42
...
...
@@ -198,7 +198,7 @@ int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs,
nsymbs
++
;
}
/* Compute the probabilities of each symbol in Q15 */
tree_node_compute_probs
(
symb
,
0
,
32768
);
tree_node_compute_probs
(
symb
,
0
,
CDF_PROB_TOP
);
/* Extract the cdf, index, path and length */
tree_node_extract
(
symb
,
0
,
0
,
cdf
,
index
,
path
,
len
);
/* Convert to CDF */
...
...
aom_dsp/prob.h
View file @
2ce4bd42
...
...
@@ -27,6 +27,9 @@ typedef uint8_t aom_prob;
// TODO(negge): Rename this aom_prob once we remove vpxbool.
typedef
uint16_t
aom_cdf_prob
;
#define CDF_PROB_BITS 15
#define CDF_PROB_TOP (1 << CDF_PROB_BITS)
#define MAX_PROB 255
#define aom_prob_half ((aom_prob)128)
...
...
@@ -144,7 +147,7 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
#if 1
const
int
tmp0
=
1
<<
rate2
;
tmp
=
tmp0
;
diff
=
((
32768
-
(
nsymbs
<<
rate2
))
>>
rate
)
<<
rate
;
diff
=
((
CDF_PROB_TOP
-
(
nsymbs
<<
rate2
))
>>
rate
)
<<
rate
;
// Single loop (faster)
for
(
i
=
0
;
i
<
nsymbs
-
1
;
++
i
,
tmp
+=
tmp0
)
{
tmp
+=
(
i
==
val
?
diff
:
0
);
...
...
@@ -155,7 +158,7 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
tmp
=
(
i
+
1
)
<<
rate2
;
cdf
[
i
]
-=
((
cdf
[
i
]
-
tmp
)
>>
rate
);
}
diff
=
32768
-
cdf
[
nsymbs
-
1
];
diff
=
CDF_PROB_TOP
-
cdf
[
nsymbs
-
1
];
for
(
i
=
val
;
i
<
nsymbs
;
++
i
)
{
cdf
[
i
]
+=
diff
;
...
...
av1/common/entropy.c
View file @
2ce4bd42
...
...
@@ -4405,11 +4405,14 @@ static void build_token_cdfs(const aom_prob *pdf_model,
assert
(
pdf_model
[
2
]
!=
0
);
// Do the head (ZERO, ONE, TWO or more)
cdf_head
[
ZERO_TOKEN
]
=
sum
=
(
pdf_model
[
1
]
<<
7
);
scale
=
(
1
<<
15
)
-
cdf_head
[
ZERO_TOKEN
];
p
=
AOMMAX
(
1
,
(
scale
*
128
*
pdf_model
[
2
]
+
(
1
<<
14
))
>>
15
);
cdf_head
[
ONE_TOKEN
]
=
cdf_head
[
ZERO_TOKEN
]
+
p
;
cdf_head
[
TWO_TOKEN
]
=
(
1
<<
15
);
cdf_head
[
ZERO_TOKEN
]
=
sum
=
(
pdf_model
[
1
]
<<
(
CDF_PROB_BITS
-
8
));
assert
(
cdf_head
[
ZERO_TOKEN
]
<
CDF_PROB_TOP
);
scale
=
CDF_PROB_TOP
-
cdf_head
[
ZERO_TOKEN
];
p
=
ROUND_POWER_OF_TWO
(
scale
*
(
pdf_model
[
2
]
<<
(
CDF_PROB_BITS
-
8
)),
CDF_PROB_BITS
);
cdf_head
[
ONE_TOKEN
]
=
cdf_head
[
ZERO_TOKEN
]
+
AOMMAX
(
1
,
p
);
assert
(
cdf_head
[
ONE_TOKEN
]
<
CDF_PROB_TOP
);
cdf_head
[
TWO_TOKEN
]
=
CDF_PROB_TOP
;
// Do the tail
sum
=
0
;
...
...
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