Skip to content

Add support for 16-bit CRGB class #11

Closed

Description

@focalintent
No description provided.

Activity

  1. kriegsman commented on Jan 24, 2014

    @kriegsman
    Member

    In addition to CRGB16, we're also going to need CHSV16. Possibly also make "CRGB8" and "CHSV8" synonyms for the existing CRGB and CHSV classes.

    I have rgb2hsv16_rainbow up and running, but not optimized in any sense.

  2. modified the milestones: , FastLED 2.2 release on Apr 17, 2014
  3. self-assigned this
    on Apr 18, 2014
  4. modified the milestones: FastLED 2.1 release, on Apr 22, 2014
  5. added
    type: feature
    area: core
    status: triage
    and removed on Apr 16, 2026
  6. zackees commented on Aug 1, 2026

    @zackees
    Member

    Closing this as completed — the 16-bit color types asked for here exist today.

    What shipped:

    • fl::CRGB16 — src/fl/gfx/crgb16.h:9. Channels are fl::u8x8 (unsigned 8.8 fixed-point backed by a u16), which is exactly the shape the maintainer settled on in 16-bit pallets and something like CRGB16 #2168: keep values in the familiar 0-255 range but carry 8 fractional bits, rather than a raw 0-65535 intensity space.
    • fl::HSV16 — src/fl/gfx/hsv16.h:9. True full-range 0-65535 per component, with CRGB::toHSV16() (src/fl/gfx/crgb.h:88) and HSV16::ToRGB() for round-tripping. @kriegsman's rgb2hsv16_rainbow ask is served by RGBtoHSV16 (src/fl/gfx/hsv16.cpp.hpp:19), though note it uses the standard HSV hexagon rather than the rainbow hue distribution.

    Where they're actually used: 16-bit palette interpolation via ColorFromPaletteHD (src/fl/gfx/colorutils.h:1382+), and the anti-aliased blur/gfx path (src/fl/gfx/blur.cpp.hpp:324).

    The design discussion that produced this is #2168, closed completed 2026-05-24.

    Two sub-asks from this thread deliberately not done:

    1. CRGB8 / CHSV8 synonyms — not added. CRGB/CHSV remain the names, and adding aliases now would give two spellings for the pixel type that appears in essentially every sketch. Not worth the churn.
    2. A 16-bit output pipeline — still 8-bit end to end. ChannelPixelFormat (src/fl/channels/data.h:25) is literally valued as bytes-per-pixel (RGB = 3, RGBW = 4), so it structurally cannot express 16-bit-per-channel. 16-bit chipsets widen inside their encoders instead, per-pixel and streaming: WS2816 via bit-replication map8_to_16 with no gamma (src/fl/chipsets/encoders/pixel_iterator.h:483-522), UCS7604 and HD108 via gamma LUTs (encoders/ucs7604.h:144-197, encoders/hd108.h:54). So WS2816 today gains precision only in brightness scaling, not in color resolution.

    That second point is real and unaddressed, but it is a channels/encoder architecture task rather than "add a 16-bit CRGB class", and it doesn't belong on a 2014 ticket with an empty body. Anyone wanting it should open a focused issue against the Channels API — #2168 has the maintainer's guidance on shape (Channels-API-only, gated behind SKETCH_HAS_LOTS_OF_MEMORY).

    Related still-open: #1014 (ColorFromPalette in 16 bits) — largely served by ColorFromPaletteHD, worth a separate look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: corestatus: triagetype: feature

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions