Commit cfc337aa authored by Deb Mukherjee's avatar Deb Mukherjee Committed by Gerrit Code Review
Browse files

Merge "Resolves some static analysis / undefined warnings"

parents a9f47968 fced63ed
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment