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
6b3d0997
Commit
6b3d0997
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
More comments
parent
5b5be7c8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
firmware/fadecandy.cpp
+14
-3
14 additions, 3 deletions
firmware/fadecandy.cpp
with
14 additions
and
3 deletions
firmware/fadecandy.cpp
+
14
−
3
View file @
6b3d0997
...
@@ -126,11 +126,21 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -126,11 +126,21 @@ 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 coefficients, 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.
* You'd think that it would save clock cycles to calculate icPrev in updatePixel(), but this doesn't
* seem to be the case.
*/
uint32_t
icPrev
=
257
*
(
0x10000
-
interpCoefficient
);
uint32_t
icPrev
=
257
*
(
0x10000
-
interpCoefficient
);
uint32_t
icNext
=
257
*
interpCoefficient
;
uint32_t
icNext
=
257
*
interpCoefficient
;
// Pointer to the residual buffer for this pixel
/*
* Pointer to the residual buffer for this pixel. Calculating this here rather than in updatePixel
* saves a lot of clock cycles, since otherwise updatePixel() immediately needs to do a load from
* constant pool and some multiplication.
*/
int8_t
*
pResidual
=
residual
;
int8_t
*
pResidual
=
residual
;
for
(
int
i
=
0
;
i
<
LEDS_PER_STRIP
;
++
i
,
pResidual
+=
3
)
{
for
(
int
i
=
0
;
i
<
LEDS_PER_STRIP
;
++
i
,
pResidual
+=
3
)
{
...
@@ -148,7 +158,8 @@ static void updateDrawBuffer(unsigned interpCoefficient)
...
@@ -148,7 +158,8 @@ static void updateDrawBuffer(unsigned interpCoefficient)
/*
/*
* Remap bits.
* Remap bits.
* This generates fairly efficient code using the UBFX and BFI instructions.
*
* This generates compact and efficient code using the BFI instruction.
*/
*/
uint32_t
p0
=
updatePixel
(
icPrev
,
icNext
,
i
+
LEDS_PER_STRIP
*
0
,
pResidual
+
LEDS_PER_STRIP
*
3
*
0
);
uint32_t
p0
=
updatePixel
(
icPrev
,
icNext
,
i
+
LEDS_PER_STRIP
*
0
,
pResidual
+
LEDS_PER_STRIP
*
3
*
0
);
...
...
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