Fix YUV444 lossless mode unit test
Properly scale the chroma component size per color plane.
Change-Id: Ibf192d0e99f2fc3611beb82a3a9951ad09b292d3
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 3b33351..6e75df9 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -739,6 +739,23 @@
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
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 1df0dc3..13bbb7a 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -940,11 +940,14 @@
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;
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index c00c3d2..cbed979 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -3754,7 +3754,9 @@
#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