shithub: libvpx

Download patch

ref: 05be0987486d02f9b104270896ea77b60849c3e0
parent: 2dc04461f26b749cee78b8834c066316031b0107
parent: 757a45f3ebcb62ae1262c80f68eee447d6788de5
author: John Koleszar <jkoleszar@google.com>
date: Thu Jan 13 06:35:00 EST 2011

Merge remote branch 'internal/upstream-experimental' into HEAD

--- a/vp8/common/postproc.c
+++ b/vp8/common/postproc.c
@@ -680,7 +680,6 @@
 
 int vp8_post_proc_frame(VP8_COMMON *oci, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *ppflags)
 {
-    char message[512];
     int q = oci->filter_level * 10 / 6;
     int flags = ppflags->post_proc_flag;
     int deblock_level = ppflags->deblocking_level;
@@ -744,6 +743,7 @@
 #if CONFIG_POSTPROC_VISUALIZER
     if (flags & VP8D_DEBUG_TXT_FRAME_INFO)
     {
+        char message[512];
         sprintf(message, "F%1dG%1dQ%3dF%3dP%d_s%dx%d",
                 (oci->frame_type == KEY_FRAME),
                 oci->refresh_golden_frame,
@@ -823,6 +823,7 @@
 
     if (flags & VP8D_DEBUG_TXT_RATE_INFO)
     {
+        char message[512];
         sprintf(message, "Bitrate: %10.2f frame_rate: %10.2f ", oci->bitrate, oci->framerate);
         vp8_blit_text(message, oci->post_proc_buffer.y_buffer, oci->post_proc_buffer.y_stride);
     }
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -485,7 +485,6 @@
 
 static void stop_token_decoder(VP8D_COMP *pbi)
 {
-    int i;
     VP8_COMMON *pc = &pbi->common;
 
     if (pc->multi_token_partition != ONE_PARTITION)
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -451,7 +451,6 @@
 #if CONFIG_MULTITHREAD
     int core_count = 0;
     int ithread;
-    int i;
 
     pbi->b_multithreaded_rd = 0;
     pbi->allocated_decoding_thread_count = 0;
@@ -721,7 +720,6 @@
     /*int mb_row;
     int mb_col;
     int baseline_filter_level[MAX_MB_SEGMENTS];*/
-    int filter_level;
     int alt_flt_enabled = mbd->segmentation_enabled;
 
     int i;
@@ -769,7 +767,7 @@
 
     int ibc = 0;
     int num_part = 1 << pbi->common.multi_token_partition;
-    int i, j;
+    int i;
     volatile int *last_row_current_mb_col = NULL;
     int nsync = pbi->sync_range;
 
@@ -809,7 +807,6 @@
 
     for (mb_row = 0; mb_row < pc->mb_rows; mb_row += (pbi->decoding_thread_count + 1))
     {
-        int i;
 
         xd->current_bc = &pbi->mbc[mb_row%num_part];
 
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -416,7 +416,6 @@
     int sum;
     unsigned int a;
     unsigned int b;
-    unsigned int d;
     /* TODO: This could also be done over smaller areas (8x8), but that would
      *  require extensive changes elsewhere, as lambda is assumed to be fixed
      *  over an entire MB in most of the code.
@@ -674,7 +673,6 @@
     VP8_COMMON *const cm = & cpi->common;
     MACROBLOCKD *const xd = & x->e_mbd;
 
-    int i;
     TOKENEXTRA *tp = cpi->tok;
 #if CONFIG_SEGMENTATION
     int segment_counts[MAX_MB_SEGMENTS + SEEK_SEGID];
--- a/vp8/encoder/encodemb.c
+++ b/vp8/encoder/encodemb.c
@@ -273,7 +273,6 @@
     int x;
     int sz;
     int next;
-    int path;
     int rdmult;
     int rddiv;
     int final_eob;
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -262,7 +262,6 @@
      * macroblock.
      */
     size_t stats_sz;
-    FIRSTPASS_STATS stats;
 
     stats_sz = sizeof(FIRSTPASS_STATS) + mb_count;
     stats_sz = (stats_sz + 7) & ~7;
@@ -389,8 +388,6 @@
 }
 void vp8_fpmm_reset_pos(VP8_COMP *cpi, unsigned char *target_pos)
 {
-    int Offset;
-
     cpi->fp_motion_map_stats = target_pos;
 }
 
@@ -983,10 +980,10 @@
     // Restriction on active max q for constrained quality mode.
     if ( (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
          (Q < cpi->cq_target_quality) )
-         //(Q < cpi->oxcf.cq_target_quality) )
+         //(Q < cpi->oxcf.cq_level;) )
     {
         Q = cpi->cq_target_quality;
-        //Q = cpi->oxcf.cq_target_quality;
+        //Q = cpi->oxcf.cq_level;
     }
 
     // Adjust maxq_min_limit and maxq_max_limit limits based on
@@ -2289,6 +2286,9 @@
 
     cpi->common.frame_type = KEY_FRAME;
 
+    // is this a forced key frame by interval
+    cpi->this_key_frame_forced = cpi->next_key_frame_forced;
+
     // Clear the alt ref active flag as this can never be active on a key frame
     cpi->source_alt_ref_active = FALSE;
 
@@ -2351,7 +2351,11 @@
         kf_group_err /= 2.0;
         kf_group_intra_err /= 2.0;
         kf_group_coded_err /= 2.0;
+
+        cpi->next_key_frame_forced = TRUE;
     }
+    else
+        cpi->next_key_frame_forced = FALSE;
 
     // Special case for the last frame of the file
     if (cpi->stats_in >= cpi->stats_in_end)
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -589,6 +589,7 @@
     sf->iterative_sub_pixel = 1;
     sf->optimize_coefficients = 1;
     sf->use_fastquant_for_pick = 0;
+    sf->no_skip_block4x4_search = 1;
 
     sf->first_step = 0;
     sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
@@ -791,6 +792,7 @@
 
             sf->first_step = 1;
             sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
+            sf->no_skip_block4x4_search = 0;
         }
 
         if (Speed > 1)
@@ -2266,6 +2268,8 @@
 
     cpi->frames_since_key = 8;        // Give a sensible default for the first frame.
     cpi->key_frame_frequency = cpi->oxcf.key_freq;
+    cpi->this_key_frame_forced = FALSE;
+    cpi->next_key_frame_forced = FALSE;
 
     cpi->source_alt_ref_pending = FALSE;
     cpi->source_alt_ref_active = FALSE;
@@ -3792,8 +3796,6 @@
     if (cpi->pass == 2 || (cm->current_video_frame > 150))
     {
         int Q;
-        int i;
-        int bpm_target;
         //int tmp;
 
         vp8_clear_system_state();
@@ -3817,10 +3819,22 @@
            // KEY FRAMES
            else
            {
-               if (cpi->gfu_boost > 600)
-                   cpi->active_best_quality = kf_low_motion_minq[Q];
-               else
-                   cpi->active_best_quality = kf_high_motion_minq[Q];
+                // Special case for key frames forced because we have reached
+                // the maximum key frame interval. Here force the Q to a range
+                // close to but just below the ambient Q to reduce the risk
+                // of popping
+                if ( cpi->this_key_frame_forced )
+                {
+                    cpi->active_worst_quality = cpi->avg_frame_qindex * 7/8;
+                    cpi->active_best_quality = cpi->avg_frame_qindex * 2/3;
+                }
+                else
+                {
+                   if (cpi->gfu_boost > 600)
+                       cpi->active_best_quality = kf_low_motion_minq[Q];
+                   else
+                       cpi->active_best_quality = kf_high_motion_minq[Q];
+                }
            }
         }
         else
@@ -4827,7 +4841,9 @@
 #endif
 int vp8_receive_raw_frame(VP8_PTR ptr, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, INT64 time_stamp, INT64 end_time)
 {
+#if HAVE_ARMV7
     INT64 store_reg[8];
+#endif
     VP8_COMP *cpi = (VP8_COMP *) ptr;
     VP8_COMMON *cm = &cpi->common;
     struct vpx_usec_timer  timer;
@@ -4930,7 +4946,9 @@
 }
 int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, INT64 *time_stamp, INT64 *time_end, int flush)
 {
+#if HAVE_ARMV7
     INT64 store_reg[8];
+#endif
     VP8_COMP *cpi = (VP8_COMP *) ptr;
     VP8_COMMON *cm = &cpi->common;
     struct vpx_usec_timer  tsctimer;
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -183,6 +183,7 @@
     int optimize_coefficients;
 
     int use_fastquant_for_pick;
+    int no_skip_block4x4_search;
 
 } SPEED_FEATURES;
 
@@ -320,7 +321,8 @@
 
     unsigned int frames_since_key;
     unsigned int key_frame_frequency;
-    unsigned int next_key;
+    unsigned int this_key_frame_forced;
+    unsigned int next_key_frame_forced;
 
     unsigned int mode_check_freq[MAX_MODES];
     unsigned int mode_test_hit_counts[MAX_MODES];
--- a/vp8/encoder/quantize.c
+++ b/vp8/encoder/quantize.c
@@ -70,7 +70,6 @@
 void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
 {
     int i, rc, eob;
-    int zbin;
     int x, y, z, sz;
     short *coeff_ptr   = b->coeff;
     short *round_ptr   = b->round;
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1375,7 +1375,8 @@
             }
 
             /* If 8x8 is better than 16x8/8x16, then do 4x4 search */
-            if (bsi.segment_num == BLOCK_8X8)  /* || (sv_segment_rd8x8-bsi.segment_rd) < sv_segment_rd8x8>>5) */
+            /* Not skip 4x4 if speed=0 (good quality) */
+            if (cpi->sf.no_skip_block4x4_search || bsi.segment_num == BLOCK_8X8)  /* || (sv_segment_rd8x8-bsi.segment_rd) < sv_segment_rd8x8>>5) */
             {
                 bsi.mvp = &bsi.sv_mvp[0];
                 vp8_rd_check_segment(cpi, x, &bsi, BLOCK_4X4);
--- a/vp8/encoder/x86/temporal_filter_apply_sse2.asm
+++ b/vp8/encoder/x86/temporal_filter_apply_sse2.asm
@@ -84,7 +84,7 @@
         jmp         temporal_filter_apply_load_finished
 
 temporal_filter_apply_load_16:
-        movdqa      xmm0,           [rsi]  ; src (frame1)
+        movdqu      xmm0,           [rsi]  ; src (frame1)
         lea         rsi,            [rsi + rbp] ; += stride
         movdqa      xmm1,           xmm0
         punpcklbw   xmm0,           xmm7   ; src[ 0- 7]