[FFmpeg-devel] [PATCH] normal PRNG using ziggurat method

Justin Ruggles justin.ruggles
Tue Sep 9 05:04:48 CEST 2008

Michael Niedermayer wrote:
> On Mon, Sep 08, 2008 at 08:05:34PM -0400, Justin Ruggles wrote:
>> Hi,
>> This is a patch to add a PRNG which generates numbers with standard
>> normal distribution.  It uses the ziggurat method, which is quite fast
>> compared to other methods.
>> I was working on another implementation based on the original paper,
>> which had sample code in it that I was using as a starting point.  Then
>> I noticed the teeny tiny print at the bottom of the journal's download
>> page which states that the code is under GPL... :(  I found another
>> implementation which was based on the paper without using the
>> accompanying code and is under a BSD-style license.  I trimmed it down,
>> cleaned-up it up, and adapted it for FFmpeg.
>> I need this for spectral extension processing in the E-AC-3 decoder.
>> The spec requires that the generated noise which is blended with
>> translated coeffs have "zero-mean, unity variance".
> is "zero-mean, unity variance" everything the spec requires or is there
> more?

That is all it requires.

> Because any signal (like the output of any PRNG) can be scaled and translated
> to have that, there would be no need for normal distributed PRNG.
> [...]

This does scale and translate output from one of the already existing
PRNG's...sort of. :)

The zero mean part is easy enough.  If there is a simpler (and faster)
way to generate random noise with unity variance distribution, please
tell me.


More information about the ffmpeg-devel mailing list