Cleanup of multiple inter prediction functions
Reduced around 55 code lines, and removed the following functions:
dec_build_inter_predictors_sby
av1_build_interintra_predictors_sbuv
dec_build_inter_predictors_sb
build_inter_predictors_for_plane
Change-Id: I40f75e96148578236eef23c85793bcd0c4cadd65
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 80111c0..1167c35 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -1195,10 +1195,10 @@
}
// build interintra_predictors for one plane
-void av1_build_interintra_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
- uint8_t *pred, int stride,
- const BUFFER_SET *ctx, int plane,
- BLOCK_SIZE bsize) {
+void av1_build_interintra_predictor(const AV1_COMMON *cm, MACROBLOCKD *xd,
+ uint8_t *pred, int stride,
+ const BUFFER_SET *ctx, int plane,
+ BLOCK_SIZE bsize) {
assert(bsize < BLOCK_SIZES_ALL);
if (is_cur_buf_hbd(xd)) {
DECLARE_ALIGNED(16, uint16_t, intrapredictor[MAX_SB_SQUARE]);
@@ -1215,12 +1215,3 @@
MAX_SB_SIZE);
}
}
-
-void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
- uint8_t *upred, uint8_t *vpred,
- int ustride, int vstride,
- const BUFFER_SET *ctx,
- BLOCK_SIZE bsize) {
- av1_build_interintra_predictors_sbp(cm, xd, upred, ustride, ctx, 1, bsize);
- av1_build_interintra_predictors_sbp(cm, xd, vpred, vstride, ctx, 2, bsize);
-}
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index 2e6acc9..89f9ca7 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -363,16 +363,10 @@
const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type);
// build interintra_predictors for one plane
-void av1_build_interintra_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
- uint8_t *pred, int stride,
- const BUFFER_SET *ctx, int plane,
- BLOCK_SIZE bsize);
-
-void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
- uint8_t *upred, uint8_t *vpred,
- int ustride, int vstride,
- const BUFFER_SET *ctx,
- BLOCK_SIZE bsize);
+void av1_build_interintra_predictor(const AV1_COMMON *cm, MACROBLOCKD *xd,
+ uint8_t *pred, int stride,
+ const BUFFER_SET *ctx, int plane,
+ BLOCK_SIZE bsize);
void av1_build_intra_predictors_for_interintra(const AV1_COMMON *cm,
MACROBLOCKD *xd,
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index bf64046..303cd97 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -836,59 +836,27 @@
}
}
-static AOM_INLINE void dec_build_inter_predictors_for_planes(
- const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
- int plane_from, int plane_to) {
- const int mi_x = mi_col * MI_SIZE;
- const int mi_y = mi_row * MI_SIZE;
- for (int plane = plane_from; plane <= plane_to; ++plane) {
- if (plane && !xd->is_chroma_ref) break;
- const struct macroblockd_plane *pd = &xd->plane[plane];
- const int bw = pd->width;
- const int bh = pd->height;
- dec_build_inter_predictors(cm, xd, plane, xd->mi[0], 0, bw, bh, mi_x, mi_y);
- }
-}
-
-static AOM_INLINE void dec_build_inter_predictors_sby(const AV1_COMMON *cm,
- MACROBLOCKD *xd,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- dec_build_inter_predictors_for_planes(cm, xd, mi_row, mi_col, 0, 0);
-
- if (is_interintra_pred(xd->mi[0])) {
- BUFFER_SET ctx = { { xd->plane[0].dst.buf, NULL, NULL },
- { xd->plane[0].dst.stride, 0, 0 } };
- av1_build_interintra_predictors_sbp(
- cm, xd, xd->plane[0].dst.buf, xd->plane[0].dst.stride, &ctx, 0, bsize);
- }
-}
-
-static AOM_INLINE void dec_build_inter_predictors_sbuv(const AV1_COMMON *cm,
- MACROBLOCKD *xd,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- dec_build_inter_predictors_for_planes(cm, xd, mi_row, mi_col, 1,
- MAX_MB_PLANE - 1);
-
- if (is_interintra_pred(xd->mi[0])) {
- BUFFER_SET ctx = { { NULL, xd->plane[1].dst.buf, xd->plane[2].dst.buf },
- { 0, xd->plane[1].dst.stride,
- xd->plane[2].dst.stride } };
- av1_build_interintra_predictors_sbuv(
- cm, xd, xd->plane[1].dst.buf, xd->plane[2].dst.buf,
- xd->plane[1].dst.stride, xd->plane[2].dst.stride, &ctx, bsize);
- }
-}
-
-static AOM_INLINE void dec_build_inter_predictors_sb(const AV1_COMMON *cm,
- MACROBLOCKD *xd,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
+static AOM_INLINE void dec_build_inter_predictor(const AV1_COMMON *cm,
+ MACROBLOCKD *xd, int mi_row,
+ int mi_col, BLOCK_SIZE bsize) {
const int num_planes = av1_num_planes(cm);
- dec_build_inter_predictors_sby(cm, xd, mi_row, mi_col, bsize);
- if (num_planes > 1)
- dec_build_inter_predictors_sbuv(cm, xd, mi_row, mi_col, bsize);
+ for (int plane = 0; plane < num_planes; ++plane) {
+ if (plane && !xd->is_chroma_ref) break;
+ const int mi_x = mi_col * MI_SIZE;
+ const int mi_y = mi_row * MI_SIZE;
+ dec_build_inter_predictors(cm, xd, plane, xd->mi[0], 0,
+ xd->plane[plane].width, xd->plane[plane].height,
+ mi_x, mi_y);
+ if (is_interintra_pred(xd->mi[0])) {
+ BUFFER_SET ctx = { { xd->plane[0].dst.buf, xd->plane[1].dst.buf,
+ xd->plane[2].dst.buf },
+ { xd->plane[0].dst.stride, xd->plane[1].dst.stride,
+ xd->plane[2].dst.stride } };
+ av1_build_interintra_predictor(cm, xd, xd->plane[plane].dst.buf,
+ xd->plane[plane].dst.stride, &ctx, plane,
+ bsize);
+ }
+ }
}
static INLINE void dec_build_prediction_by_above_pred(
@@ -1091,7 +1059,7 @@
}
}
- dec_build_inter_predictors_sb(cm, xd, mi_row, mi_col, bsize);
+ dec_build_inter_predictor(cm, xd, mi_row, mi_col, bsize);
if (mbmi->motion_mode == OBMC_CAUSAL) {
dec_build_obmc_inter_predictors_sb(cm, xd);
}
diff --git a/av1/encoder/reconinter_enc.c b/av1/encoder/reconinter_enc.c
index b6fa647..f71dc27 100644
--- a/av1/encoder/reconinter_enc.c
+++ b/av1/encoder/reconinter_enc.c
@@ -170,31 +170,6 @@
}
}
-static void build_inter_predictors_for_plane(const AV1_COMMON *cm,
- MACROBLOCKD *xd, int mi_row,
- int mi_col, const BUFFER_SET *ctx,
- BLOCK_SIZE bsize, int plane_idx) {
- if (plane_idx && !xd->is_chroma_ref) return;
-
- const struct macroblockd_plane *pd = &xd->plane[plane_idx];
- const int mi_x = mi_col * MI_SIZE;
- const int mi_y = mi_row * MI_SIZE;
- build_inter_predictors(cm, xd, plane_idx, xd->mi[0], pd->width, pd->height,
- mi_x, mi_y);
-
- if (is_interintra_pred(xd->mi[0])) {
- BUFFER_SET default_ctx = { { NULL, NULL, NULL }, { 0, 0, 0 } };
- if (!ctx) {
- default_ctx.plane[plane_idx] = xd->plane[plane_idx].dst.buf;
- default_ctx.stride[plane_idx] = xd->plane[plane_idx].dst.stride;
- ctx = &default_ctx;
- }
- av1_build_interintra_predictors_sbp(cm, xd, xd->plane[plane_idx].dst.buf,
- xd->plane[plane_idx].dst.stride, ctx,
- plane_idx, bsize);
- }
-}
-
void av1_enc_build_inter_predictor_y(MACROBLOCKD *xd, int mi_row, int mi_col) {
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
@@ -222,9 +197,26 @@
int mi_row, int mi_col,
const BUFFER_SET *ctx, BLOCK_SIZE bsize,
int plane_from, int plane_to) {
- for (int plane_idx = plane_from; plane_idx <= plane_to; ++plane_idx) {
- build_inter_predictors_for_plane(cm, xd, mi_row, mi_col, ctx, bsize,
- plane_idx);
+ for (int plane = plane_from; plane <= plane_to; ++plane) {
+ if (plane && !xd->is_chroma_ref) break;
+ const int mi_x = mi_col * MI_SIZE;
+ const int mi_y = mi_row * MI_SIZE;
+ build_inter_predictors(cm, xd, plane, xd->mi[0], xd->plane[plane].width,
+ xd->plane[plane].height, mi_x, mi_y);
+
+ if (is_interintra_pred(xd->mi[0])) {
+ BUFFER_SET default_ctx = {
+ { xd->plane[0].dst.buf, xd->plane[1].dst.buf, xd->plane[2].dst.buf },
+ { xd->plane[0].dst.stride, xd->plane[1].dst.stride,
+ xd->plane[2].dst.stride }
+ };
+ if (!ctx) {
+ ctx = &default_ctx;
+ }
+ av1_build_interintra_predictor(cm, xd, xd->plane[plane].dst.buf,
+ xd->plane[plane].dst.stride, ctx, plane,
+ bsize);
+ }
}
}