shithub: libvpx

Download patch

ref: 14c9fce8e417cb8865c0ddf98ca23a39329c9690
parent: f2a6799cc90d8aa17deaf96e1bcbda119864d581
author: Attila Nagy <attilanagy@google.com>
date: Fri Apr 27 09:41:58 EDT 2012

Fix compiler warnings

Fix code for following warnings:
-Wimplicit-function-declaration
-Wuninitialized
-Wunused-but-set-variable
-Wunused-variable

Change-Id: I2be434f22fdecb903198e8b0711255b4c1a2947a

--- a/configure
+++ b/configure
@@ -528,6 +528,10 @@
         check_add_cflags -Wpointer-arith
         check_add_cflags -Wtype-limits
         check_add_cflags -Wcast-qual
+        check_add_cflags -Wimplicit-function-declaration
+        check_add_cflags -Wuninitialized
+        check_add_cflags -Wunused-variable
+        check_add_cflags -Wunused-but-set-variable        
         enabled extra_warnings || check_add_cflags -Wno-unused-function
     fi
 
--- a/vp8/common/arm/variance_arm.c
+++ b/vp8/common/arm/variance_arm.c
@@ -97,6 +97,17 @@
 
 #if HAVE_NEON
 
+extern unsigned int vp8_sub_pixel_variance16x16_neon_func
+(
+    const unsigned char  *src_ptr,
+    int  src_pixels_per_line,
+    int  xoffset,
+    int  yoffset,
+    const unsigned char *dst_ptr,
+    int dst_pixels_per_line,
+    unsigned int *sse
+);
+
 unsigned int vp8_sub_pixel_variance16x16_neon
 (
     const unsigned char  *src_ptr,
--- a/vp8/common/mbpitch.c
+++ b/vp8/common/mbpitch.c
@@ -11,45 +11,6 @@
 
 #include "blockd.h"
 
-typedef enum
-{
-    PRED = 0,
-    DEST = 1
-} BLOCKSET;
-
-static void setup_macroblock(MACROBLOCKD *x, BLOCKSET bs)
-{
-    int block;
-
-    unsigned char **y, **u, **v;
-
-    if (bs == DEST)
-    {
-        y = &x->dst.y_buffer;
-        u = &x->dst.u_buffer;
-        v = &x->dst.v_buffer;
-    }
-    else
-    {
-        y = &x->pre.y_buffer;
-        u = &x->pre.u_buffer;
-        v = &x->pre.v_buffer;
-    }
-
-    for (block = 0; block < 16; block++) /* y blocks */
-    {
-        x->block[block].offset =
-            (block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4;
-    }
-
-    for (block = 16; block < 20; block++) /* U and V blocks */
-    {
-        x->block[block+4].offset =
-        x->block[block].offset =
-            ((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4;
-    }
-}
-
 void vp8_setup_block_dptrs(MACROBLOCKD *x)
 {
     int r, c;
@@ -90,8 +51,18 @@
 
 void vp8_build_block_doffsets(MACROBLOCKD *x)
 {
+    int block;
 
-    /* handle the destination pitch features */
-    setup_macroblock(x, DEST);
-    setup_macroblock(x, PRED);
+    for (block = 0; block < 16; block++) /* y blocks */
+    {
+        x->block[block].offset =
+            (block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4;
+    }
+
+    for (block = 16; block < 20; block++) /* U and V blocks */
+    {
+        x->block[block+4].offset =
+        x->block[block].offset =
+            ((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4;
+    }
 }
--- a/vp8/common/mfqe.c
+++ b/vp8/common/mfqe.c
@@ -118,7 +118,7 @@
 #define USE_SSD
 static void multiframe_quality_enhance_block
 (
-    int blksize, /* Currently only values supported are 16, 8, 4 */
+    int blksize, /* Currently only values supported are 16, 8 */
     int qcurr,
     int qprev,
     unsigned char *y,
@@ -140,9 +140,7 @@
     int uvblksize = blksize >> 1;
     int qdiff = qcurr - qprev;
 
-    int i, j;
-    unsigned char *yp;
-    unsigned char *ydp;
+    int i;
     unsigned char *up;
     unsigned char *udp;
     unsigned char *vp;
@@ -167,7 +165,7 @@
         vsad = (vp8_sad8x8(v, uv_stride, vd, uvd_stride, INT_MAX)+32)>>6;
 #endif
     }
-    else if (blksize == 8)
+    else /* if (blksize == 8) */
     {
         actd = (vp8_variance8x8(yd, yd_stride, VP8_ZEROS, 0, &sse)+32)>>6;
         act = (vp8_variance8x8(y, y_stride, VP8_ZEROS, 0, &sse)+32)>>6;
--- a/vp8/common/rtcd_defs.sh
+++ b/vp8/common/rtcd_defs.sh
@@ -129,6 +129,7 @@
 prototype void vp8_build_intra_predictors_mbuv_s "struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row,  unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride"
 specialize vp8_build_intra_predictors_mbuv_s sse2 ssse3
 
+prototype void vp8_intra4x4_predict_d "unsigned char *above, unsigned char *left, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left"
 prototype void vp8_intra4x4_predict "unsigned char *src, int src_stride, int b_mode, unsigned char *dst, int dst_stride"
 specialize vp8_intra4x4_predict media
 vp8_intra4x4_predict_media=vp8_intra4x4_predict_armv6
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -508,7 +508,7 @@
 {
     VP8_COMMON* pc = &pbi->common;
     const unsigned char *partition_size_ptr = token_part_sizes + i * 3;
-    unsigned int partition_size;
+    unsigned int partition_size = 0;
     ptrdiff_t bytes_left = fragment_end - fragment_start;
     /* Calculate the length of this partition. The last partition
      * size is implicit. If the partition size can't be read, then
--- a/vp8/encoder/arm/neon/picklpf_arm.c
+++ b/vp8/encoder/arm/neon/picklpf_arm.c
@@ -22,11 +22,9 @@
     unsigned char *src_y, *dst_y;
     int yheight;
     int ystride;
-    int border;
     int yoffset;
     int linestocopy;
 
-    border   = src_ybc->border;
     yheight  = src_ybc->y_height;
     ystride  = src_ybc->y_stride;
 
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -521,12 +521,11 @@
     const MV_CONTEXT *mvc = pc->fc.mvc;
 
 
-    MODE_INFO *m = pc->mi, *ms;
+    MODE_INFO *m = pc->mi;
     const int mis = pc->mode_info_stride;
     int mb_row = -1;
 
     int prob_skip_false = 0;
-    ms = pc->mi - 1;
 
     cpi->mb.partition_info = cpi->mb.pi;
 
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -2313,12 +2313,9 @@
     FIRSTPASS_STATS this_frame = {0};
     FIRSTPASS_STATS this_frame_copy;
 
-    double this_frame_error;
     double this_frame_intra_error;
     double this_frame_coded_error;
 
-    FIRSTPASS_STATS *start_pos;
-
     int overhead_bits;
 
     if (!cpi->twopass.stats_in)
@@ -2331,11 +2328,8 @@
     if (EOF == input_stats(cpi, &this_frame))
         return;
 
-    this_frame_error = this_frame.ssim_weighted_pred_err;
     this_frame_intra_error = this_frame.intra_error;
     this_frame_coded_error = this_frame.coded_error;
-
-    start_pos = cpi->twopass.stats_in;
 
     // keyframe and section processing !
     if (cpi->twopass.frames_to_key == 0)
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1030,8 +1030,10 @@
 
 static void alloc_raw_frame_buffers(VP8_COMP *cpi)
 {
+#if VP8_TEMPORAL_ALT_REF
     int width = (cpi->oxcf.Width + 15) & ~15;
     int height = (cpi->oxcf.Height + 15) & ~15;
+#endif
 
     cpi->lookahead = vp8_lookahead_init(cpi->oxcf.Width, cpi->oxcf.Height,
                                         cpi->oxcf.lag_in_frames);
@@ -3180,9 +3182,11 @@
 
     int Loop = 0;
     int loop_count;
-    int this_q;
-    int last_zbin_oq;
 
+    VP8_COMMON *cm = &cpi->common;
+    int active_worst_qchanged = 0;
+
+#if !(CONFIG_REALTIME_ONLY)
     int q_low;
     int q_high;
     int zbin_oq_high;
@@ -3189,11 +3193,10 @@
     int zbin_oq_low = 0;
     int top_index;
     int bottom_index;
-    VP8_COMMON *cm = &cpi->common;
-    int active_worst_qchanged = 0;
-
     int overshoot_seen = 0;
     int undershoot_seen = 0;
+#endif
+
     int drop_mark = cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100;
     int drop_mark75 = drop_mark * 2 / 3;
     int drop_mark50 = drop_mark / 4;
@@ -3353,7 +3356,6 @@
         {
             cpi->decimation_factor = 1;
         }
-
         //vpx_log("Encoder: Decimation Factor: %d \n",cpi->decimation_factor);
     }
 
@@ -3595,8 +3597,9 @@
 
     // Determine initial Q to try
     Q = vp8_regulate_q(cpi, cpi->this_frame_target);
-    last_zbin_oq = cpi->zbin_over_quant;
 
+#if !(CONFIG_REALTIME_ONLY)
+
     // Set highest allowed value for Zbin over quant
     if (cm->frame_type == KEY_FRAME)
         zbin_oq_high = 0; //ZBIN_OQ_MAX/16
@@ -3607,6 +3610,7 @@
     }
     else
         zbin_oq_high = ZBIN_OQ_MAX;
+#endif
 
     // Setup background Q adjustment for error resilient mode.
     // For multi-layer encodes only enable this for the base layer.
@@ -3615,18 +3619,20 @@
 
     vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_shoot_limit);
 
+#if !(CONFIG_REALTIME_ONLY)
     // Limit Q range for the adaptive loop.
     bottom_index = cpi->active_best_quality;
     top_index    = cpi->active_worst_quality;
     q_low  = cpi->active_best_quality;
     q_high = cpi->active_worst_quality;
+#endif
 
     vp8_save_coding_context(cpi);
 
     loop_count = 0;
 
-
     scale_and_extend_source(cpi->un_scaled_source, cpi);
+
 #if !(CONFIG_REALTIME_ONLY) && CONFIG_POSTPROC && !(CONFIG_TEMPORAL_DENOISING)
 
     if (cpi->oxcf.noise_sensitivity > 0)
@@ -3690,7 +3696,6 @@
             */
 
         vp8_set_quantizer(cpi, Q);
-        this_q = Q;
 
         // setup skip prob for costing in mode/mv decision
         if (cpi->common.mb_no_coeff_skip)
@@ -3813,9 +3818,10 @@
             if (cpi->compressor_speed == 2)
             {
                 /* we don't do re-encoding in realtime mode
-                 * if key frame is decided than we force it on next frame */
+                 * if key frame is decided then we force it on next frame */
                 cpi->force_next_frame_intra = key_frame_decision;
             }
+#if !(CONFIG_REALTIME_ONLY)
             else if (key_frame_decision)
             {
                 // Reset all our sizing numbers and recode
@@ -3853,6 +3859,7 @@
 
                 continue;
             }
+#endif
         }
 
         vp8_clear_system_state();
@@ -3872,10 +3879,12 @@
             while ((cpi->active_worst_quality < cpi->worst_quality) && (over_size_percent > 0))
             {
                 cpi->active_worst_quality++;
-                top_index = cpi->active_worst_quality;
+
                 over_size_percent = (int)(over_size_percent * 0.96);        // Assume 1 qstep = about 4% on frame size.
             }
-
+#if !(CONFIG_REALTIME_ONLY)
+            top_index = cpi->active_worst_quality;
+#endif
             // If we have updated the active max Q do not call vp8_update_rate_correction_factors() this loop.
             active_worst_qchanged = 1;
         }
@@ -4034,9 +4043,7 @@
             // Clamp cpi->zbin_over_quant
             cpi->zbin_over_quant = (cpi->zbin_over_quant < zbin_oq_low) ? zbin_oq_low : (cpi->zbin_over_quant > zbin_oq_high) ? zbin_oq_high : cpi->zbin_over_quant;
 
-            //Loop = (Q != last_q) || (last_zbin_oq != cpi->zbin_over_quant);
             Loop = Q != last_q;
-            last_zbin_oq = cpi->zbin_over_quant;
         }
         else
 #endif
--- a/vp8/encoder/picklpf.c
+++ b/vp8/encoder/picklpf.c
@@ -29,11 +29,9 @@
     unsigned char *src_y, *dst_y;
     int yheight;
     int ystride;
-    int border;
     int yoffset;
     int linestocopy;
 
-    border   = src_ybc->border;
     yheight  = src_ybc->y_height;
     ystride  = src_ybc->y_stride;
 
--- a/vp8/encoder/temporal_filter.c
+++ b/vp8/encoder/temporal_filter.c
@@ -148,7 +148,6 @@
 {
     MACROBLOCK *x = &cpi->mb;
     int step_param;
-    int further_steps;
     int sadpb = x->sadperbit16;
     int bestsme = INT_MAX;
 
@@ -184,15 +183,11 @@
     // Further step/diamond searches as necessary
     if (cpi->Speed < 8)
     {
-        step_param = cpi->sf.first_step +
-                    (cpi->Speed > 5);
-        further_steps =
-            (cpi->sf.max_step_search_steps - 1)-step_param;
+        step_param = cpi->sf.first_step + (cpi->Speed > 5);
     }
     else
     {
         step_param = cpi->sf.first_step + 2;
-        further_steps = 0;
     }
 
     /*cpi->sf.search_method == HEX*/
--- a/vp8_scalable_patterns.c
+++ b/vp8_scalable_patterns.c
@@ -438,6 +438,7 @@
     }
 
     case 8:
+    default:
     {
         // 3-layers
         int ids[4] = {0,2,1,2};
@@ -469,8 +470,6 @@
                          VP8_EFLAG_NO_UPD_ENTROPY;
         break;
     }
-    default:
-        break;
     }
 
     // Open input file
--- a/vpx/vpx_encoder.h
+++ b/vpx/vpx_encoder.h
@@ -32,7 +32,12 @@
 #define VPX_ENCODER_H
 #include "vpx_codec.h"
 
+/*! Temporal Scalability: Maximum length of the sequence defining frame
+ * layer membership
+ */
 #define MAX_PERIODICITY 16
+
+/*! Temporal Scalability: Maximum number of coding layers */
 #define MAX_LAYERS       5
 
     /*!\brief Current ABI version number
--