]> granicus.if.org Git - libvpx/commitdiff
resolve issue with arm code failing unit test
authorJim Bankoski <jimbankoski@google.com>
Tue, 25 Feb 2014 01:34:27 +0000 (17:34 -0800)
committerJim Bankoski <jimbankoski@google.com>
Tue, 25 Feb 2014 01:34:27 +0000 (17:34 -0800)
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

vp9/encoder/vp9_encodeframe.c

index 4ad90c65d11baa8c573d3ad1d7aa1dbd6c3eae67..15c2fe031f28521b3a8e589d05b55d3cfec7a5f4 100644 (file)
@@ -1212,8 +1212,6 @@ static void rd_use_partition(VP9_COMP *cpi,
   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 @@ static void rd_use_partition(VP9_COMP *cpi,
       && (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 @@ static void rd_use_partition(VP9_COMP *cpi,
       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];
     }
   }