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:
@@ -750,7 +750,7 @@ void DebayerCpu::process4(uint32_t frame, const uint8_t *src, uint8_t *dst)
|
||||
}
|
||||
}
|
||||
|
||||
void DebayerCpu::updateGammaTable(DebayerParams ¶ms)
|
||||
void DebayerCpu::updateGammaTable(const DebayerParams ¶ms)
|
||||
{
|
||||
const RGB<float> blackLevel = params.blackLevel;
|
||||
/* Take let's say the green channel black level */
|
||||
@@ -780,7 +780,7 @@ void DebayerCpu::updateGammaTable(DebayerParams ¶ms)
|
||||
gammaTable_[blackIndex]);
|
||||
}
|
||||
|
||||
void DebayerCpu::updateLookupTables(DebayerParams ¶ms)
|
||||
void DebayerCpu::updateLookupTables(const DebayerParams ¶ms)
|
||||
{
|
||||
const bool gammaUpdateNeeded =
|
||||
params.gamma != params_.gamma ||
|
||||
@@ -842,7 +842,7 @@ void DebayerCpu::updateLookupTables(DebayerParams ¶ms)
|
||||
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 ¶ms)
|
||||
{
|
||||
bench_.startFrame();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user