]> granicus.if.org Git - libvpx/commitdiff
Fix nullptr with offset.
authorJeremy Leconte <jleconte@google.com>
Thu, 10 Dec 2020 16:54:54 +0000 (17:54 +0100)
committerJeremy Leconte <jleconte@google.com>
Thu, 10 Dec 2020 18:54:53 +0000 (18:54 +0000)
The error occurs with low resolution when LibvpxVp8Encoder::NumberOfThreads returns 1.

Bug: b:175283098
Change-Id: Icc9387c75f4ac6e4f09f102b3143e83c998c5e38

vp8/encoder/encodeframe.c

index 2b3d9564ce20ab2ce20940550bcc94ec91f01cb7..2f84381d24f91f2b5656e78e3b6b376e193d6e57 100644 (file)
@@ -343,8 +343,11 @@ static void encode_mb_row(VP8_COMP *cpi, VP8_COMMON *cm, int mb_row,
   const int nsync = cpi->mt_sync_range;
   vpx_atomic_int rightmost_col = VPX_ATOMIC_INIT(cm->mb_cols + nsync);
   const vpx_atomic_int *last_row_current_mb_col;
-  vpx_atomic_int *current_mb_col = &cpi->mt_current_mb_col[mb_row];
+  vpx_atomic_int *current_mb_col = NULL;
 
+  if (vpx_atomic_load_acquire(&cpi->b_multi_threaded) != 0) {
+    current_mb_col = &cpi->mt_current_mb_col[mb_row];
+  }
   if (vpx_atomic_load_acquire(&cpi->b_multi_threaded) != 0 && mb_row != 0) {
     last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1];
   } else {