[CFL] Compute DC_PRED until end of frame
When computing CFL's prediction block level DC_PRED,
We can't assume that the neighbor will use the same
transform size. As such, we don't know what pixels
are available outside of the frame. A simple
solution is to stop computing DC_PRED at the block
boundary.
Results on Subset 1 ( Compared to 9c6f854 with CfL enabled)
PSNR | PSNR Cb | PSNR Cr | PSNR HVS | SSIM | MS SSIM | CIEDE 2000
-0.0015 | -0.0026 | -0.0025 | -0.0034 | -0.0008 | -0.0044 | 0.0019
Change-Id: I00ed4114e5c5871fdc7222fa2000474eb11d33e0
diff --git a/av1/common/cfl.c b/av1/common/cfl.c
index 0feabe4..b323353 100644
--- a/av1/common/cfl.c
+++ b/av1/common/cfl.c
@@ -114,7 +114,7 @@
// CfL computes its own block-level DC_PRED. This is required to compute both
// alpha_cb and alpha_cr before the prediction are computed.
-static void cfl_dc_pred(MACROBLOCKD *xd) {
+static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) {
const struct macroblockd_plane *const pd_u = &xd->plane[AOM_PLANE_U];
const struct macroblockd_plane *const pd_v = &xd->plane[AOM_PLANE_V];
@@ -125,8 +125,13 @@
const int dst_v_stride = pd_v->dst.stride;
CFL_CTX *const cfl = xd->cfl;
- const int width = cfl->uv_width;
- const int height = cfl->uv_height;
+
+ // Compute DC_PRED until block boundary. We can't assume the neighbor will use
+ // the same transform size.
+ const int width = max_block_wide(xd, plane_bsize, AOM_PLANE_U)
+ << tx_size_wide_log2[0];
+ const int height = max_block_high(xd, plane_bsize, AOM_PLANE_U)
+ << tx_size_high_log2[0];
// Number of pixel on the top and left borders.
const double num_pel = width + height;
@@ -297,7 +302,7 @@
// Compute block-level DC_PRED for both chromatic planes.
// DC_PRED replaces beta in the linear model.
- cfl_dc_pred(xd);
+ cfl_dc_pred(xd, plane_bsize);
// Compute block-level average on reconstructed luma input.
cfl_compute_average(cfl);
cfl->are_parameters_computed = 1;