as there's been a small discussion going on doom9 about the number of
x264_malloc and x264_free calls that x264 performs and how to handle it.<br>
here's a patch that reduces the number by removing some repetitive calls,<br><br>in hpel_filter: 1 call to each removed by changing method signature to provide 1 buffer.<br>in pixel_ssim_wxh: 2 calls to each removed by changing method signature to provide 2 buffers.<br>
<br>allocation buffers are added to the x264_t definition in the "thread-local" section so each thread can have its own.<br>the buffers are allocated in encoder_open() in the thread specific section,<br>so each thread has its own set of buffers (though ssim buffers aren't allocated if not being calculated)<br>
the buffers are free'd in encoder_close() in the thread specific section.<br>(which confirms no heap corrupts or seg faults at run time)<br><br>from some very small scale testing on a video w/ 1000 640x480-sized frames,<br>
the number of x264_malloc/x264_free calls is reduced 97+% on default settings w/o ssim calculation<br>and reduced 99+% w/ ssim calculation<br>