Commit fcca37a4 authored by Luc Trudeau's avatar Luc Trudeau

[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
parent 2484fa05
......@@ -25,6 +25,7 @@ void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm) {
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
......
......@@ -60,6 +60,9 @@ typedef struct {
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) {
......
......@@ -292,10 +292,6 @@ struct macroblock {
#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
......
......@@ -5949,7 +5949,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
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 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
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,
......
......@@ -1095,7 +1095,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
// 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);
......
......@@ -578,7 +578,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
#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);
......
......@@ -2104,7 +2104,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
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 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
// 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]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment