]> granicus.if.org Git - libvpx/commitdiff
Prevent encoder crash caused by row tile dependencies
authorYunqing Wang <yunqingwang@google.com>
Tue, 22 Mar 2016 17:54:43 +0000 (10:54 -0700)
committerYunqing Wang <yunqingwang@google.com>
Tue, 22 Mar 2016 23:15:12 +0000 (16:15 -0700)
In multi-thread case, the encoder may crash if using encoder option
tile-rows > 0. To prevent that, force tile-rows=0 in this situation.
This is a workaround for WebM issue 1095:
https://bugs.chromium.org/p/webm/issues/detail?id=1095

The further fix can be done by adding synchronizations after a tile
row is encoded. But this will hurt multi-threaded encoder performance.
So, it is recommended to use tile-rows=0 while encoding with threads
> 1.

Change-Id: I656cbcc200f8d0410d09530e7981ad8f32fe7bc9

vp9/vp9_cx_iface.c
vpxenc.c

index 624d5c9fcd7f00d42306ee2d71a95fb42674c650..07de29baddda62aeced38079c19a04aeeae2d61b 100644 (file)
@@ -486,7 +486,13 @@ static vpx_codec_err_t set_encoder_config(
   oxcf->content = extra_cfg->content;
 
   oxcf->tile_columns = extra_cfg->tile_columns;
-  oxcf->tile_rows    = extra_cfg->tile_rows;
+
+  // The dependencies between row tiles cause error in multi-threaded encoding.
+  // For now, it is forced to be 0 in this case.
+  if (oxcf->max_threads > 1 && oxcf->tile_columns > 0)
+    oxcf->tile_rows  = 0;
+  else
+    oxcf->tile_rows  = extra_cfg->tile_rows;
 
   oxcf->error_resilient_mode         = cfg->g_error_resilient;
   oxcf->frame_parallel_decoding_mode = extra_cfg->frame_parallel_decoding_mode;
index f24b1805bf59e5adaccbdfcf58ce3d914fb4046d..50e7c7fc7947de7d1342a403d8af2d39cfd3c627 100644 (file)
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -380,7 +380,8 @@ static const arg_def_t cpu_used_vp9 = ARG_DEF(
 static const arg_def_t tile_cols = ARG_DEF(
     NULL, "tile-columns", 1, "Number of tile columns to use, log2");
 static const arg_def_t tile_rows = ARG_DEF(
-    NULL, "tile-rows", 1, "Number of tile rows to use, log2");
+    NULL, "tile-rows", 1,
+    "Number of tile rows to use, log2 (set to 0 while threads > 1)");
 static const arg_def_t lossless = ARG_DEF(
     NULL, "lossless", 1, "Lossless mode (0: false (default), 1: true)");
 static const arg_def_t frame_parallel_decoding = ARG_DEF(