Use aom_reader with laplace_decode_special().
Change the laplace_decode_special() function to take an aom_reader struct instead of an od_ec_dec struct. Rename laplace_decode_special() to aom_laplace_decode_special(). Change-Id: I137ae9a4df3fb0fd0b54dea09f787f70a7d287f5
This commit is contained in:
Родитель
984b2327ad
Коммит
b97f1c479c
|
@ -26,13 +26,13 @@
|
|||
generic_decode_(r, model, max, ex_q16, integration, str)
|
||||
# define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, str) \
|
||||
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate, str)
|
||||
# define od_decode_cdf_adapt(ec, cdf, n, increment, str) od_decode_cdf_adapt_(ec, cdf, n, increment, str)
|
||||
# define od_decode_cdf_adapt(enc, cdf, n, increment, str) od_decode_cdf_adapt_(enc, cdf, n, increment, str)
|
||||
#else
|
||||
# define generic_decode(r, model, max, ex_q16, integration, str) \
|
||||
generic_decode_(r, model, max, ex_q16, integration)
|
||||
# define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, str) \
|
||||
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate)
|
||||
# define od_decode_cdf_adapt(ec, cdf, n, increment, str) od_decode_cdf_adapt_(ec, cdf, n, increment)
|
||||
# define od_decode_cdf_adapt(enc, cdf, n, increment, str) od_decode_cdf_adapt_(enc, cdf, n, increment)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -122,11 +122,7 @@ int generic_decode_(aom_reader *r, generic_encoder *model, int max,
|
|||
OD_ASSERT(*ex_q16 < INT_MAX >> 1);
|
||||
e = ((2**ex_q16 >> 8) + (1 << shift >> 1)) >> shift;
|
||||
decay = OD_MAXI(2, OD_MINI(254, 256*e/(e + 256)));
|
||||
#if CONFIG_DAALA_EC
|
||||
xs += laplace_decode_special(&r->ec, decay, (max == -1) ? -1 : ms - 15, ACCT_STR);
|
||||
#else
|
||||
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
#endif
|
||||
xs += aom_laplace_decode_special(r, decay, (max == -1) ? -1 : ms - 15, ACCT_STR);
|
||||
}
|
||||
if (shift != 0) {
|
||||
int special;
|
||||
|
|
|
@ -102,7 +102,8 @@ void aom_decode_band_pvq_splits(aom_reader *r, od_pvq_codeword_ctx *adapt,
|
|||
*
|
||||
* @retval decoded variable x
|
||||
*/
|
||||
int od_laplace_decode_special_(od_ec_dec *dec, unsigned decay, int max OD_ACC_STR) {
|
||||
int aom_laplace_decode_special_(aom_reader *r, unsigned decay,
|
||||
int max OD_ACC_STR) {
|
||||
int pos;
|
||||
int shift;
|
||||
int xs;
|
||||
|
@ -135,19 +136,27 @@ int od_laplace_decode_special_(od_ec_dec *dec, unsigned decay, int max OD_ACC_ST
|
|||
}
|
||||
if (ms > 0 && ms < 15) {
|
||||
/* Simple way of truncating the pdf when we have a bound. */
|
||||
sym = od_ec_decode_cdf_unscaled(dec, cdf, ms + 1);
|
||||
sym = aom_read_cdf_unscaled(r, cdf, ms + 1, ACCT_STR);
|
||||
}
|
||||
else sym = od_ec_decode_cdf_q15(dec, cdf, 16);
|
||||
else sym = aom_read_cdf(r, cdf, 16, ACCT_STR);
|
||||
xs += sym;
|
||||
ms -= 15;
|
||||
}
|
||||
while (sym >= 15 && ms != 0);
|
||||
if (shift) pos = (xs << shift) + od_ec_dec_bits(dec, shift, ACCT_STR);
|
||||
#if CONFIG_DAALA_EC
|
||||
if (shift) pos = (xs << shift) + od_ec_dec_bits(&r->ec, shift, ACCT_STR);
|
||||
else pos = xs;
|
||||
#else
|
||||
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
#endif
|
||||
OD_ASSERT(pos >> shift <= max >> shift || max == -1);
|
||||
if (max != -1 && pos > max) {
|
||||
pos = max;
|
||||
dec->error = 1;
|
||||
#if CONFIG_DAALA_EC
|
||||
r->ec.error = 1;
|
||||
#else
|
||||
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
#endif
|
||||
}
|
||||
OD_ASSERT(pos <= max || max == -1);
|
||||
return pos;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#if !defined(_pvq_decoder_H)
|
||||
# define _pvq_decoder_H (1)
|
||||
# include "aom_dsp/bitreader.h"
|
||||
# include "aom_dsp/entdec.h"
|
||||
# include "av1/common/pvq.h"
|
||||
# include "av1/decoder/decint.h"
|
||||
|
@ -21,12 +22,13 @@ void aom_decode_band_pvq_splits(aom_reader *r, od_pvq_codeword_ctx *adapt,
|
|||
od_coeff *y, int n, int k, int level);
|
||||
|
||||
#if OD_ACCOUNTING
|
||||
# define laplace_decode_special(dec, decay, max, str) od_laplace_decode_special_(dec, decay, max, str)
|
||||
# define aom_laplace_decode_special(r, decay, max, str) aom_laplace_decode_special_(r, decay, max, str)
|
||||
#else
|
||||
# define laplace_decode_special(dec, decay, max, str) od_laplace_decode_special_(dec, decay, max)
|
||||
# define aom_laplace_decode_special(r, decay, max, str) aom_laplace_decode_special_(r, decay, max)
|
||||
#endif
|
||||
|
||||
int od_laplace_decode_special_(od_ec_dec *dec, unsigned decay, int max OD_ACC_STR);
|
||||
int aom_laplace_decode_special_(aom_reader *r, unsigned decay,
|
||||
int max OD_ACC_STR);
|
||||
|
||||
void od_pvq_decode(daala_dec_ctx *dec, od_coeff *ref, od_coeff *out, int q0,
|
||||
int pli, int bs, const od_val16 *beta, int robust, int is_keyframe,
|
||||
|
|
Загрузка…
Ссылка в новой задаче