Commit 2d2dac2b authored by Jingning Han's avatar Jingning Han

Fix YUV444 lossless mode unit test

Properly scale the chroma component size per color plane.

Change-Id: Ibf192d0e99f2fc3611beb82a3a9951ad09b292d3
parent 65201569
......@@ -739,6 +739,23 @@ static INLINE int is_chroma_reference(const int mi_row, const int mi_col,
return ref_pos;
}
static INLINE BLOCK_SIZE scale_chroma_bsize(const BLOCK_SIZE bsize,
const int subsampling_x,
const int subsampling_y) {
BLOCK_SIZE bs = bsize;
if (bs < BLOCK_8X8) {
if (subsampling_x == 1 && subsampling_y == 1)
bs = BLOCK_8X8;
else if (subsampling_x == 1)
bs = BLOCK_8X4;
else if (subsampling_y == 1)
bs = BLOCK_4X8;
}
return bs;
}
#endif
#if CONFIG_EXT_PARTITION_TYPES
......
......@@ -940,11 +940,14 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize,
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
if (!is_chroma_reference(mi_row, mi_col, bsize,
xd->plane[plane].subsampling_x,
xd->plane[plane].subsampling_y))
const int subsampling_x = xd->plane[plane].subsampling_x;
const int subsampling_y = xd->plane[plane].subsampling_y;
if (!is_chroma_reference(mi_row, mi_col, bsize, subsampling_x,
subsampling_y))
continue;
if (plane) bsize = AOMMAX(bsize, BLOCK_8X8);
bsize = scale_chroma_bsize(bsize, subsampling_x, subsampling_y);
#else
(void)mi_row;
(void)mi_col;
......
......@@ -3754,7 +3754,9 @@ static int super_block_uvrd(const AV1_COMP *const cpi, MACROBLOCK *x,
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
if (x->skip_chroma_rd) return is_cost_valid;
bsize = AOMMAX(BLOCK_8X8, bsize);
bsize = scale_chroma_bsize(bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y);
#endif // CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
#if !CONFIG_PVQ
......
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