hc
2023-02-14 0cc9b7c44253c93447ddf73e206fbdbb3d9f16b1
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
 
/*
 *  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 _FAKE_CAM_HW_ISP20_H_
#define _FAKE_CAM_HW_ISP20_H_
 
#include "CamHwIsp20.h"
 
namespace RkCam {
 
#define START_TAG           0xFF00
#define FORMAT_TAG          0xFF01
#define NORMAL_RAW_TAG      0xFF02
#define HDR_S_RAW_TAG       0xFF03
#define HDR_M_RAW_TAG       0xFF04
#define HDR_L_RAW_TAG       0xFF05
#define STATS_TAG           0xFF06
#define ISP_REG_FMT_TAG     0xFF07
#define ISP_REG_TAG         0xFF08
#define ISPP_REG_FMT_TAG    0xFF09
#define ISPP_REG_TAG        0xFF0A
#define PLATFORM_TAG        0xFF0B
#define END_TAG             0x00FF
 
#define TAG_BYTE_LEN     (2)
#define BLOCK_BYTE_LEN   (4)
 
struct _block_header {
    unsigned short block_id;
    unsigned int block_length;
}__attribute__ ((packed));
 
struct _st_addrinfo
{
    uint32_t fd;
    uint32_t haddr;
    uint32_t laddr;
    uint32_t size;
}__attribute__ ((packed));
 
struct _raw_format
{
    uint16_t tag;
    uint32_t size;
    uint16_t vesrion;
    char sensor[32];
    char scene[32];
    uint32_t frame_id;
    uint16_t width;
    uint16_t height;
    uint8_t bit_width;
    uint8_t bayer_fmt;
    uint8_t hdr_mode;
    uint8_t buf_type;
    uint16_t line_length;
    uint16_t acive_line_length;
    uint8_t byte_order;
}__attribute__ ((packed));
 
struct _frame_info
{
    uint16_t tag;
    uint32_t size;
    uint16_t vesrion;
    uint32_t frame_id;
 
    float normal_exp;
    float normal_gain;
    uint32_t normal_exp_reg;
    uint32_t normal_gain_reg;
 
    float hdr_exp_l;
    float hdr_gain_l;
    uint32_t hdr_exp_l_reg;
    uint32_t hdr_gain_l_reg;
 
    float hdr_exp_m;
    float hdr_gain_m;
    uint32_t hdr_gain_m_reg;
    uint32_t hdr_exp_m_reg;
 
    float hdr_exp_s;
    float hdr_gain_s;
    uint32_t hdr_exp_s_reg;
    uint32_t hdr_gain_s_reg;
 
    float awg_rgain;
    float awg_bgain;
}__attribute__ ((packed));
 
class FakeCamHwIsp20 : public CamHwIsp20 {
public:
    explicit FakeCamHwIsp20();
    virtual ~FakeCamHwIsp20();
    virtual XCamReturn init(const char* sns_ent_name);
    virtual XCamReturn prepare(uint32_t width, uint32_t height, int mode, int t_delay, int g_delay);
    virtual XCamReturn enqueueRawBuffer(void *rawdata, bool sync);
    virtual XCamReturn enqueueRawFile(const char *path);
    virtual XCamReturn registRawdataCb(void (*callback)(void *));
    virtual XCamReturn rawdataPrepare(rk_aiq_raw_prop_t prop);
private:
    XCamReturn init_mipi_devices(rk_sensor_full_info_t *s_info);
    void parse_rk_rawdata(void *rawdata, struct rk_aiq_vbuf *vbuf);
    void parse_rk_rawfile(FILE *fp, struct rk_aiq_vbuf *vbuf);
    struct _st_addrinfo _st_addr[3];
    struct _raw_format _rawfmt;
    struct _frame_info _finfo;
    enum v4l2_memory    _rx_memory_type;
    enum v4l2_memory    _tx_memory_type;
    rk_aiq_rawbuf_type_t _rawbuf_type;
};
 
};
#endif