[CFL] Compute prediction block DC_PRED as double
The prediction block level DC_PRED is stored and computed as double
instead of int.
Change-Id: I22766c102a7b62d4b5e7621438185808cc0ea8f4
diff --git a/av1/common/cfl.c b/av1/common/cfl.c
index 1f3ba30..7f6fe29 100644
--- a/av1/common/cfl.c
+++ b/av1/common/cfl.c
@@ -47,7 +47,7 @@
: tx_size_high[tx_size];
// Number of pixel on the top and left borders.
- const int num_pel = block_width + block_height;
+ const double num_pel = block_width + block_height;
int sum_u = 0;
int sum_v = 0;
@@ -83,8 +83,8 @@
sum_v += block_height * 129;
}
- xd->cfl->dc_pred[CFL_PRED_U] = (sum_u + (num_pel >> 1)) / num_pel;
- xd->cfl->dc_pred[CFL_PRED_V] = (sum_v + (num_pel >> 1)) / num_pel;
+ xd->cfl->dc_pred[CFL_PRED_U] = sum_u / num_pel;
+ xd->cfl->dc_pred[CFL_PRED_V] = sum_v / num_pel;
}
double cfl_ind_to_alpha(const MB_MODE_INFO *const mbmi,
@@ -100,7 +100,7 @@
// Predict the current transform block using CfL.
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
- int row, int col, TX_SIZE tx_size, int dc_pred,
+ int row, int col, TX_SIZE tx_size, double dc_pred,
double alpha) {
const int width = tx_size_wide[tx_size];
const int height = tx_size_high[tx_size];
diff --git a/av1/common/cfl.h b/av1/common/cfl.h
index e4d1155..d6d437e 100644
--- a/av1/common/cfl.h
+++ b/av1/common/cfl.h
@@ -37,7 +37,7 @@
int subsampling_x, subsampling_y;
// CfL Performs its own block level DC_PRED for each chromatic plane
- int dc_pred[CFL_PRED_PLANES];
+ double dc_pred[CFL_PRED_PLANES];
// Count the number of TX blocks in a predicted block to know when you are at
// the last one, so you can check for skips.
@@ -61,7 +61,7 @@
double cfl_ind_to_alpha(const MB_MODE_INFO *mbmi, CFL_PRED_TYPE pred_type);
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
- int row, int col, TX_SIZE tx_size, int dc_pred,
+ int row, int col, TX_SIZE tx_size, double dc_pred,
double alpha);
void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,