rtc: Restrict usage of src_sad_blk_64x64 to single spatial layer
For blk_sad usage: disallow for spatial layers.
This is a possible fix for the crash in the issue below.
The issue seems to be incorrect setting of svc->mi_cols/rows_full_resoln (used for the allocation of src_sad_blk_64x64 for spatial layers) for the case of switching up layers (2SL to 3SL) and then passing in lower resolution for the top layer after the switch.
The performance effect of src_sad_blk_64x64 for spatial layered encoding is expected to be small/minimal, so ok to disable. Will follow-up with a unittest and maybe re-enable the feature with the proper fix.
Bug b:433046392, b:432035817
Change-Id: Id0b2b36771fffef75bc89f51cf62709d5b6ad606
(cherry picked from commit 820b4991a9c76831a8631ea93077f71fa240c15f)
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index d8688c5..f32be7b 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -3241,8 +3241,9 @@
// non-zero sad exists along bottom border even though source is static.
const int border =
rc->prev_frame_is_dropped || cpi->svc.number_temporal_layers > 1;
- // Store blkwise SAD for later use
- if (width == cm->render_width && height == cm->render_height) {
+ // Store blkwise SAD for later use. Disable for spatial layers for now.
+ if (width == cm->render_width && height == cm->render_height &&
+ cpi->svc.number_spatial_layers == 1) {
if (cpi->src_sad_blk_64x64 == NULL) {
CHECK_MEM_ERROR(cm, cpi->src_sad_blk_64x64,
(uint64_t *)aom_calloc(sb_cols * sb_rows,