shithub: libvpx

Download patch

ref: a047b31e2fb37609ca3652b547e921f16d8fb110
parent: 292f6789cb78f4454abd5bb1e4f988342bb63188
author: Angie Chiang <angiebird@google.com>
date: Wed Jan 23 11:52:56 EST 2019

Add set_block_src_pred_buf()

This function sets src and pre buffer of MACROBLOCK
and MACROBLOCKD.
Will add static decorator once this function is called.

Change-Id: I0fb46784dd97839e4d87c9e027fe8c59683e70d8

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6010,6 +6010,23 @@
 }
 
 #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;