Commit ac4535c8 authored by Yushin Cho's avatar Yushin Cho
Browse files

Change PVQ's skip_dir symbols to use dyadic and ec_adapt adaptation

Change-Id: Idfe23c1aef5d080567094af6e87d65bda3835ae5
parent b9802238
...@@ -208,8 +208,7 @@ void od_adapt_pvq_ctx_reset(od_pvq_adapt_ctx *state, int is_keyframe) { ...@@ -208,8 +208,7 @@ void od_adapt_pvq_ctx_reset(od_pvq_adapt_ctx *state, int is_keyframe) {
} }
state->pvq_gaintheta_increment = 128; state->pvq_gaintheta_increment = 128;
OD_CDFS_INIT(state->pvq_gaintheta_cdf, state->pvq_gaintheta_increment >> 2); OD_CDFS_INIT(state->pvq_gaintheta_cdf, state->pvq_gaintheta_increment >> 2);
state->pvq_skip_dir_increment = 128; OD_CDFS_INIT_Q15(state->pvq_skip_dir_cdf);
OD_CDFS_INIT(state->pvq_skip_dir_cdf, state->pvq_skip_dir_increment >> 2);
OD_CDFS_INIT(ctx->pvq_split_cdf, 0); OD_CDFS_INIT(ctx->pvq_split_cdf, 0);
} }
......
...@@ -133,8 +133,7 @@ struct od_pvq_adapt_ctx { ...@@ -133,8 +133,7 @@ struct od_pvq_adapt_ctx {
int pvq_exg[OD_NPLANES_MAX][OD_TXSIZES][PVQ_MAX_PARTITIONS]; int pvq_exg[OD_NPLANES_MAX][OD_TXSIZES][PVQ_MAX_PARTITIONS];
int pvq_gaintheta_increment; int pvq_gaintheta_increment;
uint16_t pvq_gaintheta_cdf[2*OD_TXSIZES*PVQ_MAX_PARTITIONS][16]; uint16_t pvq_gaintheta_cdf[2*OD_TXSIZES*PVQ_MAX_PARTITIONS][16];
int pvq_skip_dir_increment; uint16_t pvq_skip_dir_cdf[2*(OD_TXSIZES-1)][CDF_SIZE(7)];
uint16_t pvq_skip_dir_cdf[2*(OD_TXSIZES-1)][7];
}; };
typedef struct od_qm_entry { typedef struct od_qm_entry {
......
...@@ -370,9 +370,9 @@ void od_pvq_decode(daala_dec_ctx *dec, ...@@ -370,9 +370,9 @@ void od_pvq_decode(daala_dec_ctx *dec,
if (i == 0 && !skip_rest[0] && bs > 0) { if (i == 0 && !skip_rest[0] && bs > 0) {
int skip_dir; int skip_dir;
int j; int j;
skip_dir = aom_decode_cdf_adapt(dec->r, skip_dir = aom_read_symbol(dec->r,
&dec->state.adapt.pvq.pvq_skip_dir_cdf[(pli != 0) + 2*(bs - 1)][0], 7, &dec->state.adapt.pvq.pvq_skip_dir_cdf[(pli != 0) + 2*(bs - 1)][0], 7,
dec->state.adapt.pvq.pvq_skip_dir_increment, "pvq:skiprest"); "pvq:skiprest");
for (j = 0; j < 3; j++) skip_rest[j] = !!(skip_dir & (1 << j)); for (j = 0; j < 3; j++) skip_rest[j] = !!(skip_dir & (1 << j));
} }
} }
......
...@@ -1076,11 +1076,11 @@ static void pack_pvq_tokens(aom_writer *w, MACROBLOCK *const x, ...@@ -1076,11 +1076,11 @@ static void pack_pvq_tokens(aom_writer *w, MACROBLOCK *const x,
encode_flip, flip); encode_flip, flip);
} }
if (i == 0 && !pvq->skip_rest && pvq->bs > 0) { if (i == 0 && !pvq->skip_rest && pvq->bs > 0) {
aom_encode_cdf_adapt( aom_write_symbol(
w, pvq->skip_dir, w, pvq->skip_dir,
&adapt->pvq &adapt->pvq
.pvq_skip_dir_cdf[(plane != 0) + 2 * (pvq->bs - 1)][0], .pvq_skip_dir_cdf[(plane != 0) + 2 * (pvq->bs - 1)][0],
7, adapt->pvq.pvq_skip_dir_increment); 7);
} }
} }
} }
......
...@@ -932,9 +932,8 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc, ...@@ -932,9 +932,8 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
skip_rest, encode_flip, flip); skip_rest, encode_flip, flip);
} }
if (i == 0 && !skip_rest && bs > 0) { if (i == 0 && !skip_rest && bs > 0) {
aom_encode_cdf_adapt(&enc->w, skip_dir, aom_write_symbol(&enc->w, skip_dir,
&enc->state.adapt.pvq.pvq_skip_dir_cdf[(pli != 0) + 2*(bs - 1)][0], 7, &enc->state.adapt.pvq.pvq_skip_dir_cdf[(pli != 0) + 2*(bs - 1)][0], 7);
enc->state.adapt.pvq.pvq_skip_dir_increment);
} }
if (encode_flip) cfl_encoded = 1; if (encode_flip) cfl_encoded = 1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment