Fix pixel_gradient_info allocation In very rare cases, the work thread data needs to be re-allocated, but the condition in is_gradient_caching_for_hog_enabled() is not true. Thus, this results in no pixel_gradient_info data allocated for work threads and the memory write violation happens. This change fixes this issue. Bug: b/559019046 Change-Id: I38b2285aeffe1732239cb2401b61a3654f386896 (cherry picked from commit f9a09995618828dba5a3f154f30d60779e4acd33)
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c index d46b3ee..53513f8 100644 --- a/av1/encoder/ethread.c +++ b/av1/encoder/ethread.c
@@ -1039,12 +1039,10 @@ } } - if (is_gradient_caching_for_hog_enabled(ppi->cpi)) { - const int plane_types = PLANE_TYPES >> ppi->seq_params.monochrome; - AOM_CHECK_MEM_ERROR(&ppi->error, td->pixel_gradient_info, - aom_malloc(sizeof(*td->pixel_gradient_info) * - plane_types * MAX_SB_SQUARE)); - } + const int plane_types = PLANE_TYPES >> ppi->seq_params.monochrome; + AOM_CHECK_MEM_ERROR(&ppi->error, td->pixel_gradient_info, + aom_malloc(sizeof(*td->pixel_gradient_info) * + plane_types * MAX_SB_SQUARE)); if (is_src_var_for_4x4_sub_blocks_caching_enabled(ppi->cpi)) { const BLOCK_SIZE sb_size = ppi->cpi->common.seq_params->sb_size;