iniwf / webm

Automatically exported from code.google.com/p/webm
0 stars 0 forks source link

Defer frame allocations if possible #905

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to get memory consumption down as I prepare a 10-bit, 8K render. 
(I'm pulling frames from my renderfarm and packing them into a few encoders in 
parallel to increase utilization, and my encoding box doesn't have enough RAM 
to hold all the frames as-is.)

One source of memory is the preallocation of reference frames. At 8K, the extra 
frames add up - more than 2.3G using 444, 1.2G using 420.

With the encoding settings I'm currently using for mezzanine formats, these 
preallocated frames aren't ever used. I was able to chop memory usage down by 
0.8G (more than 20%) just by hacking the constant for preallocated frames down 
from 12 to 4:

--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -38,7 +38,7 @@ extern "C" {
 // 1 scratch frame for the new frame, 3 for scaled references on the encoder
 // TODO(jkoleszar): These 3 extra references could probably come from the
 // normal reference pool.
-#define FRAME_BUFFERS (REF_FRAMES + 4)
+#define FRAME_BUFFERS (REF_FRAMES - 4)

 #define FRAME_CONTEXTS_LOG2 2
 #define FRAME_CONTEXTS (1 << FRAME_CONTEXTS_LOG2)

A more elegant solution would be to allocate these frames on demand.

Original issue reported on code.google.com by str...@google.com on 26 Dec 2014 at 10:15

GoogleCodeExporter commented 9 years ago

Original comment by ya...@google.com on 15 Jan 2015 at 11:19

GoogleCodeExporter commented 9 years ago
Issue 788 has been merged into this issue.

Original comment by ya...@google.com on 15 Jan 2015 at 11:39

GoogleCodeExporter commented 9 years ago
Patch to make reference frame allocation dynamic is in process:
https://gerrit.chromium.org/gerrit/#/c/73800

Original comment by agra...@google.com on 20 Feb 2015 at 6:07

GoogleCodeExporter commented 9 years ago
Reference frame buffer allocation is now "on-demand" in the encoder:
https://gerrit.chromium.org/gerrit/#/c/73800
Patch has now been merged.

Original comment by agra...@google.com on 5 Mar 2015 at 7:55