shithub: libvpx

Download patch

ref: 4093192ec9b2168528e7747de581a8d656de6ab9
parent: 793c2d84297f9d0e6fc6e6c0d89ec13d8faf3cba
author: Jingning Han <jingning@google.com>
date: Wed Oct 2 13:05:31 EDT 2013

Change b_mode_info definition from union to struct

This commit defines b_mode_info as a struct type. This will allow
us to further remove the use of PARTITION_INFO in the encoding process.

Change-Id: I975b0f7d557b5e0f66545a61b472def76b671cce

--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -101,10 +101,10 @@
    modes for the Y blocks to the left and above us; for interframes, there
    is a single probability table. */
 
-union b_mode_info {
+typedef struct {
   MB_PREDICTION_MODE as_mode;
   int_mv as_mv[2];  // first, second inter predictor motion vectors
-};
+} b_mode_info;
 
 typedef enum {
   NONE = -1,
@@ -154,7 +154,7 @@
 
 typedef struct {
   MB_MODE_INFO mbmi;
-  union b_mode_info bmi[4];
+  b_mode_info bmi[4];
 } MODE_INFO;
 
 static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) {
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -57,7 +57,7 @@
     vpx_memcpy(dst_list, mv_list, MAX_MV_REF_CANDIDATES * sizeof(int_mv));
   } else if (block_idx == 1 || block_idx == 2) {
     int dst = 0, n;
-    union b_mode_info *bmi = mi->bmi;
+    b_mode_info *bmi = mi->bmi;
 
     dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int;
     for (n = 0; dst < MAX_MV_REF_CANDIDATES &&
@@ -66,7 +66,7 @@
         dst_list[dst++].as_int = mv_list[n].as_int;
   } else {
     int dst = 0, n;
-    union b_mode_info *bmi = mi->bmi;
+    b_mode_info *bmi = mi->bmi;
 
     assert(block_idx == 3);
     dst_list[dst++].as_int = bmi[2].as_mv[ref_idx].as_int;
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -3857,7 +3857,7 @@
   int intra_cost_penalty = 20 * vp9_dc_quant(cpi->common.base_qindex,
                                              cpi->common.y_dc_delta_q);
   int_mv seg_mvs[4][MAX_REF_FRAMES];
-  union b_mode_info best_bmodes[4];
+  b_mode_info best_bmodes[4];
   PARTITION_INFO best_partition;
   int best_skip2 = 0;
   unsigned char best_zcoeff_blk[256] = { 0 };
@@ -4100,7 +4100,7 @@
       int switchable_filter_index;
       int_mv *second_ref = is_comp_pred ?
           &mbmi->ref_mvs[second_ref_frame][0] : NULL;
-      union b_mode_info tmp_best_bmodes[16];
+      b_mode_info tmp_best_bmodes[16];
       MB_MODE_INFO tmp_best_mbmode;
       PARTITION_INFO tmp_best_partition;
       BEST_SEG_INFO bsi[SWITCHABLE_FILTERS];
@@ -4364,7 +4364,8 @@
 
         // TODO(debargha): enhance this test with a better distortion prediction
         // based on qp, activity mask and history
-        if (cpi->sf.mode_search_skip_flags & FLAG_EARLY_TERMINATE) {
+        if ((cpi->sf.mode_search_skip_flags & FLAG_EARLY_TERMINATE) &&
+            (mode_index > MIN_EARLY_TERM_INDEX)) {
           const int qstep = xd->plane[0].dequant[1];
           // TODO(debargha): Enhance this by specializing for each mode_index
           int scale = 4;
--