From 817be1d2145c1d73f7e953144bcf002d2ccdf878 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Mon, 20 Jul 2015 14:13:38 -0700 Subject: [PATCH] vpx_dsp/bitwriter.h: vp9_->vpx_ changes prefix vp9_ to vpx_ for non codec specific functions and data structures. Change-Id: I91a21548e39bd24d2c7caaaa223ae47240bb78c8 --- test/vp9_boolcoder_test.cc | 8 +-- vp9/encoder/vp9_bitstream.c | 104 +++++++++++++++++------------------ vp9/encoder/vp9_encodemv.c | 20 +++---- vp9/encoder/vp9_encodemv.h | 4 +- vp9/encoder/vp9_subexp.c | 28 +++++----- vp9/encoder/vp9_subexp.h | 6 +- vp9/encoder/vp9_treewriter.h | 6 +- vpx_dsp/bitwriter.c | 8 +-- vpx_dsp/bitwriter.h | 20 +++---- 9 files changed, 102 insertions(+), 102 deletions(-) diff --git a/test/vp9_boolcoder_test.cc b/test/vp9_boolcoder_test.cc index 689f3bbe3..b91742975 100644 --- a/test/vp9_boolcoder_test.cc +++ b/test/vp9_boolcoder_test.cc @@ -50,9 +50,9 @@ TEST(VP9, TestBitIO) { const int random_seed = 6432; const int kBufferSize = 10000; ACMRandom bit_rnd(random_seed); - vp9_writer bw; + vpx_writer bw; uint8_t bw_buffer[kBufferSize]; - vp9_start_encode(&bw, bw_buffer); + vpx_start_encode(&bw, bw_buffer); int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0; for (int i = 0; i < kBitsToTest; ++i) { @@ -61,10 +61,10 @@ TEST(VP9, TestBitIO) { } else if (bit_method == 3) { bit = bit_rnd(2); } - vp9_write(&bw, bit, static_cast(probas[i])); + vpx_write(&bw, bit, static_cast(probas[i])); } - vp9_stop_encode(&bw); + vpx_stop_encode(&bw); // First bit should be zero GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0); diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index b974eaefa..ca39a6731 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -44,12 +44,12 @@ static const struct vp9_token partition_encodings[PARTITION_TYPES] = static const struct vp9_token inter_mode_encodings[INTER_MODES] = {{2, 2}, {6, 3}, {0, 1}, {7, 3}}; -static void write_intra_mode(vp9_writer *w, PREDICTION_MODE mode, +static void write_intra_mode(vpx_writer *w, PREDICTION_MODE mode, const vpx_prob *probs) { vp9_write_token(w, vp9_intra_mode_tree, probs, &intra_mode_encodings[mode]); } -static void write_inter_mode(vp9_writer *w, PREDICTION_MODE mode, +static void write_inter_mode(vpx_writer *w, PREDICTION_MODE mode, const vpx_prob *probs) { assert(is_inter_mode(mode)); vp9_write_token(w, vp9_inter_mode_tree, probs, @@ -64,7 +64,7 @@ static void encode_unsigned_max(struct vp9_write_bit_buffer *wb, static void prob_diff_update(const vpx_tree_index *tree, vpx_prob probs[/*n - 1*/], const unsigned int counts[/*n - 1*/], - int n, vp9_writer *w) { + int n, vpx_writer *w) { int i; unsigned int branch_ct[32][2]; @@ -77,32 +77,32 @@ static void prob_diff_update(const vpx_tree_index *tree, } static void write_selected_tx_size(const VP9_COMMON *cm, - const MACROBLOCKD *xd, vp9_writer *w) { + const MACROBLOCKD *xd, vpx_writer *w) { TX_SIZE tx_size = xd->mi[0]->mbmi.tx_size; BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; const TX_SIZE max_tx_size = max_txsize_lookup[bsize]; const vpx_prob *const tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc->tx_probs); - vp9_write(w, tx_size != TX_4X4, tx_probs[0]); + vpx_write(w, tx_size != TX_4X4, tx_probs[0]); if (tx_size != TX_4X4 && max_tx_size >= TX_16X16) { - vp9_write(w, tx_size != TX_8X8, tx_probs[1]); + vpx_write(w, tx_size != TX_8X8, tx_probs[1]); if (tx_size != TX_8X8 && max_tx_size >= TX_32X32) - vp9_write(w, tx_size != TX_16X16, tx_probs[2]); + vpx_write(w, tx_size != TX_16X16, tx_probs[2]); } } static int write_skip(const VP9_COMMON *cm, const MACROBLOCKD *xd, - int segment_id, const MODE_INFO *mi, vp9_writer *w) { + int segment_id, const MODE_INFO *mi, vpx_writer *w) { if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) { return 1; } else { const int skip = mi->mbmi.skip; - vp9_write(w, skip, vp9_get_skip_prob(cm, xd)); + vpx_write(w, skip, vp9_get_skip_prob(cm, xd)); return skip; } } -static void update_skip_probs(VP9_COMMON *cm, vp9_writer *w, +static void update_skip_probs(VP9_COMMON *cm, vpx_writer *w, FRAME_COUNTS *counts) { int k; @@ -110,7 +110,7 @@ static void update_skip_probs(VP9_COMMON *cm, vp9_writer *w, vp9_cond_prob_diff_update(w, &cm->fc->skip_probs[k], counts->skip[k]); } -static void update_switchable_interp_probs(VP9_COMMON *cm, vp9_writer *w, +static void update_switchable_interp_probs(VP9_COMMON *cm, vpx_writer *w, FRAME_COUNTS *counts) { int j; for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) @@ -119,7 +119,7 @@ static void update_switchable_interp_probs(VP9_COMMON *cm, vp9_writer *w, counts->switchable_interp[j], SWITCHABLE_FILTERS, w); } -static void pack_mb_tokens(vp9_writer *w, +static void pack_mb_tokens(vpx_writer *w, TOKENEXTRA **tp, const TOKENEXTRA *const stop, vpx_bit_depth_t bit_depth) { TOKENEXTRA *p = *tp; @@ -179,12 +179,12 @@ static void pack_mb_tokens(vp9_writer *w, do { const int bb = (v >> --n) & 1; - vp9_write(w, bb, pb[i >> 1]); + vpx_write(w, bb, pb[i >> 1]); i = b->tree[i + bb]; } while (n); } - vp9_write_bit(w, e & 1); + vpx_write_bit(w, e & 1); } ++p; } @@ -192,7 +192,7 @@ static void pack_mb_tokens(vp9_writer *w, *tp = p + (p->token == EOSB_TOKEN); } -static void write_segment_id(vp9_writer *w, const struct segmentation *seg, +static void write_segment_id(vpx_writer *w, const struct segmentation *seg, int segment_id) { if (seg->enabled && seg->update_map) vp9_write_tree(w, vp9_segment_tree, seg->tree_probs, segment_id, 3, 0); @@ -200,7 +200,7 @@ static void write_segment_id(vp9_writer *w, const struct segmentation *seg, // This function encodes the reference frame static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd, - vp9_writer *w) { + vpx_writer *w) { const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; const int is_compound = has_second_ref(mbmi); const int segment_id = mbmi->segment_id; @@ -215,27 +215,27 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd, // does the feature use compound prediction or not // (if not specified at the frame/segment level) if (cm->reference_mode == REFERENCE_MODE_SELECT) { - vp9_write(w, is_compound, vp9_get_reference_mode_prob(cm, xd)); + vpx_write(w, is_compound, vp9_get_reference_mode_prob(cm, xd)); } else { assert(!is_compound == (cm->reference_mode == SINGLE_REFERENCE)); } if (is_compound) { - vp9_write(w, mbmi->ref_frame[0] == GOLDEN_FRAME, + vpx_write(w, mbmi->ref_frame[0] == GOLDEN_FRAME, vp9_get_pred_prob_comp_ref_p(cm, xd)); } else { const int bit0 = mbmi->ref_frame[0] != LAST_FRAME; - vp9_write(w, bit0, vp9_get_pred_prob_single_ref_p1(cm, xd)); + vpx_write(w, bit0, vp9_get_pred_prob_single_ref_p1(cm, xd)); if (bit0) { const int bit1 = mbmi->ref_frame[0] != GOLDEN_FRAME; - vp9_write(w, bit1, vp9_get_pred_prob_single_ref_p2(cm, xd)); + vpx_write(w, bit1, vp9_get_pred_prob_single_ref_p2(cm, xd)); } } } } static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, - vp9_writer *w) { + vpx_writer *w) { VP9_COMMON *const cm = &cpi->common; const nmv_context *nmvc = &cm->fc->nmvc; const MACROBLOCK *const x = &cpi->td.mb; @@ -255,7 +255,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, if (seg->temporal_update) { const int pred_flag = mbmi->seg_id_predicted; vpx_prob pred_prob = vp9_get_pred_prob_seg_id(seg, xd); - vp9_write(w, pred_flag, pred_prob); + vpx_write(w, pred_flag, pred_prob); if (!pred_flag) write_segment_id(w, seg, segment_id); } else { @@ -266,7 +266,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, skip = write_skip(cm, xd, segment_id, mi, w); if (!segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME)) - vp9_write(w, is_inter, vp9_get_intra_inter_prob(cm, xd)); + vpx_write(w, is_inter, vp9_get_intra_inter_prob(cm, xd)); if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT && !(is_inter && skip)) { @@ -339,7 +339,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, } static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd, - MODE_INFO **mi_8x8, vp9_writer *w) { + MODE_INFO **mi_8x8, vpx_writer *w) { const struct segmentation *const seg = &cm->seg; const MODE_INFO *const mi = mi_8x8[0]; const MODE_INFO *const above_mi = xd->above_mi; @@ -375,7 +375,7 @@ static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd, } static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile, - vp9_writer *w, TOKENEXTRA **tok, + vpx_writer *w, TOKENEXTRA **tok, const TOKENEXTRA *const tok_end, int mi_row, int mi_col) { const VP9_COMMON *const cm = &cpi->common; @@ -405,7 +405,7 @@ static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile, static void write_partition(const VP9_COMMON *const cm, const MACROBLOCKD *const xd, int hbs, int mi_row, int mi_col, - PARTITION_TYPE p, BLOCK_SIZE bsize, vp9_writer *w) { + PARTITION_TYPE p, BLOCK_SIZE bsize, vpx_writer *w) { const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize); const vpx_prob *const probs = xd->partition_probs[ctx]; const int has_rows = (mi_row + hbs) < cm->mi_rows; @@ -415,17 +415,17 @@ static void write_partition(const VP9_COMMON *const cm, vp9_write_token(w, vp9_partition_tree, probs, &partition_encodings[p]); } else if (!has_rows && has_cols) { assert(p == PARTITION_SPLIT || p == PARTITION_HORZ); - vp9_write(w, p == PARTITION_SPLIT, probs[1]); + vpx_write(w, p == PARTITION_SPLIT, probs[1]); } else if (has_rows && !has_cols) { assert(p == PARTITION_SPLIT || p == PARTITION_VERT); - vp9_write(w, p == PARTITION_SPLIT, probs[2]); + vpx_write(w, p == PARTITION_SPLIT, probs[2]); } else { assert(p == PARTITION_SPLIT); } } static void write_modes_sb(VP9_COMP *cpi, - const TileInfo *const tile, vp9_writer *w, + const TileInfo *const tile, vpx_writer *w, TOKENEXTRA **tok, const TOKENEXTRA *const tok_end, int mi_row, int mi_col, BLOCK_SIZE bsize) { const VP9_COMMON *const cm = &cpi->common; @@ -483,7 +483,7 @@ static void write_modes_sb(VP9_COMP *cpi, } static void write_modes(VP9_COMP *cpi, - const TileInfo *const tile, vp9_writer *w, + const TileInfo *const tile, vpx_writer *w, TOKENEXTRA **tok, const TOKENEXTRA *const tok_end) { const VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; @@ -528,7 +528,7 @@ static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE tx_size, } } -static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi, +static void update_coef_probs_common(vpx_writer* const bc, VP9_COMP *cpi, TX_SIZE tx_size, vp9_coeff_stats *frame_branch_ct, vp9_coeff_probs_model *new_coef_probs) { @@ -575,10 +575,10 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi, // printf("Update %d %d, savings %d\n", update[0], update[1], savings); /* Is coef updated at all */ if (update[1] == 0 || savings < 0) { - vp9_write_bit(bc, 0); + vpx_write_bit(bc, 0); return; } - vp9_write_bit(bc, 1); + vpx_write_bit(bc, 1); for (i = 0; i < PLANE_TYPES; ++i) { for (j = 0; j < REF_TYPES; ++j) { for (k = 0; k < COEF_BANDS; ++k) { @@ -600,7 +600,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi, *oldp, &newp, upd); if (s > 0 && newp != *oldp) u = 1; - vp9_write(bc, u, upd); + vpx_write(bc, u, upd); if (u) { /* send/use new probability */ vp9_write_prob_diff_update(bc, newp, *oldp); @@ -648,11 +648,11 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi, if (u == 1 && updates == 1) { int v; // first update - vp9_write_bit(bc, 1); + vpx_write_bit(bc, 1); for (v = 0; v < noupdates_before_first; ++v) - vp9_write(bc, 0, upd); + vpx_write(bc, 0, upd); } - vp9_write(bc, u, upd); + vpx_write(bc, u, upd); if (u) { /* send/use new probability */ vp9_write_prob_diff_update(bc, newp, *oldp); @@ -664,7 +664,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi, } } if (updates == 0) { - vp9_write_bit(bc, 0); // no updates + vpx_write_bit(bc, 0); // no updates } return; } @@ -673,7 +673,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi, } } -static void update_coef_probs(VP9_COMP *cpi, vp9_writer* w) { +static void update_coef_probs(VP9_COMP *cpi, vpx_writer* w) { const TX_MODE tx_mode = cpi->common.tx_mode; const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode]; TX_SIZE tx_size; @@ -682,7 +682,7 @@ static void update_coef_probs(VP9_COMP *cpi, vp9_writer* w) { vp9_coeff_probs_model frame_coef_probs[PLANE_TYPES]; if (cpi->td.counts->tx.tx_totals[tx_size] <= 20 || (tx_size >= TX_16X16 && cpi->sf.tx_size_search_method == USE_TX_8X8)) { - vp9_write_bit(w, 0); + vpx_write_bit(w, 0); } else { build_tree_distribution(cpi, tx_size, frame_branch_ct, frame_coef_probs); @@ -812,12 +812,12 @@ static void encode_segmentation(VP9_COMMON *cm, MACROBLOCKD *xd, } } -static void encode_txfm_probs(VP9_COMMON *cm, vp9_writer *w, +static void encode_txfm_probs(VP9_COMMON *cm, vpx_writer *w, FRAME_COUNTS *counts) { // Mode - vp9_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2); + vpx_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2); if (cm->tx_mode >= ALLOW_32X32) - vp9_write_bit(w, cm->tx_mode == TX_MODE_SELECT); + vpx_write_bit(w, cm->tx_mode == TX_MODE_SELECT); // Probabilities if (cm->tx_mode == TX_MODE_SELECT) { @@ -928,7 +928,7 @@ static int get_refresh_mask(VP9_COMP *cpi) { static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) { VP9_COMMON *const cm = &cpi->common; - vp9_writer residual_bc; + vpx_writer residual_bc; int tile_row, tile_col; TOKENEXTRA *tok_end; size_t total_size = 0; @@ -947,14 +947,14 @@ static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) { cpi->tok_count[tile_row][tile_col]; if (tile_col < tile_cols - 1 || tile_row < tile_rows - 1) - vp9_start_encode(&residual_bc, data_ptr + total_size + 4); + vpx_start_encode(&residual_bc, data_ptr + total_size + 4); else - vp9_start_encode(&residual_bc, data_ptr + total_size); + vpx_start_encode(&residual_bc, data_ptr + total_size); write_modes(cpi, &cpi->tile_data[tile_idx].tile_info, &residual_bc, &tok, tok_end); assert(tok == tok_end); - vp9_stop_encode(&residual_bc); + vpx_stop_encode(&residual_bc); if (tile_col < tile_cols - 1 || tile_row < tile_rows - 1) { // size of this tile mem_put_be32(data_ptr + total_size, residual_bc.pos); @@ -1155,9 +1155,9 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) { MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; FRAME_CONTEXT *const fc = cm->fc; FRAME_COUNTS *counts = cpi->td.counts; - vp9_writer header_bc; + vpx_writer header_bc; - vp9_start_encode(&header_bc, data); + vpx_start_encode(&header_bc, data); if (xd->lossless) cm->tx_mode = ONLY_4X4; @@ -1185,9 +1185,9 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) { const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE; const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT; - vp9_write_bit(&header_bc, use_compound_pred); + vpx_write_bit(&header_bc, use_compound_pred); if (use_compound_pred) { - vp9_write_bit(&header_bc, use_hybrid_pred); + vpx_write_bit(&header_bc, use_hybrid_pred); if (use_hybrid_pred) for (i = 0; i < COMP_INTER_CONTEXTS; i++) vp9_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i], @@ -1221,7 +1221,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) { &counts->mv); } - vp9_stop_encode(&header_bc); + vpx_stop_encode(&header_bc); assert(header_bc.pos <= 0xffff); return header_bc.pos; diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index 39129735f..a1d77dba8 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -29,7 +29,7 @@ void vp9_entropy_mv_init(void) { vp9_tokens_from_tree(mv_fp_encodings, vp9_mv_fp_tree); } -static void encode_mv_component(vp9_writer* w, int comp, +static void encode_mv_component(vpx_writer* w, int comp, const nmv_component* mvcomp, int usehp) { int offset; const int sign = comp < 0; @@ -42,7 +42,7 @@ static void encode_mv_component(vp9_writer* w, int comp, assert(comp != 0); // Sign - vp9_write(w, sign, mvcomp->sign); + vpx_write(w, sign, mvcomp->sign); // Class vp9_write_token(w, vp9_mv_class_tree, mvcomp->classes, @@ -56,7 +56,7 @@ static void encode_mv_component(vp9_writer* w, int comp, int i; const int n = mv_class + CLASS0_BITS - 1; // number of bits for (i = 0; i < n; ++i) - vp9_write(w, (d >> i) & 1, mvcomp->bits[i]); + vpx_write(w, (d >> i) & 1, mvcomp->bits[i]); } // Fractional bits @@ -66,7 +66,7 @@ static void encode_mv_component(vp9_writer* w, int comp, // High precision bit if (usehp) - vp9_write(w, hp, + vpx_write(w, hp, mv_class == MV_CLASS_0 ? mvcomp->class0_hp : mvcomp->hp); } @@ -133,15 +133,15 @@ static void build_nmv_component_cost_table(int *mvcost, } } -static int update_mv(vp9_writer *w, const unsigned int ct[2], vpx_prob *cur_p, +static int update_mv(vpx_writer *w, const unsigned int ct[2], vpx_prob *cur_p, vpx_prob upd_p) { const vpx_prob new_p = get_binary_prob(ct[0], ct[1]) | 1; const int update = cost_branch256(ct, *cur_p) + vp9_cost_zero(upd_p) > cost_branch256(ct, new_p) + vp9_cost_one(upd_p) + 7 * 256; - vp9_write(w, update, upd_p); + vpx_write(w, update, upd_p); if (update) { *cur_p = new_p; - vp9_write_literal(w, new_p >> 1, 7); + vpx_write_literal(w, new_p >> 1, 7); } return update; } @@ -149,7 +149,7 @@ static int update_mv(vp9_writer *w, const unsigned int ct[2], vpx_prob *cur_p, static void write_mv_update(const vpx_tree_index *tree, vpx_prob probs[/*n - 1*/], const unsigned int counts[/*n - 1*/], - int n, vp9_writer *w) { + int n, vpx_writer *w) { int i; unsigned int branch_ct[32][2]; @@ -161,7 +161,7 @@ static void write_mv_update(const vpx_tree_index *tree, update_mv(w, branch_ct[i], &probs[i], MV_UPDATE_PROB); } -void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer *w, +void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vpx_writer *w, nmv_context_counts *const counts) { int i, j; nmv_context *const mvc = &cm->fc->nmvc; @@ -199,7 +199,7 @@ void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer *w, } } -void vp9_encode_mv(VP9_COMP* cpi, vp9_writer* w, +void vp9_encode_mv(VP9_COMP* cpi, vpx_writer* w, const MV* mv, const MV* ref, const nmv_context* mvctx, int usehp) { const MV diff = {mv->row - ref->row, diff --git a/vp9/encoder/vp9_encodemv.h b/vp9/encoder/vp9_encodemv.h index e8ee5ab66..5fb114cc1 100644 --- a/vp9/encoder/vp9_encodemv.h +++ b/vp9/encoder/vp9_encodemv.h @@ -20,10 +20,10 @@ extern "C" { void vp9_entropy_mv_init(void); -void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer *w, +void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vpx_writer *w, nmv_context_counts *const counts); -void vp9_encode_mv(VP9_COMP *cpi, vp9_writer* w, const MV* mv, const MV* ref, +void vp9_encode_mv(VP9_COMP *cpi, vpx_writer* w, const MV* mv, const MV* ref, const nmv_context* mvctx, int usehp); void vp9_build_nmv_cost_table(int *mvjoint, int *mvcost[2], diff --git a/vp9/encoder/vp9_subexp.c b/vp9/encoder/vp9_subexp.c index 7254a6173..799f179d9 100644 --- a/vp9/encoder/vp9_subexp.c +++ b/vp9/encoder/vp9_subexp.c @@ -83,35 +83,35 @@ static int prob_diff_update_cost(vpx_prob newp, vpx_prob oldp) { return update_bits[delp] * 256; } -static void encode_uniform(vp9_writer *w, int v) { +static void encode_uniform(vpx_writer *w, int v) { const int l = 8; const int m = (1 << l) - 191; if (v < m) { - vp9_write_literal(w, v, l - 1); + vpx_write_literal(w, v, l - 1); } else { - vp9_write_literal(w, m + ((v - m) >> 1), l - 1); - vp9_write_literal(w, (v - m) & 1, 1); + vpx_write_literal(w, m + ((v - m) >> 1), l - 1); + vpx_write_literal(w, (v - m) & 1, 1); } } -static INLINE int write_bit_gte(vp9_writer *w, int word, int test) { - vp9_write_literal(w, word >= test, 1); +static INLINE int write_bit_gte(vpx_writer *w, int word, int test) { + vpx_write_literal(w, word >= test, 1); return word >= test; } -static void encode_term_subexp(vp9_writer *w, int word) { +static void encode_term_subexp(vpx_writer *w, int word) { if (!write_bit_gte(w, word, 16)) { - vp9_write_literal(w, word, 4); + vpx_write_literal(w, word, 4); } else if (!write_bit_gte(w, word, 32)) { - vp9_write_literal(w, word - 16, 4); + vpx_write_literal(w, word - 16, 4); } else if (!write_bit_gte(w, word, 64)) { - vp9_write_literal(w, word - 32, 5); + vpx_write_literal(w, word - 32, 5); } else { encode_uniform(w, word - 64); } } -void vp9_write_prob_diff_update(vp9_writer *w, vpx_prob newp, vpx_prob oldp) { +void vp9_write_prob_diff_update(vpx_writer *w, vpx_prob newp, vpx_prob oldp) { const int delp = remap_prob(newp, oldp); encode_term_subexp(w, delp); } @@ -196,7 +196,7 @@ int vp9_prob_diff_update_savings_search_model(const unsigned int *ct, return bestsavings; } -void vp9_cond_prob_diff_update(vp9_writer *w, vpx_prob *oldp, +void vp9_cond_prob_diff_update(vpx_writer *w, vpx_prob *oldp, const unsigned int ct[2]) { const vpx_prob upd = DIFF_UPDATE_PROB; vpx_prob newp = get_binary_prob(ct[0], ct[1]); @@ -204,10 +204,10 @@ void vp9_cond_prob_diff_update(vp9_writer *w, vpx_prob *oldp, upd); assert(newp >= 1); if (savings > 0) { - vp9_write(w, 1, upd); + vpx_write(w, 1, upd); vp9_write_prob_diff_update(w, newp, *oldp); *oldp = newp; } else { - vp9_write(w, 0, upd); + vpx_write(w, 0, upd); } } diff --git a/vp9/encoder/vp9_subexp.h b/vp9/encoder/vp9_subexp.h index 94cb3e1a8..b96823232 100644 --- a/vp9/encoder/vp9_subexp.h +++ b/vp9/encoder/vp9_subexp.h @@ -18,12 +18,12 @@ extern "C" { #include "vpx_dsp/prob.h" -struct vp9_writer; +struct vpx_writer; -void vp9_write_prob_diff_update(struct vp9_writer *w, +void vp9_write_prob_diff_update(struct vpx_writer *w, vpx_prob newp, vpx_prob oldp); -void vp9_cond_prob_diff_update(struct vp9_writer *w, vpx_prob *oldp, +void vp9_cond_prob_diff_update(struct vpx_writer *w, vpx_prob *oldp, const unsigned int ct[2]); int vp9_prob_diff_update_savings_search(const unsigned int *ct, diff --git a/vp9/encoder/vp9_treewriter.h b/vp9/encoder/vp9_treewriter.h index 883077c65..0f8935076 100644 --- a/vp9/encoder/vp9_treewriter.h +++ b/vp9/encoder/vp9_treewriter.h @@ -28,17 +28,17 @@ struct vp9_token { void vp9_tokens_from_tree(struct vp9_token*, const vpx_tree_index *); -static INLINE void vp9_write_tree(vp9_writer *w, const vpx_tree_index *tree, +static INLINE void vp9_write_tree(vpx_writer *w, const vpx_tree_index *tree, const vpx_prob *probs, int bits, int len, vpx_tree_index i) { do { const int bit = (bits >> --len) & 1; - vp9_write(w, bit, probs[i >> 1]); + vpx_write(w, bit, probs[i >> 1]); i = tree[i + bit]; } while (len); } -static INLINE void vp9_write_token(vp9_writer *w, const vpx_tree_index *tree, +static INLINE void vp9_write_token(vpx_writer *w, const vpx_tree_index *tree, const vpx_prob *probs, const struct vp9_token *token) { vp9_write_tree(w, tree, probs, token->value, token->len, 0); diff --git a/vpx_dsp/bitwriter.c b/vpx_dsp/bitwriter.c index 1d3493531..5b232e346 100644 --- a/vpx_dsp/bitwriter.c +++ b/vpx_dsp/bitwriter.c @@ -12,20 +12,20 @@ #include "./bitwriter.h" -void vp9_start_encode(vp9_writer *br, uint8_t *source) { +void vpx_start_encode(vpx_writer *br, uint8_t *source) { br->lowvalue = 0; br->range = 255; br->count = -24; br->buffer = source; br->pos = 0; - vp9_write_bit(br, 0); + vpx_write_bit(br, 0); } -void vp9_stop_encode(vp9_writer *br) { +void vpx_stop_encode(vpx_writer *br) { int i; for (i = 0; i < 32; i++) - vp9_write_bit(br, 0); + vpx_write_bit(br, 0); // Ensure there's no ambigous collision with any index marker bytes if ((br->buffer[br->pos - 1] & 0xe0) == 0xc0) diff --git a/vpx_dsp/bitwriter.h b/vpx_dsp/bitwriter.h index a6a858997..f6ca9b916 100644 --- a/vpx_dsp/bitwriter.h +++ b/vpx_dsp/bitwriter.h @@ -19,18 +19,18 @@ extern "C" { #endif -typedef struct vp9_writer { +typedef struct vpx_writer { unsigned int lowvalue; unsigned int range; int count; unsigned int pos; uint8_t *buffer; -} vp9_writer; +} vpx_writer; -void vp9_start_encode(vp9_writer *bc, uint8_t *buffer); -void vp9_stop_encode(vp9_writer *bc); +void vpx_start_encode(vpx_writer *bc, uint8_t *buffer); +void vpx_stop_encode(vpx_writer *bc); -static INLINE void vp9_write(vp9_writer *br, int bit, int probability) { +static INLINE void vpx_write(vpx_writer *br, int bit, int probability) { unsigned int split; int count = br->count; unsigned int range = br->range; @@ -78,18 +78,18 @@ static INLINE void vp9_write(vp9_writer *br, int bit, int probability) { br->range = range; } -static INLINE void vp9_write_bit(vp9_writer *w, int bit) { - vp9_write(w, bit, 128); // vpx_prob_half +static INLINE void vpx_write_bit(vpx_writer *w, int bit) { + vpx_write(w, bit, 128); // vpx_prob_half } -static INLINE void vp9_write_literal(vp9_writer *w, int data, int bits) { +static INLINE void vpx_write_literal(vpx_writer *w, int data, int bits) { int bit; for (bit = bits - 1; bit >= 0; bit--) - vp9_write_bit(w, 1 & (data >> bit)); + vpx_write_bit(w, 1 & (data >> bit)); } -#define vp9_write_prob(w, v) vp9_write_literal((w), (v), 8) +#define vpx_write_prob(w, v) vpx_write_literal((w), (v), 8) #ifdef __cplusplus } // extern "C" -- 2.40.0