Commit 44472cde authored by James Zern's avatar James Zern Committed by Gerrit Code Review

vp9: disable postproc buffer alloc when unnecessary

the buffer is only used in encoding and only when
CONFIG_INTERNAL_STATS or CONFIG_VP9_POSTPROC is enabled.
a future change should decouple this from the frame buffer allocation
and make it conditional based on runtime flags when the above config
options are enabled.
reduces decode heap usage by at least 12%

Change-Id: Id0b97620d4936afefa538d3aadf32106743d9caf
parent 715b8d3b
...@@ -127,12 +127,15 @@ void vp9_free_context_buffers(VP9_COMMON *cm) { ...@@ -127,12 +127,15 @@ void vp9_free_context_buffers(VP9_COMMON *cm) {
int vp9_resize_frame_buffers(VP9_COMMON *cm, int width, int height) { int vp9_resize_frame_buffers(VP9_COMMON *cm, int width, int height) {
const int aligned_width = ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2); const int aligned_width = ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2);
const int aligned_height = ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2); const int aligned_height = ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2);
#if CONFIG_INTERNAL_STATS || CONFIG_VP9_POSTPROC
const int ss_x = cm->subsampling_x; const int ss_x = cm->subsampling_x;
const int ss_y = cm->subsampling_y; const int ss_y = cm->subsampling_y;
// TODO(agrange): this should be conditionally allocated.
if (vp9_realloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y, if (vp9_realloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y,
VP9_DEC_BORDER_IN_PIXELS, NULL, NULL, NULL) < 0) VP9_DEC_BORDER_IN_PIXELS, NULL, NULL, NULL) < 0)
goto fail; goto fail;
#endif
set_mb_mi(cm, aligned_width, aligned_height); set_mb_mi(cm, aligned_width, aligned_height);
...@@ -199,9 +202,11 @@ int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) { ...@@ -199,9 +202,11 @@ int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) {
init_frame_bufs(cm); init_frame_bufs(cm);
#if CONFIG_INTERNAL_STATS || CONFIG_VP9_POSTPROC
if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y, if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y,
VP9_ENC_BORDER_IN_PIXELS) < 0) VP9_ENC_BORDER_IN_PIXELS) < 0)
goto fail; goto fail;
#endif
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment