Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
7b239a2d
Commit
7b239a2d
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Another optimization attempt. Still not helping."
This reverts commit
f5e7cc2e
.
parent
f5e7cc2e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
firmware/fadecandy.cpp
+15
-15
15 additions, 15 deletions
firmware/fadecandy.cpp
firmware/fc_usb.h
+4
-4
4 additions, 4 deletions
firmware/fc_usb.h
with
19 additions
and
19 deletions
firmware/fadecandy.cpp
+
15
−
15
View file @
7b239a2d
...
@@ -54,7 +54,7 @@ ALWAYS_INLINE static inline uint32_t lutInterpolate(const uint16_t *lut, uint32_
...
@@ -54,7 +54,7 @@ ALWAYS_INLINE static inline uint32_t lutInterpolate(const uint16_t *lut, uint32_
return
(
lut
[
index
]
*
invAlpha
+
lut
[
index
+
1
]
*
alpha
)
>>
8
;
return
(
lut
[
index
]
*
invAlpha
+
lut
[
index
+
1
]
*
alpha
)
>>
8
;
}
}
static
inline
uint32_t
updatePixel
(
fcFramebufferIter
iter
,
uint32_t
ic
)
static
inline
uint32_t
updatePixel
(
uint32_t
icPrev
,
uint32_t
icNext
,
fcFramebufferIter
iter
)
{
{
/*
/*
* Update pipeline for one pixel:
* Update pipeline for one pixel:
...
@@ -68,10 +68,9 @@ static inline uint32_t updatePixel(fcFramebufferIter iter, uint32_t ic)
...
@@ -68,10 +68,9 @@ static inline uint32_t updatePixel(fcFramebufferIter iter, uint32_t ic)
const
uint8_t
*
pixelNext
=
buffers
.
fbNext
->
pixel
(
iter
);
const
uint8_t
*
pixelNext
=
buffers
.
fbNext
->
pixel
(
iter
);
// Per-channel linear interpolation and conversion to 16-bit color.
// Per-channel linear interpolation and conversion to 16-bit color.
uint32_t
icPrev
=
(
257
*
0x10000
)
-
ic
;
int
iR
=
(
pixelPrev
[
0
]
*
icPrev
+
pixelNext
[
0
]
*
icNext
)
>>
16
;
int
iR
=
(
pixelPrev
[
0
]
*
icPrev
+
pixelNext
[
0
]
*
ic
)
>>
16
;
int
iG
=
(
pixelPrev
[
1
]
*
icPrev
+
pixelNext
[
1
]
*
icNext
)
>>
16
;
int
iG
=
(
pixelPrev
[
1
]
*
icPrev
+
pixelNext
[
1
]
*
ic
)
>>
16
;
int
iB
=
(
pixelPrev
[
2
]
*
icPrev
+
pixelNext
[
2
]
*
icNext
)
>>
16
;
int
iB
=
(
pixelPrev
[
2
]
*
icPrev
+
pixelNext
[
2
]
*
ic
)
>>
16
;
// Pass through our color LUT
// Pass through our color LUT
iR
=
lutInterpolate
(
&
buffers
.
lutCurrent
[
0
*
256
],
iR
);
iR
=
lutInterpolate
(
&
buffers
.
lutCurrent
[
0
*
256
],
iR
);
...
@@ -130,8 +129,9 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -130,8 +129,9 @@ static void updateDrawBuffer(unsigned interpCoefficient)
// For each pixel, this is a 24-byte stream of bits (6 words)
// For each pixel, this is a 24-byte stream of bits (6 words)
uint32_t
*
out
=
(
uint32_t
*
)
leds
.
getDrawBuffer
();
uint32_t
*
out
=
(
uint32_t
*
)
leds
.
getDrawBuffer
();
// Interpolation coefficient, including a multiply by 257 to convert 8-bit color to 16-bit color.
// Interpolation coefficients, including a multiply by 257 to convert 8-bit color to 16-bit color.
uint32_t
ic
=
257
*
interpCoefficient
;
uint32_t
icPrev
=
257
*
(
0x10000
-
interpCoefficient
);
uint32_t
icNext
=
257
*
interpCoefficient
;
/*
/*
* Iterators for each LED strip. (Avoids division later on).
* Iterators for each LED strip. (Avoids division later on).
...
@@ -175,7 +175,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -175,7 +175,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
*/
*/
i0
.
next
();
i0
.
next
();
uint32_t
p0
=
updatePixel
(
i
0
,
ic
);
uint32_t
p0
=
updatePixel
(
i
cPrev
,
icNext
,
i0
);
o5
.
p0d
=
p0
;
o5
.
p0d
=
p0
;
o5
.
p0c
=
p0
>>
1
;
o5
.
p0c
=
p0
>>
1
;
...
@@ -203,7 +203,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -203,7 +203,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
o0
.
p0a
=
p0
>>
23
;
o0
.
p0a
=
p0
>>
23
;
i1
.
next
();
i1
.
next
();
uint32_t
p1
=
updatePixel
(
i
1
,
ic
);
uint32_t
p1
=
updatePixel
(
i
cPrev
,
icNext
,
i1
);
o5
.
p1d
=
p1
;
o5
.
p1d
=
p1
;
o5
.
p1c
=
p1
>>
1
;
o5
.
p1c
=
p1
>>
1
;
...
@@ -231,7 +231,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -231,7 +231,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
o0
.
p1a
=
p1
>>
23
;
o0
.
p1a
=
p1
>>
23
;
i2
.
next
();
i2
.
next
();
uint32_t
p2
=
updatePixel
(
i
2
,
ic
);
uint32_t
p2
=
updatePixel
(
i
cPrev
,
icNext
,
i2
);
o5
.
p2d
=
p2
;
o5
.
p2d
=
p2
;
o5
.
p2c
=
p2
>>
1
;
o5
.
p2c
=
p2
>>
1
;
...
@@ -259,7 +259,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -259,7 +259,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
o0
.
p2a
=
p2
>>
23
;
o0
.
p2a
=
p2
>>
23
;
i3
.
next
();
i3
.
next
();
uint32_t
p3
=
updatePixel
(
i
3
,
ic
);
uint32_t
p3
=
updatePixel
(
i
cPrev
,
icNext
,
i3
);
o5
.
p3d
=
p3
;
o5
.
p3d
=
p3
;
o5
.
p3c
=
p3
>>
1
;
o5
.
p3c
=
p3
>>
1
;
...
@@ -287,7 +287,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -287,7 +287,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
o0
.
p3a
=
p3
>>
23
;
o0
.
p3a
=
p3
>>
23
;
i4
.
next
();
i4
.
next
();
uint32_t
p4
=
updatePixel
(
i
4
,
ic
);
uint32_t
p4
=
updatePixel
(
i
cPrev
,
icNext
,
i4
);
o5
.
p4d
=
p4
;
o5
.
p4d
=
p4
;
o5
.
p4c
=
p4
>>
1
;
o5
.
p4c
=
p4
>>
1
;
...
@@ -315,7 +315,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -315,7 +315,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
o0
.
p4a
=
p4
>>
23
;
o0
.
p4a
=
p4
>>
23
;
i5
.
next
();
i5
.
next
();
uint32_t
p5
=
updatePixel
(
i
5
,
ic
);
uint32_t
p5
=
updatePixel
(
i
cPrev
,
icNext
,
i5
);
o5
.
p5d
=
p5
;
o5
.
p5d
=
p5
;
o5
.
p5c
=
p5
>>
1
;
o5
.
p5c
=
p5
>>
1
;
...
@@ -343,7 +343,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -343,7 +343,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
o0
.
p5a
=
p5
>>
23
;
o0
.
p5a
=
p5
>>
23
;
i6
.
next
();
i6
.
next
();
uint32_t
p6
=
updatePixel
(
i
6
,
ic
);
uint32_t
p6
=
updatePixel
(
i
cPrev
,
icNext
,
i6
);
o5
.
p6d
=
p6
;
o5
.
p6d
=
p6
;
o5
.
p6c
=
p6
>>
1
;
o5
.
p6c
=
p6
>>
1
;
...
@@ -371,7 +371,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -371,7 +371,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
o0
.
p6a
=
p6
>>
23
;
o0
.
p6a
=
p6
>>
23
;
i7
.
next
();
i7
.
next
();
uint32_t
p7
=
updatePixel
(
i
7
,
ic
);
uint32_t
p7
=
updatePixel
(
i
cPrev
,
icNext
,
i7
);
o5
.
p7d
=
p7
;
o5
.
p7d
=
p7
;
o5
.
p7c
=
p7
>>
1
;
o5
.
p7c
=
p7
>>
1
;
...
...
This diff is collapsed.
Click to expand it.
firmware/fc_usb.h
+
4
−
4
View file @
7b239a2d
...
@@ -89,10 +89,10 @@ struct fcFramebufferIter
...
@@ -89,10 +89,10 @@ struct fcFramebufferIter
ALWAYS_INLINE
void
next
()
ALWAYS_INLINE
void
next
()
{
{
i
ndex
+=
3
;
i
f
(
++
index
>=
(
1
+
PIXELS_PER_PACKET
*
3
))
{
unsigned
overflow
=
index
>>
6
;
index
=
0
;
index
=
(
index
+
overflow
)
&
63
;
packet
++
;
packet
+=
overflow
;
}
component
+=
3
;
component
+=
3
;
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment