summaryrefslogtreecommitdiff
path: root/src/cam/main.cpp
AgeCommit message (Expand)Author
2021-08-05cam: Add support for viewfinder through DRM/KMSLaurent Pinchart
2021-07-23cam: Initialize CamApp::loopUsers_Laurent Pinchart
2021-07-22cam: Support using multiple cameras concurrentlyLaurent Pinchart
2021-07-22cam: Add camera index to file name of capture framesLaurent Pinchart
2021-07-22cam: Make camera-related options sub-options of OptCameraLaurent Pinchart
2021-07-22cam: Allow specifying directories in the --file optionLaurent Pinchart
2021-07-22cam: Reorganize run() function and merge the two event loopsLaurent Pinchart
2021-07-22cam: Move session_ member variable to a local variable in run() functionLaurent Pinchart
2021-07-22cam: Move printing of camera information to CameraSession classLaurent Pinchart
2021-07-22cam: Move camera session creation and monitoring setup to run()Laurent Pinchart
2021-07-22cam: Make CamApp::cameraName() staticLaurent Pinchart
2021-07-22cam: Drop unneeded error check and messageLaurent Pinchart
2021-07-22cam: Use std::unique_ptr<> to manage CameraManagerLaurent Pinchart
2021-07-22cam: Move camera acquire to the CameraSession classLaurent Pinchart
2021-07-22cam: Move CameraConfiguration creation to CameraSession classLaurent Pinchart
2021-07-22cam: Store camera session pointer in CamApp classLaurent Pinchart
2021-07-22cam: Move event loop execution from CameraSession to CamAppLaurent Pinchart
2021-07-22cam: Move event loop exit from CameraSession to CamAppLaurent Pinchart
2021-07-22cam: camera_session: Access event loop through global instanceLaurent Pinchart
2021-07-22cam: Rename Capture to CameraSessionLaurent Pinchart
2021-05-06cam: Add option to print the Request metadataJacopo Mondi
2021-03-22cam: Do not assume Location is availableJacopo Mondi
2020-11-15cam: Use libevent to implement event loopLaurent Pinchart
2020-10-02cam: Print user-friendly camera namesNiklas Söderlund
2020-08-25meson: Remove -Wno-unused-parameterLaurent Pinchart
2020-08-10cam: Rename cameraName variableNiklas Söderlund
2020-08-05libcamera: camera: Rename name() to id()Niklas Söderlund
2020-08-05cam: Use the common cleanup function on failureNiklas Söderlund
2020-08-03cam: Add --monitor optionUmang Jain
2020-07-27cam: Add optional argument to --capture to specify how many frames to captureNiklas Söderlund
2020-07-27cam: capture: Cache the EventLoop handlerNiklas Söderlund
2020-07-27cam: Add option to disallow adjusting of requested formatsNiklas Söderlund
2020-05-01cam: Make use of StreamKeyValueParserNiklas Söderlund
2020-04-26cam: Add an option to list camera controlsLaurent Pinchart
2020-04-26cam: Rename OptProps to OptListPropertiesLaurent Pinchart
2020-03-27cam: Add option to capture StillCaptureRaw streamNiklas Söderlund
2020-03-24cam: main: Cache lookup of role propertyLaurent Pinchart
2020-03-20cam: Print one property per lineJacopo Mondi
2020-03-18libcamera: PixelFormat: Turn into a classNiklas Söderlund
2020-03-18libcamera: Use PixelFormat instead of unsigned int where appropriateNiklas Söderlund
2020-03-06cam: Add option to list camera propertiesJacopo Mondi
2019-11-20cam: Store camera as shared pointer everywhereNiklas Söderlund
2019-08-19libcamera: camera_manager: Construct CameraManager instances manuallyLaurent Pinchart
2019-06-19cam: Add --info option to print information about stream(s)Niklas Söderlund
2019-06-19cam: Validate camera configurationNiklas Söderlund
2019-06-19cam: Move camera configuration preparation to CamAppNiklas Söderlund
2019-06-18cam: Allow selecting cameras by indexLaurent Pinchart
2019-06-10cam: Fix cam --help crashNiklas Söderlund
2019-05-25cam: Add CamApp classNiklas Söderlund
2019-05-25cam: capture: Break out capture to a new classNiklas Söderlund
{ public: Awb(Controller *controller = NULL); ~Awb(); char const *name() const override; void initialise() override; int read(const libcamera::YamlObject &params) override; /* AWB handles "pausing" for itself. */ bool isPaused() const override; void pause() override; void resume() override; unsigned int getConvergenceFrames() const override; void setMode(std::string const &name) override; void setManualGains(double manualR, double manualB) override; void switchMode(CameraMode const &cameraMode, Metadata *metadata) override; void prepare(Metadata *imageMetadata) override; void process(StatisticsPtr &stats, Metadata *imageMetadata) override; struct RGB { RGB(double r = 0, double g = 0, double b = 0) : R(r), G(g), B(b) { } double R, G, B; RGB &operator+=(RGB const &other) { R += other.R, G += other.G, B += other.B; return *this; } }; private: bool isAutoEnabled() const; /* configuration is read-only, and available to both threads */ AwbConfig config_; std::thread asyncThread_; void asyncFunc(); /* asynchronous thread function */ std::mutex mutex_; /* condvar for async thread to wait on */ std::condition_variable asyncSignal_; /* condvar for synchronous thread to wait on */ std::condition_variable syncSignal_; /* for sync thread to check if async thread finished (requires mutex) */ bool asyncFinished_; /* for async thread to check if it's been told to run (requires mutex) */ bool asyncStart_; /* for async thread to check if it's been told to quit (requires mutex) */ bool asyncAbort_; /* * The following are only for the synchronous thread to use: * for sync thread to note its has asked async thread to run */ bool asyncStarted_; /* counts up to framePeriod before restarting the async thread */ int framePhase_; int frameCount_; /* counts up to startup_frames */ AwbStatus syncResults_; AwbStatus prevSyncResults_; std::string modeName_; /* * 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, double lux); /* copy out the results from the async thread so that it can be restarted */ void fetchAsyncResults(); StatisticsPtr statistics_; AwbMode *mode_; double lux_; AwbStatus asyncResults_; void doAwb(); void awbBayes(); void awbGrey(); void prepareStats(); double computeDelta2Sum(double gainR, double gainB); Pwl interpolatePrior(); double coarseSearch(Pwl const &prior); void fineSearch(double &t, double &r, double &b, Pwl const &prior); std::vector<RGB> zones_; std::vector<Pwl::Point> points_; /* manual r setting */ double manualR_; /* manual b setting */ double manualB_; bool firstSwitchMode_; /* is this the first call to SwitchMode? */ }; static inline Awb::RGB operator+(Awb::RGB const &a, Awb::RGB const &b) { return Awb::RGB(a.R + b.R, a.G + b.G, a.B + b.B); } static inline Awb::RGB operator-(Awb::RGB const &a, Awb::RGB const &b) { return Awb::RGB(a.R - b.R, a.G - b.G, a.B - b.B); } static inline Awb::RGB operator*(double d, Awb::RGB const &rgb) { return Awb::RGB(d * rgb.R, d * rgb.G, d * rgb.B); } static inline Awb::RGB operator*(Awb::RGB const &rgb, double d) { return d * rgb; } } /* namespace RPiController */