From 14c9fce8e417cb8865c0ddf98ca23a39329c9690 Mon Sep 17 00:00:00 2001 From: Attila Nagy Date: Fri, 27 Apr 2012 13:41:58 +0300 Subject: [PATCH] Fix compiler warnings Fix code for following warnings: -Wimplicit-function-declaration -Wuninitialized -Wunused-but-set-variable -Wunused-variable Change-Id: I2be434f22fdecb903198e8b0711255b4c1a2947a --- configure | 4 +++ vp8/common/arm/variance_arm.c | 11 ++++++++ vp8/common/mbpitch.c | 55 +++++++++----------------------------- vp8/common/mfqe.c | 8 +++--- vp8/common/rtcd_defs.sh | 1 + vp8/decoder/decodframe.c | 2 +- vp8/encoder/arm/neon/picklpf_arm.c | 2 -- vp8/encoder/bitstream.c | 3 +-- vp8/encoder/firstpass.c | 6 ----- vp8/encoder/onyx_if.c | 35 ++++++++++++++---------- vp8/encoder/picklpf.c | 2 -- vp8/encoder/temporal_filter.c | 7 +---- vp8_scalable_patterns.c | 3 +-- vpx/vpx_encoder.h | 5 ++++ 14 files changed, 62 insertions(+), 82 deletions(-) diff --git a/configure b/configure index c5da0e3..62e1ffb 100755 --- a/configure +++ b/configure @@ -528,6 +528,10 @@ process_toolchain() { 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 diff --git a/vp8/common/arm/variance_arm.c b/vp8/common/arm/variance_arm.c index 41d5eb3..891d767 100644 --- a/vp8/common/arm/variance_arm.c +++ b/vp8/common/arm/variance_arm.c @@ -97,6 +97,17 @@ unsigned int vp8_sub_pixel_variance16x16_armv6 #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, diff --git a/vp8/common/mbpitch.c b/vp8/common/mbpitch.c index 32025fa..32e1b66 100644 --- 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_setup_block_dptrs(MACROBLOCKD *x) 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; + } } diff --git a/vp8/common/mfqe.c b/vp8/common/mfqe.c index 1c5eadf..ca67e91 100644 --- a/vp8/common/mfqe.c +++ b/vp8/common/mfqe.c @@ -118,7 +118,7 @@ static unsigned int int_sqrt(unsigned int x) #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 @@ static void multiframe_quality_enhance_block 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 @@ static void multiframe_quality_enhance_block 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; diff --git a/vp8/common/rtcd_defs.sh b/vp8/common/rtcd_defs.sh index 9c7ebf4..99860d0 100644 --- a/vp8/common/rtcd_defs.sh +++ b/vp8/common/rtcd_defs.sh @@ -129,6 +129,7 @@ specialize vp8_build_intra_predictors_mby_s sse2 ssse3 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 diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index f75e8ee..7dbde9e 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -508,7 +508,7 @@ static unsigned int read_available_partition_size( { 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 diff --git a/vp8/encoder/arm/neon/picklpf_arm.c b/vp8/encoder/arm/neon/picklpf_arm.c index 6610d2d..ec8071e 100644 --- a/vp8/encoder/arm/neon/picklpf_arm.c +++ b/vp8/encoder/arm/neon/picklpf_arm.c @@ -22,11 +22,9 @@ void vp8_yv12_copy_partial_frame_neon(YV12_BUFFER_CONFIG *src_ybc, 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; diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index af00f7c..7cbeb5d 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -521,12 +521,11 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) 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; diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c index ac83622..4f6afc9 100644 --- a/vp8/encoder/firstpass.c +++ b/vp8/encoder/firstpass.c @@ -2313,12 +2313,9 @@ void vp8_second_pass(VP8_COMP *cpi) 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,12 +2328,9 @@ void vp8_second_pass(VP8_COMP *cpi) 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) { diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 43caf20..b4429cd 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -1030,8 +1030,10 @@ void vp8_set_speed_features(VP8_COMP *cpi) 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,20 +3182,21 @@ static void encode_frame_to_data_rate 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; 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 @@ static void encode_frame_to_data_rate { cpi->decimation_factor = 1; } - //vpx_log("Encoder: Decimation Factor: %d \n",cpi->decimation_factor); } @@ -3595,7 +3597,8 @@ static void encode_frame_to_data_rate // 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) @@ -3607,6 +3610,7 @@ static void encode_frame_to_data_rate } 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 @@ static void encode_frame_to_data_rate 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 @@ static void encode_frame_to_data_rate */ 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 @@ static void encode_frame_to_data_rate 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 @@ static void encode_frame_to_data_rate continue; } +#endif } vp8_clear_system_state(); @@ -3872,10 +3879,12 @@ static void encode_frame_to_data_rate 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 @@ static void encode_frame_to_data_rate // 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 diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c index eb54819..385c807 100644 --- a/vp8/encoder/picklpf.c +++ b/vp8/encoder/picklpf.c @@ -29,11 +29,9 @@ void vp8_yv12_copy_partial_frame_c(YV12_BUFFER_CONFIG *src_ybc, 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; diff --git a/vp8/encoder/temporal_filter.c b/vp8/encoder/temporal_filter.c index 7e7def4..dfe8531 100644 --- a/vp8/encoder/temporal_filter.c +++ b/vp8/encoder/temporal_filter.c @@ -148,7 +148,6 @@ static int vp8_temporal_filter_find_matching_mb_c { MACROBLOCK *x = &cpi->mb; int step_param; - int further_steps; int sadpb = x->sadperbit16; int bestsme = INT_MAX; @@ -184,15 +183,11 @@ static int vp8_temporal_filter_find_matching_mb_c // 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*/ diff --git a/vp8_scalable_patterns.c b/vp8_scalable_patterns.c index 50cc03a..7fd03f9 100644 --- a/vp8_scalable_patterns.c +++ b/vp8_scalable_patterns.c @@ -438,6 +438,7 @@ int main(int argc, char **argv) { } case 8: + default: { // 3-layers int ids[4] = {0,2,1,2}; @@ -469,8 +470,6 @@ int main(int argc, char **argv) { VP8_EFLAG_NO_UPD_ENTROPY; break; } - default: - break; } // Open input file diff --git a/vpx/vpx_encoder.h b/vpx/vpx_encoder.h index 885ca22..0e4ed09 100644 --- a/vpx/vpx_encoder.h +++ b/vpx/vpx_encoder.h @@ -32,7 +32,12 @@ extern "C" { #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 -- 2.7.4