[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] Build problem on OS/2
From: |
strk |
Subject: |
Re: [Gnash-dev] Build problem on OS/2 |
Date: |
Thu, 9 Aug 2007 17:48:17 +0200 |
On Thu, Aug 09, 2007 at 08:07:12AM -0700, David Rorex wrote:
> On 8/8/07, strk <address@hidden> wrote:
> >
> > On Thu, Aug 09, 2007 at 05:47:28AM +0200, strk wrote:
> > > On Wed, Aug 08, 2007 at 06:03:37PM -0700, David Rorex wrote:
> > > > On 8/8/07, Paul Smedley <address@hidden> wrote:
> > >
> > > > Why is it even calling ceil on an int in the first place? I think you
> > should
> > > > be able to simply do: (regardless of platform)
> > > >
> > > > in->ensureBytes( sample_count * ( 3 + n_bits/8 );
> > >
> > > It's not calling ceil on an int, but on the result of a division.
> > > We want to get 1 if n_bits is 6 ...
> > >
> > > ceil(n_bits/8)
> >
> > I committed a patch fixing a bug in that function.
> > The new code still contains the ceil call, Paul, try adding a final .0
> > to the constant in the division (4096.0 and 8.0) in case it fails the
> > way it is.
> >
> > --strk;
> >
>
> Yeah, I was going to say that, if n_bits is an int, and 8 is an int, then
> the result will also be an int (as if floor had been called on it). adding
> the .0 will force floating point division.
Gah :( using float math results in a bogus computation:
27580] 11:30:01: ERROR: Parsing exception: premature end of tag: need to read
9638 bytes, but only 9635 left in this tag
while int math was fine.
Does anyone see the flow in this computation ?
// bitsPerSample is the number of bits for each sample
unsigned int bitsPerSample = n_bits;
if (stereo) bitsPerSample *= 2;
// There's going to be one block every 4096 samples (or fraction)
unsigned int blocksCount = (unsigned int)ceil(sample_count/4096.0);
// Every block will have an header of 22 bits
unsigned int bitsPerBlock = 22;
unsigned long bytesNeeded = (unsigned long)ceil(
((sample_count*bitsPerSample)+(bitsPerBlock*blocksCount)) / 8.0 );
Using int math on the ceil lines gives exactly the number of bytes left in the
tag (9635), using
float math gives 3 bytes more (mmm... ceil of 22 bits, it seems).
I verified that the "blocks" loop is entered the expected number of times (4,
using float math).
All these tests are performed runnign gangsta_rap_se.swf.
Any help is appreciated.
--strk;
- [Gnash-dev] cofiguration error in MinGW, jeremy chow, 2007/08/02
- Re: [Gnash-dev] cofiguration error in MinGW, Dossy Shiobara, 2007/08/02
- [Gnash-dev] Build problem on OS/2, Paul Smedley, 2007/08/08
- Re: [Gnash-dev] Build problem on OS/2, strk, 2007/08/08
- Re: [Gnash-dev] Build problem on OS/2, Paul Smedley, 2007/08/08
- Re: [Gnash-dev] Build problem on OS/2, David Rorex, 2007/08/08
- Re: [Gnash-dev] Build problem on OS/2, strk, 2007/08/08
- Re: [Gnash-dev] Build problem on OS/2, strk, 2007/08/09
- Re: [Gnash-dev] Build problem on OS/2, David Rorex, 2007/08/09
- Re: [Gnash-dev] Build problem on OS/2,
strk <=
- [Gnash-dev] bytes needed for parsing ADPCM samples, strk, 2007/08/09
- [Gnash-dev] Re: bytes needed for parsing ADPCM samples, Paul Smedley, 2007/08/09