diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h index 330f1611c..0645937a0 100644 --- a/vp8/common/blockd.h +++ b/vp8/common/blockd.h @@ -144,6 +144,11 @@ typedef struct int_mv mv; } B_MODE_INFO; +union b_mode_info +{ + B_PREDICTION_MODE as_mode; + int_mv mv; +}; typedef enum { @@ -170,11 +175,7 @@ typedef struct typedef struct { MB_MODE_INFO mbmi; - union - { - B_PREDICTION_MODE as_mode; - int_mv mv; - } bmi[16]; + union b_mode_info bmi[16]; } MODE_INFO; typedef struct diff --git a/vp8/decoder/ec_types.h b/vp8/decoder/ec_types.h index a4f8c78b3..ccb5ddbb9 100644 --- a/vp8/decoder/ec_types.h +++ b/vp8/decoder/ec_types.h @@ -13,13 +13,15 @@ #define MAX_OVERLAPS 16 + + /* The area (pixel area in Q6) the block pointed to by bmi overlaps * another block with. */ typedef struct { int overlap; - B_MODE_INFO *bmi; + union b_mode_info *bmi; } OVERLAP_NODE; /* Structure to keep track of overlapping blocks on a block level. */ diff --git a/vp8/decoder/error_concealment.c b/vp8/decoder/error_concealment.c index dcb5c86a5..c06bdcf07 100644 --- a/vp8/decoder/error_concealment.c +++ b/vp8/decoder/error_concealment.c @@ -69,7 +69,7 @@ void vp8_de_alloc_overlap_lists(VP8D_COMP *pbi) /* Inserts a new overlap area value to the list of overlaps of a block */ static void assign_overlap(OVERLAP_NODE* overlaps, - B_MODE_INFO *bmi, + union b_mode_info *bmi, int overlap) { int i; @@ -111,7 +111,7 @@ static int block_overlap(int b1_row, int b1_col, int b2_row, int b2_col) * first block being overlapped in the macroblock has position (first_blk_row, * first_blk_col) in blocks relative the upper-left corner of the image. */ -static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, B_MODE_INFO *bmi, +static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, union b_mode_info *bmi, int new_row, int new_col, int mb_row, int mb_col, int first_blk_row, int first_blk_col) @@ -171,7 +171,7 @@ static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, B_MODE_INFO *bmi, void vp8_calculate_overlaps(MB_OVERLAP *overlap_ul, int mb_rows, int mb_cols, - B_MODE_INFO *bmi, + union b_mode_info *bmi, int b_row, int b_col) { MB_OVERLAP *mb_overlap; @@ -246,7 +246,7 @@ void vp8_calculate_overlaps(MB_OVERLAP *overlap_ul, * Filters out all overlapping blocks which do not refer to the correct * reference frame type. */ -static void estimate_mv(const OVERLAP_NODE *overlaps, B_MODE_INFO *bmi) +static void estimate_mv(const OVERLAP_NODE *overlaps, union b_mode_info *bmi) { int i; int overlap_sum = 0; @@ -267,13 +267,11 @@ static void estimate_mv(const OVERLAP_NODE *overlaps, B_MODE_INFO *bmi) /* Q9 / Q6 = Q3 */ bmi->mv.as_mv.col = col_acc / overlap_sum; bmi->mv.as_mv.row = row_acc / overlap_sum; - bmi->mode = NEW4X4; } else { bmi->mv.as_mv.col = 0; bmi->mv.as_mv.row = 0; - bmi->mode = NEW4X4; } } @@ -290,7 +288,7 @@ static void estimate_mb_mvs(const B_OVERLAP *block_overlaps, int i; int non_zero_count = 0; MV * const filtered_mv = &(mi->mbmi.mv.as_mv); - B_MODE_INFO * const bmi = mi->bmi; + union b_mode_info * const bmi = mi->bmi; filtered_mv->col = 0; filtered_mv->row = 0; for (i = 0; i < 16; ++i) @@ -558,7 +556,7 @@ static void interpolate_mvs(MACROBLOCKD *mb, */ mv->as_mv.row = mv_row_sum / w_sum; mv->as_mv.col = mv_col_sum / w_sum; - mi->bmi[row*4 + col].mode = NEW4X4; + mi->mbmi.need_to_clamp_mvs = vp8_check_mv_bounds(mv, mb->mb_to_left_edge, mb->mb_to_right_edge, diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index b2208b823..ff5bb5a84 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -1046,11 +1046,9 @@ void vp8_set_speed_features(VP8_COMP *cpi) { sf->auto_filter = 0; // Faster selection of loop filter -#if CONFIG_REALTIME_ONLY sf->search_method = HEX; -#else - sf->search_method = DIAMOND; -#endif + //sf->search_method = DIAMOND; + sf->iterative_sub_pixel = 0; cpi->mode_check_freq[THR_V_PRED] = 4; @@ -3176,15 +3174,21 @@ void update_reference_frames(VP8_COMMON *cm) if (cm->copy_buffer_to_arf == 1) { - yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG; - yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; - cm->alt_fb_idx = cm->lst_fb_idx; + if(cm->alt_fb_idx != cm->lst_fb_idx) + { + yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG; + yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + cm->alt_fb_idx = cm->lst_fb_idx; + } } else /* if (cm->copy_buffer_to_arf == 2) */ { - yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG; - yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; - cm->alt_fb_idx = cm->gld_fb_idx; + if(cm->alt_fb_idx != cm->gld_fb_idx) + { + yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG; + yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + cm->alt_fb_idx = cm->gld_fb_idx; + } } } @@ -3202,15 +3206,21 @@ void update_reference_frames(VP8_COMMON *cm) if (cm->copy_buffer_to_gf == 1) { - yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG; - yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; - cm->gld_fb_idx = cm->lst_fb_idx; + if(cm->gld_fb_idx != cm->lst_fb_idx) + { + yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG; + yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; + cm->gld_fb_idx = cm->lst_fb_idx; + } } else /* if (cm->copy_buffer_to_gf == 2) */ { - yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG; - yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; - cm->gld_fb_idx = cm->alt_fb_idx; + if(cm->alt_fb_idx != cm->gld_fb_idx) + { + yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG; + yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; + cm->gld_fb_idx = cm->alt_fb_idx; + } } } } diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index ef976f2a0..21f44d9ac 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -1204,11 +1204,6 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x, c = &x->block[n]; e = &x->e_mbd.block[n]; - if (cpi->sf.search_method == HEX) - bestsme = vp8_hex_search(x, c, e, bsi->ref_mv, - &mode_mv[NEW4X4], step_param, sadpb, &num00, v_fn_ptr, x->mvsadcost, x->mvcost, bsi->ref_mv); - - else { bestsme = cpi->diamond_search_sad(x, c, e, &bsi->mvp, &mode_mv[NEW4X4], step_param, @@ -2131,12 +2126,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int step_param = sr; // Initial step/diamond search - if (cpi->sf.search_method == HEX) - { - bestsme = vp8_hex_search(x, b, d, &best_ref_mv, &d->bmi.mv, step_param, sadpb/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost, &best_ref_mv); - mode_mv[NEWMV].as_int = d->bmi.mv.as_int; - } - else { bestsme = cpi->diamond_search_sad(x, b, d, &mvp, &d->bmi.mv, step_param, sadpb / 2/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvcost, &best_ref_mv); //sadpb < 9 mode_mv[NEWMV].as_int = d->bmi.mv.as_int;