ΣSigmaStudio Ask AI Русский Log in

log-spaced lookup table?

SigmaDSP & SigmaStudio ggilles Nov 23, 2012 00:00 10 replies Original on forum ↗
Subscribe
ggilles Question
Nov 23, 2012 00:00

Hello,

I have a design where I need to compute a gain from the estimation of the input signal level in a specific frequency band. There is a wide dynamic range for this input signal, so I can not simply use a lookup table because input points are linearly spaced which is not accurate enough.

The RMS lookup table does not really help here because it includes time constants that I must avoid.

Having a simple lookup table with logarithmically spaced values would solve my problem.

Is there anything in sigma studio which could help me implement this without using a lot of CPU?

Are there any plans to include a log-spaced lookup table?

Regards

-- Gilles

KJBob Reply
Nov 23, 2012 00:00

Hi Gilles,

If you can afford the 81 instructions for a square root block, you could place it directly before your look-up table and square the result afterward. This effectively doubles your dynamic range -- for example, a signal of 0.0001 (-80dB) would now present to the look-up table as 0.01 (-40dB). Another way to look at it is that the square root expands the lower end of your scale, effectively compressing the low-end resolution of your look-up table.

Best regards,

Bob

ggilles Reply
Nov 24, 2012 00:00

Hi Bob,

thank you for your answer.

Using the square root block would help but is not enough: I need >100dB dynamic range. Moreover, this is expensive CPU wise...

What puzzles me is that the "log-spaced" table must exist in some form anyway: all the compressors use this kind of functionnality. For example, the full range compressor uses only 73 instructions and performs a lookup in a 3dB spaced table with 40 points: that's effectively a 114dB dynamic range! My problem is that I must avoid the time constants involved in the compressor block.

ADIApproved Reply
Nov 27, 2012 00:00

Hi Bob and Gilles:

Your suspicious are correct, all SigmaDSP cores have a db converter (more acurately, it's a log2 converter). A dB lookup table should be possible, the code already exist, all we need is to expose it to the user without time constants and/or other code. If you don't have an urgent need, we could add this in the next build and will probably be available in ~ 2 months (coming Beta and/or release). If you need it more urgently, perhaps you want to contract a qualified 3rd party to create it for you.

Let me now your thoughts.

Miguel

ggilles Reply
Nov 27, 2012 00:00

Miguel,

I am really happy to learn that there is a log2 in the Sigma DSP. This should be an advertised feature! Could you tell me how much CPU cycles are used?

A log converter would be very useful in itself (without a lookup table). The first obvious use case is to avoid division: log(A/B) = log(A) - log(B). Therefore, I would suggest to simply add the log2 to the basic DSP blocks. In this way, we could easily build a log-spaced table of any size by combining the log2 and a lookup table ; and we could also use the log for other things.

If you manage to put this in the coming beta/release, that would be awesome!

Regards,

-- Gilles

ADIApproved Reply
Dec 3, 2012 00:00

Hi Gilles:

The Log2 converter uses very few instructions (I believe only 2) in our core.

I agree with you that the division would be simplified however to get a real division we need the antilog of (Log(A)-Log(B)) and the SigmaDSP do not have an antilog. The Sigma300 comming next year will have one .

I'm planning for making the log based table you required. Hope we can get it ready by the beginning of next year. Would you need and AntiLog? (that would probably take more time).

Please comment.

Miguel

KJBob Reply
Dec 3, 2012 00:00

Hi Miguel,

Having the antilogarithm would also simplify the square root block. Presently it uses 81 -- 141 instructions, but if we could implement sqrt(x) = antilog (0.5*log(x)), this would significantly reduce the instruction count. In fact, an arbitrary power function would become just as trivial. These algorithms would be useful for conditioning sensor outputs, or perhaps for the side-chain in an audio app.

Bob

ggilles Reply
Dec 4, 2012 00:00

Miguel,

I have at least one case of using log2 to avoid division, without needing _real_ the result of the division.

To me, having the log2 instruction available sooner would makes much more sense than "hiding" it inside a log-spaced table later.

Short answer:

I would like a solution as soon as possible.

ADIApproved Reply
Dec 4, 2012 00:00

Hi all:

We are making plans and this will become available in the next SigmaStudio (~3.9.1 Beta) scheduled for the beginning of next year. We also agree that this would be a very usefull and valuable tool.

Hope this meets your product schedules.

Miguel

ggilles Reply
Dec 5, 2012 00:00

Miguel,

thank you for making this happen.

Best regards,

-- Gilles

KJBob Reply
May 1, 2015 00:00

Hi Miguel and all,

Some documentation on the use of this log-spaced table can be found at:

Is there any documentation for the ADAU170x's Log Lookup Table?

Best regards,

Bob