IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Converting Frequency Distributions
Canar
post Apr 24 2004, 23:36
Post #1





Group: Super Moderator
Posts: 3327
Joined: 26-July 02
From: princegeorge.ca
Member No.: 2796



I don't know how to phrase my question properly, so I'll try and explain what my intent is.

In a thread a while back, I mentioned an idea of mine: If you find the distribution of the PCM data in a file, altering that distribution could fix some dynamic compression problems, albeit with an increase in harmonic distortion.

So, what would be a method for converting the known, arbitrary distribution of PCM data to another arbitrary distribution, ie the normal distribution?


--------------------
∑:<
Go to the top of the page
+Quote Post
ErikS
post Apr 25 2004, 18:41
Post #2





Group: Members
Posts: 757
Joined: 8-October 01
Member No.: 247



Should be easy in matlab for example. Check out the histeq function first.
Go to the top of the page
+Quote Post
Canar
post Apr 27 2004, 03:33
Post #3





Group: Super Moderator
Posts: 3327
Joined: 26-July 02
From: princegeorge.ca
Member No.: 2796



QUOTE (ErikS @ Apr 25 2004, 09:41 AM)
Should be easy in matlab for example. Check out the histeq function first.

Hmm... if I were only working in Matlab... wink.gif

May look into that more, may just hack with the math. I don't know a lot about summation operators though. ohmy.gif

Thanks for the idea at very least.


--------------------
∑:<
Go to the top of the page
+Quote Post
ErikS
post Apr 27 2004, 04:03
Post #4





Group: Members
Posts: 757
Joined: 8-October 01
Member No.: 247



Ok then. So maybe a short description of what histeq does is in place?

You need a function to map input values between -32k and +32k to the same output range. First you have to find the PDF by counting the occurances of each value, and then dividing by the total number of samples. Then a function to turn this into a uniform distribution use this as your mapping function: T(x) = (sum(pdf(i), i=-32 to x) - 0.5 ) * 64k

Then to turn a uniform pdf into a normal there is a fixed function, lets call it N. Compose these two functions, (N o T) and apply it to your data.

Edit: crappy autoformatting turned my variable into ... smile.gif

Oh, and by the way... why not try your idea in matlab before coding in in C or something? It's much faster way of testing, and if it turns out it doesn't work, much less work down the drain. And if it does work you have a good prototype before you start writing c code.

Edit2: Just found that N is normally called Box-Muller transform. Google it.

This post has been edited by ErikS: Apr 27 2004, 04:20
Go to the top of the page
+Quote Post
cabbagerat
post Apr 27 2004, 10:20
Post #5





Group: Members
Posts: 1018
Joined: 27-September 03
From: Cape Town
Member No.: 9042



If you don't have access to Matlab you can try Octave, which is a very similar language and is free. Last time I used it (it develops quickly though) it didn't have the Histeq function, but certainly supports all the primitives that would make one easy to implement. Googling for "octave histeq" also returns a couple of implementations.
Octave's Sourceforge page is a good place to start.

QUOTE
Oh, and by the way... why not try your idea in matlab before coding in in C or something

This is a very good idea - it means you can seperate the maths from the practicalities. Once you are sure of the maths you are doing, then implementing in C would be simple (look at the fftw and ATLAS libraries for a start).


--------------------
Simulate your radar: http://www.brooker.co.za/fers/
Go to the top of the page
+Quote Post
Canar
post Apr 27 2004, 19:00
Post #6





Group: Super Moderator
Posts: 3327
Joined: 26-July 02
From: princegeorge.ca
Member No.: 2796



Yeah, I thought that might have been what you intended with the Matlab comment. I'll look into Octave, but I almost think it'd take longer for me to learn that language than to write the code in Delphi (that's what I'm coding in). I'm pretty solid at converting math stuff into code.

Box-Muller transform, eh? I'll look into that. Thank you all for the insight. Hopefully I can make something out of this.

Edit: Histogram equalization! That's what I needed to search for! w00t.gif
Thanks again, everyone. wink.gif

This post has been edited by Canar: Apr 27 2004, 19:08


--------------------
∑:<
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th April 2014 - 07:24