[CFL] CfL Initialization Simplification
The CfL context is now stored inside MACROBLOCKD instead of
MACROBLOCKD only storing a pointer to the CfL context.
The intent is to avoid race conditions as MACROBLOCKD is stored
inside ThreadData. This change also simplifies CfL Initialization.
Change-Id: I991503716b21fc9aca60caddb2008b8bff397e6d
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index b5fb4bc..1d62c41 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -219,7 +219,7 @@
}
}
#if CONFIG_CFL
- if (plane == AOM_PLANE_Y && xd->cfl->store_y) {
+ if (plane == AOM_PLANE_Y && xd->cfl.store_y) {
cfl_store_tx(xd, row, col, tx_size, mbmi->sb_type);
}
#endif // CONFIG_CFL
@@ -326,8 +326,8 @@
xd->mi[0]->mbmi.mi_col = mi_col;
#endif
#if CONFIG_CFL
- xd->cfl->mi_row = mi_row;
- xd->cfl->mi_col = mi_col;
+ xd->cfl.mi_row = mi_row;
+ xd->cfl.mi_col = mi_col;
#endif
assert(x_mis && y_mis);
@@ -398,7 +398,7 @@
set_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
#if CONFIG_CFL
- CFL_CTX *const cfl = xd->cfl;
+ CFL_CTX *const cfl = &xd->cfl;
cfl->is_chroma_reference = is_chroma_reference(
mi_row, mi_col, bsize, cfl->subsampling_x, cfl->subsampling_y);
#endif // CONFIG_CFL
@@ -2234,11 +2234,7 @@
td->bit_reader.accounting = NULL;
}
#endif
- av1_init_macroblockd(cm, &td->xd,
-#if CONFIG_CFL
- &td->cfl,
-#endif
- td->dqcoeff);
+ av1_init_macroblockd(cm, &td->xd, td->dqcoeff);
// Initialise the tile context from the frame context
td->tctx = *cm->fc;
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index f0c87c5..4aebe8f 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -1120,16 +1120,16 @@
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y)) {
#if CONFIG_CFL
- xd->cfl->is_chroma_reference = 1;
+ xd->cfl.is_chroma_reference = 1;
#endif // CONFIG_CFL
mbmi->uv_mode = read_intra_mode_uv(ec_ctx, r, mbmi->mode);
#if CONFIG_CFL
if (mbmi->uv_mode == UV_CFL_PRED) {
mbmi->cfl_alpha_idx = read_cfl_alphas(ec_ctx, r, &mbmi->cfl_alpha_signs);
- xd->cfl->store_y = 1;
+ xd->cfl.store_y = 1;
} else {
- xd->cfl->store_y = 0;
+ xd->cfl.store_y = 0;
}
#endif // CONFIG_CFL
@@ -1137,8 +1137,8 @@
// Avoid decoding angle_info if there is is no chroma prediction
mbmi->uv_mode = UV_DC_PRED;
#if CONFIG_CFL
- xd->cfl->is_chroma_reference = 0;
- xd->cfl->store_y = 1;
+ xd->cfl.is_chroma_reference = 0;
+ xd->cfl.store_y = 1;
#endif
}
@@ -1489,9 +1489,9 @@
if (mbmi->uv_mode == UV_CFL_PRED) {
mbmi->cfl_alpha_idx =
read_cfl_alphas(xd->tile_ctx, r, &mbmi->cfl_alpha_signs);
- xd->cfl->store_y = 1;
+ xd->cfl.store_y = 1;
} else {
- xd->cfl->store_y = 0;
+ xd->cfl.store_y = 0;
}
#endif // CONFIG_CFL
@@ -1499,8 +1499,8 @@
// Avoid decoding angle_info if there is is no chroma prediction
mbmi->uv_mode = UV_DC_PRED;
#if CONFIG_CFL
- xd->cfl->is_chroma_reference = 0;
- xd->cfl->store_y = 1;
+ xd->cfl.is_chroma_reference = 0;
+ xd->cfl.store_y = 1;
#endif
}
diff --git a/av1/decoder/decoder.h b/av1/decoder/decoder.h
index bb7512f..28227a5 100644
--- a/av1/decoder/decoder.h
+++ b/av1/decoder/decoder.h
@@ -39,9 +39,6 @@
DECLARE_ALIGNED(16, MACROBLOCKD, xd);
/* dqcoeff are shared by all the planes. So planes must be decoded serially */
DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_TX_SQUARE]);
-#if CONFIG_CFL
- CFL_CTX cfl;
-#endif
DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx);
DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_PALETTE_SQUARE]);
} TileData;