ipa_proxy.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* ipa_proxy.h - Image Processing Algorithm proxy
*/
#ifndef __LIBCAMERA_INTERNAL_IPA_PROXY_H__
#define __LIBCAMERA_INTERNAL_IPA_PROXY_H__
#include <memory>
#include <string>
#include <vector>
#include <libcamera/ipa/ipa_interface.h>
namespace libcamera {
class IPAModule;
class IPAProxy : public IPAInterface
{
public:
IPAProxy(IPAModule *ipam);
~IPAProxy();
bool isValid() const { return valid_; }
std::string configurationFile(const std::string &file) const;
protected:
std::string resolvePath(const std::string &file) const;
bool valid_;
private:
IPAModule *ipam_;
};
class IPAProxyFactory
{
public:
IPAProxyFactory(const char *name);
virtual ~IPAProxyFactory() {}
virtual std::unique_ptr<IPAProxy> create(IPAModule *ipam) = 0;
const std::string &name() const { return name_; }
static void registerType(IPAProxyFactory *factory);
static std::vector<IPAProxyFactory *> &factories();
private:
std::string name_;
};
#define REGISTER_IPA_PROXY(proxy) \
class proxy##Factory final : public IPAProxyFactory \
{ \
public: \
proxy##Factory() : IPAProxyFactory(#proxy) {} \
std::unique_ptr<IPAProxy> create(IPAModule *ipam) \
{ \
return std::make_unique<proxy>(ipam); \
} \
}; \
static proxy##Factory global_##proxy##Factory;
} /* namespace libcamera */
#endif /* __LIBCAMERA_INTERNAL_IPA_PROXY_H__ */
libcamera::IPAInterface
C++ Interface for IPA implementation.
Definition: ipa_interface.h:151
libcamera::IPAModule
Wrapper around IPA module shared object.
Definition: ipa_module.h:23
libcamera::IPAProxyFactory
Registration of IPAProxy classes and creation of instances.
Definition: ipa_proxy.h:40
libcamera::IPAProxyFactory::factories
static std::vector< IPAProxyFactory * > & factories()
Retrieve the list of all IPAProxy factories.
Definition: ipa_proxy.cpp:292
libcamera::IPAProxyFactory::IPAProxyFactory
IPAProxyFactory(const char *name)
Construct a IPAProxy factory.
Definition: ipa_proxy.cpp:243
libcamera::IPAProxyFactory::name
const std::string & name() const
Retrieve the factory name.
Definition: ipa_proxy.h:47
libcamera::IPAProxyFactory::registerType
static void registerType(IPAProxyFactory *factory)
Add a IPAProxy class to the registry.
Definition: ipa_proxy.cpp:274
libcamera::IPAProxyFactory::create
virtual std::unique_ptr< IPAProxy > create(IPAModule *ipam)=0
Create an instance of the IPAProxy corresponding to the factory.
libcamera::IPAProxy
IPA Proxy.
Definition: ipa_proxy.h:21
libcamera::IPAProxy::IPAProxy
IPAProxy(IPAModule *ipam)
Construct an IPAProxy instance.
Definition: ipa_proxy.cpp:45
libcamera::IPAProxy::valid_
bool valid_
Flag to indicate if the IPAProxy instance is valid.
Definition: ipa_proxy.h:33
libcamera::IPAProxy::resolvePath
std::string resolvePath(const std::string &file) const
Find a valid full path for a proxy worker for a given executable name.
Definition: ipa_proxy.cpp:162
libcamera::IPAProxy::configurationFile
std::string configurationFile(const std::string &file) const
Retrieve the absolute path to an IPA configuration file.
Definition: ipa_proxy.cpp:87
libcamera::IPAProxy::isValid
bool isValid() const
Check if the IPAProxy instance is valid.
Definition: ipa_proxy.h:26
ipa_interface.h
Image Processing Algorithm interface.