]> granicus.if.org Git - libvpx/commitdiff
Enhance the row mt sync read to accept the sync_range greater than 1
authorYunqing Wang <yunqingwang@google.com>
Tue, 28 Mar 2017 18:27:31 +0000 (11:27 -0700)
committerYunqing Wang <yunqingwang@google.com>
Fri, 31 Mar 2017 17:48:38 +0000 (10:48 -0700)
The row mt sync read uses sync_range = 1, and wouldn't work if we want
to use a sync_range that is greater than 1. To make it work, this sync
read code is modified. Pass in col instead of col - 1 to make it
consistent with other row mt code in VP9, and then add 1 in "while"
codition.

Change-Id: I4a0e487190ac5d47b8216368da12d80fec779c1a

vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_ethread.c
vp9/encoder/vp9_firstpass.c

index f5f9fa9d9fb94d8fa989e6088040ac76178259e2..1a4512f9dde929c554308f93a98d97e0130041ce 100644 (file)
@@ -3316,7 +3316,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, ThreadData *td,
     MODE_INFO **mi = cm->mi_grid_visible + idx_str;
 
     (*(cpi->row_mt_sync_read_ptr))(&tile_data->row_mt_sync, sb_row,
-                                   sb_col_in_tile - 1);
+                                   sb_col_in_tile);
 
     if (sf->adaptive_pred_interp_filter) {
       for (i = 0; i < 64; ++i) td->leaf_tree[i].pred_interp_filter = SWITCHABLE;
@@ -4094,7 +4094,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, ThreadData *td,
     int seg_skip = 0;
 
     (*(cpi->row_mt_sync_read_ptr))(&tile_data->row_mt_sync, sb_row,
-                                   sb_col_in_tile - 1);
+                                   sb_col_in_tile);
 
     x->source_variance = UINT_MAX;
     vp9_zero(x->pred_mv);
index 2b2a556a6ca53149ce4cc54b5b46ffa868e7e4df..681e960c8df71d0c379cc74c705e8c105308fb73 100644 (file)
@@ -320,7 +320,7 @@ void vp9_row_mt_sync_read(VP9RowMTSync *const row_mt_sync, int r, int c) {
     pthread_mutex_t *const mutex = &row_mt_sync->mutex_[r - 1];
     pthread_mutex_lock(mutex);
 
-    while (c > row_mt_sync->cur_col[r - 1] - nsync) {
+    while (c > row_mt_sync->cur_col[r - 1] - nsync + 1) {
       pthread_cond_wait(&row_mt_sync->cond_[r - 1], mutex);
     }
     pthread_mutex_unlock(mutex);
@@ -349,7 +349,7 @@ void vp9_row_mt_sync_write(VP9RowMTSync *const row_mt_sync, int r, int c,
 
   if (c < cols - 1) {
     cur = c;
-    if (c % nsync) sig = 0;
+    if (c % nsync != nsync - 1) sig = 0;
   } else {
     cur = cols + nsync;
   }
index b51cedd892170e9289cf0a8a7585a1480c990b29..222e27a9f2644964eba00df9c320f75c67676027 100644 (file)
@@ -884,7 +884,7 @@ void vp9_first_pass_encode_tile_mb_row(VP9_COMP *cpi, ThreadData *td,
     const int mb_index = mb_row * cm->mb_cols + mb_col;
 #endif
 
-    (*(cpi->row_mt_sync_read_ptr))(&tile_data->row_mt_sync, mb_row, c - 1);
+    (*(cpi->row_mt_sync_read_ptr))(&tile_data->row_mt_sync, mb_row, c);
 
     // Adjust to the next column of MBs.
     x->plane[0].src.buf = cpi->Source->y_buffer +