Change PVQ's gaintheta symbols to use dyadic and ec_adapt adaptation
Change-Id: I367d5561f53f60df42c3ff6f334b1441c85788bd
diff --git a/av1/common/pvq.c b/av1/common/pvq.c
index 29da83a..47f53bb 100644
--- a/av1/common/pvq.c
+++ b/av1/common/pvq.c
@@ -206,8 +206,7 @@
for (i = 0; i < OD_TXSIZES*PVQ_MAX_PARTITIONS; i++) {
state->pvq_ext[i] = is_keyframe ? 24576 : 2 << 16;
}
- state->pvq_gaintheta_increment = 128;
- OD_CDFS_INIT(state->pvq_gaintheta_cdf, state->pvq_gaintheta_increment >> 2);
+ OD_CDFS_INIT(state->pvq_gaintheta_cdf, 0);
OD_CDFS_INIT_Q15(state->pvq_skip_dir_cdf);
OD_CDFS_INIT(ctx->pvq_split_cdf, 0);
}
diff --git a/av1/common/pvq.h b/av1/common/pvq.h
index 34d8bb7..0feb82a 100644
--- a/av1/common/pvq.h
+++ b/av1/common/pvq.h
@@ -131,9 +131,8 @@
generic_encoder pvq_param_model[3];
int pvq_ext[OD_TXSIZES*PVQ_MAX_PARTITIONS];
int pvq_exg[OD_NPLANES_MAX][OD_TXSIZES][PVQ_MAX_PARTITIONS];
- int pvq_gaintheta_increment;
- uint16_t pvq_gaintheta_cdf[2*OD_TXSIZES*PVQ_MAX_PARTITIONS][16];
- uint16_t pvq_skip_dir_cdf[2*(OD_TXSIZES-1)][CDF_SIZE(7)];
+ uint16_t pvq_gaintheta_cdf[2*OD_TXSIZES*PVQ_MAX_PARTITIONS][CDF_SIZE(16)];
+ uint16_t pvq_skip_dir_cdf[2*(OD_TXSIZES-1)][CDF_SIZE(7)];
};
typedef struct od_qm_entry {
diff --git a/av1/decoder/pvq_decoder.c b/av1/decoder/pvq_decoder.c
index 0bc3387..d264bf8 100644
--- a/av1/decoder/pvq_decoder.c
+++ b/av1/decoder/pvq_decoder.c
@@ -173,9 +173,8 @@
/* Jointly decode gain, itheta and noref for small values. Then we handle
larger gain. We need to wait for itheta because in the !nodesync case
it depends on max_theta, which depends on the gain. */
- id = aom_decode_cdf_adapt(r, &adapt->pvq.pvq_gaintheta_cdf[cdf_ctx][0],
- 8 + 7*has_skip, adapt->pvq.pvq_gaintheta_increment,
- "pvq:gaintheta");
+ id = aom_read_symbol_pvq(r, &adapt->pvq.pvq_gaintheta_cdf[cdf_ctx][0],
+ 8 + 7*has_skip, "pvq:gaintheta");
if (!is_keyframe && id >= 10) id++;
if (is_keyframe && id >= 8) id++;
if (id >= 8) {
diff --git a/av1/encoder/pvq_encoder.c b/av1/encoder/pvq_encoder.c
index 1210225..4811544 100644
--- a/av1/encoder/pvq_encoder.c
+++ b/av1/encoder/pvq_encoder.c
@@ -680,8 +680,8 @@
}
/* Jointly code gain, theta and noref for small values. Then we handle
larger gain and theta values. For noref, theta = -1. */
- aom_encode_cdf_adapt(w, id, &adapt->pvq.pvq_gaintheta_cdf[cdf_ctx][0],
- 8 + 7*code_skip, adapt->pvq.pvq_gaintheta_increment);
+ aom_write_symbol_pvq(w, id, &adapt->pvq.pvq_gaintheta_cdf[cdf_ctx][0],
+ 8 + 7*code_skip);
if (encode_flip) {
/* We could eventually do some smarter entropy coding here, but it would
have to be good enough to overcome the overhead of the entropy coder.