summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/rpi/alsc.hpp
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2020-08-01 09:01:50 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-05 17:48:55 +0300
commit7f6b9121cc51cc5356a4c91957cce1aa6011d47e (patch)
treed23541e7ea62b326b95f287eaa0f45ad7c01b9a2 /src/ipa/raspberrypi/controller/rpi/alsc.hpp
parentdb552b0b925a9ba2c3cc54aa40feed6fb7e66981 (diff)
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 <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller/rpi/alsc.hpp')
-rw-r--r--src/ipa/raspberrypi/controller/rpi/alsc.hpp3
1 files changed, 2 insertions, 1 deletions
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);