[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libmedia/AudioDecoderNellymoser...
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog libmedia/AudioDecoderNellymoser... |
Date: |
Sat, 01 Mar 2008 04:47:45 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 08/03/01 04:47:45
Modified files:
. : ChangeLog
libmedia : AudioDecoderNellymoser.cpp
Log message:
Boostified random.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5764&r2=1.5765
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoderNellymoser.cpp?cvsroot=gnash&r1=1.9&r2=1.10
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5764
retrieving revision 1.5765
diff -u -b -r1.5764 -r1.5765
--- ChangeLog 1 Mar 2008 00:53:53 -0000 1.5764
+++ ChangeLog 1 Mar 2008 04:47:44 -0000 1.5765
@@ -1,3 +1,7 @@
+2008-02-29 Bastiaan Jacques <address@hidden>
+
+ * libmedia/AudioDecoderNellymoser.cpp: Boostified random.
+
2008-02-29 John Gilmore <address@hidden>
* doc/C/cygnal.man-xml, doc/C/dumpshm.man-xml, doc/C/gnash.man-xml,
Index: libmedia/AudioDecoderNellymoser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoderNellymoser.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libmedia/AudioDecoderNellymoser.cpp 27 Feb 2008 08:51:54 -0000 1.9
+++ libmedia/AudioDecoderNellymoser.cpp 1 Mar 2008 04:47:45 -0000 1.10
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: AudioDecoderNellymoser.cpp,v 1.9 2008/02/27 08:51:54 bwy Exp $
+// $Id: AudioDecoderNellymoser.cpp,v 1.10 2008/03/01 04:47:45 bjacques Exp $
// This file incorporates work covered by the following copyright and
permission
// notice:
@@ -49,9 +49,9 @@
#include "AudioDecoderNellymoser.h"
#include "utility.h"
-#include <cstdlib>
#include <ctime>
#include <cmath>
+#include "VM.h"
namespace gnash {
namespace media {
@@ -642,6 +642,18 @@
return ret;
}
+static int
+gimme_random()
+{
+ using namespace boost;
+ VM::RNG& rnd = VM::get().randomNumberGenerator();
+
+ uniform_int<> dist(0, std::numeric_limits<int>::max());
+ variate_generator<VM::RNG&, uniform_int<> > uni(rnd, dist);
+
+ return uni();
+}
+
static void nelly_decode_block(nelly_handle* nh, unsigned char
block[NELLY_BLOCK_LEN], float audio[256])
{
int i,j;
@@ -679,7 +691,9 @@
for (j = 0; j < NELLY_FILL_LEN; j++) {
if (bits[j] <= 0) {
buf[j] = M_SQRT1_2*pows[j];
- if (random() % 2)
+
+
+ if (gimme_random() % 2)
buf[j] *= -1.0;
} else {
v = get_bits(block, &bit_offset, bits[j]);
@@ -711,15 +725,9 @@
static nelly_handle *nelly_get_handle()
{
- static int first = 1;
int i;
nelly_handle *nh;
- if (first) {
- srandom(time(NULL));
- first = 0;
- }
-
nh = new nelly_handle;
if (nh != NULL)