summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Grange <agrange@google.com>2012-04-13 10:26:49 -0700
committerAdrian Grange <agrange@google.com>2012-04-13 10:26:49 -0700
commitfa589adc5fda876fc4ee04bebfc76c67abe3e05a (patch)
tree1ddae5699244965371594cf26bd825c2ff240e8c
parent636b2f385e81cf9a8d5d4d78af90a763796d59c4 (diff)
downloadlibvpx-fa589adc5fda876fc4ee04bebfc76c67abe3e05a.tar
libvpx-fa589adc5fda876fc4ee04bebfc76c67abe3e05a.tar.gz
libvpx-fa589adc5fda876fc4ee04bebfc76c67abe3e05a.tar.bz2
libvpx-fa589adc5fda876fc4ee04bebfc76c67abe3e05a.zip
Added save coding context & modified MV bounds
Added code to save the coding context in vp8_rd_pick_inter_mode when the coding mode is forced to ARF(0,0). Also, modified the MV bounds computation to comply with the change in MV border from 32 to 64 pixels. Change-Id: I96963a6f5f4d04ce84c807ae11e0635177c3ad6c
-rw-r--r--vp8/encoder/encodeframe.c36
-rw-r--r--vp8/encoder/rdopt.c36
2 files changed, 42 insertions, 30 deletions
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index 5032cbdce..bc17cd4bc 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -559,12 +559,12 @@ static void pick_mb_modes (VP8_COMP *cpi,
// Set up limit values for MV components to prevent them from
// extending beyond the UMV borders assuming 16x16 block size
- x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16)
- + (VP8BORDERINPIXELS - 16);
- x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16)
- + (VP8BORDERINPIXELS - 16);
+ x->mv_row_min = -((mb_row * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
+ x->mv_col_min = -((mb_col * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
+ x->mv_row_max = ((cm->mb_rows - mb_row) * 16 +
+ (VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
+ x->mv_col_max = ((cm->mb_cols - mb_col) * 16 +
+ (VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
xd->up_available = (mb_row != 0);
xd->left_available = (mb_col != 0);
@@ -756,22 +756,22 @@ static void encode_sb ( VP8_COMP *cpi,
// Set up limit values for MV components to prevent them from
// extending beyond the UMV borders assuming 16x16 block size
- x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16)
- + (VP8BORDERINPIXELS - 16);
- x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16)
- + (VP8BORDERINPIXELS - 16);
+ x->mv_row_min = -((mb_row * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
+ x->mv_col_min = -((mb_col * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
+ x->mv_row_max = ((cm->mb_rows - mb_row) * 16 +
+ (VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
+ x->mv_col_max = ((cm->mb_cols - mb_col) * 16 +
+ (VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
#if CONFIG_SUPERBLOCKS
// Set up limit values for MV components to prevent them from
// extending beyond the UMV borders assuming 32x32 block size
- x->mv_row_min_sb = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_row_max_sb = ((cm->mb_rows - 1 - mb_row) * 16)
- + (VP8BORDERINPIXELS - 32);
- x->mv_col_min_sb = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_col_max_sb = ((cm->mb_cols - 1 - mb_col) * 16)
- + (VP8BORDERINPIXELS - 32);
+ x->mv_row_min_sb = -((mb_row * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
+ x->mv_col_min_sb = -((mb_col * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
+ x->mv_row_max_sb = ((cm->mb_rows - mb_row) * 16 +
+ (VP8BORDERINPIXELS - 32 - INTERP_EXTEND));
+ x->mv_col_max_sb = ((cm->mb_cols - mb_col) * 16 +
+ (VP8BORDERINPIXELS - 32 - INTERP_EXTEND));
#endif
xd->up_available = (mb_row != 0);
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 44782065f..e3604fe5e 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2532,6 +2532,26 @@ void vp8_estimate_ref_frame_costs(VP8_COMP *cpi, unsigned int * ref_costs )
}
}
+static void store_coding_context (MACROBLOCK *x, int mb_index,
+ int mode_index,
+ PARTITION_INFO *partition,
+ int_mv *ref_mv)
+{
+ MACROBLOCKD *xd = &x->e_mbd;
+
+ // Take a snapshot of the coding context so it can be
+ // restored if we decide to encode this way
+ x->mb_context[mb_index].best_mode_index = mode_index;
+ vpx_memcpy(&x->mb_context[mb_index].mic, xd->mode_info_context,
+ sizeof(MODE_INFO));
+ vpx_memcpy(&x->mb_context[mb_index].partition_info, partition,
+ sizeof(PARTITION_INFO));
+ x->mb_context[mb_index].best_ref_mv.as_int = ref_mv->as_int;
+
+ //x->mb_context[mb_index].rddiv = x->rddiv;
+ //x->mb_context[mb_index].rdmult = x->rdmult;
+}
+
void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset,
int *returnrate, int *returndistortion, int *returnintra,
int *best_single_rd_diff, int *best_comp_rd_diff,
@@ -3536,6 +3556,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
*best_single_rd_diff = *best_comp_rd_diff = *best_hybrid_rd_diff = 0;
+ store_coding_context (x, mb_index, best_mode_index, &best_partition,
+ &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame] );
return;
}
@@ -3580,18 +3602,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
else
*best_hybrid_rd_diff = best_rd - best_hybrid_rd;
- // Take a snapshot of the coding context so it can be
- // restored if we decide to encode this way
- x->mb_context[mb_index].best_mode_index = best_mode_index;
- vpx_memcpy(&x->mb_context[mb_index].mic, x->e_mbd.mode_info_context,
- sizeof(MODE_INFO));
- vpx_memcpy(&x->mb_context[mb_index].partition_info, &best_partition,
- sizeof(PARTITION_INFO));
- vpx_memcpy(&x->mb_context[mb_index].best_ref_mv,
- &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame],
- sizeof(int_mv));
- //x->mb_context[mb_index].rddiv = x->rddiv;
- //x->mb_context[mb_index].rdmult = x->rdmult;
+ store_coding_context (x, mb_index, best_mode_index, &best_partition,
+ &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame] );
}
int vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x)