Commit 03b7e7d5 authored by Luc Trudeau's avatar Luc Trudeau

[CFL] Replace Magic Numbers with Constants

Added CFL_SUB8X8_VAL_MI_SIZE and CFL_SUB8X8_VAL_MI_SQUARE to replace the
magic numbers previously used. Also, CFL_SUB8X8_VAL_MI_SIZE goes from 2
to 4 to support the upcoming EXT_PARTITION_TYPE experiment.

Change-Id: I5c812af3366f80345a749451415660024e41ea3c
parent bbf6186e
......@@ -685,6 +685,11 @@ typedef struct {
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_CFL
#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#define CFL_SUB8X8_VAL_MI_SIZE (4)
#define CFL_SUB8X8_VAL_MI_SQUARE \
(CFL_SUB8X8_VAL_MI_SIZE * CFL_SUB8X8_VAL_MI_SIZE)
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
typedef struct cfl_ctx {
// Pixel buffer containing the luma pixels used as prediction for chroma
// TODO(ltrudeau) Convert to uint16 for HBD support
......@@ -731,7 +736,7 @@ typedef struct cfl_ctx {
// The prediction used for sub8x8 blocks originates from multiple luma blocks,
// this array is used to validate that cfl_store() is called only once for
// each luma block
uint8_t sub8x8_val[4];
uint8_t sub8x8_val[CFL_SUB8X8_VAL_MI_SQUARE];
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#endif // CONFIG_CB4X4
} CFL_CTX;
......
......@@ -314,10 +314,10 @@ void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,
}
#if CONFIG_DEBUG
for (int unit_r = 0; unit_r < tx_size_high_unit[tx_size]; unit_r++) {
assert(row + unit_r < 2);
int row_off = (row + unit_r) * 2;
assert(row + unit_r < CFL_SUB8X8_VAL_MI_SIZE);
int row_off = (row + unit_r) * CFL_SUB8X8_VAL_MI_SIZE;
for (int unit_c = 0; unit_c < tx_size_wide_unit[tx_size]; unit_c++) {
assert(col + unit_c < 2);
assert(col + unit_c < CFL_SUB8X8_VAL_MI_SIZE);
assert(cfl->sub8x8_val[row_off + col + unit_c] == 0);
cfl->sub8x8_val[row_off + col + unit_c] = 1;
}
......@@ -371,13 +371,9 @@ void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) {
BLOCK_4X4, get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]));
#if CONFIG_DEBUG
if (mbmi->sb_type < BLOCK_8X8) {
const int val_high =
block_size_high[BLOCK_8X8] / block_size_high[BLOCK_4X4];
const int val_wide =
block_size_wide[BLOCK_8X8] / block_size_wide[BLOCK_4X4];
for (int val_r = 0; val_r < val_high; val_r++) {
for (int val_c = 0; val_c < val_wide; val_c++) {
assert(cfl->sub8x8_val[(val_r * val_wide) + val_c] == 1);
for (int val_r = 0; val_r < mi_size_high[mbmi->sb_type]; val_r++) {
for (int val_c = 0; val_c < mi_size_wide[mbmi->sb_type]; val_c++) {
assert(cfl->sub8x8_val[val_r * CFL_SUB8X8_VAL_MI_SIZE + val_c] == 1);
}
}
cfl_clear_sub8x8_val(cfl);
......
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