Merge "Resolves some static analysis / undefined warnings"

This commit is contained in:
Deb Mukherjee
2014-10-07 12:15:26 -07:00
committed by Gerrit Code Review
5 changed files with 64 additions and 57 deletions

View File

@@ -27,7 +27,7 @@ static void print_mi_data(VP9_COMMON *cm, FILE *file, const char *descriptor,
int mi_row, mi_col; int mi_row, mi_col;
int mi_index = 0; int mi_index = 0;
// TODO(hkuang): Fix this debug function. // TODO(hkuang): Fix this debug function.
MODE_INFO **mi = NULL; MODE_INFO **mi = &cm->mi;
int rows = cm->mi_rows; int rows = cm->mi_rows;
int cols = cm->mi_cols; int cols = cm->mi_cols;
char prefix = descriptor[0]; 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; int mi_index = 0;
FILE *mvs = fopen(file, "a"); FILE *mvs = fopen(file, "a");
// TODO(hkuang): Fix this debug function. // TODO(hkuang): Fix this debug function.
MODE_INFO **mi = NULL; MODE_INFO **mi = &cm->mi;
int rows = cm->mi_rows; int rows = cm->mi_rows;
int cols = cm->mi_cols; int cols = cm->mi_cols;

View File

@@ -223,14 +223,18 @@ void vp9_loop_filter_alloc(VP9LfSync *lf_sync, VP9_COMMON *cm, int rows,
CHECK_MEM_ERROR(cm, lf_sync->mutex_, CHECK_MEM_ERROR(cm, lf_sync->mutex_,
vpx_malloc(sizeof(*lf_sync->mutex_) * rows)); vpx_malloc(sizeof(*lf_sync->mutex_) * rows));
for (i = 0; i < rows; ++i) { if (lf_sync->mutex_) {
pthread_mutex_init(&lf_sync->mutex_[i], NULL); for (i = 0; i < rows; ++i) {
pthread_mutex_init(&lf_sync->mutex_[i], NULL);
}
} }
CHECK_MEM_ERROR(cm, lf_sync->cond_, CHECK_MEM_ERROR(cm, lf_sync->cond_,
vpx_malloc(sizeof(*lf_sync->cond_) * rows)); vpx_malloc(sizeof(*lf_sync->cond_) * rows));
for (i = 0; i < rows; ++i) { if (lf_sync->cond_) {
pthread_cond_init(&lf_sync->cond_[i], NULL); for (i = 0; i < rows; ++i) {
pthread_cond_init(&lf_sync->cond_[i], NULL);
}
} }
} }
#endif // CONFIG_MULTITHREAD #endif // CONFIG_MULTITHREAD

View File

@@ -1224,9 +1224,7 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
cpi->oxcf = *oxcf; cpi->oxcf = *oxcf;
#if CONFIG_VP9_HIGHBITDEPTH #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 #endif // CONFIG_VP9_HIGHBITDEPTH
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL; rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;

View File

@@ -232,7 +232,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
// Fast approximate the modelling function. // Fast approximate the modelling function.
if (cpi->oxcf.speed > 4) { if (cpi->oxcf.speed > 4) {
int64_t rate; int64_t rate;
int64_t square_error = sse; const int64_t square_error = sum_sse;
int quantizer = (pd->dequant[1] >> 3); int quantizer = (pd->dequant[1] >> 3);
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_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) if (tx_size != TX_32X32)
dc_correct >>= 2; dc_correct >>= 2;
args->dist = args->sse - dc_correct; args->dist = MAX(0, args->sse - dc_correct);
} }
} else { } else {
// skip forward transform // skip forward transform
@@ -2458,7 +2458,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
DECLARE_ALIGNED_ARRAY(16, uint16_t, tmp_buf16, MAX_MB_PLANE * 64 * 64); 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); DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp_buf8, MAX_MB_PLANE * 64 * 64);
uint8_t *tmp_buf = tmp_buf8; uint8_t *tmp_buf;
#else #else
DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp_buf, MAX_MB_PLANE * 64 * 64); DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp_buf, MAX_MB_PLANE * 64 * 64);
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH

View File

@@ -676,61 +676,66 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
frames[frames_to_blur - 1 - frame] = &buf->img; frames[frames_to_blur - 1 - frame] = &buf->img;
} }
// Setup scaling factors. Scaling on each of the arnr frames is not supported if (frames_to_blur > 0) {
if (is_two_pass_svc(cpi)) { // Setup scaling factors. Scaling on each of the arnr frames is not
// In spatial svc the scaling factors might be less then 1/2. So we will use // supported.
// non-normative scaling. if (is_two_pass_svc(cpi)) {
int frame_used = 0; // 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 #if CONFIG_VP9_HIGHBITDEPTH
vp9_setup_scale_factors_for_frame(&sf, vp9_setup_scale_factors_for_frame(
get_frame_new_buffer(cm)->y_crop_width, &sf,
get_frame_new_buffer(cm)->y_crop_height, get_frame_new_buffer(cm)->y_crop_width,
get_frame_new_buffer(cm)->y_crop_width, get_frame_new_buffer(cm)->y_crop_height,
get_frame_new_buffer(cm)->y_crop_height, get_frame_new_buffer(cm)->y_crop_width,
cm->use_highbitdepth); get_frame_new_buffer(cm)->y_crop_height,
cm->use_highbitdepth);
#else #else
vp9_setup_scale_factors_for_frame(&sf, vp9_setup_scale_factors_for_frame(
get_frame_new_buffer(cm)->y_crop_width, &sf,
get_frame_new_buffer(cm)->y_crop_height, get_frame_new_buffer(cm)->y_crop_width,
get_frame_new_buffer(cm)->y_crop_width, get_frame_new_buffer(cm)->y_crop_height,
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 #endif // CONFIG_VP9_HIGHBITDEPTH
for (frame = 0; frame < frames_to_blur; ++frame) { for (frame = 0; frame < frames_to_blur; ++frame) {
if (cm->mi_cols * MI_SIZE != frames[frame]->y_width || if (cm->mi_cols * MI_SIZE != frames[frame]->y_width ||
cm->mi_rows * MI_SIZE != frames[frame]->y_height) { cm->mi_rows * MI_SIZE != frames[frame]->y_height) {
if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used], if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used],
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth, cm->use_highbitdepth,
#endif #endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, VP9_ENC_BORDER_IN_PIXELS, NULL, NULL,
NULL)) NULL)) {
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to reallocate alt_ref_buffer"); "Failed to reallocate alt_ref_buffer");
}
frames[frame] = vp9_scale_if_required(cm, frames[frame], frames[frame] = vp9_scale_if_required(
&cpi->svc.scaled_frames[frame_used]); cm, frames[frame], &cpi->svc.scaled_frames[frame_used]);
++frame_used; ++frame_used;
}
} }
} } else {
} else { // ARF is produced at the native frame size and resized when coded.
// ARF is produced at the native frame size and resized when coded.
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
vp9_setup_scale_factors_for_frame(&sf, vp9_setup_scale_factors_for_frame(&sf,
frames[0]->y_crop_width, frames[0]->y_crop_width,
frames[0]->y_crop_height, frames[0]->y_crop_height,
frames[0]->y_crop_width, frames[0]->y_crop_width,
frames[0]->y_crop_height, frames[0]->y_crop_height,
cm->use_highbitdepth); cm->use_highbitdepth);
#else #else
vp9_setup_scale_factors_for_frame(&sf, vp9_setup_scale_factors_for_frame(&sf,
frames[0]->y_crop_width, frames[0]->y_crop_width,
frames[0]->y_crop_height, frames[0]->y_crop_height,
frames[0]->y_crop_width, frames[0]->y_crop_width,
frames[0]->y_crop_height); frames[0]->y_crop_height);
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
}
} }
temporal_filter_iterate_c(cpi, frames, frames_to_blur, temporal_filter_iterate_c(cpi, frames, frames_to_blur,