summaryrefslogtreecommitdiff
path: root/aiq/aiq.h
blob: 49eee2d0b653f0641b506a0b49e81e99a4e370b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* SPDX-License-Identifier: Apache-2.0 */
/*
 * Copyright (C) 2021, Google Inc.
 *
 * aiq.h - Intel IA Imaging library C++ wrapper
 *
 * To simplify naming, and prevent confusion the wrapper is named simply aiq
 * rather than ia_aiq.
 */

#include <string>

#include <ia_imaging/ia_aiq.h>
#include <ia_imaging/ia_cmc_parser.h>
#include <linux/intel-ipu3.h>

#include <libcamera/geometry.h>

#include "aiq_input_parameters.h"
#include "aiq_results.h"
#include "binary_data.h"
#include "stats/ipa_ipu3_stats.h"

#ifndef IPA_IPU3_AIQ_H
#define IPA_IPU3_AIQ_H

namespace libcamera {

namespace ipa::ipu3::aiq {

class AIQ
{
public:
	AIQ();
	~AIQ();

	int init(BinaryData &aiqb, BinaryData &nvm, BinaryData &aiqd);
	int configure();
	int setStatistics(unsigned int frame,
			  int64_t timestamp, AiqResults &results,
			  const ipu3_uapi_stats_3a *stats);
	int run2a(unsigned int frame, AiqInputParameters &params, AiqResults &results);

private:
	std::string decodeError(ia_err err);

	int aeRun(ia_aiq_ae_input_params &aeParams, AiqResults &results);
	int afRun(ia_aiq_af_input_params &afParams, AiqResults &results);
	int afBracketRun(ia_aiq_af_bracket_input_params &afBracketParams,
			 AiqResults &results);
	int awbRun(ia_aiq_awb_input_params &awbParams, AiqResults &results);
	int dsdRun(ia_aiq_dsd_input_params &dsdParams, AiqResults &results);
	int gbceRun(ia_aiq_gbce_input_params &gbceParams, AiqResults &results);
	int parameterAdapterRun(ia_aiq_pa_input_params &paParams,
				AiqResults &results);
	int shadingAdapterRun(ia_aiq_sa_input_params &saParams,
			      AiqResults &results);

	ia_aiq *aiq_;
	ia_cmc_t *iaCmc_;
	std::string version_;

	IPAIPU3Stats *aiqStats_;
};

} /* namespace ipa::ipu3::aiq */

} /* namespace libcamera */

#endif /* IPA_IPU3_AIQ_H */