Commit 63c5bf2b authored by Yunqing Wang's avatar Yunqing Wang

Fix Tsan errors

This patch fixed 2 reported Tsan errors while running VP9 real-time
encoder.

Change-Id: Ib0278fe802852862c3ce87c4a500e544d7089f67
parent 004b9d83
......@@ -458,8 +458,7 @@ static int set_vt_partitioning(VP9_COMP *cpi,
return 0;
}
void vp9_set_vbp_thresholds(VP9_COMP *cpi, int64_t thresholds[], int q) {
void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) {
SPEED_FEATURES *const sf = &cpi->sf;
if (sf->partition_search_type != VAR_BASED_PARTITION &&
sf->partition_search_type != REFERENCE_PARTITION) {
......@@ -480,25 +479,41 @@ void vp9_set_vbp_thresholds(VP9_COMP *cpi, int64_t thresholds[], int q) {
// Array index: 0 - threshold_64x64; 1 - threshold_32x32;
// 2 - threshold_16x16; 3 - vbp_threshold_8x8;
if (is_key_frame) {
thresholds[0] = threshold_base;
thresholds[1] = threshold_base >> 2;
thresholds[2] = threshold_base >> 2;
thresholds[3] = threshold_base << 2;
cpi->vbp_thresholds[0] = threshold_base;
cpi->vbp_thresholds[1] = threshold_base >> 2;
cpi->vbp_thresholds[2] = threshold_base >> 2;
cpi->vbp_thresholds[3] = threshold_base << 2;
cpi->vbp_bsize_min = BLOCK_8X8;
} else {
thresholds[1] = threshold_base;
cpi->vbp_thresholds[1] = threshold_base;
if (cm->width <= 352 && cm->height <= 288) {
thresholds[0] = threshold_base >> 2;
thresholds[2] = threshold_base << 3;
cpi->vbp_thresholds[0] = threshold_base >> 2;
cpi->vbp_thresholds[2] = threshold_base << 3;
} else {
thresholds[0] = threshold_base;
thresholds[2] = threshold_base << cpi->oxcf.speed;
cpi->vbp_thresholds[0] = threshold_base;
cpi->vbp_thresholds[2] = threshold_base << cpi->oxcf.speed;
}
cpi->vbp_bsize_min = BLOCK_16X16;
}
}
}
static void modify_vbp_thresholds(VP9_COMP *cpi, int64_t thresholds[], int q) {
VP9_COMMON *const cm = &cpi->common;
const int64_t threshold_base = (int64_t)(cpi->y_dequant[q][1]);
// Array index: 0 - threshold_64x64; 1 - threshold_32x32;
// 2 - threshold_16x16; 3 - vbp_threshold_8x8;
thresholds[1] = threshold_base;
if (cm->width <= 352 && cm->height <= 288) {
thresholds[0] = threshold_base >> 2;
thresholds[2] = threshold_base << 3;
} else {
thresholds[0] = threshold_base;
thresholds[2] = threshold_base << cpi->oxcf.speed;
}
}
static void fill_variance_4x4avg(const uint8_t *s, int sp, const uint8_t *d,
int dp, int x8_idx, int y8_idx, v8x8 *vst,
#if CONFIG_VP9_HIGHBITDEPTH
......@@ -611,7 +626,7 @@ static void choose_partitioning(VP9_COMP *cpi,
if (cyclic_refresh_segment_id_boosted(segment_id)) {
int q = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex);
vp9_set_vbp_thresholds(cpi, thresholds, q);
modify_vbp_thresholds(cpi, thresholds, q);
}
}
......@@ -3854,6 +3869,9 @@ static void encode_frame_internal(VP9_COMP *cpi) {
}
vp9_zero(x->zcoeff_blk);
if (cm->frame_type != KEY_FRAME && cpi->rc.frames_since_golden == 0)
cpi->ref_frame_flags &= (~VP9_GOLD_FLAG);
if (sf->partition_search_type == SOURCE_VAR_BASED_PARTITION)
source_var_based_partition_search_method(cpi);
}
......
......@@ -40,7 +40,7 @@ void vp9_init_tile_data(struct VP9_COMP *cpi);
void vp9_encode_tile(struct VP9_COMP *cpi, struct ThreadData *td,
int tile_row, int tile_col);
void vp9_set_vbp_thresholds(struct VP9_COMP *cpi, int64_t thresholds[], int q);
void vp9_set_vbp_thresholds(struct VP9_COMP *cpi, int q);
#ifdef __cplusplus
} // extern "C"
......
......@@ -2958,7 +2958,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi) {
set_size_dependent_vars(cpi, &q, &bottom_index, &top_index);
vp9_set_quantizer(cm, q);
vp9_set_vbp_thresholds(cpi, cpi->vbp_thresholds, q);
vp9_set_vbp_thresholds(cpi, q);
setup_frame(cpi);
......
......@@ -1125,7 +1125,6 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
#endif
if (cpi->rc.frames_since_golden == 0) {
cpi->ref_frame_flags &= (~VP9_GOLD_FLAG);
usable_ref_frame = LAST_FRAME;
} else {
usable_ref_frame = GOLDEN_FRAME;
......
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