diff options
author | Deb Mukherjee <debargha@google.com> | 2014-10-07 12:15:26 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2014-10-07 12:15:26 -0700 |
commit | cfc337aae8dabc2e4e1af28506d58230dc9de5c3 (patch) | |
tree | 4b91a0b0b0566969896738d94ce94e0d8964e4dd /vp9 | |
parent | a9f479682ac36288d63f2851f5d13a51be20a7ac (diff) | |
parent | fced63ed300c721c115c00af0bd91907702242eb (diff) | |
download | libvpx-cfc337aae8dabc2e4e1af28506d58230dc9de5c3.tar libvpx-cfc337aae8dabc2e4e1af28506d58230dc9de5c3.tar.gz libvpx-cfc337aae8dabc2e4e1af28506d58230dc9de5c3.tar.bz2 libvpx-cfc337aae8dabc2e4e1af28506d58230dc9de5c3.zip |
Merge "Resolves some static analysis / undefined warnings"
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/vp9_debugmodes.c | 4 | ||||
-rw-r--r-- | vp9/decoder/vp9_dthread.c | 12 | ||||
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_rdopt.c | 6 | ||||
-rw-r--r-- | vp9/encoder/vp9_temporal_filter.c | 95 |
5 files changed, 64 insertions, 57 deletions
diff --git a/vp9/common/vp9_debugmodes.c b/vp9/common/vp9_debugmodes.c index 3f1684104..d9dace6ac 100644 --- a/vp9/common/vp9_debugmodes.c +++ b/vp9/common/vp9_debugmodes.c @@ -27,7 +27,7 @@ static void print_mi_data(VP9_COMMON *cm, FILE *file, const char *descriptor, int mi_row, mi_col; int mi_index = 0; // TODO(hkuang): Fix this debug function. - MODE_INFO **mi = NULL; + MODE_INFO **mi = &cm->mi; int rows = cm->mi_rows; int cols = cm->mi_cols; char prefix = descriptor[0]; @@ -53,7 +53,7 @@ void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, const char *file) { int mi_index = 0; FILE *mvs = fopen(file, "a"); // TODO(hkuang): Fix this debug function. - MODE_INFO **mi = NULL; + MODE_INFO **mi = &cm->mi; int rows = cm->mi_rows; int cols = cm->mi_cols; diff --git a/vp9/decoder/vp9_dthread.c b/vp9/decoder/vp9_dthread.c index 62ea6c14d..69e4fde85 100644 --- a/vp9/decoder/vp9_dthread.c +++ b/vp9/decoder/vp9_dthread.c @@ -223,14 +223,18 @@ void vp9_loop_filter_alloc(VP9LfSync *lf_sync, VP9_COMMON *cm, int rows, CHECK_MEM_ERROR(cm, lf_sync->mutex_, vpx_malloc(sizeof(*lf_sync->mutex_) * rows)); - for (i = 0; i < rows; ++i) { - pthread_mutex_init(&lf_sync->mutex_[i], NULL); + if (lf_sync->mutex_) { + for (i = 0; i < rows; ++i) { + pthread_mutex_init(&lf_sync->mutex_[i], NULL); + } } CHECK_MEM_ERROR(cm, lf_sync->cond_, vpx_malloc(sizeof(*lf_sync->cond_) * rows)); - for (i = 0; i < rows; ++i) { - pthread_cond_init(&lf_sync->cond_[i], NULL); + if (lf_sync->cond_) { + for (i = 0; i < rows; ++i) { + pthread_cond_init(&lf_sync->cond_[i], NULL); + } } } #endif // CONFIG_MULTITHREAD diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 822a45e5e..dbc206ec4 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1224,9 +1224,7 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { cpi->oxcf = *oxcf; #if CONFIG_VP9_HIGHBITDEPTH - if (cpi->oxcf.use_highbitdepth) { - cpi->mb.e_mbd.bd = (int)cm->bit_depth; - } + cpi->mb.e_mbd.bd = (int)cm->bit_depth; #endif // CONFIG_VP9_HIGHBITDEPTH rc->baseline_gf_interval = DEFAULT_GF_INTERVAL; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index f793269ee..e984225e9 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -232,7 +232,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize, // Fast approximate the modelling function. if (cpi->oxcf.speed > 4) { int64_t rate; - int64_t square_error = sse; + const int64_t square_error = sum_sse; int quantizer = (pd->dequant[1] >> 3); #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -497,7 +497,7 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, if (tx_size != TX_32X32) dc_correct >>= 2; - args->dist = args->sse - dc_correct; + args->dist = MAX(0, args->sse - dc_correct); } } else { // skip forward transform @@ -2458,7 +2458,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, #if CONFIG_VP9_HIGHBITDEPTH DECLARE_ALIGNED_ARRAY(16, uint16_t, tmp_buf16, MAX_MB_PLANE * 64 * 64); DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp_buf8, MAX_MB_PLANE * 64 * 64); - uint8_t *tmp_buf = tmp_buf8; + uint8_t *tmp_buf; #else DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp_buf, MAX_MB_PLANE * 64 * 64); #endif // CONFIG_VP9_HIGHBITDEPTH diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index eeb1ce929..2d594dd09 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -676,61 +676,66 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { frames[frames_to_blur - 1 - frame] = &buf->img; } - // Setup scaling factors. Scaling on each of the arnr frames is not supported - if (is_two_pass_svc(cpi)) { - // In spatial svc the scaling factors might be less then 1/2. So we will use - // non-normative scaling. - int frame_used = 0; + if (frames_to_blur > 0) { + // Setup scaling factors. Scaling on each of the arnr frames is not + // supported. + if (is_two_pass_svc(cpi)) { + // In spatial svc the scaling factors might be less then 1/2. + // So we will use non-normative scaling. + int frame_used = 0; #if CONFIG_VP9_HIGHBITDEPTH - vp9_setup_scale_factors_for_frame(&sf, - get_frame_new_buffer(cm)->y_crop_width, - get_frame_new_buffer(cm)->y_crop_height, - get_frame_new_buffer(cm)->y_crop_width, - get_frame_new_buffer(cm)->y_crop_height, - cm->use_highbitdepth); + vp9_setup_scale_factors_for_frame( + &sf, + get_frame_new_buffer(cm)->y_crop_width, + get_frame_new_buffer(cm)->y_crop_height, + get_frame_new_buffer(cm)->y_crop_width, + get_frame_new_buffer(cm)->y_crop_height, + cm->use_highbitdepth); #else - vp9_setup_scale_factors_for_frame(&sf, - get_frame_new_buffer(cm)->y_crop_width, - get_frame_new_buffer(cm)->y_crop_height, - get_frame_new_buffer(cm)->y_crop_width, - get_frame_new_buffer(cm)->y_crop_height); + vp9_setup_scale_factors_for_frame( + &sf, + get_frame_new_buffer(cm)->y_crop_width, + get_frame_new_buffer(cm)->y_crop_height, + get_frame_new_buffer(cm)->y_crop_width, + get_frame_new_buffer(cm)->y_crop_height); #endif // CONFIG_VP9_HIGHBITDEPTH - for (frame = 0; frame < frames_to_blur; ++frame) { - if (cm->mi_cols * MI_SIZE != frames[frame]->y_width || - cm->mi_rows * MI_SIZE != frames[frame]->y_height) { - if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used], - cm->width, cm->height, - cm->subsampling_x, cm->subsampling_y, + for (frame = 0; frame < frames_to_blur; ++frame) { + if (cm->mi_cols * MI_SIZE != frames[frame]->y_width || + cm->mi_rows * MI_SIZE != frames[frame]->y_height) { + if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used], + cm->width, cm->height, + cm->subsampling_x, cm->subsampling_y, #if CONFIG_VP9_HIGHBITDEPTH - cm->use_highbitdepth, + cm->use_highbitdepth, #endif - VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, - NULL)) - vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, - "Failed to reallocate alt_ref_buffer"); - - frames[frame] = vp9_scale_if_required(cm, frames[frame], - &cpi->svc.scaled_frames[frame_used]); - ++frame_used; + VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, + NULL)) { + vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, + "Failed to reallocate alt_ref_buffer"); + } + frames[frame] = vp9_scale_if_required( + cm, frames[frame], &cpi->svc.scaled_frames[frame_used]); + ++frame_used; + } } - } - } else { - // ARF is produced at the native frame size and resized when coded. + } else { + // ARF is produced at the native frame size and resized when coded. #if CONFIG_VP9_HIGHBITDEPTH - vp9_setup_scale_factors_for_frame(&sf, - frames[0]->y_crop_width, - frames[0]->y_crop_height, - frames[0]->y_crop_width, - frames[0]->y_crop_height, - cm->use_highbitdepth); + vp9_setup_scale_factors_for_frame(&sf, + frames[0]->y_crop_width, + frames[0]->y_crop_height, + frames[0]->y_crop_width, + frames[0]->y_crop_height, + cm->use_highbitdepth); #else - vp9_setup_scale_factors_for_frame(&sf, - frames[0]->y_crop_width, - frames[0]->y_crop_height, - frames[0]->y_crop_width, - frames[0]->y_crop_height); + vp9_setup_scale_factors_for_frame(&sf, + frames[0]->y_crop_width, + frames[0]->y_crop_height, + frames[0]->y_crop_width, + frames[0]->y_crop_height); #endif // CONFIG_VP9_HIGHBITDEPTH + } } temporal_filter_iterate_c(cpi, frames, frames_to_blur, |