From: Paul Wilkins Date: Mon, 29 Oct 2012 13:44:18 +0000 (+0000) Subject: Name space clean up. X-Git-Tag: v1.3.0~1217^2~170^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a99a2c36670436d584002a5da00c77f9c3ce5d2f;p=libvpx Name space clean up. Preparation for project restructuring. Added vp9_ prefix on some function names that have global scope. Added static declaration on some that dont. Change-Id: If072f78b4300e8c17cfeed82c5d17b59946dcc5e --- diff --git a/vp8/common/mvref_common.c b/vp8/common/mvref_common.c index b6040cd59..7fd48b938 100644 --- a/vp8/common/mvref_common.c +++ b/vp8/common/mvref_common.c @@ -33,17 +33,10 @@ static void clamp_mv(const MACROBLOCKD *xd, int_mv *mv) { mv->as_mv.row = xd->mb_to_bottom_edge + MV_BORDER; } -// Code for selecting / building and entropy coding a motion vector reference -// Returns a seperation value for two vectors. -// This is taken as the sum of the abs x and y difference. -unsigned int mv_distance(int_mv *mv1, int_mv *mv2) { - return (abs(mv1->as_mv.row - mv2->as_mv.row) + - abs(mv1->as_mv.col - mv2->as_mv.col)); -} // Gets a best matching candidate refenence motion vector // from the given mode info structure (if available) -int get_candidate_mvref( +static int get_candidate_mvref( const MODE_INFO *candidate_mi, MV_REFERENCE_FRAME ref_frame, MV_REFERENCE_FRAME *c_ref_frame, @@ -111,7 +104,7 @@ int get_candidate_mvref( // Performs mv adjustment based on reference frame and clamps the MV // if it goes off the edge of the buffer. -void scale_mv( +static void scale_mv( MACROBLOCKD *xd, MV_REFERENCE_FRAME this_ref_frame, MV_REFERENCE_FRAME candidate_ref_frame, @@ -162,7 +155,7 @@ void scale_mv( // Adds a new candidate reference vector to the list if indeed it is new. // If it is not new then the score of the existing candidate that it matches // is increased and the list is resorted. -void addmv_and_shuffle( +static void addmv_and_shuffle( int_mv *mv_list, int *mv_scores, int *index, @@ -212,7 +205,7 @@ void addmv_and_shuffle( // This function searches the neighbourhood of a given MB/SB and populates a // list of candidate reference vectors. // -void find_mv_refs( +void vp9_find_mv_refs( MACROBLOCKD *xd, MODE_INFO *here, MODE_INFO *lf_here, diff --git a/vp8/common/mvref_common.h b/vp8/common/mvref_common.h index 3f19ddbdb..7f396e4d7 100644 --- a/vp8/common/mvref_common.h +++ b/vp8/common/mvref_common.h @@ -17,9 +17,7 @@ #ifndef __INC_MVREF_COMMON_H #define __INC_MVREF_COMMON_H -unsigned int mv_distance(int_mv *mv1, int_mv *mv2); - -void find_mv_refs( +void vp9_find_mv_refs( MACROBLOCKD *xd, MODE_INFO *here, MODE_INFO *lf_here, diff --git a/vp8/common/pred_common.c b/vp8/common/pred_common.c index a97eed8e4..6fe12d46d 100644 --- a/vp8/common/pred_common.c +++ b/vp8/common/pred_common.c @@ -15,9 +15,9 @@ // TBD prediction functions for various bitstream signals // Returns a context number for the given MB prediction signal -unsigned char get_pred_context(const VP8_COMMON *const cm, - const MACROBLOCKD *const xd, - PRED_ID pred_id) { +unsigned char vp9_get_pred_context(const VP8_COMMON *const cm, + const MACROBLOCKD *const xd, + PRED_ID pred_id) { int pred_context; MODE_INFO *m = xd->mode_info_context; @@ -104,14 +104,14 @@ unsigned char get_pred_context(const VP8_COMMON *const cm, // This function returns a context probability for coding a given // prediction signal -vp8_prob get_pred_prob(const VP8_COMMON *const cm, - const MACROBLOCKD *const xd, - PRED_ID pred_id) { +vp8_prob vp9_get_pred_prob(const VP8_COMMON *const cm, + const MACROBLOCKD *const xd, + PRED_ID pred_id) { vp8_prob pred_probability; int pred_context; // Get the appropriate prediction context - pred_context = get_pred_context(cm, xd, pred_id); + pred_context = vp9_get_pred_context(cm, xd, pred_id); switch (pred_id) { case PRED_SEG_ID: @@ -144,14 +144,14 @@ vp8_prob get_pred_prob(const VP8_COMMON *const cm, // This function returns a context probability ptr for coding a given // prediction signal -const vp8_prob *get_pred_probs(const VP8_COMMON *const cm, - const MACROBLOCKD *const xd, - PRED_ID pred_id) { +const vp8_prob *vp9_get_pred_probs(const VP8_COMMON *const cm, + const MACROBLOCKD *const xd, + PRED_ID pred_id) { const vp8_prob *pred_probability; int pred_context; // Get the appropriate prediction context - pred_context = get_pred_context(cm, xd, pred_id); + pred_context = vp9_get_pred_context(cm, xd, pred_id); switch (pred_id) { case PRED_SEG_ID: @@ -188,8 +188,8 @@ const vp8_prob *get_pred_probs(const VP8_COMMON *const cm, // This function returns the status of the given prediction signal. // I.e. is the predicted value for the given signal correct. -unsigned char get_pred_flag(const MACROBLOCKD *const xd, - PRED_ID pred_id) { +unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd, + PRED_ID pred_id) { unsigned char pred_flag = 0; switch (pred_id) { @@ -216,9 +216,9 @@ unsigned char get_pred_flag(const MACROBLOCKD *const xd, // This function sets the status of the given prediction signal. // I.e. is the predicted value for the given signal correct. -void set_pred_flag(MACROBLOCKD *const xd, - PRED_ID pred_id, - unsigned char pred_flag) { +void vp9_set_pred_flag(MACROBLOCKD *const xd, + PRED_ID pred_id, + unsigned char pred_flag) { switch (pred_id) { case PRED_SEG_ID: xd->mode_info_context->mbmi.seg_id_predicted = pred_flag; @@ -257,14 +257,14 @@ void set_pred_flag(MACROBLOCKD *const xd, // peredict various bitstream signals. // Macroblock segment id prediction function -unsigned char get_pred_mb_segid(const VP8_COMMON *const cm, int MbIndex) { +unsigned char vp9_get_pred_mb_segid(const VP8_COMMON *const cm, int MbIndex) { // Currently the prediction for the macroblock segment ID is // the value stored for this macroblock in the previous frame. return cm->last_frame_seg_map[MbIndex]; } -MV_REFERENCE_FRAME get_pred_ref(const VP8_COMMON *const cm, - const MACROBLOCKD *const xd) { +MV_REFERENCE_FRAME vp9_get_pred_ref(const VP8_COMMON *const cm, + const MACROBLOCKD *const xd) { MODE_INFO *m = xd->mode_info_context; MV_REFERENCE_FRAME left; @@ -335,7 +335,7 @@ MV_REFERENCE_FRAME get_pred_ref(const VP8_COMMON *const cm, // Functions to computes a set of modified reference frame probabilities // to use when the prediction of the reference frame value fails -void calc_ref_probs(int *count, vp8_prob *probs) { +void vp9_calc_ref_probs(int *count, vp8_prob *probs) { int tot_count; tot_count = count[0] + count[1] + count[2] + count[3]; @@ -365,7 +365,7 @@ void calc_ref_probs(int *count, vp8_prob *probs) { // Values willbe set to 0 for reference frame options that are not possible // because wither they were predicted and prediction has failed or because // they are not allowed for a given segment. -void compute_mod_refprobs(VP8_COMMON *const cm) { +void vp9_compute_mod_refprobs(VP8_COMMON *const cm) { int norm_cnt[MAX_REF_FRAMES]; int intra_count; int inter_count; @@ -387,28 +387,28 @@ void compute_mod_refprobs(VP8_COMMON *const cm) { norm_cnt[1] = last_count; norm_cnt[2] = gf_count; norm_cnt[3] = arf_count; - calc_ref_probs(norm_cnt, cm->mod_refprobs[INTRA_FRAME]); + vp9_calc_ref_probs(norm_cnt, cm->mod_refprobs[INTRA_FRAME]); cm->mod_refprobs[INTRA_FRAME][0] = 0; // This branch implicit norm_cnt[0] = intra_count; norm_cnt[1] = 0; norm_cnt[2] = gf_count; norm_cnt[3] = arf_count; - calc_ref_probs(norm_cnt, cm->mod_refprobs[LAST_FRAME]); + vp9_calc_ref_probs(norm_cnt, cm->mod_refprobs[LAST_FRAME]); cm->mod_refprobs[LAST_FRAME][1] = 0; // This branch implicit norm_cnt[0] = intra_count; norm_cnt[1] = last_count; norm_cnt[2] = 0; norm_cnt[3] = arf_count; - calc_ref_probs(norm_cnt, cm->mod_refprobs[GOLDEN_FRAME]); + vp9_calc_ref_probs(norm_cnt, cm->mod_refprobs[GOLDEN_FRAME]); cm->mod_refprobs[GOLDEN_FRAME][2] = 0; // This branch implicit norm_cnt[0] = intra_count; norm_cnt[1] = last_count; norm_cnt[2] = gf_count; norm_cnt[3] = 0; - calc_ref_probs(norm_cnt, cm->mod_refprobs[ALTREF_FRAME]); + vp9_calc_ref_probs(norm_cnt, cm->mod_refprobs[ALTREF_FRAME]); cm->mod_refprobs[ALTREF_FRAME][2] = 0; // This branch implicit // Score the reference frames based on overal frequency. diff --git a/vp8/common/pred_common.h b/vp8/common/pred_common.h index 2a9875dfe..0096e3d79 100644 --- a/vp8/common/pred_common.h +++ b/vp8/common/pred_common.h @@ -25,30 +25,31 @@ typedef enum { PRED_SWITCHABLE_INTERP = 4 } PRED_ID; -extern unsigned char get_pred_context(const VP8_COMMON *const cm, - const MACROBLOCKD *const xd, - PRED_ID pred_id); +extern unsigned char vp9_get_pred_context(const VP8_COMMON *const cm, + const MACROBLOCKD *const xd, + PRED_ID pred_id); -extern vp8_prob get_pred_prob(const VP8_COMMON *const cm, - const MACROBLOCKD *const xd, - PRED_ID pred_id); +extern vp8_prob vp9_get_pred_prob(const VP8_COMMON *const cm, + const MACROBLOCKD *const xd, + PRED_ID pred_id); -extern const vp8_prob *get_pred_probs(const VP8_COMMON *const cm, - const MACROBLOCKD *const xd, - PRED_ID pred_id); +extern const vp8_prob *vp9_get_pred_probs(const VP8_COMMON *const cm, + const MACROBLOCKD *const xd, + PRED_ID pred_id); -extern unsigned char get_pred_flag(const MACROBLOCKD *const xd, - PRED_ID pred_id); +extern unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd, + PRED_ID pred_id); -extern void set_pred_flag(MACROBLOCKD *const xd, - PRED_ID pred_id, - unsigned char pred_flag); +extern void vp9_set_pred_flag(MACROBLOCKD *const xd, + PRED_ID pred_id, + unsigned char pred_flag); -extern unsigned char get_pred_mb_segid(const VP8_COMMON *const cm, int MbIndex); +extern unsigned char vp9_get_pred_mb_segid(const VP8_COMMON *const cm, + int MbIndex); -extern MV_REFERENCE_FRAME get_pred_ref(const VP8_COMMON *const cm, +extern MV_REFERENCE_FRAME vp9_get_pred_ref(const VP8_COMMON *const cm, const MACROBLOCKD *const xd); -extern void compute_mod_refprobs(VP8_COMMON *const cm); +extern void vp9_compute_mod_refprobs(VP8_COMMON *const cm); #endif /* __INC_PRED_COMMON_H__ */ diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c index 991fb9103..2187e020f 100644 --- a/vp8/decoder/decodemv.c +++ b/vp8/decoder/decodemv.c @@ -115,7 +115,8 @@ static void kfread_modes(VP8D_COMP *pbi, (get_segdata(&pbi->mb, m->mbmi.segment_id, SEG_LVL_EOB) != 0))) { MACROBLOCKD *const xd = &pbi->mb; - m->mbmi.mb_skip_coeff = vp8_read(bc, get_pred_prob(cm, xd, PRED_MBSKIP)); + m->mbmi.mb_skip_coeff = + vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP)); } else { if (segfeature_active(&pbi->mb, m->mbmi.segment_id, SEG_LVL_EOB) && @@ -379,16 +380,16 @@ static MV_REFERENCE_FRAME read_ref_frame(VP8D_COMP *pbi, MV_REFERENCE_FRAME pred_ref; // Get the context probability the prediction flag - pred_prob = get_pred_prob(cm, xd, PRED_REF); + pred_prob = vp9_get_pred_prob(cm, xd, PRED_REF); // Read the prediction status flag prediction_flag = (unsigned char)vp8_read(bc, pred_prob); // Store the prediction flag. - set_pred_flag(xd, PRED_REF, prediction_flag); + vp9_set_pred_flag(xd, PRED_REF, prediction_flag); // Get the predicted reference frame. - pred_ref = get_pred_ref(cm, xd); + pred_ref = vp9_get_pred_ref(cm, xd); // If correctly predicted then use the predicted value if (prediction_flag) { @@ -453,8 +454,8 @@ static MV_REFERENCE_FRAME read_ref_frame(VP8D_COMP *pbi, // The reference frame for the mb is considered as correclty predicted // if it is signaled at the segment level for the purposes of the // common prediction model - set_pred_flag(xd, PRED_REF, 1); - ref_frame = get_pred_ref(cm, xd); + vp9_set_pred_flag(xd, PRED_REF, 1); + ref_frame = vp9_get_pred_ref(cm, xd); } return (MV_REFERENCE_FRAME)ref_frame; @@ -529,7 +530,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi, vp8_reader *bc) { // Computes a modified set of probabilities for use when reference // frame prediction fails. - compute_mod_refprobs(cm); + vp9_compute_mod_refprobs(cm); pbi->common.comp_pred_mode = vp8_read(bc, 128); if (cm->comp_pred_mode) @@ -576,19 +577,19 @@ static void read_mb_segment_id(VP8D_COMP *pbi, // Get the context based probability for reading the // prediction status flag vp8_prob pred_prob = - get_pred_prob(cm, xd, PRED_SEG_ID); + vp9_get_pred_prob(cm, xd, PRED_SEG_ID); // Read the prediction status flag unsigned char seg_pred_flag = (unsigned char)vp8_read(bc, pred_prob); // Store the prediction flag. - set_pred_flag(xd, PRED_SEG_ID, seg_pred_flag); + vp9_set_pred_flag(xd, PRED_SEG_ID, seg_pred_flag); // If the value is flagged as correctly predicted // then use the predicted value if (seg_pred_flag) { - mbmi->segment_id = get_pred_mb_segid(cm, index); + mbmi->segment_id = vp9_get_pred_mb_segid(cm, index); } // Else .... decode it explicitly else { @@ -678,7 +679,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, (get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) != 0))) { // Read the macroblock coeff skip flag if this feature is in use, // else default to 0 - mbmi->mb_skip_coeff = vp8_read(bc, get_pred_prob(cm, xd, PRED_MBSKIP)); + mbmi->mb_skip_coeff = vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP)); } else { if (segfeature_active(xd, mbmi->segment_id, SEG_LVL_EOB) && @@ -731,9 +732,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, xd->pre.u_buffer = cm->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset; xd->pre.v_buffer = cm->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset; - find_mv_refs(xd, mi, prev_mi, - ref_frame, mbmi->ref_mvs[ref_frame], - cm->ref_frame_sign_bias); + vp9_find_mv_refs(xd, mi, prev_mi, + ref_frame, mbmi->ref_mvs[ref_frame], + cm->ref_frame_sign_bias); vp8_find_best_ref_mvs(xd, xd->pre.y_buffer, @@ -775,7 +776,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, if (cm->mcomp_filter_type == SWITCHABLE) { mbmi->interp_filter = vp8_switchable_interp[ vp8_treed_read(bc, vp8_switchable_interp_tree, - get_pred_probs(cm, xd, PRED_SWITCHABLE_INTERP))]; + vp9_get_pred_probs(cm, xd, PRED_SWITCHABLE_INTERP))]; } else { mbmi->interp_filter = cm->mcomp_filter_type; } @@ -783,7 +784,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, if (cm->comp_pred_mode == COMP_PREDICTION_ONLY || (cm->comp_pred_mode == HYBRID_PREDICTION && - vp8_read(bc, get_pred_prob(cm, xd, PRED_COMP)))) { + vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_COMP)))) { /* Since we have 3 reference frames, we can only have 3 unique * combinations of combinations of 2 different reference frames * (A-G, G-L or A-L). In the bitstream, we use this to simply @@ -818,10 +819,10 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, mbmi->second_ref_frame, cm->ref_frame_sign_bias); - find_mv_refs(xd, mi, prev_mi, - mbmi->second_ref_frame, - mbmi->ref_mvs[mbmi->second_ref_frame], - cm->ref_frame_sign_bias); + vp9_find_mv_refs(xd, mi, prev_mi, + mbmi->second_ref_frame, + mbmi->ref_mvs[mbmi->second_ref_frame], + cm->ref_frame_sign_bias); vp8_find_best_ref_mvs(xd, xd->second_pre.y_buffer, diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index 3c7e37762..4c1d61ed8 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -800,16 +800,16 @@ static void encode_ref_frame(vp8_writer *const bc, MV_REFERENCE_FRAME pred_rf; // Get the context probability the prediction flag - pred_prob = get_pred_prob(cm, xd, PRED_REF); + pred_prob = vp9_get_pred_prob(cm, xd, PRED_REF); // Get the predicted value. - pred_rf = get_pred_ref(cm, xd); + pred_rf = vp9_get_pred_ref(cm, xd); // Did the chosen reference frame match its predicted value. prediction_flag = (xd->mode_info_context->mbmi.ref_frame == pred_rf); - set_pred_flag(xd, PRED_REF, prediction_flag); + vp9_set_pred_flag(xd, PRED_REF, prediction_flag); vp8_write(bc, prediction_flag, pred_prob); // If not predicted correctly then code value explicitly @@ -869,7 +869,7 @@ static void update_ref_probs(VP8_COMP *const cpi) { // Compute a modified set of probabilities to use when prediction of the // reference frame fails - compute_mod_refprobs(cm); + vp9_compute_mod_refprobs(cm); } static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) { @@ -956,8 +956,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) { if (cpi->mb.e_mbd.update_mb_segmentation_map) { // Is temporal coding of the segment map enabled if (pc->temporal_update) { - prediction_flag = get_pred_flag(xd, PRED_SEG_ID); - pred_prob = get_pred_prob(pc, xd, PRED_SEG_ID); + prediction_flag = vp9_get_pred_flag(xd, PRED_SEG_ID); + pred_prob = vp9_get_pred_prob(pc, xd, PRED_SEG_ID); // Code the segment id prediction flag for this mb vp8_write(bc, prediction_flag, pred_prob); @@ -983,7 +983,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) { } #endif vp8_encode_bool(bc, skip_coeff, - get_pred_prob(pc, xd, PRED_MBSKIP)); + vp9_get_pred_prob(pc, xd, PRED_MBSKIP)); } // Encode the reference frame. @@ -1097,8 +1097,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) { { if (cpi->common.mcomp_filter_type == SWITCHABLE) { vp8_write_token(bc, vp8_switchable_interp_tree, - get_pred_probs(&cpi->common, xd, - PRED_SWITCHABLE_INTERP), + vp9_get_pred_probs(&cpi->common, xd, + PRED_SWITCHABLE_INTERP), vp8_switchable_interp_encodings + vp8_switchable_interp_map[mi->interp_filter]); } else { @@ -1126,7 +1126,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) { // (if not specified at the frame/segment level) if (cpi->common.comp_pred_mode == HYBRID_PREDICTION) { vp8_write(bc, mi->second_ref_frame != INTRA_FRAME, - get_pred_prob(pc, xd, PRED_COMP)); + vp9_get_pred_prob(pc, xd, PRED_COMP)); } { @@ -1326,7 +1326,7 @@ static void write_mb_modes_kf(const VP8_COMMON *c, } #endif vp8_encode_bool(bc, skip_coeff, - get_pred_prob(c, xd, PRED_MBSKIP)); + vp9_get_pred_prob(c, xd, PRED_MBSKIP)); } #if CONFIG_SUPERBLOCKS diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index a71715ea5..a1f2ba0fc 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -666,8 +666,8 @@ static void pick_mb_modes(VP8_COMP *cpi, check_segref(xd, seg_id, GOLDEN_FRAME) + check_segref(xd, seg_id, ALTREF_FRAME) > 1) { // Get the prediction context and status - int pred_flag = get_pred_flag(xd, PRED_REF); - int pred_context = get_pred_context(cm, xd, PRED_REF); + int pred_flag = vp9_get_pred_flag(xd, PRED_REF); + int pred_context = vp9_get_pred_context(cm, xd, PRED_REF); // Count prediction success cpi->ref_pred_count[pred_context][pred_flag]++; @@ -1005,7 +1005,7 @@ static void encode_sb(VP8_COMP *cpi, if (xd->mode_info_context->mbmi.ref_frame) { unsigned char pred_context; - pred_context = get_pred_context(cm, xd, PRED_COMP); + pred_context = vp9_get_pred_context(cm, xd, PRED_COMP); if (xd->mode_info_context->mbmi.second_ref_frame == INTRA_FRAME) cpi->single_pred_count[pred_context]++; @@ -1308,7 +1308,7 @@ static void encode_frame_internal(VP8_COMP *cpi) { // Compute a modified set of reference frame probabilities to use when // prediction fails. These are based on the current general estimates for // this frame which may be updated with each iteration of the recode loop. - compute_mod_refprobs(cm); + vp9_compute_mod_refprobs(cm); #if CONFIG_NEW_MVREF // temp stats reset @@ -2011,8 +2011,8 @@ void vp8cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x, // SET VARIOUS PREDICTION FLAGS // Did the chosen reference frame match its predicted value. - ref_pred_flag = ((mbmi->ref_frame == get_pred_ref(cm, xd))); - set_pred_flag(xd, PRED_REF, ref_pred_flag); + ref_pred_flag = ((mbmi->ref_frame == vp9_get_pred_ref(cm, xd))); + vp9_set_pred_flag(xd, PRED_REF, ref_pred_flag); if (mbmi->ref_frame == INTRA_FRAME) { if (mbmi->mode == B_PRED) { @@ -2207,8 +2207,8 @@ void vp8cx_encode_inter_superblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, // Did the chosen reference frame match its predicted value. ref_pred_flag = ((xd->mode_info_context->mbmi.ref_frame == - get_pred_ref(cm, xd))); - set_pred_flag(xd, PRED_REF, ref_pred_flag); + vp9_get_pred_ref(cm, xd))); + vp9_set_pred_flag(xd, PRED_REF, ref_pred_flag); if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) { vp8_build_intra_predictors_sby_s(&x->e_mbd); diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 53d8552ae..30e9ef65b 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -862,7 +862,7 @@ static void macro_block_yrd(VP8_COMP *cpi, MACROBLOCK *x, int *rate, MACROBLOCKD *xd = &x->e_mbd; int can_skip = cm->mb_no_coeff_skip; - vp8_prob skip_prob = can_skip ? get_pred_prob(cm, xd, PRED_MBSKIP) : 128; + vp8_prob skip_prob = can_skip ? vp9_get_pred_prob(cm, xd, PRED_MBSKIP) : 128; int s0, s1; int r4x4, r4x4s, r8x8, r8x8s, d4x4, d8x8, s4x4, s8x8; int64_t rd4x4, rd8x8, rd4x4s, rd8x8s; @@ -3018,7 +3018,7 @@ static void set_i8x8_block_modes(MACROBLOCK *x, int modes[2][4]) { } } -extern void calc_ref_probs(int *count, vp8_prob *probs); +extern void vp9_calc_ref_probs(int *count, vp8_prob *probs); static void estimate_curframe_refprobs(VP8_COMP *cpi, vp8_prob mod_refprobs[3], int pred_ref) { int norm_cnt[MAX_REF_FRAMES]; const int *const rfct = cpi->count_mb_ref_frame_usage; @@ -3034,28 +3034,28 @@ static void estimate_curframe_refprobs(VP8_COMP *cpi, vp8_prob mod_refprobs[3], norm_cnt[1] = last_count; norm_cnt[2] = gf_count; norm_cnt[3] = arf_count; - calc_ref_probs(norm_cnt, mod_refprobs); + vp9_calc_ref_probs(norm_cnt, mod_refprobs); mod_refprobs[0] = 0; // This branch implicit } else if (pred_ref == LAST_FRAME) { norm_cnt[0] = intra_count; norm_cnt[1] = 0; norm_cnt[2] = gf_count; norm_cnt[3] = arf_count; - calc_ref_probs(norm_cnt, mod_refprobs); + vp9_calc_ref_probs(norm_cnt, mod_refprobs); mod_refprobs[1] = 0; // This branch implicit } else if (pred_ref == GOLDEN_FRAME) { norm_cnt[0] = intra_count; norm_cnt[1] = last_count; norm_cnt[2] = 0; norm_cnt[3] = arf_count; - calc_ref_probs(norm_cnt, mod_refprobs); + vp9_calc_ref_probs(norm_cnt, mod_refprobs); mod_refprobs[2] = 0; // This branch implicit } else { norm_cnt[0] = intra_count; norm_cnt[1] = last_count; norm_cnt[2] = gf_count; norm_cnt[3] = 0; - calc_ref_probs(norm_cnt, mod_refprobs); + vp9_calc_ref_probs(norm_cnt, mod_refprobs); mod_refprobs[2] = 0; // This branch implicit } } @@ -3095,13 +3095,13 @@ static void vp8_estimate_ref_frame_costs(VP8_COMP *cpi, int segment_id, unsigned } // Get the predicted reference for this mb - pred_ref = get_pred_ref(cm, xd); + pred_ref = vp9_get_pred_ref(cm, xd); // Get the context probability for the prediction flag (based on last frame) - pred_prob = get_pred_prob(cm, xd, PRED_REF); + pred_prob = vp9_get_pred_prob(cm, xd, PRED_REF); // Predict probability for current frame based on stats so far - pred_ctx = get_pred_context(cm, xd, PRED_REF); + pred_ctx = vp9_get_pred_context(cm, xd, PRED_REF); tot_count = cpi->ref_pred_count[pred_ctx][0] + cpi->ref_pred_count[pred_ctx][1]; if (tot_count) { new_pred_prob = @@ -3234,11 +3234,11 @@ void setup_buffer_inter(VP8_COMP *cpi, MACROBLOCK *x, int idx, int frame_type, v_buffer[frame_type] = yv12->v_buffer + recon_uvoffset; #if CONFIG_NEWBESTREFMV - find_mv_refs(xd, xd->mode_info_context, - xd->prev_mode_info_context, - frame_type, - mbmi->ref_mvs[frame_type], - cpi->common.ref_frame_sign_bias); + vp9_find_mv_refs(xd, xd->mode_info_context, + xd->prev_mode_info_context, + frame_type, + mbmi->ref_mvs[frame_type], + cpi->common.ref_frame_sign_bias); vp8_find_best_ref_mvs(xd, y_buffer[frame_type], yv12->y_stride, @@ -3670,7 +3670,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int if (cpi->common.mcomp_filter_type == SWITCHABLE) rate2 += SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs - [get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] + [vp9_get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] [vp8_switchable_interp_map[mbmi->interp_filter]]; // If even the 'Y' rd value of split is higher than best so far // then dont bother looking at UV @@ -3693,7 +3693,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int mode_excluded = cpi->common.comp_pred_mode == COMP_PREDICTION_ONLY; compmode_cost = - vp8_cost_bit(get_pred_prob(cm, xd, PRED_COMP), is_comp_pred); + vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP), is_comp_pred); mbmi->mode = this_mode; } else { @@ -3811,14 +3811,14 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int #endif if (cpi->common.mcomp_filter_type == SWITCHABLE) rate2 += SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs - [get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] + [vp9_get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] [vp8_switchable_interp_map[ xd->mode_info_context->mbmi.interp_filter]]; /* We don't include the cost of the second reference here, because there are only * three options: Last/Golden, ARF/Last or Golden/ARF, or in other words if you * present them in that order, the second one is always known if the first is known */ - compmode_cost = vp8_cost_bit(get_pred_prob(cm, xd, PRED_COMP), + compmode_cost = vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP), is_comp_pred); rate2 += vp8_cost_mv_ref(cpi, this_mode, mdcounts); @@ -3918,7 +3918,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int // Cost the skip mb case vp8_prob skip_prob = - get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP); + vp9_get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP); if (skip_prob) { prob_skip_cost = vp8_cost_bit(skip_prob, 1); @@ -3932,7 +3932,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int mbmi->mb_skip_coeff = 0; if (mb_skip_allowed) { int prob_skip_cost = vp8_cost_bit( - get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP), 0); + vp9_get_pred_prob(cm, &x->e_mbd, PRED_MBSKIP), 0); rate2 += prob_skip_cost; other_cost += prob_skip_cost; } @@ -4084,7 +4084,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int best_mbmode.mode >= NEARESTMV && best_mbmode.mode <= SPLITMV) { ++cpi->switchable_interp_count - [get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] + [vp9_get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] [vp8_switchable_interp_map[best_mbmode.interp_filter]]; } @@ -4200,12 +4200,12 @@ void vp8_rd_pick_intra_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, if (cpi->common.mb_no_coeff_skip && y_skip && uv_skip) { *returnrate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly + - vp8_cost_bit(get_pred_prob(cm, xd, PRED_MBSKIP), 1); + vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1); *returndist = dist_y + (dist_uv >> 2); } else { *returnrate = rate_y + rate_uv; if (cpi->common.mb_no_coeff_skip) - *returnrate += vp8_cost_bit(get_pred_prob(cm, xd, PRED_MBSKIP), 0); + *returnrate += vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0); *returndist = dist_y + (dist_uv >> 2); } } @@ -4297,7 +4297,7 @@ void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, mbmi->mode = mode16x16; mbmi->uv_mode = modeuv; rate = rateuv8x8 + rate16x16 - rateuv8x8_tokenonly - rate16x16_tokenonly + - vp8_cost_bit(get_pred_prob(cm, xd, PRED_MBSKIP), 1); + vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1); dist = dist16x16 + (distuv8x8 >> 2); mbmi->txfm_size = txfm_size_16x16; memset(x->mb_context[xd->mb_index].txfm_rd_diff, 0, @@ -4330,7 +4330,7 @@ void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, } } if (cpi->common.mb_no_coeff_skip) - rate += vp8_cost_bit(get_pred_prob(cm, xd, PRED_MBSKIP), 0); + rate += vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0); } else { if (error4x4 < error8x8) { rate = rateuv; @@ -4360,7 +4360,7 @@ void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, sizeof(x->mb_context[xd->mb_index].txfm_rd_diff)); } if (cpi->common.mb_no_coeff_skip) - rate += vp8_cost_bit(get_pred_prob(cm, xd, PRED_MBSKIP), 0); + rate += vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0); } *returnrate = rate; @@ -4701,7 +4701,7 @@ int64_t vp8_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, xd->dst.uv_stride); compmode_cost = - vp8_cost_bit(get_pred_prob(cm, xd, PRED_COMP), 0); + vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP), 0); if (cpi->active_map_enabled && x->active_ptr[0] == 0) { x->skip = 1; @@ -4853,7 +4853,7 @@ int64_t vp8_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, * are only three options: Last/Golden, ARF/Last or Golden/ARF, or in * other words if you present them in that order, the second one is * always known if the first is known */ - compmode_cost = vp8_cost_bit(get_pred_prob(cm, xd, PRED_COMP), 1); + compmode_cost = vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_COMP), 1); } if (cpi->common.comp_pred_mode == HYBRID_PREDICTION) { @@ -4890,7 +4890,7 @@ int64_t vp8_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, // Cost the skip mb case vp8_prob skip_prob = - get_pred_prob(cm, xd, PRED_MBSKIP); + vp9_get_pred_prob(cm, xd, PRED_MBSKIP); if (skip_prob) { prob_skip_cost = vp8_cost_bit(skip_prob, 1); @@ -4901,7 +4901,7 @@ int64_t vp8_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, } // Add in the cost of the no skip flag. else if (mb_skip_allowed) { - int prob_skip_cost = vp8_cost_bit(get_pred_prob(cm, xd, + int prob_skip_cost = vp8_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0); rate2 += prob_skip_cost; other_cost += prob_skip_cost; diff --git a/vp8/encoder/segmentation.c b/vp8/encoder/segmentation.c index e85bb45ce..fea816ca2 100644 --- a/vp8/encoder/segmentation.c +++ b/vp8/encoder/segmentation.c @@ -222,15 +222,15 @@ void choose_segmap_coding_method(VP8_COMP *cpi) { if (cm->frame_type != KEY_FRAME) { // Test to see if the segment id matches the predicted value. int seg_predicted = - (segment_id == get_pred_mb_segid(cm, segmap_index)); + (segment_id == vp9_get_pred_mb_segid(cm, segmap_index)); // Get the segment id prediction context pred_context = - get_pred_context(cm, xd, PRED_SEG_ID); + vp9_get_pred_context(cm, xd, PRED_SEG_ID); // Store the prediction status for this mb and update counts // as appropriate - set_pred_flag(xd, PRED_SEG_ID, seg_predicted); + vp9_set_pred_flag(xd, PRED_SEG_ID, seg_predicted); temporal_predictor_count[pred_context][seg_predicted]++; if (!seg_predicted) diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c index a96b8e455..99f6b1fb1 100644 --- a/vp8/encoder/tokenize.c +++ b/vp8/encoder/tokenize.c @@ -297,7 +297,7 @@ void vp8_tokenize_mb(VP8_COMP *cpi, int has_y2_block; int b; int tx_size = xd->mode_info_context->mbmi.txfm_size; - int mb_skip_context = get_pred_context(&cpi->common, xd, PRED_MBSKIP); + int mb_skip_context = vp9_get_pred_context(&cpi->common, xd, PRED_MBSKIP); TOKENEXTRA *t_backup = *t; ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *) xd->above_context; ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *) xd->left_context;