shithub: libvpx

Download patch

ref: 6254c8d780f29065ab42d6c3d7a71b2e20081933
parent: a5062cc6356671da86ead502165f01b50b16b353
parent: 2ad62c93129e363a6c7a916f656d807dfefce8e6
author: Dmitry Kovalev <dkovalev@google.com>
date: Mon Jul 8 16:07:06 EDT 2013

Merge "Calling set_partition_seg_context() instead of code duplication."

--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -305,11 +305,10 @@
   return 2 * ((cm->mb_cols + 3) & ~3);
 }
 
-static INLINE void set_partition_seg_context(VP9_COMMON *cm,
-                                             MACROBLOCKD *xd,
+static INLINE void set_partition_seg_context(VP9_COMMON *cm, MACROBLOCKD *xd,
                                              int mi_row, int mi_col) {
   xd->above_seg_context = cm->above_seg_context + mi_col;
-  xd->left_seg_context  = cm->left_seg_context + (mi_row & MI_MASK);
+  xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK);
 }
 
 static int check_bsize_coverage(VP9_COMMON *cm, MACROBLOCKD *xd,
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -206,9 +206,9 @@
     pd->left_context = cm->left_context[i] +
                            (((mi_row * 2) & 15) >> pd->subsampling_y);
   }
-  xd->above_seg_context = cm->above_seg_context + mi_col;
-  xd->left_seg_context  = cm->left_seg_context + (mi_row & MI_MASK);
 
+  set_partition_seg_context(cm, xd, mi_row, mi_col);
+
   // Distance of Mb to the various image edges. These are specified to 8th pel
   // as they are always compared to values that are in 1/8th pel units
   set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw);
@@ -304,10 +304,8 @@
 
   if (bsize >= BLOCK_SIZE_SB8X8) {
     int pl;
-    int idx = check_bsize_coverage(pc, xd, mi_row, mi_col, bsize);
-    // read the partition information
-    xd->left_seg_context = pc->left_seg_context + (mi_row & MI_MASK);
-    xd->above_seg_context = pc->above_seg_context + mi_col;
+    const int idx = check_bsize_coverage(pc, xd, mi_row, mi_col, bsize);
+    set_partition_seg_context(pc, xd, mi_row, mi_col);
     pl = partition_plane_context(xd, bsize);
 
     if (idx == 0)
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -656,9 +656,8 @@
 
   if (bsize >= BLOCK_SIZE_SB8X8) {
     int pl;
-    int idx = check_bsize_coverage(cm, xd, mi_row, mi_col, bsize);
-    xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK);
-    xd->above_seg_context = cm->above_seg_context + mi_col;
+    const int idx = check_bsize_coverage(cm, xd, mi_row, mi_col, bsize);
+    set_partition_seg_context(cm, xd, mi_row, mi_col);
     pl = partition_plane_context(xd, bsize);
     // encode the partition information
     if (idx == 0)