[FFmpeg-devel] [PATCH] SBG decoder
nicolas.george at normalesup.org
Sat Dec 3 11:20:24 CET 2011
The incoming patch series implement a demuxer/decoder for the SBG file
For those who do not know (probably everyone), SBG is the script language
used by the SBaGen program to generate binaural beats sessions.
Binaural beats is when someone listens to different but very near
frequencies separately with each ear: the interference pattern that normally
happens in the air or on the wire instead happens inside the brain, and is
rumored to generate brainwaves that can be used for relaxation or focus.
I have no means of leading a serious medical experiment on this, but I have
found that some frequencies are quite pleasant to listen to before going to
sleep, and it does not seems like placebo.
If someone wants to try, just copy-paste the file in the example section of
the last patch into a plain text file, convert it into a more convenient
format (lossy codecs are ok) using the patched ffmpeg or sbagen itself, and
then listen to it using earplugs or a headset while relaxing.
Now, for the patches themselves:
[PATCH 1/5] 2a337e4 avutil: av_x_if_null: remove const for the return value.
This avoids the warning when using it with non-const values and variables.
This is the same thing as the standard prototype for strchr for example.
[PATCH 2/5] 140c450 lavu/error: define AVERROR_BUG.
To report an inconsistency less aggressively than assert.
[PATCH 3/5] lavu: add noise generator.
White and pink noise generator. Seekable: you can jump to four hours into
the stream of random numbers in constant time and get exactly the same
result each time. The usual PRNG are not seekable, and the common block
ciphers are too slow.
[PATCH 4/5] lavc: add ffwavesynth pseudo-codec.
SBG does not fit the demuxer+codec scheme. Instead of just having the
demuxer do all the work and output PCM, like libmodplug, I chose the
- the ffwavesynth pseudo-codec does the synthesis work: it accepts a
generic global layout in the extradata and then does the synthesis for
any frame as requested;
- the SBG demuxer does the global work (parsing the language, tweaking
transitions, etc.) and prepares a layout for ffwavesynth.
I can easily revert to a more basic "the demuxer does all the work" scheme
if people like it better.
[PATCH 5/5] lavf: add SBG demuxer.
This is the demuxer itself. Most of the code is the parser for the
language and bug-compatibility with the strange ways sbagen handles some
On the overall, this implementation is significantly faster than sbagen
unless there is noise involved, because I use an almost cryptographically
strong PRNG while they use a linear congruence PRNG (which does not allow
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel