<<
 
>>
 
 
justin = {main feed = { recent comments, search } , music , code , askjf , pubkey };
 
Music
July 21, 2015
broken beds
jerkiness
Music
July 6, 2015
check for weevils
Music
July 3, 2015
opening windows

(retroactively posted Nov 2015)

Comment...

(retroactively posted Nov 2015)

Recordings:

long losta cola

Comment...

(retroactively posted Nov 2015)

Comment...

(retroactively posted Nov 2015)

Comment...

(retroactively posted Nov 2015)

Comment...

Music
June 2, 2015
there went the block
Music
May 25, 2015
the new angle
Music
May 12, 2015
and so returns the heat
Music
May 7, 2015
they think you are special
Music
May 4, 2015
go away
more taint
Music
May 1, 2015
not seventy eight again
drink 'n stencil
April 30, 2015

(retroactively posted Nov 2015)

Recordings:

last chance for the apes

Comment...

Music
April 23, 2015
an incoherent tooth
Music
April 21, 2015
in need of something
Music
April 15, 2015
smac reprise
Music
April 13, 2015
strong men also cry
Music
April 10, 2015
alternate form

(retroactively posted Nov 2015)

Comment...

(retroactively posted Nov 2015)

Comment...

(retroactively posted Nov 2015)



Recordings:

no fools flat

Comment...

My new mp3 player!
March 22, 2015
This week's distraction is my new minimal HTML5 audio player, which is about 8kb of HTML/CSS/JS (or 3kb gzipped), and available here. The HTML5 audio tag does all of the work, this just does a basic AJAX-fetched media library, searching, and playlisting. I made it for all (1500 or so) of my recordings, but it should be pretty reusable...

Yes, no visualization, but that'd be so 1990s...

Recordings:

not the odds

2 Comments
Music
March 16, 2015
all according to plan
imperial odds
Music
March 12, 2015
gotta have standards
Music
March 10, 2015
crumbling plaster
Music
March 9, 2015
meltage
Music
March 7, 2015
another day another toilet
fixing to leave
Music
March 4, 2015
lonely disappointed
Music
February 23, 2015
short fuse
Music
February 19, 2015
dark rooms
white tighty
Music
February 16, 2015
not having visions
Music
February 12, 2015
angles and snowflakes
Music
February 4, 2015
raccoon hunger
Music
January 21, 2015
slog
Music
January 14, 2015
alex_jason - 1 -- [9:04]
alex_jason - 2 -- [9:47]
Music
December 14, 2014
always more
Music
December 6, 2014
freeform jam with very and googleable and v
Music
November 22, 2014
a cold pillar
Music
November 18, 2014
bitter
kiss
Music
November 6, 2014
spheresofwet
EEL overkill
November 4, 2014


Comment...
Music
October 29, 2014
scheduling
First, from a recent 'git log' command: ..and to think, back when we used VSS we didn't even have commit messages! Soon after, "AudioChannel" became instantiable and went on to be known as "MediaTrack", and as one would hope many other things ended up changing.

Wow, 9 years have gone by.

I've been having a blast this week working on something that let me make this:

The interesting bit of this is not the contents of the video itself -- 3 hasty first-takes with drums, bass, and guitar, each with 2 cameras (a Canon 6D and a Contour Roam 2) -- but how it was put together.

I've spent much of the last week experimenting with improving the video features of REAPER, specifically adding support for fades and video processing. This is a ridiculously large can of worms to open, so I'm keeping it mostly contained in my office and studio.

Working on video features is reminding me of when I was first starting work on what would become REAPER: I was focused on doing things that I could use then and there for things I wanted to make. It is incredibly satisfying to work this way. So now, I'm doing it in a branch (thank you git), as it is useful for me, but so incredibly far from the usability standard that REAPER represents now (even if you argue that REAPER is poorly designed, it's still 100x better than what I've done this week). You can't go put half-baked, poor performing, completely-programmer-oriented video features into a 9 year old program.

The syntax has since been simplified a bit, but basically you have meta-video items which can combine other video items on the fly. So you can write new transitions or customize existing transitions while you work (which is something I love about JSFX).

I'm going to keep working on this, it might get there someday. Former Vegas fans, fear not, REAPER isn't going to become a video editor. I'm just going for a taste...

6 Comments

Music
October 27, 2014
transitioning time
Music
October 21, 2014
light and heat
Music
October 18, 2014
oh no itsa g
Music
October 10, 2014
a quick woodland waltz
open windows falling apart
post waltz
yossy says
Music
October 6, 2014
possum pocket
Music
October 2, 2014
back are we and
Music
August 29, 2014
something newer
something over
Music
August 26, 2014
boots
damp with envy
Music
August 20, 2014
nude brick
Music
August 19, 2014
sundays are far away
Music
August 13, 2014
hookworms
licecap 1.25beta 3
July 24, 2014
I just posted (to our prerelease site) LICEcap 1.25 beta 3, which includes support for using transparency for smaller images. I had some fun debugging this (including some very stupid mistakes on my part that took about an entire day to debug, oops).

I also had some fun writing logic to decide what to do when a pixel could be encoded as transparent, but also could be well-represented by an indexed color. Iniitially I had it only use the indexed value if the previous pixel was indexed, but it ended up being quite a bit better to do track the occurence of transparent pixels and pixels of that index, and use the one that is more common. There is probably a better algorithm to use here, but that saw some good gains. For comparison, I ran 1.24 and 1.25 beta 3 at the same time for a stupid demo video. The 1.24 version was 2.5MB, the 1.25 beta 3 version was 1.5MB. WIN. It ultimately is highly dependent on the content, though, so I might look at trying some other things out...



1 Comment

checking assumptions
July 15, 2014
Very often in computer code integers are divided by powers of two, such as 2, 4, 8, 16, 32, 64, and so on). These divisions are much faster than dividing by other numbers (since computers represent the underlying number in binary). In C/C++, there are two ways this type of division is typically expressed: normal division (x/256), or a shift (x<<8). These two methods produce the same results for non-negative values, and depending on the meaning of the code in question, (x/256) is often more readable, and thus I use it regularly.

If x is signed and is negative, division rounds towards 0, whereas the shift rounds towards negative infinity, but in situations where rounding of negative values is not important, I had generally assumed that modern compilers would generate similarly efficient code (reducing x/256 into a single x86 sar instruction).

It turns out, testing with a two modern compilers (and one slightly out of date compiler), this is not the case.

Here is the C code:

  void b(int r);
  void f(int v)
  {
    int i;
    for (i=0;i<v/256;i++) b(v > 0 ? v/65536 : 0);
  }

  void f2(int v)
  {
    int i;
    for (i=0;i<(v>>8);i++) b(v > 0 ? v >> 16 : 0);
  }

Ideally, a compiler should generate identical code for each of these functions. In the case of the loop counter, if v is less than 0, how it is rounded makes no difference. In the case of the parameter to b(), the code v >> 16 is only evaluated if v is known to be above 0.

Let's look at the output of some compilers (removing decoration and unrelated code). I've marked some code as bold to signify instructions that could be eliminated (with slight changes to the surrounding instructions):

Conclusions?

I'm not sure what to say here -- modern compilers can generate a lot of really good code, especially looking at floating point and SSE, but this makes me feel as though some of the basics have been neglected. If I were a better programmer I'd go dig into LLVM and GCC and submit patches.

I should have also tested ICC, but I've spent enough time on this, and the only ICC version we use is old enough that I would just regret not using the latest.

For comparison, here is what I would like to see LLVM generate for f():


f():                              # using divides
	cmpl	$256, %edi
	jl	LBB0_3            # if v is less than 256, skip loop

	movl	%edi, %ebx
	movl	%edi, %ebp
	shrl	$8, %ebx          # ebx = v/256, since v is non-negative
	shrl	$16, %ebp         # ebp = v/65536, since v is non-negative

LBB0_2:
	movl	%ebp, %edi
	callq	_b
	decl    %ebx
	jnz	LBB0_2
LBB0_3:

Performance-wise, I'm sure they wouldn't differ in any meaningful way, but the decrease in size would be nice.

Finally: write for the compiler you have, not the compiler you wish you had. When performance is important, use shifts instead of divides, or use unsigned types (which really should generate the same code for (x/256) vs (x>>8)). Move as much logic out of the loop as you can -- yes, the compiler might be able to do it for you, but why depend on that? But most important of all: test your assumptions.

5 Comments
Music
July 8, 2014
heartburn
The office today
July 7, 2014



3 Comments

search : rss : recent comments : Copyright © 2025 Justin Frankel