ipa: raspberrypi Store the target string in the controller
The target string may be used by algorithms to determine the running hardware target. Store the target string provided by the camera tuning files in the controller state. Add a getTarget() member function to retrieve this string. Validate the correct hardware target ("bcm2835") during the IPA initialisation phase. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
f7bf0be653
commit
cf6df17958
4 changed files with 22 additions and 0 deletions
|
@ -41,6 +41,10 @@ public:
|
||||||
{
|
{
|
||||||
return controller_->getGlobalMetadata();
|
return controller_->getGlobalMetadata();
|
||||||
}
|
}
|
||||||
|
const std::string &getTarget() const
|
||||||
|
{
|
||||||
|
return controller_->getTarget();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Controller *controller_;
|
Controller *controller_;
|
||||||
|
|
|
@ -38,6 +38,7 @@ int Controller::read(char const *filename)
|
||||||
|
|
||||||
std::unique_ptr<YamlObject> root = YamlParser::parse(file);
|
std::unique_ptr<YamlObject> root = YamlParser::parse(file);
|
||||||
double version = (*root)["version"].get<double>(1.0);
|
double version = (*root)["version"].get<double>(1.0);
|
||||||
|
target_ = (*root)["target"].get<std::string>("bcm2835");
|
||||||
|
|
||||||
if (version < 2.0) {
|
if (version < 2.0) {
|
||||||
LOG(RPiController, Warning)
|
LOG(RPiController, Warning)
|
||||||
|
@ -142,3 +143,8 @@ Algorithm *Controller::getAlgorithm(std::string const &name) const
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string &Controller::getTarget() const
|
||||||
|
{
|
||||||
|
return target_;
|
||||||
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
void process(StatisticsPtr stats, Metadata *imageMetadata);
|
void process(StatisticsPtr stats, Metadata *imageMetadata);
|
||||||
Metadata &getGlobalMetadata();
|
Metadata &getGlobalMetadata();
|
||||||
Algorithm *getAlgorithm(std::string const &name) const;
|
Algorithm *getAlgorithm(std::string const &name) const;
|
||||||
|
const std::string &getTarget() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int createAlgorithm(const std::string &name, const libcamera::YamlObject ¶ms);
|
int createAlgorithm(const std::string &name, const libcamera::YamlObject ¶ms);
|
||||||
|
@ -53,6 +54,9 @@ protected:
|
||||||
Metadata globalMetadata_;
|
Metadata globalMetadata_;
|
||||||
std::vector<AlgorithmPtr> algorithms_;
|
std::vector<AlgorithmPtr> algorithms_;
|
||||||
bool switchModeCalled_;
|
bool switchModeCalled_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string target_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace RPiController */
|
} /* namespace RPiController */
|
||||||
|
|
|
@ -266,6 +266,14 @@ int IPARPi::init(const IPASettings &settings, bool lensPresent, IPAInitResult *r
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string &target = controller_.getTarget();
|
||||||
|
if (target != "bcm2835") {
|
||||||
|
LOG(IPARPI, Error)
|
||||||
|
<< "Tuning data file target returned \"" << target << "\""
|
||||||
|
<< ", expected \"bcm2835\"";
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
lensPresent_ = lensPresent;
|
lensPresent_ = lensPresent;
|
||||||
|
|
||||||
controller_.initialise();
|
controller_.initialise();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue