shithub: libvpx

Download patch

ref: eee331e7f3185b57a3c64d97b999422925064f49
parent: 1d7c6e79d9df0512291a824de2af4ac1b3855bed
parent: c49f49b113ce06f5dfb67327aab7761f561de0d2
author: John Koleszar <jkoleszar@google.com>
date: Fri Dec 17 19:05:13 EST 2010

Merge remote branch 'origin/master' into experimental

Change-Id: Iae8b85d2f6ad4d854c43dded8588e054906f7156

--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -683,6 +683,32 @@
         sf->thresh_mult[THR_NEARG    ] = 1000;
         sf->thresh_mult[THR_NEARA    ] = 1000;
 
+#if 1
+        sf->thresh_mult[THR_ZEROMV   ] = 0;
+        sf->thresh_mult[THR_ZEROG    ] = 0;
+        sf->thresh_mult[THR_ZEROA    ] = 0;
+        sf->thresh_mult[THR_NEARESTMV] = 0;
+        sf->thresh_mult[THR_NEARESTG ] = 0;
+        sf->thresh_mult[THR_NEARESTA ] = 0;
+        sf->thresh_mult[THR_NEARMV   ] = 0;
+        sf->thresh_mult[THR_NEARG    ] = 0;
+        sf->thresh_mult[THR_NEARA    ] = 0;
+
+//        sf->thresh_mult[THR_DC       ] = 0;
+
+//        sf->thresh_mult[THR_V_PRED   ] = 1000;
+//        sf->thresh_mult[THR_H_PRED   ] = 1000;
+//        sf->thresh_mult[THR_B_PRED   ] = 2000;
+//        sf->thresh_mult[THR_TM       ] = 1000;
+
+        sf->thresh_mult[THR_NEWMV    ] = 1000;
+        sf->thresh_mult[THR_NEWG     ] = 1000;
+        sf->thresh_mult[THR_NEWA     ] = 1000;
+
+        sf->thresh_mult[THR_SPLITMV  ] = 1700;
+        sf->thresh_mult[THR_SPLITG   ] = 4500;
+        sf->thresh_mult[THR_SPLITA   ] = 4500;
+#else
         sf->thresh_mult[THR_NEWMV    ] = 1500;
         sf->thresh_mult[THR_NEWG     ] = 1500;
         sf->thresh_mult[THR_NEWA     ] = 1500;
@@ -690,7 +716,7 @@
         sf->thresh_mult[THR_SPLITMV  ] = 5000;
         sf->thresh_mult[THR_SPLITG   ] = 10000;
         sf->thresh_mult[THR_SPLITA   ] = 10000;
-
+#endif
         sf->full_freq[0] = 15;
         sf->full_freq[1] = 31;
 
@@ -731,7 +757,7 @@
 
             cpi->mode_check_freq[THR_SPLITG] = 4;
             cpi->mode_check_freq[THR_SPLITA] = 4;
-            cpi->mode_check_freq[THR_SPLITMV] = 2;
+            cpi->mode_check_freq[THR_SPLITMV] = 0;
 
             sf->thresh_mult[THR_TM       ] = 1500;
             sf->thresh_mult[THR_V_PRED   ] = 1500;
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1038,7 +1038,7 @@
   int d;
   int segment_yrate;
   B_PREDICTION_MODE modes[16];
-  MV mvs[16];
+  int_mv mvs[16];
   unsigned char eobs[16];
 
   int mvthresh;
@@ -1276,7 +1276,7 @@
         {
             BLOCKD *bd = &x->e_mbd.block[i];
 
-            bsi->mvs[i] = bd->bmi.mv.as_mv;
+            bsi->mvs[i].as_mv = bd->bmi.mv.as_mv;
             bsi->modes[i] = bd->bmi.mode;
             bsi->eobs[i] = bd->eob;
         }
@@ -1305,19 +1305,32 @@
     {
         bsi.modes[i] = ZERO4X4;
     }
+    if(cpi->compressor_speed == 0)
+    {
+        /* for now, we will keep the original segmentation order
+           when in best quality mode */
+        vp8_rd_check_segment(cpi, x, &bsi, BLOCK_16X8);
+        vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X16);
+        vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X8);
+        vp8_rd_check_segment(cpi, x, &bsi, BLOCK_4X4);
+    }
+    else
+    {
+        vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X8);
+        if (bsi.segment_rd < best_rd)
+        {
+          vp8_rd_check_segment(cpi, x, &bsi, BLOCK_8X16);
+          vp8_rd_check_segment(cpi, x, &bsi, BLOCK_16X8);
+          vp8_rd_check_segment(cpi, x, &bsi, BLOCK_4X4);
+        }
+    }
 
-    /* original */
-    vp8_rd_check_segment(cpi, x, &bsi, 0);
-    vp8_rd_check_segment(cpi, x, &bsi, 1);
-    vp8_rd_check_segment(cpi, x, &bsi, 2);
-    vp8_rd_check_segment(cpi, x, &bsi, 3);
-
     /* set it to the best */
     for (i = 0; i < 16; i++)
     {
         BLOCKD *bd = &x->e_mbd.block[i];
 
-        bd->bmi.mv.as_mv = bsi.mvs[i];
+        bd->bmi.mv.as_mv = bsi.mvs[i].as_mv;
         bd->bmi.mode = bsi.modes[i];
         bd->eob = bsi.eobs[i];
     }
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -466,6 +466,7 @@
             vpx_img_set_rect(&ctx->img,
                              VP8BORDERINPIXELS, VP8BORDERINPIXELS,
                              sd.y_width, sd.y_height);
+            ctx->img.user_priv = user_priv;
             ctx->img_avail = 1;
 
         }
@@ -688,6 +689,26 @@
 #endif
 }
 
+static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
+                                                int ctrl_id,
+                                                va_list args)
+{
+    int *update_info = va_arg(args, int *);
+    VP8D_COMP *pbi = (VP8D_COMP *)ctx->pbi;
+
+    if (update_info)
+    {
+        *update_info = pbi->common.refresh_alt_ref_frame * (int) VP8_ALTR_FRAME
+            + pbi->common.refresh_golden_frame * (int) VP8_GOLD_FRAME
+            + pbi->common.refresh_last_frame * (int) VP8_LAST_FRAME;
+
+        return VPX_CODEC_OK;
+    }
+    else
+        return VPX_CODEC_INVALID_PARAM;
+}
+
+
 vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] =
 {
     {VP8_SET_REFERENCE,             vp8_set_reference},
@@ -697,6 +718,7 @@
     {VP8_SET_DBG_COLOR_MB_MODES,    vp8_set_dbg_options},
     {VP8_SET_DBG_COLOR_B_MODES,     vp8_set_dbg_options},
     {VP8_SET_DBG_DISPLAY_MV,        vp8_set_dbg_options},
+    {VP8D_GET_LAST_REF_UPDATES,     vp8_get_last_ref_updates},
     { -1, NULL},
 };
 
--- a/vpx/vp8dx.h
+++ b/vpx/vp8dx.h
@@ -36,6 +36,30 @@
 #include "vp8.h"
 
 
+/*!\brief VP8 decoder control functions
+ *
+ * The set of macros define the control functions of VP8 decoder interface
+ */
+enum vp8d_dec_control_id
+{
+    VP8_DECODER_CTRL_ID_START   = 256,
+    VP8D_GET_LAST_REF_UPDATES,              /**< control function to get info on which reference frames were updated
+                                            by the last decode */
+    VP8_DECODER_CTRL_ID_MAX
+} ;
+
+
+/*!\brief VP8 encoder control function parameter type
+ *
+ * Defines the data types that VP8E control functions take. Note that
+ * additional common controls are defined in vp8.h
+ *
+ */
+
+
+VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES,   int *)
+
+
 /*! @} - end defgroup vp8_decoder */