summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Expand)Author
2021-10-19build: Preserve upstream git versioning using meson distNaushir Patuck
2021-10-19utils: gen-version: Pass the meson source root to the gen-version.sh scriptNaushir Patuck
2021-10-19utils: hooks: pre-push: Check push to integration/* branchesLaurent Pinchart
2021-09-27libcamera: control_serializer: Separate the handles spaceJacopo Mondi
2021-09-27ipa: proxy_worker: Reset ControlSerializer on workerJacopo Mondi
2021-09-10utils: ipc: proxy worker: Fix indentation in call deserializationPaul Elder
2021-09-02libcamera: Drop emitter object pointer from signal argumentsLaurent Pinchart
2021-09-02libcamera: Don't use emitter object pointer argument to slotLaurent Pinchart
2021-08-27utils: checkstyle.py: Use single-quoted strings when possibleLaurent Pinchart
2021-08-19ipa: Use FileDescriptor instead of int in layers above IPC payloadPaul Elder
2021-08-18utils: ipc: ipa_proxy_worker: Log IPCUnixSocket::send() failuresLaurent Pinchart
2021-08-05utils: ipc: Initialise ThreadProxyKieran Bingham
2021-08-03utils: raspberrypi: ctt: Fix namespace for sklearn NearestCentroid functionDavid Plowman
2021-08-02utils: raspberrypi: ctt: Fix usage of findHomography functionDavid Plowman
2021-07-27utils: ipc: Assign a new gid to proxy workerUmang Jain
2021-07-09utils: ipc: proxy: Reset ControlSerializer during IPA configureUmang Jain
2021-06-25libcamera/base: Move extended base functionalityKieran Bingham
2021-06-01utils: ipc: mojo: Error if ControlInfoMap/List doesn't prefix libcameraPaul Elder
2021-05-31utils: ipc: extract-docs: Extract the SPDX headerPaul Elder
2021-05-27utils: ipc: Add script to extract doxygen docs from mojom filesPaul Elder
2021-05-26utils: ipc: Update mojoPaul Elder
2021-05-26utils: update-mojo.sh: Add script for updating mojoPaul Elder
2021-05-24ipa: Move core IPA interface documentation to a .cpp fileUmang Jain
2021-04-27utils: ipc: Use the proper namespace for mojom structsPaul Elder
2021-03-29utils: ipc: proxy: Track IPA with a state machineKieran Bingham
2021-03-24utils: ipc: proxy: Process pending messagesLaurent Pinchart
2021-03-24utils: ipc: proxy: Assert asynchronous calls execute in the running stateLaurent Pinchart
2021-03-12utils: raspberrypi: Add a DelayedControls log parserNaushir Patuck
2021-03-09utils: ipc: Make first output parameter direct return if int32Paul Elder
2021-03-09utils: ipc: Support custom parameters to init()Paul Elder
2021-03-08utils: Add kernel headers update scriptLaurent Pinchart
2021-03-04utils: ipc: templates: Drop unused variableLaurent Pinchart
2021-02-16utils: checkstyle.py: Handle renamed files in header add checkerLaurent Pinchart
2021-02-16utils: checkstyle.py: Restore checks of renamed filesLaurent Pinchart
2021-02-16meson: ipa, proxy: Generate headers and proxy with mojoPaul Elder
2021-02-16utils: ipc: add parser scriptPaul Elder
2021-02-16utils: ipc: add generator scriptPaul Elder
2021-02-16utils: ipc: add templates for code generation for IPC mechanismPaul Elder
2021-02-01utils: gen-formats: Support big-endian DRM formatsLaurent Pinchart
2021-01-21utils: checkstyle.py: Fix "protected" members in Commit classLaurent Pinchart
2020-12-29utils: checkstyle.py: Drop astyle supportLaurent Pinchart
2020-12-29utils: checkstyle.py: Add header add checkerLaurent Pinchart
2020-12-29utils: checkstyle.py: Add commit checkersLaurent Pinchart
2020-12-29utils: checkstyle.py: Move diff parsing to Commit classLaurent Pinchart
2020-12-29utils: checkstyle.py: Add ability to filter files by status in a commitLaurent Pinchart
2020-12-29utils: checkstyle.py: Make title and files properties of commit classLaurent Pinchart
2020-12-29utils: checkstyle.py: Move commit handling to a separate sectionLaurent Pinchart
2020-12-29utils: checkstyle.py: Factor out automatic class registryLaurent Pinchart
2020-12-29utils: checkstyle.py: Drop arguments to super() when possibleLaurent Pinchart
2020-12-27utils: gen-controls: Fix enumerators documentationLaurent Pinchart
n class="hl opt">].asList()) { auto value = p["ct"].get<double>(); if (!value) return -EINVAL; CtCcm ctCcm; ctCcm.ct = *value; ret = ctCcm.ccm.read(p["ccm"]); if (ret) return ret; if (!config_.ccms.empty() && ctCcm.ct <= config_.ccms.back().ct) { LOG(RPiCcm, Error) << "CCM not in increasing colour temperature order"; return -EINVAL; } config_.ccms.push_back(std::move(ctCcm)); } if (config_.ccms.empty()) { LOG(RPiCcm, Error) << "No CCMs specified"; return -EINVAL; } return 0; } void Ccm::setSaturation(double saturation) { saturation_ = saturation; } void Ccm::initialise() { } template<typename T> static bool getLocked(Metadata *metadata, std::string const &tag, T &value) { T *ptr = metadata->getLocked<T>(tag); if (ptr == nullptr) return false; value = *ptr; return true; } Matrix calculateCcm(std::vector<CtCcm> const &ccms, double ct) { if (ct <= ccms.front().ct) return ccms.front().ccm; else if (ct >= ccms.back().ct) return ccms.back().ccm; else { int i = 0; for (; ct > ccms[i].ct; i++) ; double lambda = (ct - ccms[i - 1].ct) / (ccms[i].ct - ccms[i - 1].ct); return lambda * ccms[i].ccm + (1.0 - lambda) * ccms[i - 1].ccm; } } Matrix applySaturation(Matrix const &ccm, double saturation) { Matrix RGB2Y(0.299, 0.587, 0.114, -0.169, -0.331, 0.500, 0.500, -0.419, -0.081); Matrix Y2RGB(1.000, 0.000, 1.402, 1.000, -0.345, -0.714, 1.000, 1.771, 0.000); Matrix S(1, 0, 0, 0, saturation, 0, 0, 0, saturation); return Y2RGB * S * RGB2Y * ccm; } void Ccm::prepare(Metadata *imageMetadata) { bool awbOk = false, luxOk = false; struct AwbStatus awb = {}; awb.temperatureK = 4000; /* in case no metadata */ struct LuxStatus lux = {}; lux.lux = 400; /* in case no metadata */ { /* grab mutex just once to get everything */ std::lock_guard<Metadata> lock(*imageMetadata); awbOk = getLocked(imageMetadata, "awb.status", awb); luxOk = getLocked(imageMetadata, "lux.status", lux); } if (!awbOk) LOG(RPiCcm, Warning) << "no colour temperature found"; if (!luxOk) LOG(RPiCcm, Warning) << "no lux value found"; Matrix ccm = calculateCcm(config_.ccms, awb.temperatureK); double saturation = saturation_; struct CcmStatus ccmStatus; ccmStatus.saturation = saturation; if (!config_.saturation.empty()) saturation *= config_.saturation.eval( config_.saturation.domain().clamp(lux.lux)); ccm = applySaturation(ccm, saturation); for (int j = 0; j < 3; j++) for (int i = 0; i < 3; i++) ccmStatus.matrix[j * 3 + i] = std::max(-8.0, std::min(7.9999, ccm.m[j][i])); LOG(RPiCcm, Debug) << "colour temperature " << awb.temperatureK << "K"; LOG(RPiCcm, Debug) << "CCM: " << ccmStatus.matrix[0] << " " << ccmStatus.matrix[1] << " " << ccmStatus.matrix[2] << " " << ccmStatus.matrix[3] << " " << ccmStatus.matrix[4] << " " << ccmStatus.matrix[5] << " " << ccmStatus.matrix[6] << " " << ccmStatus.matrix[7] << " " << ccmStatus.matrix[8]; imageMetadata->set("ccm.status", ccmStatus); } /* Register algorithm with the system. */ static Algorithm *create(Controller *controller) { return (Algorithm *)new Ccm(controller); ; } static RegisterAlgorithm reg(NAME, &create);