]> git.tuebingen.mpg.de Git - paraslash.git/commit
Speed up the oggdec filter and avoid wasting tons of memory.
authorAndre Noll <maan@systemlinux.org>
Wed, 9 Feb 2011 17:18:17 +0000 (18:18 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 13 Feb 2011 22:15:43 +0000 (23:15 +0100)
commitf44d27b634fe4a26efc38de75e8b84524d156c4b
tree5941c6f4c68ac1a646c0eaaaa528adc8891d9fae
parent058d91940d3cc131a6cf222cd79fe5c5e38c9dbd
Speed up the oggdec filter and avoid wasting tons of memory.

Calls to ov_read appear to return at most 4K, no matter how much data
was requested. We allocated 64K per output chunk, so 60K of that space
is wasted. On the other hand we need large output buffers in order to
not sacrifice performance when para_filter decodes to stdout.

Fix this flaw by increasing the oggdec output buffer size from 64K to
640K, calling ov_read() until the output buffer is full or there is
nothing left to read, and then reallocating the buffer to the amount
of bytes actually read.

Assuming CD audio, the 640K output buffer size roughly matches
the decoded size of the 32K input buffer used by the stdin task,
so each input buffer corresponds roughly to one output buffer. The
patched version performs almost identically to the oggdec reference
implementation while previous versions were up to a factor of 2 slower.
oggdec_filter.c