From: Yunqing Wang Date: Tue, 25 Oct 2016 16:00:58 +0000 (-0700) Subject: Change 2 motion search counts to be tile data X-Git-Tag: v1.6.1~152 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c192def8f3433d6713824fd31e76e9fa58cfd7f9;p=libvpx Change 2 motion search counts to be tile data This patch modified the motion search counts used in: https://chromium-review.googlesource.com/#/c/305640/ These 2 counts were originally added as thread data, and used to make decisions in motion search. The tile encoding order can be inconsistent while using different number of threads, which can cause bitstream mismatch. Here moved them to tile data to solve the issue. BUG=webm:1322 Change-Id: Iedc4477aef1746aa0a4f84d88a1156296fd3ba87 --- diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index aff7b1d9b..3ab05375f 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -3974,8 +3974,10 @@ void vp9_encode_tile(VP9_COMP *cpi, ThreadData *td, int tile_row, int mi_row; // Set up pointers to per thread motion search counters. - td->mb.m_search_count_ptr = &td->rd_counts.m_search_count; - td->mb.ex_search_count_ptr = &td->rd_counts.ex_search_count; + this_tile->m_search_count = 0; // Count of motion search hits. + this_tile->ex_search_count = 0; // Exhaustive mesh search hits. + td->mb.m_search_count_ptr = &this_tile->m_search_count; + td->mb.ex_search_count_ptr = &this_tile->ex_search_count; for (mi_row = mi_row_start; mi_row < mi_row_end; mi_row += MI_BLOCK_SIZE) { if (cpi->sf.use_nonrd_pick_mode) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 43b708be8..4aa24b4e4 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2805,11 +2805,9 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) { "%7.2lf %7.2lf %7.2lf %7.2lf %7.2lf" "%6d %6d %5d %5d %5d " "%10"PRId64" %10.3lf" - "%10lf %8u %10"PRId64" %10d %10d %10d %10d %10d\n", + "%10lf %8u %10"PRId64" %10d %10d %10d\n", cpi->common.current_video_frame, cm->width, cm->height, - cpi->td.rd_counts.m_search_count, - cpi->td.rd_counts.ex_search_count, cpi->rc.source_alt_ref_pending, cpi->rc.source_alt_ref_active, cpi->rc.this_frame_target, diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index e353d4779..0007e6395 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -267,14 +267,14 @@ typedef struct TileDataEnc { TileInfo tile_info; int thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; int mode_map[BLOCK_SIZES][MAX_MODES]; + int m_search_count; + int ex_search_count; } TileDataEnc; typedef struct RD_COUNTS { vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES]; int64_t comp_pred_diff[REFERENCE_MODES]; int64_t filter_diff[SWITCHABLE_FILTER_CONTEXTS]; - int m_search_count; - int ex_search_count; } RD_COUNTS; typedef struct ThreadData { diff --git a/vp9/encoder/vp9_ethread.c b/vp9/encoder/vp9_ethread.c index 7657573bb..f4f7c7bac 100644 --- a/vp9/encoder/vp9_ethread.c +++ b/vp9/encoder/vp9_ethread.c @@ -30,10 +30,6 @@ static void accumulate_rd_opt(ThreadData *td, ThreadData *td_t) { for (n = 0; n < ENTROPY_TOKENS; n++) td->rd_counts.coef_counts[i][j][k][l][m][n] += td_t->rd_counts.coef_counts[i][j][k][l][m][n]; - - // Counts of all motion searches and exhuastive mesh searches. - td->rd_counts.m_search_count += td_t->rd_counts.m_search_count; - td->rd_counts.ex_search_count += td_t->rd_counts.ex_search_count; } static int enc_worker_hook(EncWorkerData *const thread_data, void *unused) {