shithub: libvpx

Download patch

ref: 4070c93bfa85ad77111e169e93ad207177bc7d8a
parent: 255c63b8641036746fc0acd0370c93e15ca918c5
parent: 4a4ade6dc8d6b4af4848c830a359b4a0fc81d1a5
author: John Koleszar <jkoleszar@google.com>
date: Fri May 27 20:05:09 EDT 2011

Merge remote branch 'internal/upstream' into HEAD

--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -144,6 +144,11 @@
     int_mv mv;
 } B_MODE_INFO;
 
+union b_mode_info
+{
+    B_PREDICTION_MODE as_mode;
+    int_mv mv;
+};
 
 typedef enum
 {
@@ -170,11 +175,7 @@
 typedef struct
 {
     MB_MODE_INFO mbmi;
-    union
-    {
-        B_PREDICTION_MODE as_mode;
-        int_mv mv;
-    } bmi[16];
+    union b_mode_info bmi[16];
 } MODE_INFO;
 
 typedef struct
--- a/vp8/decoder/ec_types.h
+++ b/vp8/decoder/ec_types.h
@@ -13,6 +13,8 @@
 
 #define MAX_OVERLAPS 16
 
+
+
 /* The area (pixel area in Q6) the block pointed to by bmi overlaps
  * another block with.
  */
@@ -19,7 +21,7 @@
 typedef struct
 {
     int overlap;
-    B_MODE_INFO *bmi;
+    union b_mode_info *bmi;
 } OVERLAP_NODE;
 
 /* Structure to keep track of overlapping blocks on a block level. */
--- a/vp8/decoder/error_concealment.c
+++ b/vp8/decoder/error_concealment.c
@@ -69,7 +69,7 @@
 
 /* Inserts a new overlap area value to the list of overlaps of a block */
 static void assign_overlap(OVERLAP_NODE* overlaps,
-                           B_MODE_INFO *bmi,
+                           union b_mode_info *bmi,
                            int overlap)
 {
     int i;
@@ -111,7 +111,7 @@
  * first block being overlapped in the macroblock has position (first_blk_row,
  * first_blk_col) in blocks relative the upper-left corner of the image.
  */
-static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, B_MODE_INFO *bmi,
+static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, union b_mode_info *bmi,
                                   int new_row, int new_col,
                                   int mb_row, int mb_col,
                                   int first_blk_row, int first_blk_col)
@@ -171,7 +171,7 @@
 
 void vp8_calculate_overlaps(MB_OVERLAP *overlap_ul,
                             int mb_rows, int mb_cols,
-                            B_MODE_INFO *bmi,
+                            union b_mode_info *bmi,
                             int b_row, int b_col)
 {
     MB_OVERLAP *mb_overlap;
@@ -246,7 +246,7 @@
  * Filters out all overlapping blocks which do not refer to the correct
  * reference frame type.
  */
-static void estimate_mv(const OVERLAP_NODE *overlaps, B_MODE_INFO *bmi)
+static void estimate_mv(const OVERLAP_NODE *overlaps, union b_mode_info *bmi)
 {
     int i;
     int overlap_sum = 0;
@@ -267,13 +267,11 @@
         /* Q9 / Q6 = Q3 */
         bmi->mv.as_mv.col = col_acc / overlap_sum;
         bmi->mv.as_mv.row = row_acc / overlap_sum;
-        bmi->mode = NEW4X4;
     }
     else
     {
         bmi->mv.as_mv.col = 0;
         bmi->mv.as_mv.row = 0;
-        bmi->mode = NEW4X4;
     }
 }
 
@@ -290,7 +288,7 @@
     int i;
     int non_zero_count = 0;
     MV * const filtered_mv = &(mi->mbmi.mv.as_mv);
-    B_MODE_INFO * const bmi = mi->bmi;
+    union b_mode_info * const bmi = mi->bmi;
     filtered_mv->col = 0;
     filtered_mv->row = 0;
     for (i = 0; i < 16; ++i)
@@ -558,7 +556,7 @@
                  */
                 mv->as_mv.row = mv_row_sum / w_sum;
                 mv->as_mv.col = mv_col_sum / w_sum;
-                mi->bmi[row*4 + col].mode = NEW4X4;
+
                 mi->mbmi.need_to_clamp_mvs = vp8_check_mv_bounds(mv,
                                                        mb->mb_to_left_edge,
                                                        mb->mb_to_right_edge,
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1046,11 +1046,9 @@
         {
             sf->auto_filter = 0;                     // Faster selection of loop filter
 
-#if CONFIG_REALTIME_ONLY
             sf->search_method = HEX;
-#else
-            sf->search_method = DIAMOND;
-#endif
+            //sf->search_method = DIAMOND;
+
             sf->iterative_sub_pixel = 0;
 
             cpi->mode_check_freq[THR_V_PRED] = 4;
@@ -3176,15 +3174,21 @@
 
             if (cm->copy_buffer_to_arf == 1)
             {
-                yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG;
-                yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
-                cm->alt_fb_idx = cm->lst_fb_idx;
+                if(cm->alt_fb_idx != cm->lst_fb_idx)
+                {
+                    yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG;
+                    yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+                    cm->alt_fb_idx = cm->lst_fb_idx;
+                }
             }
             else /* if (cm->copy_buffer_to_arf == 2) */
             {
-                yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG;
-                yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
-                cm->alt_fb_idx = cm->gld_fb_idx;
+                if(cm->alt_fb_idx != cm->gld_fb_idx)
+                {
+                    yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG;
+                    yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+                    cm->alt_fb_idx = cm->gld_fb_idx;
+                }
             }
         }
 
@@ -3202,15 +3206,21 @@
 
             if (cm->copy_buffer_to_gf == 1)
             {
-                yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG;
-                yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
-                cm->gld_fb_idx = cm->lst_fb_idx;
+                if(cm->gld_fb_idx != cm->lst_fb_idx)
+                {
+                    yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG;
+                    yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
+                    cm->gld_fb_idx = cm->lst_fb_idx;
+                }
             }
             else /* if (cm->copy_buffer_to_gf == 2) */
             {
-                yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG;
-                yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
-                cm->gld_fb_idx = cm->alt_fb_idx;
+                if(cm->alt_fb_idx != cm->gld_fb_idx)
+                {
+                    yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG;
+                    yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
+                    cm->gld_fb_idx = cm->alt_fb_idx;
+                }
             }
         }
     }
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1204,11 +1204,6 @@
                     c = &x->block[n];
                     e = &x->e_mbd.block[n];
 
-                    if (cpi->sf.search_method == HEX)
-                        bestsme = vp8_hex_search(x, c, e, bsi->ref_mv,
-                                                 &mode_mv[NEW4X4], step_param, sadpb, &num00, v_fn_ptr, x->mvsadcost, x->mvcost, bsi->ref_mv);
-
-                    else
                     {
                         bestsme = cpi->diamond_search_sad(x, c, e, &bsi->mvp,
                                                           &mode_mv[NEW4X4], step_param,
@@ -2131,12 +2126,6 @@
                 step_param = sr;
 
             // Initial step/diamond search
-            if (cpi->sf.search_method == HEX)
-            {
-                bestsme = vp8_hex_search(x, b, d, &best_ref_mv, &d->bmi.mv, step_param, sadpb/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvsadcost, x->mvcost, &best_ref_mv);
-                mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
-            }
-            else
             {
                 bestsme = cpi->diamond_search_sad(x, b, d, &mvp, &d->bmi.mv, step_param, sadpb / 2/*x->errorperbit*/, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvcost, &best_ref_mv); //sadpb < 9
                 mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
--