You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pixel value of 1 not visible when dithering is set to 0. #86
This is a side effect of how scale8 works - mark and I are very aware of that, but given that it would nearly double the CPU time taken by scale8 to fix, (cycles that we don't have available on certain AVR implementations - and we want behavior to be consistent across platforms) - we're leaving it alone for now.
scale8 is (scale*value>> 8) - 1 * 255 is 255, right shift that 8 and you get 0.
Sorry, I think I don't get your explanation line completely and I would like to understand it to find a work around.
scale8 is (scale*value>> 8) - 1 * 255 is 255, right shift that 8 and you get 0.
Please correct me if my thinking is wrong:
I think that the default scale the full range so 255.
So that would mean 255*1 >> 8 = 0
But 0 - 1 is not possible with unsigned numbers?
Is there scaling involved when writing RGB colors to the led output?
Do I understand it right that when dithering is turned off both a value of CRGB(0,0,0) and CRGB(1,1,1) give an output of 0?
What is the value then of CRGB(2,2,2) is it the most minimum light value possible?
So would that mean that the led range that can be controlled is actually from 1 (as 0) to 255 (as 254)?
Because then I could map the dithering table from 0-255 to 1-254.
Yes - for the global brightness - we scale the RGB values before writing them out - and this is done independently of the dithering - and yes, CRGB(2,2,2) is going to be the most minimum light value for now.
When brightness is set to 255 your values are going to be:
0,0,1,...253,254
I do have some thoughts on how to fix this long term - but I hate burning the cycles on avr. (That said, over the next 6 months, we're going to split functionality between avr and arm because we're starting to want to do things that just won't be possible on avr).
Yeah - the default brightness is 255. (in an ideal world, the logic would be changed to):
if(scale<255) { value *= (scale+1); value >>= 8; } return value;
that conditional adds more than a few cycles of overhead, sadly and I haven't had the time to dig through the asm/implementation to get it as close as possible to the performance of scale8 itself.
Where does this scaling happen? Do you use the scale function in lib8tion? Maybe I can modify it in my own copy to see if I'm satisfied with the result on the Teensy?
I've checked led_sysdefs.h and there inline scale is mentioned however this seems commented (so not in use). Digging a bit in the code it seems that the actual scaling is called in loadAndScale?
I think it might be good to mention the "0,0,1,...253,254" behavior on the FastLED design or temporal dithering documentation pages in the wiki.
Activity
focalintent commentedon Oct 26, 2014
This is a side effect of how scale8 works - mark and I are very aware of that, but given that it would nearly double the CPU time taken by scale8 to fix, (cycles that we don't have available on certain AVR implementations - and we want behavior to be consistent across platforms) - we're leaving it alone for now.
scale8 is (scale*value>> 8) - 1 * 255 is 255, right shift that 8 and you get 0.
kasperkamperman commentedon Oct 26, 2014
Sorry, I think I don't get your explanation line completely and I would like to understand it to find a work around.
scale8 is (scale*value>> 8) - 1 * 255 is 255, right shift that 8 and you get 0.Please correct me if my thinking is wrong:
I think that the default scale the full range so 255.
So that would mean 255*1 >> 8 = 0
But 0 - 1 is not possible with unsigned numbers?
Is there scaling involved when writing RGB colors to the led output?
Do I understand it right that when dithering is turned off both a value of CRGB(0,0,0) and CRGB(1,1,1) give an output of 0?
What is the value then of CRGB(2,2,2) is it the most minimum light value possible?
So would that mean that the led range that can be controlled is actually from 1 (as 0) to 255 (as 254)?
Because then I could map the dithering table from 0-255 to 1-254.
focalintent commentedon Oct 26, 2014
Yes - for the global brightness - we scale the RGB values before writing them out - and this is done independently of the dithering - and yes, CRGB(2,2,2) is going to be the most minimum light value for now.
When brightness is set to 255 your values are going to be:
0,0,1,...253,254
I do have some thoughts on how to fix this long term - but I hate burning the cycles on avr. (That said, over the next 6 months, we're going to split functionality between avr and arm because we're starting to want to do things that just won't be possible on avr).
kasperkamperman commentedon Oct 26, 2014
Ok. Thanks for the explanation. I suppose that if I don't make a call to
setBrightness, it's just 255.
focalintent commentedon Oct 27, 2014
Yeah - the default brightness is 255. (in an ideal world, the logic would be changed to):
if(scale<255) { value *= (scale+1); value >>= 8; } return value;
that conditional adds more than a few cycles of overhead, sadly and I haven't had the time to dig through the asm/implementation to get it as close as possible to the performance of scale8 itself.
kasperkamperman commentedon Oct 27, 2014
Where does this scaling happen? Do you use the scale function in lib8tion? Maybe I can modify it in my own copy to see if I'm satisfied with the result on the Teensy?
I've checked led_sysdefs.h and there inline scale is mentioned however this seems commented (so not in use). Digging a bit in the code it seems that the actual scaling is called in loadAndScale?
I think it might be good to mention the "0,0,1,...253,254" behavior on the FastLED design or temporal dithering documentation pages in the wiki.
focalintent commentedon Oct 27, 2014
It's not really either design or dithering - i'll find a place to mention it on there, though, as it isn't the first time this has come up.
If you want to make the changes yourself - change the implementation of the scale8 function in the file lib8tion.h
feat(ci): migrate AVR8JS + QEMU emulation workflows to fbuild test-emu