Yona-Appletree / LEDscape

Beagle Bone Black cape and firmware for driving a large number of WS281x LED strips.
126 stars 58 forks source link

Flicker when interpolation is enabled #12

Closed Dewb closed 10 years ago

Dewb commented 10 years ago

Hi! We're building an installation around the RGB123 48-output RS485 boards, and we're pretty happy with LEDscape and OPC so far.

But I'm noticing flicker whenever interpolation is enabled. It's more obvious at low client frame rates.

Here's a quick and not very good video (sorry) demonstrating the flicker. First few seconds are with interpolation on, next few seconds with interpolation off, with the client code running at about 5fps to make the effect more photographable. https://vine.co/v/M2Yte1jr1ae

It looks as if the interpolation is fading to black in between frames, and it sounds like it might be similar to the issue described here: https://twitter.com/hypher/status/459948735707901952

This is on a Beaglebone Black Rev C with Debian and the RGB-123 48-output cape. I believe it happens with the 24-output cape as well, will confirm.

Yona-Appletree commented 10 years ago

I'll take a look at this. I haven't seen the flickering bug since I made that fix awhile back, but something may have been regressed/not pushed/etc. I'll check it.

Michael Dewberry mailto:notifications@github.com July 29, 2014 at 12:35

Hi! We're building an installation around the RGB123 48-output RS485 boards, and we're pretty happy with LEDscape and OPC so far.

But I'm noticing flicker whenever interpolation is enabled. It's more obvious at low client frame rates.

Here's a quick and not very good video (sorry) demonstrating the flicker. First few seconds are with interpolation on, next few seconds with interpolation off, with the client code running at about 5fps to make the effect more photographable. https://vine.co/v/M2Yte1jr1ae

It looks as if the interpolation is fading to black in between frames, and it sounds like it might be similar to the issue described here: https://twitter.com/hypher/status/459948735707901952

This is on a Beaglebone Black Rev C with Debian and the RGB-123 48-output cape. I believe it happens with the 24-output cape as well, will confirm.

— Reply to this email directly or view it on GitHub https://github.com/Yona-Appletree/LEDscape/issues/12.

Yona Appletree Senior Developer Concentric Sky, inc yona@concentricsky.com

Yona-Appletree commented 10 years ago

Would it be possible to see the command line args you're using for LEDscape, and, if possible, a simple demo program that causes it?

Dewb commented 10 years ago

From memory, I believe the args were -c 133; will confirm. The flicker was observed with all of the OPC Python clients that I tried: https://github.com/zestyping/openpixelcontrol

Yona-Appletree commented 10 years ago

It would be very helpful for my testing if you could setup a little demo project on github that shows the issue -- something I can checkout and run against an LEDscape server to see the issue myself.

Dewb commented 10 years ago

Thanks for looking into this so quickly!

I'm getting the flicker on my hardware using stock server and client software. I'm running the master/head of Yona-Appletree/LEDscape on a Beaglebone (Rev C/Debian/RGB-123 48-output cape, as above) and the spatial-stripes.py client from the master/head of the zestyping/openpixelcontrol repo on a netbook directly connected over Ethernet to the BBone, with the following command lines:

[server] ./opc-server -c 133

[client] python spatial_stripes.py -s 10.42.0.42:7890 -f 10 -l ../layouts/wall.json

The interpolation seems to pulse down to black in between frames. Adding -i to the opc-server command line makes the flicker go away.

Dewb commented 10 years ago

I did confirm that the code I'm running contains your fix in 16d5686. I couldn't find that CL myself because it's dated 1999 -- I hoped that the problem was as simple as not having your fix, but it doesn't appear to be the case.

Yona-Appletree commented 10 years ago

Thanks for the info, I'll look into it shortly. My apologies for the commit dates -- the BBB has no hardware clock and I often start it without network so the clock is off. I don't always remember to set it before committing.

Dewb commented 10 years ago

No worries, I do that too!

Dewb commented 10 years ago

I'm now trying this bare bones test code: https://github.com/Dewb/openpixelcontrol/blob/master/python_clients/onered.py

This is the result without interpolation: https://vine.co/v/MEbJIzgBVVH

and with interpolation: https://vine.co/v/MEb1AJm3tMV

Yona-Appletree commented 10 years ago

Alright, that was a somewhat tricky one. Good find.

Basically, if new frame data came in slightly late, LEDscape would automatically rotate in the next frame. Unfortunately, the way I was handling timing caused a somewhat odd bug. I'll admit that I don't totally understand what was happening, but I reworked how frame rotation works, and it should be working now. There may be a slight lag before interpolation starts (of a frame or two), but it generally works.

I suspect that this bug is the root of why people have been seeing flickering, esp. when incoming frames have jitter in their timing (due to network latency or just variations in frame generation).

I'd love to hear feedback on how this works, as I suspect I could make a few more improvements, but I don't want to risk breaking things more right at the moment.

Dewb commented 10 years ago

Excellent! Will test this evening and report back.

Dewb commented 10 years ago

Yep, the interpolation looks great now. Thanks very much!

https://vine.co/v/ME61VKMdpEb