Skip to content

RGB fixes - #77

Open
naushir wants to merge 2 commits into
mainfrom
rgb
Open

RGB fixes#77
naushir wants to merge 2 commits into
mainfrom
rgb

Conversation

@naushir

@naushir naushir commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

naushir added 2 commits July 28, 2026 13:15
DRM XR24 stores bytes as B,G,R,X in memory but was wrongly mapped to the
PiSP XRGB8888 format which places the padding byte first.

Map XR24 and BGRx to RGBX8888 instead. Add a require_rb_swap() helper so
the R/B swap CSC is only programmed for formats whose memory layout
stores B,G,R (XR24, RG24 and BGRx), rather than unconditionally for all
RGB outputs.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
The BGR file output existed to match the pispconvert element's
unconditionally swapped RGB output, which has now been fixed. This
also makes the trailing videoconvert stage a passthrough, so remove
it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
@njhollinghurst

Copy link
Copy Markdown
Collaborator

Just to check I have understood everything...

  • Gstreamer does not natively allow BGR as distinct from RGB
  • DRM has a full set of 24- and 32-bit formats with R/B and RGB/X swaps (though it names them confusingly)
  • PiSP format word does not distinguish BGR from RGB (but it does have a flag for X position). The libpisp private strings follow this and thus cannot distinguish them either

So we require an extra flag to show that an output is R/B swapped, i.e. that R is not the first component.

The change seems to be good but leaves two outstanding questions:

  • How do we distinguish UYVY from VYUY (U/V swap)? It would seem analogous to R/B swap!
  • What do we do about RGB or RGBX inputs?

@naushir

naushir commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author
  • How do we distinguish UYVY from VYUY (U/V swap)? It would seem analogous to R/B swap!

I assumed the "order swap" bit would do the trick, but it turns out this is wrong. libcamera also has this problem so both will need fixing soon!

  • What do we do about RGB or RGBX inputs?

RGB inputs have not been tested for the GST component. There is a test for the standalone convert tool, and curiously there's an explicit "skip_gst" flag set on it...

@naushir

naushir commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

RGB inputs have not been tested for the GST component. There is a test for the standalone convert tool, and curiously there's an explicit "skip_gst" flag set on it...

Ah, that's because the test uses a non-default stride value, which cannot be expressed in the GST pipeline cmd line.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants