shithub: libvpx

Download patch

ref: df9c8d5bd9c5def7dde730adede3e2adca3db659
parent: 6c714bdbcdc17342a32896d76c0e2c5085963f41
author: Jim Bankoski <jimbankoski@google.com>
date: Mon Feb 24 12:34:27 EST 2014

resolve issue with arm code failing unit test

The optimizer did something funny with the code around
line 1412.  Before the call to encode_sb split_dist was
set properly but after it was adjusted and converted to
a negative.

https://code.google.com/p/webm/issues/detail?id=714

Change-Id: I9a7631d5325ade2dc28c1030653a23eecec8721b

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1212,8 +1212,6 @@
   PARTITION_CONTEXT sl[8], sa[8];
   int last_part_rate = INT_MAX;
   int64_t last_part_dist = INT_MAX;
-  int split_rate = INT_MAX;
-  int64_t split_dist = INT_MAX;
   int none_rate = INT_MAX;
   int64_t none_dist = INT_MAX;
   int chosen_rate = INT_MAX;
@@ -1375,8 +1373,8 @@
       && (mi_row + ms < cm->mi_rows || mi_row + (ms >> 1) == cm->mi_rows)
       && (mi_col + ms < cm->mi_cols || mi_col + (ms >> 1) == cm->mi_cols)) {
     BLOCK_SIZE split_subsize = get_subsize(bsize, PARTITION_SPLIT);
-    split_rate = 0;
-    split_dist = 0;
+    chosen_rate = 0;
+    chosen_dist = 0;
     restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
 
     // Split partition.
@@ -1404,30 +1402,28 @@
       restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
 
       if (rt == INT_MAX || dt == INT_MAX) {
-        split_rate = INT_MAX;
-        split_dist = INT_MAX;
+        chosen_rate = INT_MAX;
+        chosen_dist = INT_MAX;
         break;
       }
 
+      chosen_rate += rt;
+      chosen_dist += dt;
+
       if (i != 3)
         encode_sb(cpi, tile, tp,  mi_row + y_idx, mi_col + x_idx, 0,
                   split_subsize);
 
-      split_rate += rt;
-      split_dist += dt;
       pl = partition_plane_context(cpi->above_seg_context,
                                    cpi->left_seg_context,
                                    mi_row + y_idx, mi_col + x_idx,
                                    split_subsize);
-      split_rate += x->partition_cost[pl][PARTITION_NONE];
+      chosen_rate += x->partition_cost[pl][PARTITION_NONE];
     }
     pl = partition_plane_context(cpi->above_seg_context, cpi->left_seg_context,
                                  mi_row, mi_col, bsize);
-    if (split_rate < INT_MAX) {
-      split_rate += x->partition_cost[pl][PARTITION_SPLIT];
-
-      chosen_rate = split_rate;
-      chosen_dist = split_dist;
+    if (chosen_rate < INT_MAX) {
+      chosen_rate += x->partition_cost[pl][PARTITION_SPLIT];
     }
   }
 
--