From 7f6b9121cc51cc5356a4c91957cce1aa6011d47e Mon Sep 17 00:00:00 2001 From: David Plowman Date: Sat, 1 Aug 2020 09:01:50 +0100 Subject: libcamera: ipa: raspberrypi: ALSC: Resample luminance table This fixes a bug where the luminance correction table was not being resampled according to the camera mode, in the same way as the colour tables. This could be noticeable if any camera modes crop aggressively. This resampling can be done "up front" in the SwitchMode, as we have only a single fixed luminance table. In order to protect the recalculation of the table from the asynchronous thread (which reads it) I've elected to wait for that thread to go idle (though I doubt it would have mattered much). As a by-product of stopping the thread, it no longer needs its own copy of the camera mode (async_camera_mode_). Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck Signed-off-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/rpi/alsc.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ipa/raspberrypi/controller/rpi/alsc.hpp') diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.hpp b/src/ipa/raspberrypi/controller/rpi/alsc.hpp index e895913b..95572af0 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.hpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.hpp @@ -60,10 +60,10 @@ private: AlscConfig config_; bool first_time_; CameraMode camera_mode_; + double luminance_table_[ALSC_CELLS_X * ALSC_CELLS_Y]; std::thread async_thread_; void asyncFunc(); // asynchronous thread function std::mutex mutex_; - CameraMode async_camera_mode_; // condvar for async thread to wait on std::condition_variable async_signal_; // condvar for synchronous thread to wait on @@ -86,6 +86,7 @@ private: int frame_count2_; double sync_results_[3][ALSC_CELLS_Y][ALSC_CELLS_X]; double prev_sync_results_[3][ALSC_CELLS_Y][ALSC_CELLS_X]; + void waitForAysncThread(); // The following are for the asynchronous thread to use, though the main // thread can set/reset them if the async thread is known to be idle: void restartAsync(StatisticsPtr &stats, Metadata *image_metadata); -- cgit v1.2.1