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
63b44c4c
Commit
63b44c4c
authored
Aug 23, 2016
by
Michael Bebenita
Committed by
Yaowu Xu
Oct 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove stale OD_ACCOUNTING code.
Change-Id: Ie90dd06c387119ccd9c920a328c942477df00bb7
parent
868fc0b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
113 deletions
+42
-113
aom_dsp/daalaboolreader.h
aom_dsp/daalaboolreader.h
+4
-4
aom_dsp/entdec.c
aom_dsp/entdec.c
+20
-52
aom_dsp/entdec.h
aom_dsp/entdec.h
+18
-57
No files found.
aom_dsp/daalaboolreader.h
View file @
63b44c4c
...
...
@@ -33,10 +33,10 @@ ptrdiff_t aom_daala_reader_tell(const daala_reader *r);
static
INLINE
int
aom_daala_read
(
daala_reader
*
r
,
int
prob
)
{
if
(
prob
==
128
)
{
return
od_ec_dec_bits
(
&
r
->
ec
,
1
,
"aom_bits"
);
return
od_ec_dec_bits
(
&
r
->
ec
,
1
);
}
else
{
int
p
=
((
prob
<<
15
)
+
(
256
-
prob
))
>>
8
;
return
od_ec_decode_bool_q15
(
&
r
->
ec
,
p
,
"aom"
);
return
od_ec_decode_bool_q15
(
&
r
->
ec
,
p
);
}
}
...
...
@@ -60,7 +60,7 @@ static INLINE int daala_read_tree_bits(daala_reader *r,
int
nsymbs
;
int
symb
;
nsymbs
=
tree_to_cdf
(
tree
,
probs
,
i
,
cdf
,
index
,
path
,
dist
);
symb
=
od_ec_decode_cdf_q15
(
&
r
->
ec
,
cdf
,
nsymbs
,
"aom"
);
symb
=
od_ec_decode_cdf_q15
(
&
r
->
ec
,
cdf
,
nsymbs
);
OD_ASSERT
(
symb
>=
0
&&
symb
<
nsymbs
);
i
=
index
[
symb
];
}
while
(
i
>
0
);
...
...
@@ -69,7 +69,7 @@ static INLINE int daala_read_tree_bits(daala_reader *r,
static
INLINE
int
daala_read_symbol
(
daala_reader
*
r
,
const
aom_cdf_prob
*
cdf
,
int
nsymbs
)
{
return
od_ec_decode_cdf_q15
(
&
r
->
ec
,
cdf
,
nsymbs
,
"aom"
);
return
od_ec_decode_cdf_q15
(
&
r
->
ec
,
cdf
,
nsymbs
);
}
#ifdef __cplusplus
...
...
aom_dsp/entdec.c
View file @
63b44c4c
...
...
@@ -27,9 +27,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
#endif
#include "aom_dsp/entdec.h"
#if OD_ACCOUNTING
#include "./accounting.h"
#endif
/*A range decoder.
This is an entropy decoder based upon \cite{Mar79}, which is itself a
...
...
@@ -86,23 +83,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
URL="http://researchcommons.waikato.ac.nz/bitstream/handle/10289/78/content.pdf"
}*/
#if OD_ACCOUNTING
#define od_ec_dec_normalize(dec, dif, rng, ret, str) \
od_ec_dec_normalize_(dec, dif, rng, ret, str)
static
void
od_process_accounting
(
od_ec_dec
*
dec
,
char
*
str
)
{
if
(
dec
->
acct
!=
NULL
)
{
uint32_t
tell
;
tell
=
od_ec_dec_tell_frac
(
dec
);
OD_ASSERT
(
tell
>=
dec
->
acct
->
last_tell
);
od_accounting_record
(
dec
->
acct
,
str
,
tell
-
dec
->
acct
->
last_tell
);
dec
->
acct
->
last_tell
=
tell
;
}
}
#else
#define od_ec_dec_normalize(dec, dif, rng, ret, str) \
od_ec_dec_normalize_(dec, dif, rng, ret)
#endif
/*This is meant to be a large, positive constant that can still be efficiently
loaded as an immediate (on platforms like ARM, for example).
Even relatively modest values like 100 would work fine.*/
...
...
@@ -141,8 +121,8 @@ static void od_ec_dec_refill(od_ec_dec *dec) {
ret: The value to return.
Return: ret.
This allows the compiler to jump to this function via a tail-call.*/
static
int
od_ec_dec_normalize
_
(
od_ec_dec
*
dec
,
od_ec_window
dif
,
unsigned
rng
,
int
ret
OD_ACC_STR
)
{
static
int
od_ec_dec_normalize
(
od_ec_dec
*
dec
,
od_ec_window
dif
,
unsigned
rng
,
int
ret
)
{
int
d
;
OD_ASSERT
(
rng
<=
65535U
);
d
=
16
-
OD_ILOG_NZ
(
rng
);
...
...
@@ -150,9 +130,6 @@ static int od_ec_dec_normalize_(od_ec_dec *dec, od_ec_window dif, unsigned rng,
dec
->
dif
=
dif
<<
d
;
dec
->
rng
=
rng
<<
d
;
if
(
dec
->
cnt
<
0
)
od_ec_dec_refill
(
dec
);
#if OD_ACCOUNTING
od_process_accounting
(
dec
,
acc_str
);
#endif
return
ret
;
}
...
...
@@ -173,9 +150,6 @@ void od_ec_dec_init(od_ec_dec *dec, const unsigned char *buf,
dec
->
cnt
=
-
15
;
dec
->
error
=
0
;
od_ec_dec_refill
(
dec
);
#if OD_ACCOUNTING
dec
->
acct
=
NULL
;
#endif
}
/*Decode a bit that has an fz/ft probability of being a zero.
...
...
@@ -183,7 +157,7 @@ void od_ec_dec_init(od_ec_dec *dec, const unsigned char *buf,
ft: The total probability.
This must be at least 16384 and no more than 32768.
Return: The value decoded (0 or 1).*/
int
od_ec_decode_bool
_
(
od_ec_dec
*
dec
,
unsigned
fz
,
unsigned
ft
OD_ACC_STR
)
{
int
od_ec_decode_bool
(
od_ec_dec
*
dec
,
unsigned
fz
,
unsigned
ft
)
{
od_ec_window
dif
;
od_ec_window
vw
;
unsigned
r
;
...
...
@@ -217,7 +191,7 @@ int od_ec_decode_bool_(od_ec_dec *dec, unsigned fz, unsigned ft OD_ACC_STR) {
ret
=
dif
>=
vw
;
if
(
ret
)
dif
-=
vw
;
r
=
ret
?
r
-
v
:
v
;
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
,
acc_str
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
);
}
/*Decode a bit that has an fz probability of being a zero in Q15.
...
...
@@ -228,7 +202,7 @@ int od_ec_decode_bool_(od_ec_dec *dec, unsigned fz, unsigned ft OD_ACC_STR) {
or _dyadic() functions instead.
fz: The probability that the bit is zero, scaled by 32768.
Return: The value decoded (0 or 1).*/
int
od_ec_decode_bool_q15
_
(
od_ec_dec
*
dec
,
unsigned
fz
OD_ACC_STR
)
{
int
od_ec_decode_bool_q15
(
od_ec_dec
*
dec
,
unsigned
fz
)
{
od_ec_window
dif
;
od_ec_window
vw
;
unsigned
r
;
...
...
@@ -245,7 +219,7 @@ int od_ec_decode_bool_q15_(od_ec_dec *dec, unsigned fz OD_ACC_STR) {
ret
=
dif
>=
vw
;
if
(
ret
)
dif
-=
vw
;
r
=
ret
?
r
-
v
:
v
;
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
,
acc_str
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
);
}
/*Decodes a symbol given a cumulative distribution function (CDF) table.
...
...
@@ -256,8 +230,7 @@ int od_ec_decode_bool_q15_(od_ec_dec *dec, unsigned fz OD_ACC_STR) {
nsyms: The number of symbols in the alphabet.
This should be at most 16.
Return: The decoded symbol s.*/
int
od_ec_decode_cdf_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
OD_ACC_STR
)
{
int
od_ec_decode_cdf
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
)
{
od_ec_window
dif
;
unsigned
r
;
unsigned
c
;
...
...
@@ -315,7 +288,7 @@ int od_ec_decode_cdf_(od_ec_dec *dec, const uint16_t *cdf,
#endif
r
=
v
-
u
;
dif
-=
(
od_ec_window
)
u
<<
(
OD_EC_WINDOW_SIZE
-
16
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
,
acc_str
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
);
}
/*Decodes a symbol given a cumulative distribution function (CDF) table.
...
...
@@ -326,8 +299,7 @@ int od_ec_decode_cdf_(od_ec_dec *dec, const uint16_t *cdf,
nsyms: The number of symbols in the alphabet.
This should be at most 16.
Return: The decoded symbol s.*/
int
od_ec_decode_cdf_unscaled_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
OD_ACC_STR
)
{
int
od_ec_decode_cdf_unscaled
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
)
{
od_ec_window
dif
;
unsigned
r
;
unsigned
c
;
...
...
@@ -383,7 +355,7 @@ int od_ec_decode_cdf_unscaled_(od_ec_dec *dec, const uint16_t *cdf,
#endif
r
=
v
-
u
;
dif
-=
(
od_ec_window
)
u
<<
(
OD_EC_WINDOW_SIZE
-
16
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
,
acc_str
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
);
}
/*Decodes a symbol given a cumulative distribution function (CDF) table that
...
...
@@ -402,8 +374,8 @@ int od_ec_decode_cdf_unscaled_(od_ec_dec *dec, const uint16_t *cdf,
ftb: The number of bits of precision in the cumulative distribution.
This must be no more than 15.
Return: The decoded symbol s.*/
int
od_ec_decode_cdf_unscaled_dyadic
_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
,
unsigned
ftb
OD_ACC_STR
)
{
int
od_ec_decode_cdf_unscaled_dyadic
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
,
unsigned
ftb
)
{
od_ec_window
dif
;
unsigned
r
;
unsigned
c
;
...
...
@@ -427,7 +399,7 @@ int od_ec_decode_cdf_unscaled_dyadic_(od_ec_dec *dec, const uint16_t *cdf,
OD_ASSERT
(
v
<=
r
);
r
=
v
-
u
;
dif
-=
(
od_ec_window
)
u
<<
(
OD_EC_WINDOW_SIZE
-
16
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
,
acc_str
);
return
od_ec_dec_normalize
(
dec
,
dif
,
r
,
ret
);
}
/*Decodes a symbol given a cumulative distribution function (CDF) table in Q15.
...
...
@@ -443,9 +415,8 @@ int od_ec_decode_cdf_unscaled_dyadic_(od_ec_dec *dec, const uint16_t *cdf,
nsyms: The number of symbols in the alphabet.
This should be at most 16.
Return: The decoded symbol s.*/
int
od_ec_decode_cdf_q15_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
OD_ACC_STR
)
{
return
od_ec_decode_cdf_unscaled_dyadic
(
dec
,
cdf
,
nsyms
,
15
,
acc_str
);
int
od_ec_decode_cdf_q15
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
)
{
return
od_ec_decode_cdf_unscaled_dyadic
(
dec
,
cdf
,
nsyms
,
15
);
}
/*Extracts a raw unsigned integer with a non-power-of-2 range from the stream.
...
...
@@ -453,7 +424,7 @@ int od_ec_decode_cdf_q15_(od_ec_dec *dec, const uint16_t *cdf,
ft: The number of integers that can be decoded (one more than the max).
This must be at least 2, and no more than 2**29.
Return: The decoded bits.*/
uint32_t
od_ec_dec_uint
_
(
od_ec_dec
*
dec
,
uint32_t
ft
OD_ACC_STR
)
{
uint32_t
od_ec_dec_uint
(
od_ec_dec
*
dec
,
uint32_t
ft
)
{
OD_ASSERT
(
ft
>=
2
);
OD_ASSERT
(
ft
<=
(
uint32_t
)
1
<<
(
25
+
OD_EC_UINT_BITS
));
if
(
ft
>
1U
<<
OD_EC_UINT_BITS
)
{
...
...
@@ -463,13 +434,13 @@ uint32_t od_ec_dec_uint_(od_ec_dec *dec, uint32_t ft OD_ACC_STR) {
ft
--
;
ftb
=
OD_ILOG_NZ
(
ft
)
-
OD_EC_UINT_BITS
;
ft1
=
(
int
)(
ft
>>
ftb
)
+
1
;
t
=
od_ec_decode_cdf_q15
(
dec
,
OD_UNIFORM_CDF_Q15
(
ft1
),
ft1
,
acc_str
);
t
=
t
<<
ftb
|
od_ec_dec_bits
(
dec
,
ftb
,
acc_str
);
t
=
od_ec_decode_cdf_q15
(
dec
,
OD_UNIFORM_CDF_Q15
(
ft1
),
ft1
);
t
=
t
<<
ftb
|
od_ec_dec_bits
(
dec
,
ftb
);
if
(
t
<=
ft
)
return
t
;
dec
->
error
=
1
;
return
ft
;
}
return
od_ec_decode_cdf_q15
(
dec
,
OD_UNIFORM_CDF_Q15
(
ft
),
(
int
)
ft
,
acc_str
);
return
od_ec_decode_cdf_q15
(
dec
,
OD_UNIFORM_CDF_Q15
(
ft
),
(
int
)
ft
);
}
/*Extracts a sequence of raw bits from the stream.
...
...
@@ -477,7 +448,7 @@ uint32_t od_ec_dec_uint_(od_ec_dec *dec, uint32_t ft OD_ACC_STR) {
ftb: The number of bits to extract.
This must be between 0 and 25, inclusive.
Return: The decoded bits.*/
uint32_t
od_ec_dec_bits
_
(
od_ec_dec
*
dec
,
unsigned
ftb
OD_ACC_STR
)
{
uint32_t
od_ec_dec_bits
(
od_ec_dec
*
dec
,
unsigned
ftb
)
{
od_ec_window
window
;
int
available
;
uint32_t
ret
;
...
...
@@ -506,9 +477,6 @@ uint32_t od_ec_dec_bits_(od_ec_dec *dec, unsigned ftb OD_ACC_STR) {
available
-=
ftb
;
dec
->
end_window
=
window
;
dec
->
nend_bits
=
available
;
#if OD_ACCOUNTING
od_process_accounting
(
dec
,
acc_str
);
#endif
return
ret
;
}
...
...
aom_dsp/entdec.h
View file @
63b44c4c
...
...
@@ -26,9 +26,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
#define _entdec_H (1)
#include <limits.h>
#include "aom_dsp/entcode.h"
#if OD_ACCOUNTING
#include "./accounting.h"
#endif
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -36,36 +33,6 @@ extern "C" {
typedef
struct
od_ec_dec
od_ec_dec
;
#if OD_ACCOUNTING
#define OD_ACC_STR , char *acc_str
#define od_ec_decode_bool(dec, fz, ft, str) od_ec_decode_bool_(dec, fz, ft, str)
#define od_ec_decode_bool_q15(dec, fz, str) od_ec_decode_bool_q15_(dec, fz, str)
#define od_ec_decode_cdf(dec, cdf, nsyms, str) \
od_ec_decode_cdf_(dec, cdf, nsyms, str)
#define od_ec_decode_cdf_q15(dec, cdf, nsyms, str) \
od_ec_decode_cdf_q15_(dec, cdf, nsyms, str)
#define od_ec_decode_cdf_unscaled(dec, cdf, nsyms, str) \
od_ec_decode_cdf_unscaled_(dec, cdf, nsyms, str)
#define od_ec_decode_cdf_unscaled_dyadic(dec, cdf, nsyms, ftb, str) \
od_ec_decode_cdf_unscaled_dyadic_(dec, cdf, nsyms, ftb, str)
#define od_ec_dec_uint(dec, ft, str) od_ec_dec_uint_(dec, ft, str)
#define od_ec_dec_bits(dec, ftb, str) od_ec_dec_bits_(dec, ftb, str)
#else
#define OD_ACC_STR
#define od_ec_decode_bool(dec, fz, ft, str) od_ec_decode_bool_(dec, fz, ft)
#define od_ec_decode_bool_q15(dec, fz, str) od_ec_decode_bool_q15_(dec, fz)
#define od_ec_decode_cdf(dec, cdf, nsyms, str) \
od_ec_decode_cdf_(dec, cdf, nsyms)
#define od_ec_decode_cdf_q15(dec, cdf, nsyms, str) \
od_ec_decode_cdf_q15_(dec, cdf, nsyms)
#define od_ec_decode_cdf_unscaled(dec, cdf, nsyms, str) \
od_ec_decode_cdf_unscaled_(dec, cdf, nsyms)
#define od_ec_decode_cdf_unscaled_dyadic(dec, cdf, nsyms, ftb, str) \
od_ec_decode_cdf_unscaled_dyadic_(dec, cdf, nsyms, ftb)
#define od_ec_dec_uint(dec, ft, str) od_ec_dec_uint_(dec, ft)
#define od_ec_dec_bits(dec, ftb, str) od_ec_dec_bits_(dec, ftb)
#endif
/*The entropy decoder context.*/
struct
od_ec_dec
{
/*The start of the current input buffer.*/
...
...
@@ -94,9 +61,6 @@ struct od_ec_dec {
int16_t
cnt
;
/*Nonzero if an error occurred.*/
int
error
;
#if OD_ACCOUNTING
od_accounting_internal
*
acct
;
#endif
};
/*See entdec.c for further documentation.*/
...
...
@@ -104,33 +68,30 @@ struct od_ec_dec {
void
od_ec_dec_init
(
od_ec_dec
*
dec
,
const
unsigned
char
*
buf
,
uint32_t
storage
)
OD_ARG_NONNULL
(
1
)
OD_ARG_NONNULL
(
2
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_bool_
(
od_ec_dec
*
dec
,
unsigned
fz
,
unsigned
ft
OD_ACC_STR
)
OD_WARN_UNUSED_RESULT
int
od_ec_decode_bool
(
od_ec_dec
*
dec
,
unsigned
fz
,
unsigned
ft
)
OD_ARG_NONNULL
(
1
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_bool_q15
(
od_ec_dec
*
dec
,
unsigned
fz
)
OD_ARG_NONNULL
(
1
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_bool_q15_
(
od_ec_dec
*
dec
,
unsigned
fz
OD_ACC_STR
)
OD_ARG_NONNULL
(
1
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
OD_ACC_STR
)
OD_ARG_NONNULL
(
1
)
OD_ARG_NONNULL
(
2
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf_q15_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
OD_ACC_STR
)
OD_ARG_NONNULL
(
1
)
OD_ARG_NONNULL
(
2
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf_unscaled_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
OD_ACC_STR
)
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
)
OD_ARG_NONNULL
(
1
)
OD_ARG_NONNULL
(
2
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf_q15
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
)
OD_ARG_NONNULL
(
1
)
OD_ARG_NONNULL
(
2
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf_unscaled_dyadic_
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
,
unsigned
_ftb
OD_ACC_STR
)
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf_unscaled
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
)
OD_ARG_NONNULL
(
1
)
OD_ARG_NONNULL
(
2
);
OD_WARN_UNUSED_RESULT
int
od_ec_decode_cdf_unscaled_dyadic
(
od_ec_dec
*
dec
,
const
uint16_t
*
cdf
,
int
nsyms
,
unsigned
_ftb
)
OD_ARG_NONNULL
(
1
)
OD_ARG_NONNULL
(
2
);
OD_WARN_UNUSED_RESULT
uint32_t
od_ec_dec_uint_
(
od_ec_dec
*
dec
,
uint32_t
ft
OD_ACC_STR
)
OD_WARN_UNUSED_RESULT
uint32_t
od_ec_dec_uint
(
od_ec_dec
*
dec
,
uint32_t
ft
)
OD_ARG_NONNULL
(
1
);
OD_WARN_UNUSED_RESULT
uint32_t
od_ec_dec_bits_
(
od_ec_dec
*
dec
,
unsigned
ftb
OD_ACC_STR
)
OD_WARN_UNUSED_RESULT
uint32_t
od_ec_dec_bits
(
od_ec_dec
*
dec
,
unsigned
ftb
)
OD_ARG_NONNULL
(
1
);
OD_WARN_UNUSED_RESULT
int
od_ec_dec_tell
(
const
od_ec_dec
*
dec
)
...
...
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