[CFL] Move store flag to CFL_CTX
With recent changes, it is now possible to store the storage
flag inside the CFL_CTX. This simplifies the implementation
and will allow reuse in the decoder.
This change does not alter the bitstream.
Change-Id: Ibb8aebdd3d06f8765d40248ece8a038892e87032
diff --git a/av1/common/cfl.c b/av1/common/cfl.c
index a0ff45b..f0f6981 100644
--- a/av1/common/cfl.c
+++ b/av1/common/cfl.c
@@ -25,6 +25,7 @@
cfl->subsampling_x = cm->subsampling_x;
cfl->subsampling_y = cm->subsampling_y;
cfl->are_parameters_computed = 0;
+ cfl->store_y = 0;
}
// Load from the CfL pixel buffer into output
diff --git a/av1/common/cfl.h b/av1/common/cfl.h
index 5441425..39f9ee8 100644
--- a/av1/common/cfl.h
+++ b/av1/common/cfl.h
@@ -60,6 +60,9 @@
int dc_pred[CFL_PRED_PLANES];
int mi_row, mi_col;
+
+ // Whether the reconstructed luma pixels need to be stored
+ int store_y;
} CFL_CTX;
static INLINE int get_scaled_luma_q0(int alpha_q3, int y_pix, int avg_q3) {
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index 30f14d4..2533614 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -292,10 +292,6 @@
#endif
#endif // CONFIG_CB4X4
#endif // CONFIG_DIST_8X8
-#if CONFIG_CFL
- // Whether luma needs to be stored during RDO.
- int cfl_store_y;
-#endif
};
#ifdef __cplusplus
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 4a9359d..632acb5 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5949,7 +5949,7 @@
if (!is_inter) {
#if CONFIG_CFL
- x->cfl_store_y = 1;
+ xd->cfl->store_y = 1;
#endif // CONFIG_CFL
int plane;
mbmi->skip = 1;
@@ -5958,7 +5958,7 @@
mi_row, mi_col);
}
#if CONFIG_CFL
- x->cfl_store_y = 0;
+ xd->cfl->store_y = 0;
#endif // CONFIG_CFL
if (!dry_run) {
sum_intra_stats(td->counts, xd, mi, xd->above_mi, xd->left_mi,
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 9ecf210..6711131 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -1095,7 +1095,7 @@
// Note : *(args->skip) == mbmi->skip
#endif
#if CONFIG_CFL
- if (plane == AOM_PLANE_Y && x->cfl_store_y) {
+ if (plane == AOM_PLANE_Y && xd->cfl->store_y) {
// TODO (ltrudeau) Store sub-8x8 inter blocks when bottom right block is
// intra predicted.
cfl_store(xd->cfl, dst, dst_stride, blk_row, blk_col, tx_size, plane_bsize);
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 9498fd4..f71f35f 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -578,7 +578,7 @@
#if CONFIG_CFL
// Don't store luma on the fist pass since chroma is not computed
- x->cfl_store_y = 0;
+ xd->cfl->store_y = 0;
#endif // CONFIG_CFL
av1_frame_init_quantizer(cpi);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 695b4c4..7ea0319 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2104,7 +2104,7 @@
OUTPUT_HAS_PREDICTED_PIXELS);
}
#if CONFIG_CFL
- if (plane == AOM_PLANE_Y && x->cfl_store_y) {
+ if (plane == AOM_PLANE_Y && xd->cfl->store_y) {
struct macroblockd_plane *const pd = &xd->plane[plane];
const int dst_stride = pd->dst.stride;
uint8_t *dst =
@@ -9839,15 +9839,15 @@
// Don't store the luma value if no chroma is associated.
// Don't worry, we will store this reconstructed luma in the following
// encode dry-run the chroma plane will never know.
- x->cfl_store_y = !x->skip_chroma_rd;
+ xd->cfl->store_y = !x->skip_chroma_rd;
#else
- x->cfl_store_y = 1;
+ xd->cfl->store_y = 1;
#endif // CONFIG_CB4X4
- if (x->cfl_store_y) {
+ if (xd->cfl->store_y) {
txfm_rd_in_plane(x, cpi, &this_rd_stats, INT64_MAX, AOM_PLANE_Y,
mbmi->sb_type, mbmi->tx_size,
cpi->sf.use_fast_coef_costing);
- x->cfl_store_y = 0;
+ xd->cfl->store_y = 0;
}
#endif // CONFIG_CFL
max_uv_tx_size = uv_txsize_lookup[bsize][mbmi->tx_size][pd[1].subsampling_x]