libcamera: software_isp: debayer: Take DebayerParams by ref

When calling `Debayer::process()` from `SoftwareIsp::process()`, the
`DebayerParams` object is copied multiple times:

  (1) call of `BoundMethodMember<...>::activate()`
      inside `Object::invokeMethod()`
  (2) constructor of `BoundMethodArgs<...>`
      inside `BoundMethodMember<...>::activate()`
  (3) call of `BoundMethodMember<...>::invoke()`
      inside `BoundMethodArgs::invokePack()`
  (4) call of the actual pointer to member function
      inside `BoundMethodMember::invoke()`

While compilers might avoid one or two of the above copies, this is still
not ideal. By making `Debayer::process()` take the parameter object by
const lvalue reference, only the copy in the `BoundMethodArgs` constructor
remains. So do that.

Before:
	[0:12:51.133836595] [12424] DEBUG SoftwareIsp software_isp.cpp:399 params=0x7d0a691f57d0
	copy from 0x7d0a691f57d0 into 0x7baa65f2bf30
	copy from 0x7baa65f2bf30 into 0x7c6a69209758
	copy from 0x7c6a69209758 into 0x7baa63223930
	copy from 0x7baa63223930 into 0x7baa63223a70
	[0:12:51.134559602] [12426] DEBUG eGL debayer_egl.cpp:538 params=0x7baa63223a70
	771.099877 (30.06 fps) cam0-stream0 seq: 000031 bytesused: 8666112

After:
	[0:13:42.861691943] [12543] DEBUG SoftwareIsp software_isp.cpp:399 params=0x7cfaad5f57d0
	copy from 0x7cfaad5f57d0 into 0x7c5aad609758
	[0:13:42.862453917] [12545] DEBUG eGL debayer_egl.cpp:538 params=0x7c5aad609758
	822.827388 (30.02 fps) cam0-stream0 seq: 000031 bytesused: 8666112

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
This commit is contained in:
Barnabás Pőcze
2026-01-20 17:20:34 +01:00
parent c6c5a8bc5b
commit 78b9890a0f
5 changed files with 13 additions and 13 deletions

View File

@@ -750,7 +750,7 @@ void DebayerCpu::process4(uint32_t frame, const uint8_t *src, uint8_t *dst)
}
}
void DebayerCpu::updateGammaTable(DebayerParams &params)
void DebayerCpu::updateGammaTable(const DebayerParams &params)
{
const RGB<float> blackLevel = params.blackLevel;
/* Take let's say the green channel black level */
@@ -780,7 +780,7 @@ void DebayerCpu::updateGammaTable(DebayerParams &params)
gammaTable_[blackIndex]);
}
void DebayerCpu::updateLookupTables(DebayerParams &params)
void DebayerCpu::updateLookupTables(const DebayerParams &params)
{
const bool gammaUpdateNeeded =
params.gamma != params_.gamma ||
@@ -842,7 +842,7 @@ void DebayerCpu::updateLookupTables(DebayerParams &params)
params_ = params;
}
void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params)
void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params)
{
bench_.startFrame();