Skip to main content

Topic: How to calculate x^(4/3) (Read 4990 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • encai
  • [*]
How to calculate x^(4/3)
Hi, all
I am doing a Fixed-point AAC decoder and have
some questions:
1. how to calculate pow(x, 4.0/3.0) for x = 0, 1, ..., 8191
2. what does DRC stand for in AAC decoder.
3. where can I find some info. for Fixed-point implementation
    of AAC decoder, such as paper, precision info. and so on.

regards

encai
:confused:

  • sam
  • [*][*]
How to calculate x^(4/3)
Reply #1
1. how to calculate pow(x, 4.0/3.0) for x = 0, 1, ..., 8191

What about a look up table? Be quicker and you can tune the results how you wish. I can provide the answeres for you to any number of dp.

  • encai
  • [*]
How to calculate x^(4/3)
Reply #2
Quote
Originally posted by sam
1. how to calculate pow(x, 4.0/3.0) for x = 0, 1, ..., 8191 

What about a look up table? Be quicker and you can tune the results how you wish. I can provide the answeres for you to any number of dp.


Thanks a lot for fast reply.
A look up table is really a solution for it, but the table size
is so large...
and a small size table can not satisfy the precison request
for a AAC decoder...
Any more advice is very appreciated.

regards

  • sam
  • [*][*]
How to calculate x^(4/3)
Reply #3
Yeah, guess it depends what your developing it for. I just assumed a PC prog, and 8192 double precisson numbers (64 bit) is about 64K.

  • Gabriel
  • [*][*][*][*][*]
  • Developer
How to calculate x^(4/3)
Reply #4
First of all, be carefull because in layer3 the max value is 8207 and not 8192.

A common solution is to use only a small table of let's say 1026 values

if i <1026 then direct lookup
if i >1025 then i = i/8, then lookup, then i = i*16

This involves only lookups and shiftings so it's quite fast, and reduces a lot the table size

  • sam
  • [*][*]
How to calculate x^(4/3)
Reply #5
But wont there be a bit of round off error in the i /= 8 operation?

  • encai
  • [*]
How to calculate x^(4/3)
Reply #6
Hi, guys! Thank you for your advice.
I am doing a prog. for DSP, So even a 8K table is
too large for me.

  • Gabriel
  • [*][*][*][*][*]
  • Developer
How to calculate x^(4/3)
Reply #7
A 8k table is probably too big, but with my proposal you only have a 4k table (assuming you're using 32bits fixed-point).

In any way you'll have to find another way than real computation of pow(4/3), as this is too much expensive for dsp.


Perhaps it should also be possible to not compute this at all. After all, for decoding you have to compute this power after Huffman decoding, so perhaps it could be directly included into this decoding.

  • smack
  • [*][*][*]
How to calculate x^(4/3)
Reply #8
I had also encountered the problem of pow(x,4/3) computation when I implemented a Layer 3 decoder for a DSP. After testing some approximation calculations which took too much computing power and were not accurate enough I simply used a full (8K) lookup table.
Btw. what DSP are you using? I managed to implement a MPEG-1 layer 3 decoder (including the 8K table) on a Motorola DSP with a total of 32 KWords of memory.
(source codes available under GNU GPL ;-)

  • Gabriel
  • [*][*][*][*][*]
  • Developer
How to calculate x^(4/3)
Reply #9
<mode="source code hunter">
Where could I find this source code?
<mode="regular">

  • encai
  • [*]
How to calculate x^(4/3)
Reply #10
Quote
Originally posted by Gabriel
Perhaps it should also be possible to not compute this at all. After all, for decoding you have to compute this power after Huffman decoding, so perhaps it could be directly included into this decoding.

More info. in details please!
It is so exciting to avoid such calculation.

  • encai
  • [*]
How to calculate x^(4/3)
Reply #11
Quote
Originally posted by smack
I had also encountered the problem of pow(x,4/3) computation when I implemented a Layer 3 decoder for a DSP. After testing some approximation calculations which took too much computing power and were not accurate enough I simply used a full (8K) lookup table.


Did you use a sigle-precision table(16bit)?
was it accurate enough?

Quote
Btw. what DSP are you using? I managed to implement a MPEG-1 layer 3 decoder (including the 8K table) on a Motorola DSP with a total of 32 KWords of memory.
(source codes available under GNU GPL ;-)

I am using TI's 16 bit fixed-point DSP.
BTW: where can I find your code.

  • smack
  • [*][*][*]
How to calculate x^(4/3)
Reply #12
The Motorola DSP has 24bit words, I found the accuracy of the single precision table good enough. (IIRC the error is less than 0.5%)
I had posted the links to my programs in another thread:
http://www.hydrogenaudio.org/forums/showth...hp?threadid=840

Huffman decoding and pow(x,4/3) computation are not releated in any way, they are just two steps in the decoding process. No magic involved here, no possibility to do only one and skip the other. sorry. :-|

  • Ivan Dimkovic
  • [*][*][*][*][*]
  • Developer
How to calculate x^(4/3)
Reply #13
Check out the:

AES Paper #5363
"Optimized DSP Implementation of Non-Linear Quantization"

(Raghunath K. Rao and Girish P. Subramaniam)

Presented at the 110th Convention
2001 May 12–15 Amsterdam, The Netherlands

ABSTRACT
Non-linear quantization of the type INT(x M/N + constant) is commonly used in audio compression techniques,
particularly MPEG-1 and MPEG-2 layer III (MP3) and MPEG Advanced Audio Coding (AAC). Finding a
suitable DSP implementation is a problem since lookup table methods are prohibitive due to excessive storage
requirements, conventional series approximation methods do not give sufficient precision, and not all processors
have log/exp assist functions. This paper describes a method which utilizes the property of geometric periodicity
of the x M/N function to first normalize the problem to a small range of input x. Subsequently one can choose to
perform the x M/N in this limited range based on lookup, interpolation, or series expansion, and finally re-normalize
the output to obtain the overall answer. Using a hybrid scheme based on lookup and interpolation very
good overall precision is achieved. Compared to direct application of any of the above techniques, there is very
little additional computational burden, and the improvement in precision is very significant. Mathematically, this
method is shown to be a special case of log-exp based computation where the log is quantized.

  • encai
  • [*]
How to calculate x^(4/3)
Reply #14
Quote
Originally posted by Ivan Dimkovic
Check out the:

AES Paper #5363
"Optimized DSP Implementation of Non-Linear Quantization"

(Raghunath K. Rao and Girish P. Subramaniam)

Presented at the 110th Convention
2001 May 12?5 Amsterdam, The Netherlands


That is what I need. How can I get a E-version(such as PDF file etc...)
of it.

  • encai
  • [*]
How to calculate x^(4/3)
Reply #15
Quote
Originally posted by smack
The Motorola DSP has 24bit words, I found the accuracy of the single precision table good enough. (IIRC the error is less than 0.5%)
I had posted the links to my programs in another thread:
http://www.hydrogenaudio.org/forums/showth...hp?threadid=840


I have dl the source, but i have not use a Motorola DSP ever. :-(
Thanks any way.

  • Delirium
  • [*][*][*][*]
How to calculate x^(4/3)
Reply #16
Quote
Originally posted by encai
That is what I need. How can I get a E-version(such as PDF file etc...)
of it.
It's generally not possible to (legally) get free versions of these sorts of journal articles.  Your best bet is probably a university library, if you have access to any; the AES is big enough that many research libraries will carry the proceedings of their conferences.

I did a bit of Google searching, and the only reference I found to the abstract Ivan pasted was at the AES website, which has pre-prints of papers from conference proceedings available for sale -- this paper's pre-print # is 5363 and you can order pre-prints of it (either in hard copy or PDF) for $10 ($5 for AES members) -- same price either way, though there's probably shipping added for the hard copy version.

The search is here:
http://www.aes.org/publications/preprints/search.html

Type 5363 into the "Preprint number" box and it'll come up with an order form.

  • Gabriel
  • [*][*][*][*][*]
  • Developer
How to calculate x^(4/3)
Reply #17
I downloaded this paper last week, but I can't remember from where...

  • Ivan Dimkovic
  • [*][*][*][*][*]
  • Developer
How to calculate x^(4/3)
Reply #18
I have the AES version, but it might be possible to find it on Cirrus web site.

  • encai
  • [*]
How to calculate x^(4/3)
Reply #19
Hi, guys
Would you please tell me the URL or some info.
or sent the paper to [a href='mailto:encai@yahoo.com'][/a].
I have searched in google and find nothing.

Thanks!

  • ashok
  • [*]
How to calculate x^(4/3)
Reply #20
Hello
the best method is u can go for Newton Rahpson method
it will converge in 6 or at max 7 iterations and with same accuracy as table look up

personnaly u can contact me at
[a href='mailto:ashok_i_m@rediffmail.com'][/a]
thanks alot

  • DSPguru
  • [*][*][*]
  • Developer
How to calculate x^(4/3)
Reply #21
Quote
Originally posted by Gabriel
A common solution is to use only a small table of let's say 1026 values

if i <1026 then direct lookup
if i >1025 then i = i/8, then lookup, then i = i*16

This involves only lookups and shiftings so it's quite fast, and reduces a lot the table size
i would go with Gabriel here. just instead of using table for the 1026 results, i would implement a high-order polynom (the order depends on the accuracy, but it won't get up to 1000 - that's for sure) .

btw,
you could use MATLAB's polyfit function, in order to generate the polynom coefficients, and polyval, in order to estimate the error.

Dg.
DSPguru's Webpage - home of BeSweet & The OggMachine.
BeSplit - 7kb of A loseless AC3/AAC/MP3/MP2/WAV Cutter :)