Technical discussions related to Speech Coding (all itu and other vocoders, ACELP, CELP, AMR, etc)
Post a new Thread
Fixed point conversion - pai_raviin - Apr 30 11:33:00 2005
Hi all,
Can anybody help me with the fixed point conversion of following
code:
while (iCoef < iNextBandR)
{
*pfltXformSubBark = 0.0;
i = 0;
while (i < iWidth)
{
*pfltXformSubBark += *pfltOuterEarXform * *pfltOuterEarXform;
i++;
}
iCoef += iWidth;
pfltXformSubBark++;
iWidth = (1<<iDownFactor);
}
I am taking the values of pfltOuterEarXform in as Q30 format in
fixed point format (because the values of pfltOuterEarXform in
between 1.02527 & 0.021747) and doing the squaring of
pfltOuterEarXform and accumulating with pfltXformSubBark if and only
if i < iWidth.
And I observed the range of pfltXformSubBark values in between
0.000945910 and 33.6377.
When I do the multiplication there is overflow problem(?) i.e. it's
exceeding Q30 format. How to convert this piece of code into fixed
point??
P. Ravichandra Reddy

(You need to be a member of speechcoding -- send a blank email to speechcoding-subscribe@yahoogroups.com )
Re: Fixed point conversion - bhagawan reddy - May 3 0:53:00 2005
Dear Ravichandra,
Here you are doing Multiply and Accumulate(MAC)
operation.Hence you cannot expect *pfltXformSubBark to be in Q30 format.
Declare this as 40-bit or 64-bit, whatever your processor supports, and balance betweeen
the Integer and fractional bits you need.
Regards,
Bhagawan
pai_raviin <p...@yahoo.co.in> wrote:
Hi all,
Can anybody help me with the fixed point
conversion of following
code:
while (iCoef < iNextBandR)
{
*pfltXformSubBark = 0.0;
i = 0;
while (i < iWidth)
{
*pfltXformSubBark
+= *pfltOuterEarXform * *pfltOuterEarXform;
i++;
}
iCoef += iWidth;
pfltXformSubBark++;
iWidth = (1< }
I am taking the values of
pfltOuterEarXform in as Q30 format in
fixed point format (because the values of
pfltOuterEarXform in
between 1.02527 & 0.021747) and doing the squaring of
pfltOuterEarXform and accumulating with pfltXformSubBark if and only
if i <
iWidth.
And I observed the range of pfltXformSubBark values in between
0.000945910 and 33.6377.
When I do the multiplication there is overflow problem(?)
i.e. it's
exceeding Q30 format. How to convert this piece of code into
fixed
point??
P. Ravichandra Reddy
------------------------ Yahoo!
Groups Sponsor --------------------~-->
In low income neighborhoods, 84% do not own
computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EA3HyD/3MnJAA/79vVAA/GP4qlB/TM
--------------------------------------------------------------------~-
<*> To
visit your group on the web, go to:
http://groups.yahoo.com/group/speechcoding/
<*> To unsubscribe from this group, send an email to:
s...@yahoogroups.com
<*
Yahoo! India Matrimony: Find your life partner
online.

(You need to be a member of speechcoding -- send a blank email to speechcoding-subscribe@yahoogroups.com )
Re: Fixed point conversion - venkat ramanan - May 3 9:45:00 2005
Dear Ravichandra,
As bhagawan said,
Multiplying two variables of x bits, u will get 2x bits. We have shift the 2x bits by 1 bit
left (to eliminate the effect of one of the sign bit I guess).
So your right hand side variable have to be greater than q30 format (nearly double) and finally
you can round of to Q30 format instead of keeping the right hand side variable in Q30 format.
This will be more accurate than the later.
Regards,
Venkat
On Tue, 03 May 2005 bhagawan reddy wrote :
>Dear Ravichandra,
>
> Here you are doing Multiply and Accumulate(MAC) operation.Hence
you cannot expect *pfltXformSubBark to be in Q30 format.
>
>Declare this as 40-bit or 64-bit, whatever your processor supports, and balance betweeen
the Integer and fractional bits you need.
>
>Regards,
>Bhagawan
>pai_raviin <p...@yahoo.co.in> wrote:
>Hi all,
>
>Can anybody help me with the fixed point conversion of following
>code:
>
>while (iCoef < iNextBandR)
>{
>*pfltXformSubBark = 0.0;
>i = 0;
>while (i < iWidth)
>{
>*pfltXformSubBark += *pfltOuterEarXform * *pfltOuterEarXform;
>i++;
>}
>iCoef += iWidth;
>pfltXformSubBark++;
>iWidth = (1< }
>
>I am taking the values of pfltOuterEarXform in as Q30 format in
>fixed point format (because the values of pfltOuterEarXform in
>between 1.02527 & 0.021747) and doing the squaring of
>pfltOuterEarXform and accumulating with pfltXformSubBark if and only
>if i < iWidth.
>
>And I observed the range of pfltXformSubBark values in between
>0.000945910 and 33.6377.
>
>When I do the multiplication there is overflow problem(?) i.e. it's
>exceeding Q30 format. How to convert this piece of code into fixed
>point??
>
>P. Ravichandra Reddy
>Yahoo! India Matrimony: Find your life partneronline.
Mistakes are not end of the world but repeating them is

(You need to be a member of speechcoding -- send a blank email to speechcoding-subscribe@yahoogroups.com )
Re: Re: Fixed point conversion - Raj Baretto - May 5 6:01:00 2005
You need 6 bits to take care of the overflow according to your accumulated size(but this
depends again on iWidth). As you are using a accumulator normally of 4 bits it would be fine
when you are not doing any shifting in the loop.But while storing it in the result array or
using this after MAC operations you need to shift or use an appropriate assembly instructions
so that it stores a part of your higher accumulated value.Also remember if you are multiplying
in the fractional mode you dont need take care of the shifts to compensate for the format.The
only care care you need to take is the overflow occuring due to acccumulation. If you are using
addition or scaling in your code with this functionality then you can use the same along with
the final shifting operations.
Rgrds,
Rajendra.
On Tue, 03 May 2005 venkat ramanan wrote :
>Dear Ravichandra,
>As bhagawan said,
>Multiplying two variables of x bits, u will get 2x bits. We have shift the 2x bits by 1 bit
left (to eliminate the effect of one of the sign bit I guess).
>So your right hand side variable have to be greater than q30 format (nearly double) and
finally you can round of to Q30 format instead of keeping the right hand side variable in Q30
format. This will be more accurate than the later.
>
>Regards,
>Venkat
>
>On Tue, 03 May 2005 bhagawan reddy wrote :
> >Dear Ravichandra,
> >
> > Here you are doing Multiply and Accumulate(MAC) operation.Hence you cannot expect
*pfltXformSubBark to be in Q30 format.
> >
> >Declare this as 40-bit or 64-bit, whatever your processor supports, and balance
betweeen the Integer and fractional bits you need.
> >
> >Regards,
> >Bhagawan
> >
> >
> >pai_raviin <pai_raviin@pai_...> wrote:
> >Hi all,
> >
> >Can anybody help me with the fixed point conversion of following
> >code:
> >
> >while (iCoef < iNextBandR)
> >{
> >*pfltXformSubBark = 0.0;
> >i = 0;
> >while (i < iWidth)
> >{
> >*pfltXformSubBark += *pfltOuterEarXform * *pfltOuterEarXform;
> >i++;
> >}
> >iCoef += iWidth;
> >pfltXformSubBark++;
> >iWidth = (1< }
> >
> >I am taking the values of pfltOuterEarXform in as Q30 format in
> >fixed point format (because the values of pfltOuterEarXform in
> >between 1.02527 & 0.021747) and doing the squaring of
> >pfltOuterEarXform and accumulating with pfltXformSubBark if and only
> >if i < iWidth.
> >
> >And I observed the range of pfltXformSubBark values in between
> >0.000945910 and 33.6377.
> >
> >When I do the multiplication there is overflow problem(?) i.e. it's
> >exceeding Q30 format. How to convert this piece of code into fixed
> >point??
> >
> >P. Ravichandra Reddy
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >Yahoo! India Matrimony: Find your life partneronline.
>Mistakes are not end of the world but repeating them is

(You need to be a member of speechcoding -- send a blank email to speechcoding-subscribe@yahoogroups.com )