Commit fb9186d6 authored by Alex Converse's avatar Alex Converse
Browse files

ANS experiment: Use ANS everywhere.

Use ANS for all entropy coded data in VP10 including the compressed header and
modes and motion vectors. ANS tokens continue to be used for DCT tokens.

Change-Id: Idf709a747150601e4d95d81ecfb3dc7253d349df
parent 2a6389bb
......@@ -16,7 +16,7 @@
#include "./vpx_scale_rtcd.h"
#include "vpx_dsp/bitreader_buffer.h"
#include "vpx_dsp/bitreader.h"
#include "vp10/decoder/bitreader.h"
#include "vpx_dsp/vpx_dsp_common.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
......@@ -100,14 +100,14 @@ static TX_MODE read_tx_mode(struct vpx_read_bit_buffer *rb) {
return vpx_rb_read_bit(rb) ? TX_MODE_SELECT : vpx_rb_read_literal(rb, 2);
}
static void read_switchable_interp_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
static void read_switchable_interp_probs(FRAME_CONTEXT *fc, vp10_reader *r) {
int i, j;
for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
for (i = 0; i < SWITCHABLE_FILTERS - 1; ++i)
vp10_diff_update_prob(r, &fc->switchable_interp_prob[j][i]);
}
static void read_inter_mode_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp10_reader *r) {
int i;
#if CONFIG_REF_MV
for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i)
......@@ -130,9 +130,9 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
}
#if CONFIG_EXT_INTER
static void read_inter_compound_mode_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
static void read_inter_compound_mode_probs(FRAME_CONTEXT *fc, vp10_reader *r) {
int i, j;
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
if (vp10_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (j = 0; j < INTER_MODE_CONTEXTS; ++j) {
for (i = 0; i < INTER_COMPOUND_MODES - 1; ++i) {
vp10_diff_update_prob(r, &fc->inter_compound_mode_probs[j][i]);
......@@ -153,7 +153,7 @@ static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
}
}
static void read_frame_reference_mode_probs(VP10_COMMON *cm, vpx_reader *r) {
static void read_frame_reference_mode_probs(VP10_COMMON *cm, vp10_reader *r) {
FRAME_CONTEXT *const fc = cm->fc;
int i, j;
......@@ -178,13 +178,13 @@ static void read_frame_reference_mode_probs(VP10_COMMON *cm, vpx_reader *r) {
}
}
static void update_mv_probs(vpx_prob *p, int n, vpx_reader *r) {
static void update_mv_probs(vpx_prob *p, int n, vp10_reader *r) {
int i;
for (i = 0; i < n; ++i)
vp10_diff_update_prob(r, &p[i]);
}
static void read_mv_probs(nmv_context *ctx, int allow_hp, vpx_reader *r) {
static void read_mv_probs(nmv_context *ctx, int allow_hp, vp10_reader *r) {
int i, j;
update_mv_probs(ctx->joints, MV_JOINTS - 1, r);
......@@ -262,7 +262,7 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
const rans_dec_lut *const token_tab,
struct AnsDecoder *const r,
#else
vpx_reader *r,
vp10_reader *r,
#endif // CONFIG_ANS
MB_MODE_INFO *const mbmi,
int plane,
......@@ -298,7 +298,7 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
}
#if CONFIG_VAR_TX
static void decode_reconstruct_tx(MACROBLOCKD *const xd, vpx_reader *r,
static void decode_reconstruct_tx(MACROBLOCKD *const xd, vp10_reader *r,
MB_MODE_INFO *const mbmi,
int plane, BLOCK_SIZE plane_bsize,
int block, int blk_row, int blk_col,
......@@ -360,7 +360,7 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd,
const rans_dec_lut *const token_tab,
struct AnsDecoder *const r,
#else
vpx_reader *r,
vp10_reader *r,
#endif
MB_MODE_INFO *const mbmi, int plane,
int row, int col, TX_SIZE tx_size) {
......@@ -1808,7 +1808,7 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd,
int supertx_enabled,
#endif // CONFIG_SUPERTX
int mi_row, int mi_col,
vpx_reader *r,
vp10_reader *r,
#if CONFIG_ANS
struct AnsDecoder *const tok,
#endif // CONFIG_ANS
......@@ -2008,7 +2008,7 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd,
}
#endif // CONFIG_SUPERTX
xd->corrupted |= vpx_reader_has_error(r);
xd->corrupted |= vp10_reader_has_error(r);
}
static INLINE int dec_partition_plane_context(const MACROBLOCKD *xd,
......@@ -2042,7 +2042,7 @@ static INLINE void dec_update_partition_context(MACROBLOCKD *xd,
#endif // !CONFIG_EXT_PARTITION_TYPES
static PARTITION_TYPE read_partition(VP10_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, vpx_reader *r,
int mi_row, int mi_col, vp10_reader *r,
int has_rows, int has_cols,
#if CONFIG_EXT_PARTITION_TYPES
BLOCK_SIZE bsize,
......@@ -2056,16 +2056,16 @@ static PARTITION_TYPE read_partition(VP10_COMMON *cm, MACROBLOCKD *xd,
if (has_rows && has_cols)
#if CONFIG_EXT_PARTITION_TYPES
if (bsize <= BLOCK_8X8)
p = (PARTITION_TYPE)vpx_read_tree(r, vp10_partition_tree, probs);
p = (PARTITION_TYPE)vp10_read_tree(r, vp10_partition_tree, probs);
else
p = (PARTITION_TYPE)vpx_read_tree(r, vp10_ext_partition_tree, probs);
p = (PARTITION_TYPE)vp10_read_tree(r, vp10_ext_partition_tree, probs);
#else
p = (PARTITION_TYPE)vpx_read_tree(r, vp10_partition_tree, probs);
p = (PARTITION_TYPE)vp10_read_tree(r, vp10_partition_tree, probs);
#endif // CONFIG_EXT_PARTITION_TYPES
else if (!has_rows && has_cols)
p = vpx_read(r, probs[1]) ? PARTITION_SPLIT : PARTITION_HORZ;
p = vp10_read(r, probs[1]) ? PARTITION_SPLIT : PARTITION_HORZ;
else if (has_rows && !has_cols)
p = vpx_read(r, probs[2]) ? PARTITION_SPLIT : PARTITION_VERT;
p = vp10_read(r, probs[2]) ? PARTITION_SPLIT : PARTITION_VERT;
else
p = PARTITION_SPLIT;
......@@ -2077,9 +2077,9 @@ static PARTITION_TYPE read_partition(VP10_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_SUPERTX
static int read_skip_without_seg(VP10_COMMON *cm, const MACROBLOCKD *xd,
vpx_reader *r) {
vp10_reader *r) {
const int ctx = vp10_get_skip_context(xd);
const int skip = vpx_read(r, cm->fc->skip_probs[ctx]);
const int skip = vp10_read(r, cm->fc->skip_probs[ctx]);
FRAME_COUNTS *counts = xd->counts;
if (counts)
++counts->skip[ctx][skip];
......@@ -2093,7 +2093,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
int supertx_enabled,
#endif
int mi_row, int mi_col,
vpx_reader* r,
vp10_reader* r,
#if CONFIG_ANS
struct AnsDecoder *const tok,
#endif // CONFIG_ANS
......@@ -2134,7 +2134,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
!xd->lossless[0]) {
const int supertx_context =
partition_supertx_context_lookup[partition];
supertx_enabled = vpx_read(
supertx_enabled = vp10_read(
r, cm->fc->supertx_prob[supertx_context][supertx_size]);
if (xd->counts)
xd->counts->supertx[supertx_context][supertx_size][supertx_enabled]++;
......@@ -2156,7 +2156,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
if (get_ext_tx_types(supertx_size, bsize, 1) > 1) {
int eset = get_ext_tx_set(supertx_size, bsize, 1);
if (eset > 0) {
txfm = vpx_read_tree(r, vp10_ext_tx_inter_tree[eset],
txfm = vp10_read_tree(r, vp10_ext_tx_inter_tree[eset],
cm->fc->inter_ext_tx_prob[eset][supertx_size]);
if (xd->counts)
++xd->counts->inter_ext_tx[eset][supertx_size][txfm];
......@@ -2164,7 +2164,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
}
#else
if (supertx_size < TX_32X32) {
txfm = vpx_read_tree(r, vp10_ext_tx_tree,
txfm = vp10_read_tree(r, vp10_ext_tx_tree,
cm->fc->inter_ext_tx_prob[supertx_size]);
if (xd->counts)
++xd->counts->inter_ext_tx[supertx_size][txfm];
......@@ -2514,11 +2514,12 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#endif // CONFIG_EXT_PARTITION_TYPES
}
#if !CONFIG_ANS
static void setup_bool_decoder(const uint8_t *data,
const uint8_t *data_end,
const size_t read_size,
struct vpx_internal_error_info *error_info,
vpx_reader *r,
vp10_reader *r,
vpx_decrypt_cb decrypt_cb,
void *decrypt_state) {
// Validate the calculated partition length. If the buffer
......@@ -2532,7 +2533,7 @@ static void setup_bool_decoder(const uint8_t *data,
vpx_internal_error(error_info, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder %d", 1);
}
#if CONFIG_ANS
#else
static void setup_token_decoder(const uint8_t *data,
const uint8_t *data_end,
const size_t read_size,
......@@ -2556,10 +2557,10 @@ static void setup_token_decoder(const uint8_t *data,
#endif
static void read_coef_probs_common(vp10_coeff_probs_model *coef_probs,
vpx_reader *r) {
vp10_reader *r) {
int i, j, k, l, m;
if (vpx_read_bit(r))
if (vp10_read_bit(r))
for (i = 0; i < PLANE_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
......@@ -2569,7 +2570,7 @@ static void read_coef_probs_common(vp10_coeff_probs_model *coef_probs,
}
static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode,
vpx_reader *r) {
vp10_reader *r) {
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
TX_SIZE tx_size;
for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
......@@ -3239,14 +3240,18 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi,
&cm->counts : NULL;
vp10_zero(td->dqcoeff);
vp10_tile_init(&td->xd.tile, td->cm, tile_row, tile_col);
#if !CONFIG_ANS
setup_bool_decoder(buf->data, data_end, buf->size, &cm->error,
&td->bit_reader,
pbi->decrypt_cb, pbi->decrypt_state);
#if CONFIG_ANS
&td->bit_reader, pbi->decrypt_cb,
pbi->decrypt_state);
#else
if (buf->size < 3 || !read_is_valid(buf->data, buf->size, data_end))
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Truncated packet or corrupt tile length");
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
&td->token_ans,
pbi->decrypt_cb, pbi->decrypt_state);
#endif // CONFIG_ANS
&td->bit_reader, pbi->decrypt_cb,
pbi->decrypt_state);
#endif
vp10_init_macroblockd(cm, &td->xd, td->dqcoeff);
td->xd.plane[0].color_index_map = td->color_index_map[0];
td->xd.plane[1].color_index_map = td->color_index_map[1];
......@@ -3281,7 +3286,7 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi,
#endif // CONFIG_SUPERTX
mi_row, mi_col, &td->bit_reader,
#if CONFIG_ANS
&td->token_ans,
&td->bit_reader,
#endif // CONFIG_ANS
BLOCK_LARGEST, MAX_SB_SIZE_LOG2 - 2);
}
......@@ -3396,7 +3401,7 @@ static int tile_worker_hook(TileWorkerData *const tile_data,
#endif
mi_row, mi_col, &tile_data->bit_reader,
#if CONFIG_ANS
&tile_data->token_ans,
&tile_data->bit_reader,
#endif // CONFIG_ANS
BLOCK_LARGEST, MAX_SB_SIZE_LOG2 - 2);
}
......@@ -3537,12 +3542,13 @@ static const uint8_t *decode_tiles_mt(VP10Decoder *pbi,
vp10_zero(twd->dqcoeff);
vp10_tile_init(tile_info, cm, tile_row, buf->col);
vp10_tile_init(&twd->xd.tile, cm, tile_row, buf->col);
#if !CONFIG_ANS
setup_bool_decoder(buf->data, data_end, buf->size, &cm->error,
&twd->bit_reader,
pbi->decrypt_cb, pbi->decrypt_state);
#if CONFIG_ANS
#else
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
&twd->token_ans, pbi->decrypt_cb,
&twd->bit_reader, pbi->decrypt_cb,
pbi->decrypt_state);
#endif // CONFIG_ANS
vp10_init_macroblockd(cm, &twd->xd, twd->dqcoeff);
......@@ -3900,11 +3906,11 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
}
#if CONFIG_EXT_TX
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vp10_reader *r) {
int i, j, k;
int s;
for (s = 1; s < EXT_TX_SETS_INTER; ++s) {
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
if (vp10_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_inter_ext_tx_for_txsize[s][i]) continue;
for (j = 0; j < num_ext_tx_set_inter[s] - 1; ++j)
......@@ -3914,7 +3920,7 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
}
for (s = 1; s < EXT_TX_SETS_INTRA; ++s) {
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
if (vp10_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
if (!use_intra_ext_tx_for_txsize[s][i]) continue;
for (j = 0; j < INTRA_MODES; ++j)
......@@ -3927,16 +3933,16 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
#else
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vp10_reader *r) {
int i, j, k;
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
if (vp10_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
for (j = 0; j < TX_TYPES; ++j)
for (k = 0; k < TX_TYPES - 1; ++k)
vp10_diff_update_prob(r, &fc->intra_ext_tx_prob[i][j][k]);
}
}
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
if (vp10_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
for (k = 0; k < TX_TYPES - 1; ++k)
vp10_diff_update_prob(r, &fc->inter_ext_tx_prob[i][k]);
......@@ -3946,9 +3952,9 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
#endif // CONFIG_EXT_TX
#if CONFIG_SUPERTX
static void read_supertx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
static void read_supertx_probs(FRAME_CONTEXT *fc, vp10_reader *r) {
int i, j;
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
if (vp10_read(r, GROUP_DIFF_UPDATE_PROB)) {
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) {
for (j = 1; j < TX_SIZES; ++j) {
vp10_diff_update_prob(r, &fc->supertx_prob[i][j]);
......@@ -3965,13 +3971,19 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
MACROBLOCKD *const xd = &pbi->mb;
#endif
FRAME_CONTEXT *const fc = cm->fc;
vpx_reader r;
vp10_reader r;
int k, i, j;
#if !CONFIG_ANS
if (vpx_reader_init(&r, data, partition_size, pbi->decrypt_cb,
pbi->decrypt_state))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder 0");
#else
if (ans_read_init(&r, data, partition_size))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate compressed header ANS decoder");
#endif // !CONFIG_ANS
if (cm->tx_mode == TX_MODE_SELECT) {
for (i = 0; i < TX_SIZES - 1; ++i)
......@@ -4093,7 +4105,7 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
#endif
}
return vpx_reader_has_error(&r);
return vp10_reader_has_error(&r);
}
#ifdef NDEBUG
......
This diff is collapsed.
......@@ -11,7 +11,7 @@
#ifndef VP10_DECODER_DECODEMV_H_
#define VP10_DECODER_DECODEMV_H_
#include "vpx_dsp/bitreader.h"
#include "vp10/decoder/bitreader.h"
#include "vp10/decoder/decoder.h"
......@@ -24,7 +24,7 @@ void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,
int supertx_enabled,
#endif
int mi_row, int mi_col, vpx_reader *r,
int mi_row, int mi_col, vp10_reader *r,
int x_mis, int y_mis);
#ifdef __cplusplus
......
......@@ -14,13 +14,10 @@
#include "./vpx_config.h"
#include "vpx/vpx_codec.h"
#include "vpx_dsp/bitreader.h"
#include "vp10/decoder/bitreader.h"
#include "vpx_scale/yv12config.h"
#include "vpx_util/vpx_thread.h"
#if CONFIG_ANS
#include "vp10/common/ans.h"
#endif
#include "vp10/common/thread_common.h"
#include "vp10/common/onyxc_int.h"
#include "vp10/common/ppflags.h"
......@@ -33,10 +30,7 @@ extern "C" {
// TODO(hkuang): combine this with TileWorkerData.
typedef struct TileData {
VP10_COMMON *cm;
vpx_reader bit_reader;
#if CONFIG_ANS
struct AnsDecoder token_ans;
#endif // CONFIG_ANS
vp10_reader bit_reader;
DECLARE_ALIGNED(16, MACROBLOCKD, xd);
/* dqcoeff are shared by all the planes. So planes must be decoded serially */
DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]);
......@@ -45,10 +39,7 @@ typedef struct TileData {
typedef struct TileWorkerData {
struct VP10Decoder *pbi;
vpx_reader bit_reader;
#if CONFIG_ANS
struct AnsDecoder token_ans;
#endif // CONFIG_ANS
vp10_reader bit_reader;
FRAME_COUNTS counts;
DECLARE_ALIGNED(16, MACROBLOCKD, xd);
/* dqcoeff are shared by all the planes. So planes must be decoded serially */
......
......@@ -40,10 +40,10 @@
} while (0)
#if !CONFIG_ANS
static INLINE int read_coeff(const vpx_prob *probs, int n, vpx_reader *r) {
static INLINE int read_coeff(const vpx_prob *probs, int n, vp10_reader *r) {
int i, val = 0;
for (i = 0; i < n; ++i)
val = (val << 1) | vpx_read(r, probs[i]);
val = (val << 1) | vp10_read(r, probs[i]);
return val;
}
......@@ -51,7 +51,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
PLANE_TYPE type,
tran_low_t *dqcoeff, TX_SIZE tx_size, const int16_t *dq,
int ctx, const int16_t *scan, const int16_t *nb,
vpx_reader *r) {
vp10_reader *r) {
FRAME_COUNTS *counts = xd->counts;
const int max_eob = 16 << (tx_size << 1);
const FRAME_CONTEXT *const fc = xd->fc;
......@@ -129,12 +129,12 @@ static int decode_coefs(const MACROBLOCKD *xd,
prob = coef_probs[band][ctx];
if (counts)
++eob_branch_count[band][ctx];
if (!vpx_read(r, prob[EOB_CONTEXT_NODE])) {
if (!vp10_read(r, prob[EOB_CONTEXT_NODE])) {
INCREMENT_COUNT(EOB_MODEL_TOKEN);
break;
}
while (!vpx_read(r, prob[ZERO_CONTEXT_NODE])) {
while (!vp10_read(r, prob[ZERO_CONTEXT_NODE])) {
INCREMENT_COUNT(ZERO_TOKEN);
dqv = dq[1];
token_cache[scan[c]] = 0;
......@@ -146,13 +146,13 @@ static int decode_coefs(const MACROBLOCKD *xd,
prob = coef_probs[band][ctx];
}
if (!vpx_read(r, prob[ONE_CONTEXT_NODE])) {
if (!vp10_read(r, prob[ONE_CONTEXT_NODE])) {
INCREMENT_COUNT(ONE_TOKEN);
token = ONE_TOKEN;
val = 1;
} else {
INCREMENT_COUNT(TWO_TOKEN);
token = vpx_read_tree(r, vp10_coef_con_tree,
token = vp10_read_tree(r, vp10_coef_con_tree,
vp10_pareto8_full[prob[PIVOT_NODE] - 1]);
switch (token) {
case TWO_TOKEN:
......@@ -203,13 +203,13 @@ static int decode_coefs(const MACROBLOCKD *xd,
v = (val * dqv) >> dq_shift;
#if CONFIG_COEFFICIENT_RANGE_CHECKING
#if CONFIG_VP9_HIGHBITDEPTH
dqcoeff[scan[c]] = highbd_check_range((vpx_read_bit(r) ? -v : v),
dqcoeff[scan[c]] = highbd_check_range((vp10_read_bit(r) ? -v : v),
xd->bd);
#else
dqcoeff[scan[c]] = check_range(vpx_read_bit(r) ? -v : v);
dqcoeff[scan[c]] = check_range(vp10_read_bit(r) ? -v : v);
#endif // CONFIG_VP9_HIGHBITDEPTH
#else
dqcoeff[scan[c]] = vpx_read_bit(r) ? -v : v;
dqcoeff[scan[c]] = vp10_read_bit(r) ? -v : v;
#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
token_cache[scan[c]] = vp10_pt_energy_class[token];
++c;
......@@ -445,7 +445,7 @@ void dec_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
}
void vp10_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
vpx_reader *r) {
vp10_reader *r) {
MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
......@@ -465,7 +465,7 @@ void vp10_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
color_ctx = vp10_get_palette_color_context(color_map, cols, i, j, n,
color_order);
color_idx = vpx_read_tree(r, vp10_palette_color_tree[n - 2],
color_idx = vp10_read_tree(r, vp10_palette_color_tree[n - 2],
prob[n - 2][color_ctx]);
assert(color_idx >= 0 && color_idx < n);
color_map[i * cols + j] = color_order[color_idx];
......@@ -483,7 +483,7 @@ int vp10_decode_block_tokens(MACROBLOCKD *const xd,
#if CONFIG_ANS
struct AnsDecoder *const r,
#else
vpx_reader *r,
vp10_reader *r,
#endif // CONFIG_ANS
int seg_id) {
struct macroblockd_plane *const pd = &xd->plane[plane];
......
......@@ -21,7 +21,7 @@ extern "C" {
#endif
void vp10_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
vpx_reader *r);
vp10_reader *r);
int vp10_decode_block_tokens(MACROBLOCKD *const xd,
#if CONFIG_ANS
const rans_dec_lut *const token_tab,
......@@ -32,7 +32,7 @@ int vp10_decode_block_tokens(MACROBLOCKD *const xd,
#if CONFIG_ANS
struct AnsDecoder *const r,
#else
vpx_reader *r,
vp10_reader *r,
#endif // CONFIG_ANS
int seg_id);
......
......@@ -21,11 +21,11 @@ static int inv_recenter_nonneg(int v, int m) {
return (v & 1) ? m - ((v + 1) >> 1) : m + (v >> 1);
}
static int decode_uniform(vpx_reader *r) {
static int decode_uniform(vp10_reader *r) {
const int l = 8;
const int m = (1 << l) - 190;
const int v = vpx_read_literal(r, l - 1);
return v < m ? v : (v << 1) - m + vpx_read_bit(r);
const int v = vp10_read_literal(r, l - 1);
return v < m ? v : (v << 1) - m + vp10_read_bit(r);
}
static int inv_remap_prob(int v, int m) {
......@@ -58,18 +58,18 @@ static int inv_remap_prob(int v, int m) {
}
}
static int decode_term_subexp(vpx_reader *r) {
if (!vpx_read_bit(r))
return vpx_read_literal(r, 4);
if (!vpx_read_bit(r))
return vpx_read_literal(r, 4) + 16;
if (!vpx_read_bit(r))
return vpx_read_literal(r, 5) + 32;
static int decode_term_subexp(vp10_reader *r) {
if (!vp10_read_bit(r))
return vp10_read_literal(r, 4);
if (!vp10_read_bit(r))
return vp10_read_literal(r, 4) + 16;
if (!vp10_read_bit(r))
return vp10_read_literal(r, 5) + 32;
return decode_uniform(r) + 64;
}
void vp10_diff_update_prob(vpx_reader *r, vpx_prob* p) {
if (vpx_read(r, DIFF_UPDATE_PROB)) {
void vp10_diff_update_prob(vp10_reader *r, vpx_prob* p) {
if (vp10_read(r, DIFF_UPDATE_PROB)) {
const int delp = decode_term_subexp(r);
*p = (vpx_prob)inv_remap_prob(delp, *p);
}
......
......@@ -12,13 +12,13 @@
#ifndef VP10_DECODER_DSUBEXP_H_
#define VP10_DECODER_DSUBEXP_H_
#include "vpx_dsp/bitreader.h"
#include "vp10/decoder/bitreader.h"
#ifdef __cplusplus
extern "C" {
#endif
void vp10_diff_update_prob(vpx_reader *r, vpx_prob* p);
void vp10_diff_update_prob(vp10_reader *r, vpx_prob* p);
#ifdef __cplusplus
} // extern "C"
......
This diff is collapsed.
......@@ -31,7 +31,7 @@ void vp10_entropy_mv_init(void) {
vp10_tokens_from_tree(mv_fp_encodings, vp10_mv_fp_tree);
}
static void encode_mv_component(vpx_writer* w, int comp,
static void encode_mv_component(vp10_writer* w, int comp,
const nmv_component* mvcomp, int usehp) {
int offset;
const int sign = comp < 0;
......@@ -44,7 +44,7 @@ static void encode_mv_component(vpx_writer* w, int comp,
assert(comp != 0);