From 85640f1c9dd56378e9f86d85843732387731e69e Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 21 Aug 2013 17:43:44 -0700 Subject: [PATCH] vp9: remove unnecessary wait w/threaded loopfilter the final macroblock rows are scheduled in the main thread. prior to this change one additional macroblock row would be scheduled in the worker forcing the main thread to wait before finishing. Change-Id: I05f3168e5c629b898fcebb0d77eb6d6a90d6105e --- vp9/decoder/vp9_decodframe.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 70e85f95a..935a3d28d 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -586,6 +586,7 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) { lf_data->frame_buffer = fb; lf_data->cm = pc; lf_data->xd = pbi->mb; + lf_data->stop = 0; lf_data->y_only = 0; } vp9_loop_filter_frame_init(pc, pc->lf.filter_level); @@ -609,6 +610,9 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) { if (num_threads > 1) { LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; + // decoding has completed: finish up the loop filter in this thread. + if (mi_row + MI_BLOCK_SIZE >= pc->cur_tile_mi_row_end) continue; + vp9_worker_sync(&pbi->lf_worker); lf_data->start = lf_start; lf_data->stop = mi_row; @@ -621,13 +625,17 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) { } if (pbi->do_loopfilter_inline) { + int lf_start; if (num_threads > 1) { - // TODO(jzern): since the loop filter is delayed one mb row, this will be - // forced to wait for the last row scheduled in the for loop. + LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; + vp9_worker_sync(&pbi->lf_worker); + lf_start = lf_data->stop; + } else { + lf_start = mi_row - MI_BLOCK_SIZE; } vp9_loop_filter_rows(fb, pc, &pbi->mb, - mi_row - MI_BLOCK_SIZE, pc->mi_rows, 0); + lf_start, pc->mi_rows, 0); } } -- 2.40.0