palette-delta-encoding: remove dependency on above SB row
Do not refer to above MB when on SB boundary. This helps to
reduce line buffer.
Keyframe coding gain on the screen_content testset drops from
1.28% to 1.20%.
Change-Id: I4b06fd137d6c9ea68d618035381f09d0746ba9e8
diff --git a/av1/common/pred_common.c b/av1/common/pred_common.c
index f941405..59db9e5 100644
--- a/av1/common/pred_common.c
+++ b/av1/common/pred_common.c
@@ -154,8 +154,13 @@
#endif // CONFIG_EXT_INTRA
#if CONFIG_PALETTE_DELTA_ENCODING
-int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi,
- int plane, uint16_t *cache) {
+int av1_get_palette_cache(const MACROBLOCKD *const xd, int plane,
+ uint16_t *cache) {
+ const int row = -xd->mb_to_top_edge >> 3;
+ // Do not refer to above SB row when on SB boundary.
+ const MODE_INFO *const above_mi =
+ (row % (1 << MIN_SB_SIZE_LOG2)) ? xd->above_mi : NULL;
+ const MODE_INFO *const left_mi = xd->left_mi;
int above_n = 0, left_n = 0;
if (above_mi)
above_n = above_mi->mbmi.palette_mode_info.palette_size[plane != 0];
@@ -166,8 +171,9 @@
int left_idx = plane * PALETTE_MAX_SIZE;
int n = 0;
const uint16_t *above_colors =
- above_mi->mbmi.palette_mode_info.palette_colors;
- const uint16_t *left_colors = left_mi->mbmi.palette_mode_info.palette_colors;
+ above_mi ? above_mi->mbmi.palette_mode_info.palette_colors : NULL;
+ const uint16_t *left_colors =
+ left_mi ? left_mi->mbmi.palette_mode_info.palette_colors : NULL;
// Merge the sorted lists of base colors from above and left to get
// combined sorted color cache.
while (above_n > 0 && left_n > 0) {