Document and rename tmp_obmc_bufs in MACROBLOCK
The dynamic array tmp_obmc_bufs is also used as a temporary buffer to
hold temporary predictions in handle_inter_mode. This CL documents this
usage and rename it to the less misleading tmp_pred_bufs.
BUG=aomedia:2618
Change-Id: I281a5262cff0a7a65d4af3d0fb571cb15e4727f0
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 16a7bc4..5e832c8 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -723,7 +723,7 @@
// tmp_obmc_bufs[i][p * MAX_SB_SQUARE] is the buffer used for plane 'p'.
// There are pointers to actual buffers allocated elsewhere: e.g. In dec,
// 'pbi->td.tmp_obmc_bufs' or 'pbi->thread_data[t].td->xd.tmp_conv_dst' and in
- // enc, 'x->tmp_obmc_bufs' or 'cpi->tile_thr_data[t].td->mb.tmp_obmc_bufs'.
+ // enc, 'x->tmp_pred_bufs' or 'cpi->tile_thr_data[t].td->mb.tmp_pred_bufs'.
uint8_t *tmp_obmc_bufs[2];
} MACROBLOCKD;
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index ae204c3..9d4c6b2 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -317,7 +317,14 @@
CompoundTypeRdBuffers comp_rd_buffer;
CONV_BUF_TYPE *tmp_conv_dst;
- uint8_t *tmp_obmc_bufs[2];
+
+ // Points to a buffer that is used to hold temporary prediction results. This
+ // is used in two ways:
+ // 1. This is a temporary buffer used to pingpong the prediction in
+ // handle_inter_mode.
+ // 2. xd->tmp_obmc_bufs also points to this buffer, and is used in ombc
+ // prediction.
+ uint8_t *tmp_pred_bufs[2];
FRAME_CONTEXT *row_ctx;
// This context will be used to update color_map_cdf pointer which would be
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 6cd3f95..23a6c80 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -886,7 +886,7 @@
av1_release_compound_type_rd_buffers(&cpi->td.mb.comp_rd_buffer);
aom_free(cpi->td.mb.tmp_conv_dst);
for (int j = 0; j < 2; ++j) {
- aom_free(cpi->td.mb.tmp_obmc_bufs[j]);
+ aom_free(cpi->td.mb.tmp_pred_bufs[j]);
}
#if CONFIG_DENOISE
@@ -2872,11 +2872,11 @@
x->e_mbd.tmp_conv_dst = x->tmp_conv_dst;
}
for (int i = 0; i < 2; ++i) {
- if (x->tmp_obmc_bufs[i] == NULL) {
- CHECK_MEM_ERROR(cm, x->tmp_obmc_bufs[i],
+ if (x->tmp_pred_bufs[i] == NULL) {
+ CHECK_MEM_ERROR(cm, x->tmp_pred_bufs[i],
aom_memalign(32, 2 * MAX_MB_PLANE * MAX_SB_SQUARE *
- sizeof(*x->tmp_obmc_bufs[i])));
- x->e_mbd.tmp_obmc_bufs[i] = x->tmp_obmc_bufs[i];
+ sizeof(*x->tmp_pred_bufs[i])));
+ x->e_mbd.tmp_obmc_bufs[i] = x->tmp_pred_bufs[i];
}
}
@@ -3606,7 +3606,7 @@
aom_free(thread_data->td->tmp_conv_dst);
av1_release_compound_type_rd_buffers(&thread_data->td->comp_rd_buffer);
for (int j = 0; j < 2; ++j) {
- aom_free(thread_data->td->tmp_obmc_bufs[j]);
+ aom_free(thread_data->td->tmp_pred_bufs[j]);
}
aom_free(thread_data->td->above_pred_buf);
aom_free(thread_data->td->left_pred_buf);
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 4d6e275..2fd20e6 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -756,7 +756,7 @@
PALETTE_BUFFER *palette_buffer;
CompoundTypeRdBuffers comp_rd_buffer;
CONV_BUF_TYPE *tmp_conv_dst;
- uint8_t *tmp_obmc_bufs[2];
+ uint8_t *tmp_pred_bufs[2];
int intrabc_used;
int deltaq_used;
FRAME_CONTEXT *tctx;
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 9c01179..a05dce8 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -532,9 +532,9 @@
sizeof(*thread_data->td->tmp_conv_dst)));
for (int j = 0; j < 2; ++j) {
CHECK_MEM_ERROR(
- cm, thread_data->td->tmp_obmc_bufs[j],
+ cm, thread_data->td->tmp_pred_bufs[j],
aom_memalign(32, 2 * MAX_MB_PLANE * MAX_SB_SQUARE *
- sizeof(*thread_data->td->tmp_obmc_bufs[j])));
+ sizeof(*thread_data->td->tmp_pred_bufs[j])));
}
CHECK_MEM_ERROR(
@@ -664,14 +664,14 @@
thread_data->td->mb.comp_rd_buffer = thread_data->td->comp_rd_buffer;
thread_data->td->mb.tmp_conv_dst = thread_data->td->tmp_conv_dst;
for (int j = 0; j < 2; ++j) {
- thread_data->td->mb.tmp_obmc_bufs[j] =
- thread_data->td->tmp_obmc_bufs[j];
+ thread_data->td->mb.tmp_pred_bufs[j] =
+ thread_data->td->tmp_pred_bufs[j];
}
thread_data->td->mb.e_mbd.tmp_conv_dst = thread_data->td->mb.tmp_conv_dst;
for (int j = 0; j < 2; ++j) {
thread_data->td->mb.e_mbd.tmp_obmc_bufs[j] =
- thread_data->td->mb.tmp_obmc_bufs[j];
+ thread_data->td->mb.tmp_pred_bufs[j];
}
}
}
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index b5a403b..fd30d46 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4564,7 +4564,7 @@
int intra_mode_idx_ls[INTRA_MODES];
// Temporary buffers used by handle_inter_mode().
- uint8_t *const tmp_buf = get_buf_by_bd(xd, x->tmp_obmc_bufs[0]);
+ uint8_t *const tmp_buf = get_buf_by_bd(xd, x->tmp_pred_bufs[0]);
// The best RD found for the reference frame, among single reference modes.
// Note that the 0-th element will contain a cut-off that is later used