hc
2024-08-16 a24a44ff9ca902811b99aa9663d697cf452e08ef
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
 * rk_aiq_algo_des.h
 *
 *  Copyright (c) 2019 Rockchip Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
 
#ifndef _RK_AIQ_ALGO_DES_H_
#define _RK_AIQ_ALGO_DES_H_
 
#include "base/xcam_common.h"
#include "rk_aiq_comm.h"
 
/*
 * This file is used to define all the algos interfaces, eg. including ae, awb
 * af, anr and etc. . The typical call routine by user is as follow:
 * 1) create_context
 *    Should call this before any other interfaces, and should be called only
 *    once.
 * 2) prepare
 *    some algos have lots of pre-condtions, these condtions may consist of
 *    sensor_descriptors, tuning params for algo. This interface may be called
 *    after |create_context| or |post_process|, and shouldn't be called
 *    after |pre_process| or |processing|. That means the configs can't be
 *    changed during the process stage, and could be repeated(re-config) until
 *    one completed process routine.
 * 3) pre_process
 *    We separate the whole process to 3 steps: pre-process, processing and
 *    post-process. The caller will call all algos pre-process firstly, then
 *    call processing, then post-process at last.
 *    There may exist the dependancy between algos's params. pre-process aims
 *    to solve the dependancy. It collects all the dependancy before processing.
 * 4) processing
 *    runs the algos then outputs the result.
 * 5) post_process
 *    reserved.
 * 6) destroy_context
 *
 */
 
RKAIQ_BEGIN_DECLARE
 
typedef struct _RkAiqAlgoContext RkAiqAlgoContext;
#ifndef RKAIQAECEXPINFO_T
#define RKAIQAECEXPINFO_T
typedef struct RKAiqAecExpInfo_s RKAiqAecExpInfo_t;
#endif
#ifndef CAMCALIBDBCONTEXT_T
#define CAMCALIBDBCONTEXT_T
typedef void CamCalibDbContext_t;
#endif
typedef struct CamCalibDbV2Context_s CamCalibDbV2Context_t;
typedef struct _RkAiqResComb RkAiqResComb;
 
typedef enum RkAiqAlgoType_e {
    RK_AIQ_ALGO_TYPE_NONE = -1,
    RK_AIQ_ALGO_TYPE_AE,
    RK_AIQ_ALGO_TYPE_AWB,
    RK_AIQ_ALGO_TYPE_AF,
    RK_AIQ_ALGO_TYPE_ABLC,
    RK_AIQ_ALGO_TYPE_ADPCC,
    RK_AIQ_ALGO_TYPE_AMERGE,
    RK_AIQ_ALGO_TYPE_ATMO,
    RK_AIQ_ALGO_TYPE_ANR,
    RK_AIQ_ALGO_TYPE_ALSC,
    RK_AIQ_ALGO_TYPE_AGIC,
    RK_AIQ_ALGO_TYPE_ADEBAYER,
    RK_AIQ_ALGO_TYPE_ACCM,
    RK_AIQ_ALGO_TYPE_AGAMMA,
    RK_AIQ_ALGO_TYPE_AWDR,
    RK_AIQ_ALGO_TYPE_ADHAZ,
    RK_AIQ_ALGO_TYPE_A3DLUT,
    RK_AIQ_ALGO_TYPE_ALDCH,
    RK_AIQ_ALGO_TYPE_ACSM,
    RK_AIQ_ALGO_TYPE_ACP,
    RK_AIQ_ALGO_TYPE_AIE,
    RK_AIQ_ALGO_TYPE_ASHARP,
    RK_AIQ_ALGO_TYPE_AORB,
    RK_AIQ_ALGO_TYPE_ACGC,
    RK_AIQ_ALGO_TYPE_ASD,
    RK_AIQ_ALGO_TYPE_ADRC,
   RK_AIQ_ALGO_TYPE_ADEGAMMA,
 
    RK_AIQ_ALGO_TYPE_ARAWNR,
    RK_AIQ_ALGO_TYPE_AMFNR,
    RK_AIQ_ALGO_TYPE_AYNR,
    RK_AIQ_ALGO_TYPE_ACNR,
    RK_AIQ_ALGO_TYPE_AEIS,
    RK_AIQ_ALGO_TYPE_AFEC,
    RK_AIQ_ALGO_TYPE_AMD,
    RK_AIQ_ALGO_TYPE_AGAIN,
    RK_AIQ_ALGO_TYPE_ACAC,
    RK_AIQ_ALGO_TYPE_MAX
} RkAiqAlgoType_t;
 
typedef struct _AlgoCtxInstanceCfg {
    uint32_t isp_hw_version;
    uint32_t module_hw_version;
    CamCalibDbContext_t* calib;
    CamCalibDbV2Context_t* calibv2;
    bool isGroupMode;
} AlgoCtxInstanceCfg;
 
typedef struct _RkAiqAlgoDesComm {
    const char*                             version;
    const char*                             vendor;
    const char*                             description;
    RkAiqAlgoType_t                         type;
    int                                     id;
    XCamReturn (*create_context)            (RkAiqAlgoContext **context, const AlgoCtxInstanceCfg* cfg);
    XCamReturn (*destroy_context)           (RkAiqAlgoContext *context);
} RkAiqAlgoDesComm;
 
// base structs in order to abstract same interface
// for all algos
 
typedef enum RkAiqAlgoConfType_e {
    RK_AIQ_ALGO_CONFTYPE_INIT = 0,
    RK_AIQ_ALGO_CONFTYPE_UPDATECALIB = 0x01,
    RK_AIQ_ALGO_CONFTYPE_CHANGEMODE  = 0x02,
    RK_AIQ_ALGO_CONFTYPE_NEEDRESET   = 0x04,
    RK_AIQ_ALGO_CONFTYPE_CHANGERES   = 0x08,
    RK_AIQ_ALGO_CONFTYPE_KEEPSTATUS  = 0x10,
    RK_AIQ_ALGO_CONFTYPE_CHANGECAMS  = 0x20,
    RK_AIQ_ALGO_CONFTYPE_MAX
} RkAiqAlgoConfType_t;
 
typedef struct _RkAiqAlgoCom {
    RkAiqAlgoContext *ctx;
    uint32_t frame_id;
    union {
        struct {
            int working_mode; // real type is rk_aiq_working_mode_t or rk_aiq_isp_hdr_mode_t
            int sns_op_width;
            int sns_op_height;
            int conf_type;
            CamCalibDbContext_t* calib;
            CamCalibDbV2Context_t* calibv2;
        } prepare; //for prepare function
 
        struct {
            bool init;
            int iso;
            bool fill_light_on;
            bool gray_mode;
            bool is_bw_sensor;
            RKAiqAecExpInfo_t *preExp;
            RKAiqAecExpInfo_t *curExp;
            RKAiqAecExpInfo_t *nxtExp;
            RkAiqResComb* res_comb;
        } proc; //for pre/processing/post function
    } u;
    void* reserverd; //transfer whatever used by prepare/pre/processing/post
} RkAiqAlgoCom;
 
// generic result type
typedef struct _RkAiqAlgoResCom {
    char place_holder[1];
} RkAiqAlgoResCom;
 
typedef struct _RkAiqAlgoDescription {
    RkAiqAlgoDesComm    common;
    XCamReturn (*prepare)(RkAiqAlgoCom* params);
    XCamReturn (*pre_process)(const RkAiqAlgoCom* inparams, RkAiqAlgoResCom* outparams);
    XCamReturn (*processing)(const RkAiqAlgoCom* inparams, RkAiqAlgoResCom* outparams);
    XCamReturn (*post_process)(const RkAiqAlgoCom* inparams, RkAiqAlgoResCom* outparams);
} RkAiqAlgoDescription;
 
RKAIQ_END_DECLARE
 
#endif //_RK_AIQ_ALGO_DES_H_