]> granicus.if.org Git - libvpx/commitdiff
Add set_block_src_pred_buf()
authorAngie Chiang <angiebird@google.com>
Thu, 24 Jan 2019 00:52:56 +0000 (16:52 -0800)
committerAngie Chiang <angiebird@google.com>
Thu, 24 Jan 2019 00:52:56 +0000 (16:52 -0800)
This function sets src and pre buffer of MACROBLOCK
and MACROBLOCKD.
Will add static decorator once this function is called.

Change-Id: I0fb46784dd97839e4d87c9e027fe8c59683e70d8

vp9/encoder/vp9_encoder.c

index e16d86131d1b3acd3796f66fce4f1163d0a7245a..4b0ff7d06ad7657b194d39e70d336004446d61a3 100644 (file)
@@ -6010,6 +6010,23 @@ static void mode_estimation(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd,
 }
 
 #if CONFIG_NON_GREEDY_MV
+void set_block_src_pred_buf(MACROBLOCK *x, GF_PICTURE *gf_picture,
+                            int frame_idx, int rf_idx, int mi_row, int mi_col) {
+  MACROBLOCKD *xd = &x->e_mbd;
+  const int mb_y_offset =
+      mi_row * MI_SIZE * xd->cur_buf->y_stride + mi_col * MI_SIZE;
+  YV12_BUFFER_CONFIG *ref_frame = NULL;
+  int ref_frame_idx = gf_picture[frame_idx].ref_frame[rf_idx];
+  if (ref_frame_idx != -1) {
+    ref_frame = gf_picture[ref_frame_idx].frame;
+  }
+  x->plane[0].src.buf = xd->cur_buf->y_buffer + mb_y_offset;
+  x->plane[0].src.stride = xd->cur_buf->y_stride;
+  xd->plane[0].pre[0].buf = ref_frame->y_buffer + mb_y_offset;
+  xd->plane[0].pre[0].stride = ref_frame->y_stride;
+  assert(xd->cur_buf->y_stride == ref_frame->y_stride);
+}
+
 static double get_feature_score(uint8_t *buf, ptrdiff_t stride, int rows,
                                 int cols) {
   double IxIx = 0;