Skip to content
GitLab
Menu
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
0077927b
Commit
0077927b
authored
Feb 21, 2017
by
Yushin Cho
Browse files
Change PVQ's skip symbols to use dyadic and ec_adapt adaptation
Change-Id: I4f7d37af84220971a839f4f8f42aafa1adeb04e4
parent
4d5182ce
Changes
7
Hide whitespace changes
Inline
Side-by-side
av1/common/generic_code.c
View file @
0077927b
...
...
@@ -27,6 +27,16 @@ void aom_cdf_init(uint16_t *cdf, int ncdfs, int nsyms, int val, int first) {
}
}
void
aom_cdf_init_q15_1D
(
uint16_t
*
cdf
,
int
nsyms
,
int
cdf_size
)
{
int
i
;
for
(
i
=
0
;
i
<
nsyms
;
i
++
)
cdf
[
i
]
=
(
i
+
1
)
*
32768
/
nsyms
;
#if CONFIG_EC_ADAPT
cdf
[
cdf_size
-
1
]
=
0
;
#endif
}
/** Adapts a Q15 cdf after encoding/decoding a symbol. */
void
aom_cdf_adapt_q15
(
int
val
,
uint16_t
*
cdf
,
int
n
,
int
*
count
,
int
rate
)
{
int
i
;
...
...
av1/common/generic_code.h
View file @
0077927b
...
...
@@ -49,8 +49,21 @@ void generic_model_init(generic_encoder *model);
#define OD_SINGLE_CDF_INIT_FIRST(cdf, val, first) aom_cdf_init(cdf, \
1, sizeof(cdf)/sizeof(cdf[0]), val, first)
// WARNING: DO NOT USE this init function,
// if the size of cdf is different from what is declared by code.
#define OD_CDFS_INIT_Q15(cdfs) \
{ int n_cdfs = sizeof(cdfs)/sizeof(cdfs[0]); \
int cdf_size = sizeof(cdfs[0])/sizeof(cdfs[0][0]); \
int nsyms = cdf_size - CONFIG_EC_ADAPT; \
int i_; \
for (i_ = 0; i_ < n_cdfs; i_++) \
aom_cdf_init_q15_1D(cdfs[i_], nsyms, cdf_size); \
}
void
aom_cdf_init
(
uint16_t
*
cdf
,
int
ncdfs
,
int
nsyms
,
int
val
,
int
first
);
void
aom_cdf_init_q15_1D
(
uint16_t
*
cdf
,
int
nsyms
,
int
cdf_size
);
void
aom_cdf_adapt_q15
(
int
val
,
uint16_t
*
cdf
,
int
n
,
int
*
count
,
int
rate
);
void
aom_encode_cdf_adapt_q15
(
aom_writer
*
w
,
int
val
,
uint16_t
*
cdf
,
int
n
,
...
...
av1/common/pvq_state.c
View file @
0077927b
...
...
@@ -13,12 +13,11 @@
#include
"av1/common/odintrin.h"
void
od_adapt_ctx_reset
(
od_adapt_ctx
*
adapt
,
int
is_keyframe
)
{
int
i
;
int
pli
;
od_adapt_pvq_ctx_reset
(
&
adapt
->
pvq
,
is_keyframe
);
adapt
->
skip_increment
=
128
;
OD_CDFS_INIT
(
adapt
->
skip_cdf
,
adapt
->
skip_increment
>>
2
);
OD_CDFS_INIT_Q15
(
adapt
->
skip_cdf
);
for
(
pli
=
0
;
pli
<
OD_NPLANES_MAX
;
pli
++
)
{
int
i
;
generic_model_init
(
&
adapt
->
model_dc
[
pli
]);
for
(
i
=
0
;
i
<
OD_TXSIZES
;
i
++
)
{
int
j
;
...
...
av1/common/pvq_state.h
View file @
0077927b
...
...
@@ -34,8 +34,7 @@ struct od_adapt_ctx {
int
ex_g
[
OD_NPLANES_MAX
][
OD_TXSIZES
];
/* Joint skip flag for DC and AC */
uint16_t
skip_cdf
[
OD_TXSIZES
*
2
][
4
];
int
skip_increment
;
uint16_t
skip_cdf
[
OD_TXSIZES
*
2
][
CDF_SIZE
(
4
)];
};
struct
od_state
{
...
...
av1/decoder/decodeframe.c
View file @
0077927b
...
...
@@ -425,10 +425,10 @@ static PVQ_SKIP_TYPE read_pvq_skip(AV1_COMMON *cm, MACROBLOCKD *const xd,
// NOTE : we don't use 5 symbols for luma here in aom codebase,
// since block partition is taken care of by aom.
// So, only AC/DC skip info is coded
const
int
ac_dc_coded
=
aom_
decode_cdf_adapt
(
const
int
ac_dc_coded
=
aom_
read_symbol
(
xd
->
daala_dec
.
r
,
xd
->
daala_dec
.
state
.
adapt
.
skip_cdf
[
2
*
tx_size
+
(
plane
!=
0
)],
4
,
xd
->
daala_dec
.
state
.
adapt
.
skip_increment
,
"skip"
);
"skip"
);
if
(
ac_dc_coded
<
0
||
ac_dc_coded
>
3
)
{
aom_internal_error
(
&
cm
->
error
,
AOM_CODEC_INVALID_PARAM
,
"Invalid PVQ Skip Type"
);
...
...
av1/encoder/bitstream.c
View file @
0077927b
...
...
@@ -1057,9 +1057,8 @@ static void pack_pvq_tokens(aom_writer *w, MACROBLOCK *const x,
pvq
=
get_pvq_block
(
x
->
pvq_q
);
// encode block skip info
aom_encode_cdf_adapt
(
w
,
pvq
->
ac_dc_coded
,
adapt
->
skip_cdf
[
2
*
tx_size
+
(
plane
!=
0
)],
4
,
adapt
->
skip_increment
);
aom_write_symbol
(
w
,
pvq
->
ac_dc_coded
,
adapt
->
skip_cdf
[
2
*
tx_size
+
(
plane
!=
0
)],
4
);
// AC coeffs coded?
if
(
pvq
->
ac_dc_coded
&
AC_CODED
)
{
...
...
@@ -1070,7 +1069,7 @@ static void pack_pvq_tokens(aom_writer *w, MACROBLOCK *const x,
pvq_encode_partition
(
w
,
pvq
->
qg
[
i
],
pvq
->
theta
[
i
],
pvq
->
max_theta
[
i
],
pvq
->
y
+
pvq
->
off
[
i
],
pvq
->
size
[
i
],
pvq
->
k
[
i
],
model
,
adapt
,
exg
+
i
,
ext
+
i
,
nodesync
,
exg
+
i
,
ext
+
i
,
nodesync
||
is_keyframe
,
(
plane
!=
0
)
*
OD_TXSIZES
*
PVQ_MAX_PARTITIONS
+
pvq
->
bs
*
PVQ_MAX_PARTITIONS
+
i
,
is_keyframe
,
i
==
0
&&
(
i
<
pvq
->
nb_bands
-
1
),
pvq
->
skip_rest
,
...
...
av1/encoder/pvq_encoder.c
View file @
0077927b
...
...
@@ -884,8 +884,7 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
/* Code as if we're not skipping. */
aom_encode_cdf_adapt
(
&
enc
->
w
,
2
+
(
out
[
0
]
!=
0
),
skip_cdf
,
4
,
enc
->
state
.
adapt
.
skip_increment
);
aom_write_symbol
(
&
enc
->
w
,
2
+
(
out
[
0
]
!=
0
),
skip_cdf
,
4
);
ac_dc_coded
=
AC_CODED
+
(
out
[
0
]
!=
0
);
cfl_encoded
=
0
;
skip_rest
=
1
;
...
...
@@ -988,8 +987,7 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
}
/* We decide to skip, roll back everything as it was before. */
od_encode_rollback
(
enc
,
&
buf
);
aom_encode_cdf_adapt
(
&
enc
->
w
,
out
[
0
]
!=
0
,
skip_cdf
,
4
,
enc
->
state
.
adapt
.
skip_increment
);
aom_write_symbol
(
&
enc
->
w
,
out
[
0
]
!=
0
,
skip_cdf
,
4
);
ac_dc_coded
=
(
out
[
0
]
!=
0
);
if
(
is_keyframe
)
for
(
i
=
1
;
i
<
1
<<
(
2
*
bs
+
4
);
i
++
)
out
[
i
]
=
0
;
else
for
(
i
=
1
;
i
<
1
<<
(
2
*
bs
+
4
);
i
++
)
out
[
i
]
=
ref
[
i
];
...
...
Write
Preview
Supports
Markdown
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