Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed improvements for discussion #4138

Open
wants to merge 41 commits into
base: 0_15
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c3f472f
some improvements to consider
DedeHai Sep 11, 2024
9341768
more improvements to color_scale() now even faster.
DedeHai Sep 12, 2024
feac45f
improvement in color_add
DedeHai Sep 12, 2024
992d11b
Improvements in get/set PixelColor()
DedeHai Sep 12, 2024
b07658b
improved Segment::setPixelColorXY a tiny bit
DedeHai Sep 12, 2024
09428dc
inlined getMappedPixelIndex, improved color_add, bugfix in colorFromP…
DedeHai Sep 12, 2024
ec938f2
removed old code
DedeHai Sep 12, 2024
d45b4ad
fixes and consistency
DedeHai Sep 13, 2024
2afff05
minor tweak (break instead of continue in setPixelColorXY)
DedeHai Sep 14, 2024
6a37f25
memory improvement: dropped static gamma table
DedeHai Sep 14, 2024
0e5bd4e
remove test printout
DedeHai Sep 14, 2024
f3137eb
updated Segment::color_from_palette
DedeHai Sep 14, 2024
686866c
Merge remote-tracking branch 'upstream/0_15' into 0_15__speed_improve…
DedeHai Sep 18, 2024
6962905
cleanup and improved color_add()
DedeHai Sep 18, 2024
a88436c
revert removal of adding with saturation, renamed 'fast' to 'saturate'
DedeHai Sep 19, 2024
17d59d3
adding initialization to vStrip, added comment on padding bytes
DedeHai Sep 22, 2024
0a54002
removed IRAM_ATTR from inlined function
DedeHai Sep 22, 2024
33cf82a
Indentations and a few optimisations
blazoncek Sep 23, 2024
906f8fc
Fix C3 compiler issue.
blazoncek Sep 25, 2024
bef1ac2
Added HSV2RGB and RGB2HSV functions for higher accuracy conversions
DedeHai Sep 25, 2024
c44b9f8
Merge remote-tracking branch 'upstream/0_15' into 0_15__speed_improve…
DedeHai Sep 26, 2024
b404458
fixed one forgotten replacement of rgb2hsv_approximate
DedeHai Sep 26, 2024
a76a895
bugfix
DedeHai Sep 27, 2024
7c0fe12
updated setPixelColor() and getPixelColor() functions
DedeHai Sep 28, 2024
202901b
bugfix, ESP32 compiler requires the color order to be identical
DedeHai Sep 28, 2024
c842994
Pre-calculate virtual
blazoncek Sep 28, 2024
9114867
Fix compiler error
blazoncek Sep 28, 2024
ffbc8c5
Reverting addition of `bool unScale`, added new improvements and fixes
DedeHai Sep 29, 2024
336da25
Private global _colorScaled
blazoncek Sep 29, 2024
8e78fb4
Merge branch '0_15' into 0_15__speed_improvements
blazoncek Sep 29, 2024
0ae7329
Update comment
blazoncek Sep 29, 2024
ee380c5
Replace uint16_t with unsigned for segment data
blazoncek Sep 30, 2024
ba3a61f
Reduced code size by:
blazoncek Oct 2, 2024
a15c391
Improvement to `setPixelColorXY` and some flash optimisations
DedeHai Oct 3, 2024
ca06214
removed todo.
DedeHai Oct 3, 2024
eb5ad23
Minor tweaks and whitespace
blazoncek Oct 5, 2024
be64930
Indentation and shadowed variable.
blazoncek Oct 7, 2024
210191b
Fix for realtime drawing on main segment
blazoncek Oct 7, 2024
ef1e24c
Bugfix & code reduction
blazoncek Nov 9, 2024
5c2bac4
Merge branch '0_15' into 0_15__speed_improvements
blazoncek Nov 9, 2024
0a05611
more improvements to setPixelColor
DedeHai Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ typedef struct Segment {
{}
} *_t;

[[gnu::hot]] void _setPixelColorXY_raw(int& x, int& y, uint32_t& col); // set pixel without mapping (internal use only)

public:

Segment(uint16_t sStart=0, uint16_t sStop=30) :
Expand Down Expand Up @@ -617,12 +619,10 @@ typedef struct Segment {

// 2D Blur: shortcuts for bluring columns or rows only (50% faster than full 2D blur)
inline void blurCols(fract8 blur_amount, bool smear = false) { // blur all columns
const unsigned cols = virtualWidth();
for (unsigned k = 0; k < cols; k++) blurCol(k, blur_amount, smear);
blur2D(0, blur_amount, smear);
}
inline void blurRows(fract8 blur_amount, bool smear = false) { // blur all rows
const unsigned rows = virtualHeight();
for ( unsigned i = 0; i < rows; i++) blurRow(i, blur_amount, smear);
blur2D(blur_amount, 0, smear);
}

// 2D matrix
Expand All @@ -649,10 +649,8 @@ typedef struct Segment {
inline void addPixelColorXY(int x, int y, byte r, byte g, byte b, byte w = 0, bool preserveCR = true) { addPixelColorXY(x, y, RGBW32(r,g,b,w), preserveCR); }
inline void addPixelColorXY(int x, int y, CRGB c, bool preserveCR = true) { addPixelColorXY(x, y, RGBW32(c.r,c.g,c.b,0), preserveCR); }
inline void fadePixelColorXY(uint16_t x, uint16_t y, uint8_t fade) { setPixelColorXY(x, y, color_fade(getPixelColorXY(x,y), fade, true)); }
void box_blur(unsigned r = 1U, bool smear = false); // 2D box blur
void blur2D(uint8_t blur_amount, bool smear = false);
void blurRow(int row, fract8 blur_amount, bool smear = false);
void blurCol(int col, fract8 blur_amount, bool smear = false);
//void box_blur(unsigned r = 1U, bool smear = false); // 2D box blur
void blur2D(uint8_t blur_x, uint8_t blur_y, bool smear = false);
void moveX(int delta, bool wrap = false);
void moveY(int delta, bool wrap = false);
void move(unsigned dir, unsigned delta, bool wrap = false);
Expand All @@ -666,7 +664,6 @@ typedef struct Segment {
inline void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c) { drawCharacter(chr, x, y, w, h, RGBW32(c.r,c.g,c.b,0)); } // automatic inline
inline void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c, CRGB c2, int8_t rotate = 0) { drawCharacter(chr, x, y, w, h, RGBW32(c.r,c.g,c.b,0), RGBW32(c2.r,c2.g,c2.b,0), rotate); } // automatic inline
void wu_pixel(uint32_t x, uint32_t y, CRGB c);
inline void blur2d(fract8 blur_amount) { blur(blur_amount); }
inline void fill_solid(CRGB c) { fill(RGBW32(c.r,c.g,c.b,0)); }
#else
inline uint16_t XY(int x, int y) { return x; }
Expand All @@ -687,8 +684,8 @@ typedef struct Segment {
inline void addPixelColorXY(int x, int y, byte r, byte g, byte b, byte w = 0, bool saturate = false) { addPixelColor(x, RGBW32(r,g,b,w), saturate); }
inline void addPixelColorXY(int x, int y, CRGB c, bool saturate = false) { addPixelColor(x, RGBW32(c.r,c.g,c.b,0), saturate); }
inline void fadePixelColorXY(uint16_t x, uint16_t y, uint8_t fade) { fadePixelColor(x, fade); }
inline void box_blur(unsigned i, bool vertical, fract8 blur_amount) {}
inline void blur2D(uint8_t blur_amount, bool smear = false) {}
//inline void box_blur(unsigned i, bool vertical, fract8 blur_amount) {}
inline void blur2D(uint8_t blur_x, uint8_t blur_y, bool smear = false) {}
inline void blurRow(int row, fract8 blur_amount, bool smear = false) {}
inline void blurCol(int col, fract8 blur_amount, bool smear = false) {}
inline void moveX(int delta, bool wrap = false) {}
Expand Down
Loading