Per Monty's suggestions from a while ago, I have [finally] gotten around
to playing with different schemes for parallel oggenc. Monty's main
suggestion was to have a single thread loop over reading samples and
calling vorbis_analysis_blockout(), and then queueing up the resulting
blocks to be processed through vorbis_analysis() in other threads (in
parallel).
To verify that this works, I modified vanilla oggenc (current CVS head on
everything, of course) to do something similar, but in a single-threaded
way. However, the output from this scheme differs from the output of
vanilla oggenc. i.e., it seems that delaying the calls to
vorbis_analysis() seems to generate different output.
I'm guessing that vorbis_analysis_blockout() is somehow changing internal
DSP state, and later calls to vorbis_analysis() are based upon that DSP
state, and are therefore produce different output. Is that more or less
that is going on? Is this by design?
-----
Here's the general algorithm in my slightly modified oggenc (ignoring
memory leaks here):
- allocate/initialize a new vorbis_block
- loop until file empty
- read some samples
- loop while vorbis_analysis_blockout returns 1
- save current [and now full] vorbis_block
- allocate/initialize new vorbis_block
- if we have > N pending vorbis_blocks
- loop over the N pending vorbis_blocks
- call vorbis_analyze
- call ogg_stream_packetin
- call ogg_stream_pageout/write page to disk if necessary
Using a short audio clip (~17sec), I get different file sizes for the
resulting .ogg file when using this algorithm vs. the vanilla oggenc
algorithm.
I've attached my code that does this. It's C++ code (sorry -- using STL
lists made the queueing much easier):
- put it in your oggenc directory
- [re]move your current oggenc.c to prevent "make" from getting
confused
- s/encode.c/encode.cc/ in Makefile.am
- rm -rf .deps
- add AC_PROG_CXX to vorbis-tools/configure.in
- run autogen.sh for the vorbis-tools
Perhaps I did something stupid in the code...?
{+} Jeff Squyres
{+} squyres@cse.nd.edu
{+} Perpetual Obsessive Notre Dame Student Craving Utter Madness
{+} "I came to ND for 4 years and ended up staying for a decade"
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to
'vorbis-dev-request@xiph.org'
containing only the word 'unsubscribe' in the body. No subject is
needed.
Unsubscribe messages sent to the list will be ignored/filtered.