Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Color reversal Qt Embedded and 24bpp
QtWS25 Last Chance

Color reversal Qt Embedded and 24bpp

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vmartin
    wrote on last edited by
    #1

    Seeing an issue using Qt Embedded 4.8.5 on linux framebuffer.

    Platform is little-endian, framebuffer is 24bpp RGB.

    It seems that Qt is storing the pixels to the framebuffer in
    big-endian order ([R], [G], [B]) instead of little-endian order
    ([B], [G], [R]), causing the blue and red colors to be “reversed”.

    We checked the fbinfo returned by the framebuffer and it
    seems to be correct.

    Is this a known issue? Is it resolved in Qt 5?

    MV

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      AFAICS, it's not an big vs little indian problem, it's rather a color channel swapping problem. On what device do you have that ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      V 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        AFAICS, it's not an big vs little indian problem, it's rather a color channel swapping problem. On what device do you have that ?

        V Offline
        V Offline
        vmartin
        wrote on last edited by vmartin
        #3

        @SGaist
        Hi, thanks for your reply. This is a custom device based on ARM926 running little-endian .
        The SoC's LCDC documentation specifies the format of a 24-bit pixel value as having red
        in the high-order byte, green in the middle byte, and blue in the low-order byte.

        Being little-endian, looking that the FB as an array of bytes, I would expect the
        blue byte to be stored at the lower address, followed by the green byte and then
        the red byte. If I write to the FB in this format, colors are displayed on LCD as expected.

        But when I write an image of a red logo via Qt (displays correctly as red on a different
        --32bpp--platform), the logo shows as blue on the LCD. And when I dump the FB, I see
        the red byte comes first. Which is what suggested an endianness issue to me.

        When I look at the source, it seems to me that the pixel-format classes assume a
        big-endian framebuffer, since they always store the three bytes in red, green, blue
        order of ascending addresses.

        I have worked-around the issue by setting "pixeltype = QScreen::BGRPixel;" when
        the fbinfo matches "rgb888".

        MV

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          RGB vs BGR is really not an endianness question, you can hit that problem with both. It's about how the data is stored. However the endianness can come up when transferring that data further down which is what might be hitting you. Anyway, glad you found a workaround

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved