shithub: libvpx

Download patch

ref: ba24a28f699526c9f046ec869474dead2110ac97
parent: a4279138642f80fc906d5e2705d1caa0d97046a0
author: Jingning Han <jingning@google.com>
date: Wed May 1 18:26:08 EDT 2013

Fix bug in sb8x8 partition context

Fix the issue that causes array bound excess in getting partition
context.

Change-Id: I66166f047f0bcaefebb0bcf441c5b1f777d8da44

--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -498,7 +498,7 @@
 
 static INLINE int partition_plane_context(MACROBLOCKD *xd,
                                           BLOCK_SIZE_TYPE sb_type) {
-  int bsl = mi_width_log2(sb_type), bs = 1 << bsl;
+  int bsl = mi_width_log2(sb_type), bs;
   int above = 0, left = 0, i;
   int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - bsl;
 
@@ -505,6 +505,12 @@
   assert(mi_width_log2(sb_type) == mi_height_log2(sb_type));
   assert(bsl >= 0);
   assert(boffset >= 0);
+
+#if CONFIG_SB8X8
+  bs = 1 << (bsl - 1);
+#else
+  bs = 1 << bsl;
+#endif
 
   for (i = 0; i < bs; i++)
     above |= (xd->above_seg_context[i] & (1 << boffset));