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

[CFL] Limit Luma Partition to 32X32

Based on the HW Subgroup call of December 4th 2017, we limit luma partition to
32X32.

Regression on Subset 1
  PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
0.0881 |  1.3504 |  1.2936 |   0.0572 |  0.0182 |  0.0227 |     0.5204

https://two.arewecompressedyet.com/?job=CfL-PartU%402017-12-12T15%3A39%3A36.794Z&job=CfL-Max32x32%402017-12-12T16%3A10%3A09.989Z

Change-Id: I7e3cfd68097c0bc24b1426348b5fd574c4f638a0
parent d1941f37
......@@ -568,6 +568,7 @@ typedef struct {
#define CFL_SUB8X8_VAL_MI_SQUARE \
(CFL_SUB8X8_VAL_MI_SIZE * CFL_SUB8X8_VAL_MI_SIZE)
#endif // CONFIG_DEBUG
#define CFL_MAX_BLOCK_SIZE (BLOCK_32X32)
typedef struct cfl_ctx {
// The CfL prediction buffer is used in two steps:
// 1. Stores Q3 reconstructed luma pixels
......
......@@ -189,7 +189,7 @@ void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
TX_SIZE tx_size, int plane) {
CFL_CTX *const cfl = &xd->cfl;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
assert(is_cfl_allowed(xd));
assert(is_cfl_allowed(mbmi));
if (!cfl->are_parameters_computed) cfl_compute_parameters(xd, tx_size);
......@@ -466,7 +466,7 @@ void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
assert(is_cfl_allowed(xd));
assert(is_cfl_allowed(&xd->mi[0]->mbmi));
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
// Only dimensions of size 4 can have an odd offset.
assert(!((col & 1) && tx_size_wide[tx_size] != 4));
......@@ -487,7 +487,7 @@ void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
int col = 0;
bsize = AOMMAX(BLOCK_4X4, bsize);
assert(is_cfl_allowed(xd));
assert(is_cfl_allowed(&xd->mi[0]->mbmi));
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
sub8x8_adjust_offset(cfl, &row, &col);
#if CONFIG_DEBUG
......
......@@ -14,12 +14,11 @@
#include "av1/common/blockd.h"
static INLINE int is_cfl_allowed(const MACROBLOCKD *const xd) {
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const BLOCK_SIZE plane_bsize = AOMMAX(
BLOCK_4X4, get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]));
assert(plane_bsize < BLOCK_SIZES_ALL);
return plane_bsize <= BLOCK_32X32;
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 <= CFL_MAX_BLOCK_SIZE);
}
static INLINE int get_scaled_luma_q0(int alpha_q3, int16_t pred_buf_q3) {
......
......@@ -2782,7 +2782,7 @@ void av1_predict_intra_block_facade(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_DEBUG
assert(blk_col == 0);
assert(blk_row == 0);
assert(is_cfl_allowed(xd));
assert(is_cfl_allowed(mbmi));
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, pd));
assert(plane_bsize < BLOCK_SIZES_ALL);
......
......@@ -213,7 +213,7 @@ static void predict_and_reconstruct_intra_block(
}
}
#if CONFIG_CFL
if (plane == AOM_PLANE_Y && xd->cfl.store_y && is_cfl_allowed(xd)) {
if (plane == AOM_PLANE_Y && xd->cfl.store_y && is_cfl_allowed(mbmi)) {
cfl_store_tx(xd, row, col, tx_size, mbmi->sb_type);
}
#endif // CONFIG_CFL
......@@ -584,7 +584,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
#if CONFIG_CFL
if (mbmi->uv_mode != UV_CFL_PRED) {
if (!cfl->is_chroma_reference && is_inter_block(mbmi) &&
is_cfl_allowed(xd)) {
is_cfl_allowed(mbmi)) {
cfl_store_block(xd, mbmi->sb_type, mbmi->tx_size);
}
}
......
......@@ -1200,7 +1200,7 @@ 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(xd)) {
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.",
......@@ -1560,7 +1560,7 @@ 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(xd)) {
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.",
......
......@@ -1424,7 +1424,7 @@ 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(xd)) {
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.",
......@@ -1735,7 +1735,7 @@ static void write_mb_modes_kf(AV1_COMP *cpi, MACROBLOCKD *xd,
#if CONFIG_CFL
if (mbmi->uv_mode == UV_CFL_PRED) {
if (!is_cfl_allowed(xd)) {
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.",
......
......@@ -4827,7 +4827,7 @@ static void encode_superblock(const AV1_COMP *const cpi, TileDataEnc *tile_data,
if (is_inter_block(mbmi) &&
!is_chroma_reference(mi_row, mi_col, bsize, cfl->subsampling_x,
cfl->subsampling_y) &&
is_cfl_allowed(xd)) {
is_cfl_allowed(mbmi)) {
cfl_store_block(xd, mbmi->sb_type, mbmi->tx_size);
}
#endif // CONFIG_CFL
......
......@@ -972,7 +972,8 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
if (*eob) *(args->skip) = 0;
#if CONFIG_CFL
if (plane == AOM_PLANE_Y && xd->cfl.store_y && is_cfl_allowed(xd)) {
if (plane == AOM_PLANE_Y && xd->cfl.store_y &&
is_cfl_allowed(&xd->mi[0]->mbmi)) {
cfl_store_tx(xd, blk_row, blk_col, tx_size, plane_bsize);
}
#endif // CONFIG_CFL
......
......@@ -2142,7 +2142,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
return;
}
#if CONFIG_CFL
if (plane == AOM_PLANE_Y && xd->cfl.store_y && is_cfl_allowed(xd)) {
if (plane == AOM_PLANE_Y && xd->cfl.store_y && is_cfl_allowed(mbmi)) {
assert(!is_inter_block(mbmi) || plane_bsize < BLOCK_8X8);
cfl_store_tx(xd, blk_row, blk_col, tx_size, plane_bsize);
}
......@@ -5433,7 +5433,7 @@ static int cfl_rd_pick_alpha(MACROBLOCK *const x, const AV1_COMP *const cpi,
const BLOCK_SIZE bsize = mbmi->sb_type;
#if CONFIG_DEBUG
assert(is_cfl_allowed(xd));
assert(is_cfl_allowed(mbmi));
const BLOCK_SIZE plane_bsize = AOMMAX(
BLOCK_4X4, get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]));
assert(plane_bsize < BLOCK_SIZES_ALL);
......@@ -5553,7 +5553,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(xd)) continue;
if (!is_cfl_allowed(mbmi)) continue;
assert(!is_directional_mode);
const TX_SIZE uv_tx_size =
av1_get_uv_tx_size(mbmi, &xd->plane[AOM_PLANE_U]);
......@@ -5586,7 +5586,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(xd));
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