Commit 4d6ea54e authored by Luc Trudeau's avatar Luc Trudeau Committed by David Michael Barr

[CFL] Disable CfL for 4:1 and 1:4 Partitions

Moving CfL to using partition unit DC_PRED requires 4:1 and 1:4 DC_PRED,
which are not currently implemented. A simple solution is to disable CfL
for 4:1 and 1:4 partitions.

CfL is also disabled for luma intra partitions < 4x4. This is inherent
to luma intra prediction partition sizes. We add an assert to enforce
this.

Resulting in the following regression for Subset1
   PSNR | PSNR Cb | PSNR Cr | PSNR HVS |   SSIM | MS SSIM | CIEDE 2000
-0.0093 |  0.1803 |  0.1519 |  -0.0180 | 0.0256 |  0.0226 |     0.0352

https://two.arewecompressedyet.com/?job=CfL%402017-11-30T19%3A05%3A05.639Z&job=CfL-Disable-4to1%402017-11-30T19%3A04%3A00.761Z

Change-Id: Ie2c8b4d9cb6b6f33a103b540209e1a2fb6df74a7
parent daccae3c
......@@ -14,6 +14,12 @@
#include "av1/common/blockd.h"
static INLINE int is_cfl_allowed(const MB_MODE_INFO *mbmi) {
const BLOCK_SIZE bsize = mbmi->sb_type;
assert(bsize >= BLOCK_4X4); // Intra luma partitions can't be < 4X4
assert(bsize < BLOCK_SIZES_ALL);
return (bsize >= BLOCK_4X4) && (bsize < BLOCK_SIZES);
}
static INLINE int get_scaled_luma_q0(int alpha_q3, int16_t pred_buf_q3) {
int scaled_luma_q6 = alpha_q3 * pred_buf_q3;
return ROUND_POWER_OF_TWO_SIGNED(scaled_luma_q6, 6);
......
......@@ -1174,6 +1174,12 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
#if CONFIG_CFL
if (mbmi->uv_mode == UV_CFL_PRED) {
if (!is_cfl_allowed(mbmi)) {
aom_internal_error(
&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Chroma from Luma (CfL) cannot be signaled for a %dx%d block.",
block_size_wide[bsize], block_size_high[bsize]);
}
mbmi->cfl_alpha_idx = read_cfl_alphas(ec_ctx, r, &mbmi->cfl_alpha_signs);
xd->cfl.store_y = 1;
} else {
......@@ -1534,6 +1540,12 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row,
#if CONFIG_CFL
if (mbmi->uv_mode == UV_CFL_PRED) {
if (!is_cfl_allowed(mbmi)) {
aom_internal_error(
&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Chroma from Luma (CfL) cannot be signaled for a %dx%d block.",
block_size_wide[bsize], block_size_high[bsize]);
}
mbmi->cfl_alpha_idx =
read_cfl_alphas(xd->tile_ctx, r, &mbmi->cfl_alpha_signs);
xd->cfl.store_y = 1;
......
......@@ -1359,6 +1359,12 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#if CONFIG_CFL
if (mbmi->uv_mode == UV_CFL_PRED) {
if (!is_cfl_allowed(mbmi)) {
aom_internal_error(
&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Chroma from Luma (CfL) cannot be signaled for a %dx%d block.",
block_size_wide[bsize], block_size_high[bsize]);
}
write_cfl_alphas(ec_ctx, mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, w);
}
#endif
......@@ -1658,6 +1664,12 @@ static void write_mb_modes_kf(AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_CFL
if (mbmi->uv_mode == UV_CFL_PRED) {
if (!is_cfl_allowed(mbmi)) {
aom_internal_error(
&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Chroma from Luma (CfL) cannot be signaled for a %dx%d block.",
block_size_wide[bsize], block_size_high[bsize]);
}
write_cfl_alphas(ec_ctx, mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, w);
}
#endif
......
......@@ -5498,6 +5498,7 @@ static int64_t rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#if CONFIG_CFL
int cfl_alpha_rate = 0;
if (mode == UV_CFL_PRED) {
if (!is_cfl_allowed(mbmi)) continue;
assert(!is_directional_mode);
const TX_SIZE uv_tx_size = av1_get_uv_tx_size(mbmi, &xd->plane[1]);
cfl_alpha_rate = cfl_rd_pick_alpha(x, cpi, bsize, uv_tx_size, best_rd);
......@@ -5529,6 +5530,7 @@ static int64_t rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#if CONFIG_CFL
if (mode == UV_CFL_PRED) {
assert(is_cfl_allowed(mbmi));
this_rate += cfl_alpha_rate;
#if CONFIG_DEBUG
assert(xd->cfl.rate == this_rate);
......
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