From 0f68d80420404210a5b6bc634b82b53b71d5280c Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Mon, 28 Mar 2016 12:41:43 -0700 Subject: [PATCH] Remove duplicate ans parameter in bitstream functions. Change-Id: Icd459209dae328f90c9a875259fe5d201b2a4e45 --- vp10/decoder/decodeframe.c | 93 +++---------------------------------- vp10/encoder/bitstream.c | 95 ++++++++++++++------------------------ 2 files changed, 40 insertions(+), 148 deletions(-) diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c index b6f1a3b0f..c981be33e 100644 --- a/vp10/decoder/decodeframe.c +++ b/vp10/decoder/decodeframe.c @@ -1809,9 +1809,6 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd, #endif // CONFIG_SUPERTX int mi_row, int mi_col, vp10_reader *r, -#if CONFIG_ANS - struct AnsDecoder *const tok, -#endif // CONFIG_ANS #if CONFIG_EXT_PARTITION_TYPES PARTITION_TYPE partition, #endif // CONFIG_EXT_PARTITION_TYPES @@ -1887,10 +1884,9 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd, for (col = 0; col < max_blocks_wide; col += step) predict_and_reconstruct_intra_block(xd, #if CONFIG_ANS - cm->token_tab, tok, -#else - r, + cm->token_tab, #endif + r, mbmi, plane, row, col, tx_size); } @@ -1991,10 +1987,9 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd, for (col = 0; col < max_blocks_wide; col += step) eobtotal += reconstruct_inter_block(xd, #if CONFIG_ANS - cm->token_tab, tok, -#else - r, + cm->token_tab, #endif + r, mbmi, plane, row, col, tx_size); #endif @@ -2094,9 +2089,6 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, #endif int mi_row, int mi_col, vp10_reader* r, -#if CONFIG_ANS - struct AnsDecoder *const tok, -#endif // CONFIG_ANS BLOCK_SIZE bsize, int n4x4_l2) { VP10_COMMON *const cm = &pbi->common; const int n8x8_l2 = n4x4_l2 - 1; @@ -2185,9 +2177,6 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif // CONFIG_SUPERTX mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS #if CONFIG_EXT_PARTITION_TYPES partition, #endif // CONFIG_EXT_PARTITION_TYPES @@ -2200,9 +2189,6 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif // CONFIG_SUPERTX mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS #if CONFIG_EXT_PARTITION_TYPES partition, #endif // CONFIG_EXT_PARTITION_TYPES @@ -2214,9 +2200,6 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif // CONFIG_SUPERTX mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS #if CONFIG_EXT_PARTITION_TYPES partition, #endif // CONFIG_EXT_PARTITION_TYPES @@ -2227,9 +2210,6 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif // CONFIG_SUPERTX mi_row + hbs, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS #if CONFIG_EXT_PARTITION_TYPES partition, #endif // CONFIG_EXT_PARTITION_TYPES @@ -2241,9 +2221,6 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif // CONFIG_SUPERTX mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS #if CONFIG_EXT_PARTITION_TYPES partition, #endif // CONFIG_EXT_PARTITION_TYPES @@ -2254,9 +2231,6 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif // CONFIG_SUPERTX mi_row, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS #if CONFIG_EXT_PARTITION_TYPES partition, #endif // CONFIG_EXT_PARTITION_TYPES @@ -2268,36 +2242,24 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif // CONFIG_SUPERTX mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS subsize, n8x8_l2); decode_partition(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif // CONFIG_SUPERTX mi_row, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS subsize, n8x8_l2); decode_partition(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif // CONFIG_SUPERTX mi_row + hbs, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS subsize, n8x8_l2); decode_partition(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif // CONFIG_SUPERTX mi_row + hbs, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS subsize, n8x8_l2); break; #if CONFIG_EXT_PARTITION_TYPES @@ -2307,27 +2269,18 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row + hbs, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, subsize, n4x4_l2, n8x8_l2); break; case PARTITION_HORZ_B: @@ -2336,27 +2289,18 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, subsize, n4x4_l2, n8x8_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row + hbs, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row + hbs, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); break; case PARTITION_VERT_A: @@ -2365,27 +2309,18 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row + hbs, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, subsize, n8x8_l2, n4x4_l2); break; case PARTITION_VERT_B: @@ -2394,27 +2329,18 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, supertx_enabled, #endif mi_row, mi_col, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, subsize, n8x8_l2, n4x4_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); decode_block(pbi, xd, #if CONFIG_SUPERTX supertx_enabled, #endif mi_row + hbs, mi_col + hbs, r, -#if CONFIG_ANS - tok, -#endif // CONFIG_ANS partition, bsize2, n8x8_l2, n8x8_l2); break; #endif @@ -2461,10 +2387,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd, for (col = 0; col < max_blocks_wide; col += step) eobtotal += reconstruct_inter_block(xd, #if CONFIG_ANS - cm->token_tab, tok, -#else - r, + cm->token_tab, #endif + r, mbmi, i, row, col, tx_size); } @@ -3285,9 +3210,6 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi, 0, #endif // CONFIG_SUPERTX mi_row, mi_col, &td->bit_reader, -#if CONFIG_ANS - &td->bit_reader, -#endif // CONFIG_ANS BLOCK_LARGEST, MAX_SB_SIZE_LOG2 - 2); } pbi->mb.corrupted |= td->xd.corrupted; @@ -3400,9 +3322,6 @@ static int tile_worker_hook(TileWorkerData *const tile_data, 0, #endif mi_row, mi_col, &tile_data->bit_reader, -#if CONFIG_ANS - &tile_data->bit_reader, -#endif // CONFIG_ANS BLOCK_LARGEST, MAX_SB_SIZE_LOG2 - 2); } } diff --git a/vp10/encoder/bitstream.c b/vp10/encoder/bitstream.c index a5fbc200f..dc5215b2a 100644 --- a/vp10/encoder/bitstream.c +++ b/vp10/encoder/bitstream.c @@ -1475,30 +1475,18 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd, #endif // CONFIG_EXT_INTRA } -#if CONFIG_ANS && CONFIG_SUPERTX -#define write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, \ - supertx_enabled, mi_row, mi_col) \ - write_modes_b(cpi, tile, w, ans, tok, tok_end, supertx_enabled, mi_row, \ - mi_col) -#elif CONFIG_SUPERTX -#define write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, \ +#if CONFIG_SUPERTX +#define write_modes_b_wrapper(cpi, tile, w, tok, tok_end, \ supertx_enabled, mi_row, mi_col) \ write_modes_b(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col) -#elif CONFIG_ANS -#define write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, \ - supertx_enabled, mi_row, mi_col) \ - write_modes_b(cpi, tile, w, ans, tok, tok_end, mi_row, mi_col) #else -#define write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, \ +#define write_modes_b_wrapper(cpi, tile, w, tok, tok_end, \ supertx_enabled, mi_row, mi_col) \ write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col) #endif // CONFIG_ANS && CONFIG_SUPERTX static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile, vp10_writer *w, -#if CONFIG_ANS - struct BufAnsCoder *ans, -#endif // CONFIG_ANS const TOKENEXTRA **tok, const TOKENEXTRA *const tok_end, #if CONFIG_SUPERTX @@ -1592,7 +1580,7 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile, for (row = 0; row < num_4x4_h; row += bw) for (col = 0; col < num_4x4_w; col += bw) #if CONFIG_ANS - pack_mb_tokens_ans(ans, cm->token_tab, tok, tok_end, cm->bit_depth, + pack_mb_tokens_ans(w, cm->token_tab, tok, tok_end, cm->bit_depth, tx); #else pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx); @@ -1602,7 +1590,7 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile, TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) : m->mbmi.tx_size; #if CONFIG_ANS - pack_mb_tokens_ans(ans, cm->token_tab, tok, tok_end, cm->bit_depth, tx); + pack_mb_tokens_ans(w, cm->token_tab, tok, tok_end, cm->bit_depth, tx); #else pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx); #endif // CONFIG_ANS @@ -1644,22 +1632,13 @@ static void write_partition(const VP10_COMMON *const cm, } } -#if CONFIG_ANS && CONFIG_SUPERTX -#define write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, \ - supertx_enabled, mi_row, mi_col, bsize) \ - write_modes_sb(cpi, tile, w, ans, tok, tok_end, supertx_enabled, mi_row, \ - mi_col, bsize) -#elif CONFIG_SUPERTX -#define write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, \ +#if CONFIG_SUPERTX +#define write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, \ supertx_enabled, mi_row, mi_col, bsize) \ write_modes_sb(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col, \ bsize) -#elif CONFIG_ANS -#define write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, \ - supertx_enabled, mi_row, mi_col, bsize) \ - write_modes_sb(cpi, tile, w, ans, tok, tok_end, mi_row, mi_col, bsize) #else -#define write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, \ +#define write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, \ supertx_enabled, mi_row, mi_col, bsize) \ write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, bsize) #endif // CONFIG_ANS && CONFIG_SUPERTX @@ -1667,9 +1646,6 @@ static void write_partition(const VP10_COMMON *const cm, static void write_modes_sb(VP10_COMP *const cpi, const TileInfo *const tile, vp10_writer *const w, -#if CONFIG_ANS - struct BufAnsCoder *ans, -#endif // CONFIG_ANS const TOKENEXTRA **tok, const TOKENEXTRA *const tok_end, #if CONFIG_SUPERTX @@ -1743,69 +1719,69 @@ static void write_modes_sb(VP10_COMP *const cpi, } #endif // CONFIG_SUPERTX if (subsize < BLOCK_8X8) { - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); } else { switch (partition) { case PARTITION_NONE: - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); break; case PARTITION_HORZ: - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); if (mi_row + bs < cm->mi_rows) - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col); break; case PARTITION_VERT: - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); if (mi_col + bs < cm->mi_cols) - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col + bs); break; case PARTITION_SPLIT: - write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col, subsize); - write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col + bs, subsize); - write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col, subsize); - write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col + bs, subsize); break; #if CONFIG_EXT_PARTITION_TYPES case PARTITION_HORZ_A: - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col + bs); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col); break; case PARTITION_HORZ_B: - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col + bs); break; case PARTITION_VERT_A: - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col + bs); break; case PARTITION_VERT_B: - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row, mi_col + bs); - write_modes_b_wrapper(cpi, tile, w, ans, tok, tok_end, supertx_enabled, + write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, mi_row + bs, mi_col + bs); break; #endif // CONFIG_EXT_PARTITION_TYPES @@ -1830,7 +1806,7 @@ static void write_modes_sb(VP10_COMP *const cpi, for (row = 0; row < num_4x4_h; row += bw) for (col = 0; col < num_4x4_w; col += bw) #if CONFIG_ANS - pack_mb_tokens_ans(ans, cm->token_tab, tok, tok_end, cm->bit_depth, + pack_mb_tokens_ans(w, cm->token_tab, tok, tok_end, cm->bit_depth, tx); #else pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx); @@ -1854,9 +1830,6 @@ static void write_modes_sb(VP10_COMP *const cpi, static void write_modes(VP10_COMP *const cpi, const TileInfo *const tile, vp10_writer *const w, -#if CONFIG_ANS - struct BufAnsCoder *ans, -#endif // CONFIG_ANS const TOKENEXTRA **tok, const TOKENEXTRA *const tok_end) { VP10_COMMON *const cm = &cpi->common; @@ -1873,7 +1846,7 @@ static void write_modes(VP10_COMP *const cpi, vp10_zero_left_context(xd); for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MAX_MIB_SIZE) { - write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, 0, + write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, 0, mi_row, mi_col, BLOCK_LARGEST); } } @@ -2755,7 +2728,7 @@ static uint32_t write_tiles(VP10_COMP *const cpi, tile_size = mode_bc.pos; #else buf_ans_write_init(&mode_bc, uco_ans_buf, ans_window_size); - write_modes(cpi, &tile_info, &mode_bc, &mode_bc, &tok, tok_end); + write_modes(cpi, &tile_info, &mode_bc, &tok, tok_end); assert(tok == tok_end); ans_write_init(&token_ans, buf->data + data_offset); buf_ans_flush(&mode_bc, &token_ans); @@ -2831,7 +2804,7 @@ static uint32_t write_tiles(VP10_COMP *const cpi, tile_size = mode_bc.pos; #else buf_ans_write_init(&mode_bc, uco_ans_buf, ans_window_size); - write_modes(cpi, &tile_info, &mode_bc, &mode_bc, &tok, tok_end); + write_modes(cpi, &tile_info, &mode_bc, &tok, tok_end); assert(tok == tok_end); ans_write_init(&token_ans, dst + total_size); buf_ans_flush(&mode_bc, &token_ans);