Add unpoison_partition_ctx experiment
At the edges of the picture only a subset of partitions are legal. Add
new contexts for these borders so they don't distort the probabilities of
the interior of the image where all partitions are legal.
Only include one context for each block size of each border direction
because so few blocks fall into these contexts to begin with.
objective-1-fast:
PSNR | PSNR Cb | PSNR Cr | PSNR HVS | SSIM | MS SSIM | CIEDE 2000
-0.0294 | -0.0911 | -0.2382 | -0.0481 | -0.0441 | -0.0450 | -0.0454
derf144: -0.135
lowres: -0.124
midres: -0.076
hdres: -0.078
Change-Id: I909b98eebb7e49273cde90154c8408febe334158
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index bb17c09..4315431 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -700,7 +700,31 @@
#endif // CONFIG_EXT_PARTITION_TYPES
static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row,
- int mi_col, BLOCK_SIZE bsize) {
+ int mi_col,
+#if CONFIG_UNPOISON_PARTITION_CTX
+ int has_rows, int has_cols,
+#endif
+ BLOCK_SIZE bsize) {
+#if CONFIG_UNPOISON_PARTITION_CTX
+ const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col;
+ const PARTITION_CONTEXT *left_ctx =
+ xd->left_seg_context + (mi_row & MAX_MIB_MASK);
+ // Minimum partition point is 8x8. Offset the bsl accordingly.
+ const int bsl = mi_width_log2_lookup[bsize] - mi_width_log2_lookup[BLOCK_8X8];
+ int above = (*above_ctx >> bsl) & 1, left = (*left_ctx >> bsl) & 1;
+
+ assert(b_width_log2_lookup[bsize] == b_height_log2_lookup[bsize]);
+ assert(bsl >= 0);
+
+ if (has_rows && has_cols)
+ return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
+ else if (has_rows && !has_cols)
+ return PARTITION_CONTEXTS_PRIMARY + bsl;
+ else if (!has_rows && has_cols)
+ return PARTITION_CONTEXTS_PRIMARY + PARTITION_BLOCK_SIZES + bsl;
+ else
+ return -1; // Bogus context, forced SPLIT
+#else
const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col;
const PARTITION_CONTEXT *left_ctx =
xd->left_seg_context + (mi_row & MAX_MIB_MASK);
@@ -712,6 +736,7 @@
assert(bsl >= 0);
return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
+#endif
}
static INLINE int max_block_wide(const MACROBLOCKD *xd, const BLOCK_SIZE bsize,