ref: ffc179d8bfb836d7b39aaf8595a9051b25a7b437
parent: ebac57ce9250aac85701f5258ec54f9cf9bf14a8
author: Jeremy Leconte <jleconte@google.com>
date: Thu Dec 10 12:54:54 EST 2020
Fix nullptr with offset. The error occurs with low resolution when LibvpxVp8Encoder::NumberOfThreads returns 1. Bug: b:175283098 Change-Id: Icc9387c75f4ac6e4f09f102b3143e83c998c5e38
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -343,8 +343,11 @@
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 {