Optimize the allocation of pixel_gradient_info for monochrome
This CL optimizes the memory allocation of pixel_gradient_info by
not allocating the same for chroma in case of monochrome.
BUG=aomedia:2996
Change-Id: I51e4d26f75a08851f7d23a0e8efb7876cc3347c8
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 5d60725..e928315 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -725,8 +725,9 @@
}
if (x->pixel_gradient_info == NULL) {
+ const int plane_types = PLANE_TYPES >> cm->seq_params.monochrome;
CHECK_MEM_ERROR(cm, x->pixel_gradient_info,
- aom_malloc(sizeof(*x->pixel_gradient_info) * PLANE_TYPES *
+ aom_malloc(sizeof(*x->pixel_gradient_info) * plane_types *
MAX_SB_SQUARE));
}
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 12a000d..ce5ce4f 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -635,9 +635,10 @@
sizeof(*thread_data->td->tmp_pred_bufs[j])));
}
+ const int plane_types = PLANE_TYPES >> cm->seq_params.monochrome;
CHECK_MEM_ERROR(cm, thread_data->td->pixel_gradient_info,
aom_malloc(sizeof(*thread_data->td->pixel_gradient_info) *
- PLANE_TYPES * MAX_SB_SQUARE));
+ plane_types * MAX_SB_SQUARE));
if (cpi->sf.part_sf.partition_search_type == VAR_BASED_PARTITION) {
const int num_64x64_blocks =