List Info

Thread: Re: Porting Jack on iPaq




Re: Porting Jack on iPaq
user name
2007-01-31 04:02:16
Nyx wrote:
> I want to port meterbridge (Vumeter, Peakmeter,...)
into an iPaq
> (hx4700). So I have to develop it....
> 
> It isn't possible to cross-compile jackd on a host PC
and after to
> port it on the iPaq ?
> 
> I don't understand what is the difference between to
develop for a
> floating point processor and to develop for a static
point
> processor....
> 
> May anybody have the answer ?

Simplified:

Floating point numbers are expressed in the
mantissa,exponent form. They 
always have a fixed number of bits to represent the mantissa
and a fixed 
number of bits to represent the exponent. This basically
comes down to 
the fact that the precision of a number in float format is
relative to 
the magnitude of the number and that it remains that way.

for example:
say you have the number 12.345678901, a (low-precision)
float 
representation using 6 digits of this could be: 1.2346E+1
the absolute rounding error being approx 0.00033, so the
relative 
rounding error is about approx 2.7E-5.

Say we were to represent a 100 times bigger number, i.e.
1234.5678901. 
In our float representation it would become 1.2346E+3. This
gives an 
absolute error of approx 0.033. The absolute error becomes
100 times 
larger. However the relative error remains the same: approx
2.7E-5.

Note that the dynamic range of this floating point
representation is 
from 0 to 9.9999E9 (=9999900000)

In an equivalent fixed point representation you decide in
advance how 
many digits you use, and where to put the period. Say that
we have a 
fixed point representation with 6 digits.

Now we have two options:
1) either keep the position of the point fixed throughout
for all numbers
2) or adjust the position of the point depending on the
number

Case 1:
In order to be able to represent both numbers, we need 4
digits before 
the point, giving us 2 digits after the point. the rounded
numbers, 
absolute errors and relative errors are:
12.345678901: 0012.36, abs err=0.014, rel err=0.0012
1234.5678901: 1234.56, abs err=0.008, rel err=0.0000065

for this type of fixed point representation the absolute
error remains 
approximately constant (determined by the nb of digits after
the point), 
and the relative error is dependent on the number's
magnitude.

It is easy to see that the dynamic range of this
representation is from 
0000.00 to 9999.99. A lot lower than the float
representation, so you 
have to be aware of potential overflows.

Case 2:
In order to extend the dynamic range and lower the error you
could shift 
the point up or down:
12.345678901: 12.3457, abs err=0.000021, rel err=0.0000017
1234.5678901: 1234.56, abs err=0.008, rel err=0.0000065
dynamic range: 0 to 999999.

However you will have to keep track of the effective
position of the point:

   fixed_point x = 12.3457; // XX.XXXX

   x2 = x; // x2 = x*100, point shifted 2 places: XXXX.XX

   // now the difficult part:
   y=x2*x; // what will this be? how to compute this?

Note that case2 is the only useful case if you have limited
number of 
bits. However it is very complicated.

For jack, case 1 could be used because normally the sample
values are 
between 1.0 and -1.0, so that would allow the use of a
'fixed-point 
fixed point' representation. However, in every computation
you will have 
to check for overflows and such.

e.g. adding two audio samples for mixdown:
in float:
   y=(x1+x2)/2.0;
in fixed point:
   y=(x1/2)+(x2/2);

   because x1+x2 would overflow if both are 1 and summed
before the
   division. This does make that you lose 1 digit of
precision on both
   x1 and x2, as it 'falls off' in the division.


The explanation here is quite simplified, but I hope it
indicates the 
kind of issues you can expect when trying to port from float
to integer.

Greets,

Pieter


------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jackit-devel mailing list
Jackit-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jackit-dev
el

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )