dapphp/securimage — pull request #7 by Uranium235 (2012-04-08 15:12:29+00:00)
Title: Audiofixes

Hi drew,

I made some changes to the WavFile class. And because of that a minor adjustment to sercurimage.php.

The changes I made are mainly for speed reasons. On my (slow) system, a single core virtual machine with PHP 5.3.10 and without Zend Optimizer, a test mix of 2 10s long 24-Bit wav files is over 2 times faster now.
It seems that function calls within loops make a huge difference.

For that reason I am not using the (new) static functions to pack and unpack within the new get/setSampleValue methods. I also eliminated some costly strlen() calls and for that ensured consistency of the _dataSize property.

before: 85s - after: 35s - best possible: 17s

The "best possible" is done with simple and specialized php, no OO and function calls inside the loop.

I fully implemented the 32-bit float support.

I also cleaned up some (presumed) baggage and renamed a few things to not confuse samples and blocks of samples.

There were also some minor bugs that I fixed, although I can't remember now what exactly they were. Also the error codes for the WavException changed, as I added some more checks.

If I went to far with this for your liking, you can of course just cherry pick some things and/or revive the "baggage" I removed.

I only tested the mixing filter, although the degrade (filter) as well as the insertSilence and generateNoise methods should work as expected.

Hope this is useful to you,
Paul