<< >>
justin = { main feed , music , code , askjf , pubkey };recent comments
search
[ present ... 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ... past ]
July 22, 2011
Music
freeform jam with louie


July 14, 2011
Fun with denormals

Something that often comes up when writing audio applications are things called "denormals". These are floating point numbers that are very small, so small in fact that for some reason CPU designers think they are quite rare (OK so they are), so the circuitry that processes them is very slow, when compared to that of a "normal" sized number.

If you read that (awful) explanation, and didn't understand it or care, I apologize, you can stop reading now because it will only get more boring and less intelligible.

We have made some common code to filter out these numbers, as many others no doubt have done:

// boring code omitted, see WDL/denormal.h for the full code
// WDL_DENORMAL_DOUBLE_HW() is a macro which safely gets you the high 32 bits of a double as an unsigned int.

static double WDL_DENORMAL_INLINE denormal_filter_double(double a)
{
  return (WDL_DENORMAL_DOUBLE_HW(&a)&0x7ff00000) ? a : 0.0;
}
The above code pretty simply looks at the exponent field of the double, and if it is nonzero, returns the double, otherwise it returns 0.

Recently it came to our attention that we actually needed to filter out larger numbers as well (when sending those numbers through a process such as a FFT, they would end up as denormals). If we pick a number around 10^-16 (not being picky about the exact cutoff), which has an exponent of 0x3C9, we can choose to filter when the expoenent field is under that value:
static double WDL_DENORMAL_INLINE denormal_filter_double_aggressive(double a)
{
  return ((WDL_DENORMAL_DOUBLE_HW(&a))&0x7ff00000) >= 0x3c900000 ? a : 0.0;
}
That was pretty much free (ok slightly larger code, I suppose). One nice thing that became apparent was that we could filter NaN and infinity values this way as well (exponent == 0x7FF), with only the cost of a single integer addition:
static double WDL_DENORMAL_INLINE denormal_filter_double_aggressive(double a)
{
  return ((WDL_DENORMAL_DOUBLE_HW(&a)+0x100000)&0x7ff00000) >= 0x3cA00000 ? a : 0.0;
}
Note that the exponent is increased by 1, so that 0x7FF becomes 0, and we adjusted the cutoff constant for the change.

An extra thought: if you need to pick the cutoff number more precisely, you could change the mask to 0x7fffffff and the cutoff (0x3cA00000) to include some of the fraction digits...

Additional reading: IEEE_754-1985.

Oh and happy bastille day!

3 Comments


July 9, 2011
$50 of fun

A small r/c car, led lights, and wireless camera.

Comment...


July 1, 2011
Music
louie - 1 -- [9:35]
louie - 2 -- [3:35]
louie - 3 -- [7:40]
louie - 4 -- [10:27]
louie - 5 -- [14:21]
louie - 6 -- [5:36]
louie - 7 -- [4:50]
louie - 8 -- [2:37]
louie - 9 -- [12:23]


June 29, 2011
Music
louie - 1 -- [3:02]
louie - 2 -- [4:00]
louie - 3 -- [5:22]
louie - 4 -- [3:18]
louie - 5 -- [5:12]
louie - 6 -- [6:28]
louie - 7 -- [7:28]
louie - 8 -- [3:30]
louie - 9 -- [2:47]
louie - 10 -- [3:55]
louie - 11 -- [4:44]
louie - 12 -- [4:15]
louie - 13 -- [3:08]
louie - 14 -- [2:59]


June 27, 2011
Spotted last month

Al thought this would make a good picture.

3 Comments


June 16, 2011
I have this dream

where I'm flying through space
hoping there are no power lines

2 Comments


June 8, 2011
incredible industrial design

s/incredible/sleepy/
Yawn:



Comment...


June 5, 2011
Music
bren - 1 -- [12:46]
bren - 2 -- [13:05]


May 18, 2011
Lots of people

I am not at a Pink Floyd concert.

Comment...


May 14, 2011
A fascinating article from 1987

Reading this piece from the New Yorker about the Mississippi River from 1987 (at schwa's recommendation). I wish it had pictures, but wow.

Comment...


May 13, 2011
Caffeinated walks ftw



Comment...


May 10, 2011
Memories from winter

...are now so distant...

Comment...


May 10, 2011
Another test

I like analog clocks.

1 Comment


May 10, 2011
Columbus Park



Comment...


April 26, 2011
yet another tame impala bootleg



4 Comments


April 22, 2011
Music
louie - 1 -- [6:28]
louie - 2 -- [7:01]
louie - 3 -- [10:30]
louie - 4 -- [4:55]
louie - 5 -- [4:13]
louie - 6 -- [6:58]


April 19, 2011
tame impala

I love these guys, I can't wait until next week for their show. Anyway some of their (old?) demos/unreleased tracks have shown up on youtube, and are really wonderful. Such low quality and such good result. Here's a little playlist of some of them I put together:


Also, I would highly recommend their album "Innerspeaker", as well as the EP that has the song "half full glass of wine" on it. Both of those are outstanding.

4 Comments


April 19, 2011
Music
freeform jam with louie


April 12, 2011
power consumption

I wonder what the total number of kW hours required to say, run the Apollo 11 mission. One factor would be in the fuel required, but I also mean in running the whole operation, manufacturering components, running control rooms, processing fuel, moving the rockets around, etc etc.

Which brings me to the fact that I just got a "Kill-A-Watt", after reading this blog post. I haven't tested everything yet (nor will I ever hah), but here are the results for the things I have:

  • iPhone charger: 0.0W when no iPhone connected, 6W when charging (the classic "you should unplug wall warts when not in use" thing doesn't necessarily apply!)
  • ReadyNAS NV (old sparc model, 3 WD and 1 Seagate 1TB disks): 50W
  • Samsung 24" LCD: 45W, or 0W when in powersave mode
  • Q6600 2.4ghz computer with single 7200rpm disk, GeForce 8600 GT, UAD-1 PCI-E card, idle: 115W, full load (with UAD-1 going): 185W.
  • Sony VPC-Z12 laptop (dual core i7, SSD, 13" 1920x1080 screen, full brightness): 17W when idle in "speed" mode. 35W when idle and charging battery, 77W under full CPU load while charging battery.*
  • Updated: Brother laser printer/scanner/fax: 6W idle
  • Updated: Thinkpad X60 (1.83ghz C2D): idle 23W, 28W with full brightness setting
  • Updated: PS3: 1W off, 100W idle, 120W in RE5.
  • Updated: LG 36" LCD: 0.5W off, 45W on
  • Updated: 24" C2D iMac: 125W idle, screen at full brightness, 146W full load
  • Updated: ZT lunchbox amp: 18W cranked but not playing anything, 23W when playing loud
The biggest thing that struck me is that my laptop, under normal use conditions, is using less power than desktop's monitor ALONE. Wow. I'll test more things soon, I get to reboot once again to remove the Kill-A-Watt from my desktop now.

*I should also mention that this laptop is really wonderful, despite lacking home/end/pgup/pgdown keys, which makes me sad. It weighs only 3LBs, and is fast (i7 dual core, 4 threads, goes up to 3.2ghz or so in singlecore mode automatically), and even has an optical drive built in.

1 Comment


April 11, 2011
Music
freeform jam with louie


April 9, 2011
a little ditty

Here's a sparse musical improv I made with a friend.

Comment...


[ present ... 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ... past ]
search : rss : recent comments : Copyright © 2020 Justin Frankel