Change PVQ's partition split symbols to use dyadic and ec_adapt adaptation

Change-Id: I2fd1d6f32b1b395dfdbe556b96dddf65f3cabbbe
This commit is contained in:
Yushin Cho 2017-02-21 14:09:06 -08:00
Родитель 0077927b15
Коммит a0d6f117ff
9 изменённых файлов: 28 добавлений и 11 удалений

Просмотреть файл

@ -40,9 +40,6 @@ void generic_model_init(generic_encoder *model);
#define OD_CDFS_INIT(cdf, val) aom_cdf_init(&cdf[0][0], \
sizeof(cdf)/sizeof(cdf[0]), sizeof(cdf[0])/sizeof(cdf[0][0]), val, val)
#define OD_CDFS_INIT_FIRST(cdf, val, first) aom_cdf_init(&cdf[0][0], \
sizeof(cdf)/sizeof(cdf[0]), sizeof(cdf[0])/sizeof(cdf[0][0]), val, first)
#define OD_SINGLE_CDF_INIT(cdf, val) aom_cdf_init(cdf, \
1, sizeof(cdf)/sizeof(cdf[0]), val, val)

Просмотреть файл

@ -211,8 +211,7 @@ void od_adapt_pvq_ctx_reset(od_pvq_adapt_ctx *state, int is_keyframe) {
OD_CDFS_INIT(state->pvq_gaintheta_cdf, state->pvq_gaintheta_increment >> 2);
state->pvq_skip_dir_increment = 128;
OD_CDFS_INIT(state->pvq_skip_dir_cdf, state->pvq_skip_dir_increment >> 2);
ctx->pvq_split_increment = 128;
OD_CDFS_INIT(ctx->pvq_split_cdf, ctx->pvq_split_increment >> 1);
OD_CDFS_INIT(ctx->pvq_split_cdf, 0);
}
/* QMs are arranged from smallest to largest blocksizes, first for

Просмотреть файл

@ -124,8 +124,7 @@ struct od_pvq_codeword_ctx {
int pvq_k1_increment;
/* CDFs are size 16 despite the fact that we're using less than that. */
uint16_t pvq_k1_cdf[12][16];
uint16_t pvq_split_cdf[22*7][8];
int pvq_split_increment;
uint16_t pvq_split_cdf[22*7][CDF_SIZE(8)];
};
struct od_pvq_adapt_ctx {

Просмотреть файл

@ -33,8 +33,8 @@ static int aom_decode_pvq_split_(aom_reader *r, od_pvq_codeword_ctx *adapt,
if (sum == 0) return 0;
shift = OD_MAXI(0, OD_ILOG(sum) - 3);
fctx = 7*ctx + (sum >> shift) - 1;
msbs = aom_decode_cdf_adapt(r, adapt->pvq_split_cdf[fctx],
(sum >> shift) + 1, adapt->pvq_split_increment, ACCT_STR_NAME);
msbs = aom_read_symbol_pvq(r, adapt->pvq_split_cdf[fctx], (sum >> shift) + 1,
ACCT_STR_NAME);
if (shift) count = aom_read_literal(r, shift, ACCT_STR_NAME);
count += msbs << shift;
if (count > sum) {

Просмотреть файл

@ -28,6 +28,13 @@
#include "av1/decoder/pvq_decoder.h"
#include "aom_ports/system_state.h"
int aom_read_symbol_pvq_(aom_reader *r, aom_cdf_prob *cdf, int nsymbs
ACCT_STR_PARAM) {
if (cdf[0] == 0)
aom_cdf_init_q15_1D(cdf, nsymbs, CDF_SIZE(nsymbs));
return aom_read_symbol(r, cdf, nsymbs, ACCT_STR_NAME);
}
static void aom_decode_pvq_codeword(aom_reader *r, od_pvq_codeword_ctx *ctx,
od_coeff *y, int n, int k) {
int i;

Просмотреть файл

@ -18,6 +18,12 @@
# include "av1/common/pvq.h"
# include "av1/decoder/decint.h"
#define aom_read_symbol_pvq(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol_pvq_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
int aom_read_symbol_pvq_(aom_reader *r, aom_cdf_prob *cdf, int nsymbs
ACCT_STR_PARAM);
void aom_decode_band_pvq_splits(aom_reader *r, od_pvq_codeword_ctx *adapt,
od_coeff *y, int n, int k, int level);

Просмотреть файл

@ -35,8 +35,7 @@ static void aom_encode_pvq_split(aom_writer *w, od_pvq_codeword_ctx *adapt,
sum >>= shift;
}
fctx = 7*ctx + sum - 1;
aom_encode_cdf_adapt(w, count, adapt->pvq_split_cdf[fctx], sum + 1,
adapt->pvq_split_increment);
aom_write_symbol_pvq(w, count, adapt->pvq_split_cdf[fctx], sum + 1);
if (shift) aom_write_literal(w, rest, shift);
}

Просмотреть файл

@ -32,6 +32,13 @@
dot-product of the 1st band of chroma with the luma ref doesn't overflow.*/
#define OD_CFL_FLIP_SHIFT (OD_LIMIT_BSIZE_MAX + 0)
void aom_write_symbol_pvq(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs) {
if (cdf[0] == 0)
aom_cdf_init_q15_1D(cdf, nsymbs, CDF_SIZE(nsymbs));
aom_write_symbol(w, symb, cdf, nsymbs);
}
static void aom_encode_pvq_codeword(aom_writer *w, od_pvq_codeword_ctx *adapt,
const od_coeff *in, int n, int k) {
int i;

Просмотреть файл

@ -19,6 +19,9 @@
# include "av1/common/pvq.h"
# include "av1/encoder/encint.h"
void aom_write_symbol_pvq(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs);
void aom_encode_band_pvq_splits(aom_writer *w, od_pvq_codeword_ctx *adapt,
const int *y, int n, int k, int level);