libcamera: software_isp: Apply CCM swap also on green

When CPU ISP is asked to apply the CCM matrix

  [0 1 0]
  [0 0 0]
  [0 0 0]

for a format that requires swapping red and blue channels, the resulting
image has a wrong colour.  The CCM matrix above should take green from
pixels and make it red.  Instead, the image is blue.

The problem is that the lookup tables setup in CPU debayering swaps red
and blue in the lookup tables for red and blue, but not for green.  The
colours must be swapped also in the lookup table for green, which this
patch adds.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Milan Zamazal
2025-10-17 17:44:12 +02:00
committed by Kieran Bingham
parent f4604eb152
commit 06aee9135f
@@ -803,6 +803,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output
blueCcm_ = params.redCcm;
for (unsigned int i = 0; i < 256; i++) {
std::swap(redCcm_[i].r, redCcm_[i].b);
std::swap(greenCcm_[i].r, greenCcm_[i].b);
std::swap(blueCcm_[i].r, blueCcm_[i].b);
}
} else {