From 551f37d63d508d24dfe071454ca9f38df01c29e9 Mon Sep 17 00:00:00 2001
From: Jingning Han <jingning@google.com>
Date: Mon, 10 Jun 2013 19:54:06 -0700
Subject: [PATCH] Fix partition coding of corner block

This commit fixed the allowable partition types for bottom-right
corner blocks.

When a block has over half of its pixels as valid content in both
vertical and horizontal directions, allow all the four partition
types in the bit-stream. Otherwise, apply partition type constraints.

Change-Id: I2252e2de7125a8bfb1c824bf34299a13c81102e3
---
 vp9/common/vp9_onyxc_int.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 121995093..f461bf3ba 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -313,9 +313,7 @@ static int check_bsize_coverage(VP9_COMMON *cm, MACROBLOCKD *xd,
   int bsl = mi_width_log2(bsize), bs = 1 << bsl;
   int ms = bs / 2;
 
-  if ((mi_row + bs <= cm->mi_rows) && (mi_col + ms < cm->mi_cols))
-    return 0;
-  if ((mi_col + bs <= cm->mi_cols) && (mi_row + ms < cm->mi_rows))
+  if ((mi_row + ms < cm->mi_rows) && (mi_col + ms < cm->mi_cols))
     return 0;
 
   // frame width/height are multiples of 8, hence 8x8 block should always
@@ -323,9 +321,11 @@ static int check_bsize_coverage(VP9_COMMON *cm, MACROBLOCKD *xd,
   assert(bsize > BLOCK_SIZE_SB8X8);
 
   // return the node index in the prob tree for binary coding
-  if ((mi_col + bs <= cm->mi_cols) && (mi_row + ms >= cm->mi_rows))
+  // skip horizontal/none partition types
+  if ((mi_col + ms < cm->mi_cols) && (mi_row + ms >= cm->mi_rows))
     return 1;
-  if ((mi_row + bs <= cm->mi_rows) && (mi_col + ms >= cm->mi_cols))
+  // skip vertical/none partition types
+  if ((mi_row + ms < cm->mi_rows) && (mi_col + ms >= cm->mi_cols))
     return 2;
 
   return -1;
-- 
2.40.0