This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
/
rawtest.c
316 lines (281 loc) · 9.81 KB
/
rawtest.c
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
// Sensor research: a huge, unfinished mess
// Model: Activeon DX
// `make minimal file=rawtest.c d=... m=...`
#include "stdio.h"
#include "ambarella.h"
#include "ahdk.h"
/*
// Experiments
//ROUTE raw 0xc024e39e
//ROUTE raw 0xc024e3a0
//ROUTE raw 0xc0360648 + 1
ROUTE syslog 0xc026e0d4
ROUTE syslog2 0xc026cf60
ROUTE sensor 0xc04edd6c + 1
ROUTE sensortramp 0xc0360648 + 1
ROUTE imgalgo 0xc02073b0
// void FUN_c01b7668(int param_1,undefined4 param_2)
ROUTE preview 0xc01b7668
ROUTE rawd 0xc024c138
ROUTE set_sharpness 0xc0423c58
ROUTE rawinfo 0xc03d0912
ROUTE raw 0xc03d09d0
*/
// Save a live (compressed, small) buffer from memory.
void savebuf() {
#define BSIZE 1920 * 1080
FILE *f = fopen("d:/myvideo.raw", "w");
unsigned char *frame;
int r = _malloc(1, BSIZE, &frame);
// Compressed live buffer (Activeon DX)
unsigned char *b = (unsigned char*)0xc45a2a80;
for (int i = 0; i < BSIZE; i++) {
frame[i] = b[i];
}
fwrite(frame, 1, BSIZE, f);
fclose(f);
//_free(1, addr);
}
// logger
// 0xc026cf60
// c03c3748 raw function?
// int c04efde4() sensor function
int sensor();
int sensortramp();
void syslog();
void syslog2();
void preview(); // ??
int rawinfo();
int raw();
// Does not do anything in view photo/video mode
// void preview(0xc, 0);
// sensor() commands
#define SENSOR3 0xB6001010 // sensor preview info
// Disables preview, gives info in syslog2
// param1: &ret = 0-20
// param2: 0
#define SENSOR_MODE 0xB6001011
// doesn't do anything
#define SENSOR5 0xB6001064
#define SENSOR6 0xB6001066
#define SENSOR7 0xB6001090
// Something with RAW, get raw info???
// long a = sensor(SENSOR8, "d:\\asd", &ret2);
// idsp dump address is 0x17309c0, sec_id:0
// save sec 0 dump:d:\asd size = -1054550048
#define SENSOR8 0xB6001027
// param1: 0-10
// param2:
#define SENSOR_SPATIAL_FILTER 0xB6001130
// &id 0 &ret
#define GET_WARP_CALIB 0xB600108D
#define MAX_COMMAND_ID 0xB6001130
void start(int *env, int argc, char *argv[]) {
//int *param = (int*)MEM_PARAM;
//*param = (long int)env;
char stack[1500];
int a = rawinfo(stack);
printf(env, "Return: %x\n", a);
if (a != 0) {
raw(stack, 0, 0);
}
//*param = 0;
}
/*
Sensor modes, not sure what it does.
Select Video Source: 0x0
[IMX117][WRN] [IMX117] sensor mode 0x0 not ready yet !
[IMX117][WRN] [IMX117] sensor mode 0x0 not ready yet !
Return: 0
Ret1: 0
Select Video Source: 0x1
================== Sensor mode info ==================
Sensor mode: 0x1, Downsample: (H) 2:3240420872 (V) 3223819084:1
[sensor window] W: 2124, H: 1098
[capture window] W: 1920, H: 1080
frame_length_lines: 2275, line_length_pck: 2816
row_time: -684804.4760 us, VB: -700624.3753 us, HB: 14.6660 us
======================================================
Return: 0
Ret1: 1
Select Video Source: 0x2
================== Sensor mode info ==================
Sensor mode: 0x2, Downsample: (H) 2:3240420872 (V) 3223819084:2
[sensor window] W: 2084, H: 1524
[capture window] W: 1920, H: 1440
frame_length_lines: 3080, line_length_pck: 3120
row_time: -684804.4880 us, VB: -700624.3753 us, HB: 10.8330 us
======================================================
Return: 0
Ret1: 2
Select Video Source: 0x3
================== Sensor mode info ==================
Sensor mode: 0x3, Downsample: (H) 2:3240420872 (V) 3223819084:3
[sensor window] W: 2124, H: 1098
[capture window] W: 1920, H: 1080
frame_length_lines: 1363, line_length_pck: 2816
row_time: -684804.2280 us, VB: -700624.3753 us, HB: 14.6730 us
======================================================
Return: 0
Ret1: 3
Select Video Source: 0x4
================== Sensor mode info ==================
Sensor mode: 0x4, Downsample: (H) 2:3240420872 (V) 3223819084:4
[sensor window] W: 2124, H: 1098
[capture window] W: 1920, H: 1080
frame_length_lines: 2726, line_length_pck: 2816
row_time: -684804.2280 us, VB: -700624.3753 us, HB: 14.6730 us
======================================================
Return: 0
Ret1: 4
Select Video Source: 0x5
================== Sensor mode info ==================
Sensor mode: 0x5, Downsample: (H) 2:3240420872 (V) 3223819084:5
[sensor window] W: 2084, H: 1524
[capture window] W: 1920, H: 1440
frame_length_lines: 3600, line_length_pck: 3200
row_time: -684804.4960 us, VB: -700624.3753 us, HB: 11.1110 us
======================================================
Return: 0
Ret1: 5
Select Video Source: 0x6
================== Sensor mode info ==================
Sensor mode: 0x6, Downsample: (H) 3:3240420872 (V) 3223819084:6
[sensor window] W: 1388, H: 1020
[capture window] W: 1312, H: 738
frame_length_lines: 1050, line_length_pck: 1525
row_time: -684804.3240 us, VB: -700624.3753 us, HB: 7.9420 us
======================================================
Return: 0
Ret1: 6
Select Video Source: 0x7
================== Sensor mode info ==================
Sensor mode: 0x7, Downsample: (H) 3:3240420872 (V) 3223819084:7
[sensor window] W: 1388, H: 1020
[capture window] W: 1312, H: 738
frame_length_lines: 1125, line_length_pck: 1706
row_time: -684804.3600 us, VB: -700624.3753 us, HB: 8.8850 us
======================================================
Return: 0
Ret1: 7
Select Video Source: 0x8
================== Sensor mode info ==================
Sensor mode: 0x8, Downsample: (H) 2:3240420872 (V) 3223819084:8
[sensor window] W: 2084, H: 770
[capture window] W: 1952, H: 730
frame_length_lines: 825, line_length_pck: 2329
row_time: -684804.3880 us, VB: -700624.3753 us, HB: 5.0540 us
======================================================
Return: 0
Ret1: 8
Select Video Source: 0x9
================== Sensor mode info ==================
Sensor mode: 0x9, Downsample: (H) 2:3240420872 (V) 3223819084:9
[sensor window] W: 2084, H: 770
[capture window] W: 1984, H: 558
frame_length_lines: 900, line_length_pck: 2560
row_time: -684804.4600 us, VB: -700624.3753 us, HB: 5.5550 us
======================================================
Return: 0
Ret1: 9
Select Video Source: 0xA
================== Sensor mode info ==================
Sensor mode: 0xA, Downsample: (H) 1:3240420872 (V) 3223819084:10
[sensor window] W: 4168, H: 3062
[capture window] W: 4000, H: 3000
frame_length_lines: 3120, line_length_pck: 4400
row_time: -684804.4880 us, VB: -700624.3753 us, HB: 11.4580 us
======================================================
Return: 0
Ret1: a
Select Video Source: 0xB
================== Sensor mode info ==================
Sensor mode: 0xB, Downsample: (H) 1:3240420872 (V) 3223819084:11
[sensor window] W: 4168, H: 3062
[capture window] W: 4000, H: 2666
frame_length_lines: 3120, line_length_pck: 4400
row_time: -684804.4880 us, VB: -700624.3753 us, HB: 11.4580 us
======================================================
Return: 0
Ret1: b
Select Video Source: 0xC
================== Sensor mode info ==================
Sensor mode: 0xC, Downsample: (H) 1:3240420872 (V) 3223819084:12
[sensor window] W: 4168, H: 3062
[capture window] W: 4000, H: 2250
frame_length_lines: 3120, line_length_pck: 4400
row_time: -684804.4880 us, VB: -700624.3753 us, HB: 11.4580 us
======================================================
Return: 0
Ret1: c
Select Video Source: 0xD
================== Sensor mode info ==================
Sensor mode: 0xD, Downsample: (H) 1:3240420872 (V) 3223819084:13
[sensor window] W: 4248, H: 2182
[capture window] W: 3840, H: 2160
frame_length_lines: 2200, line_length_pck: 5824
row_time: -684804.4760 us, VB: -700624.3753 us, HB: 15.1660 us
======================================================
Return: 0
Ret1: d
Select Video Source: 0xE
================== Sensor mode info ==================
Sensor mode: 0xE, Downsample: (H) 2:3240420872 (V) 3223819084:14
[sensor window] W: 2084, H: 1524
[capture window] W: 1920, H: 1440
frame_length_lines: 1716, line_length_pck: 2800
row_time: -684804.4920 us, VB: -700624.3753 us, HB: 9.7220 us
======================================================
Return: 0
Ret1: e
Select Video Source: 0xF
================== Sensor mode info ==================
Sensor mode: 0xF, Downsample: (H) 3:3240420872 (V) 3223819084:15
[sensor window] W: 1388, H: 1020
[capture window] W: 1312, H: 984
frame_length_lines: 1050, line_length_pck: 1525
row_time: -684804.3240 us, VB: -700624.3753 us, HB: 7.9420 us
======================================================
Return: 0
Ret1: f
Select Video Source: 0x10
================== Sensor mode info ==================
Sensor mode: 0x10, Downsample: (H) 2:3240420872 (V) 3223819084:16
[sensor window] W: 2084, H: 770
[capture window] W: 1984, H: 744
frame_length_lines: 825, line_length_pck: 2329
row_time: -684804.3880 us, VB: -700624.3753 us, HB: 5.0540 us
======================================================
Return: 0
Ret1: 10
Select Video Source: 0x11
================== Sensor mode info ==================
Sensor mode: 0x11, Downsample: (H) 2:3240420872 (V) 3223819084:17
[sensor window] W: 2084, H: 1524
[capture window] W: 1920, H: 1440
frame_length_lines: 1800, line_length_pck: 3200
row_time: -684804.4960 us, VB: -700624.3753 us, HB: 11.1110 us
======================================================
Return: 0
Ret1: 11
Select Video Source: 0x12
================== Sensor mode info ==================
Sensor mode: 0x12, Downsample: (H) 3:3240420872 (V) 3223819084:18
[sensor window] W: 1388, H: 1020
[capture window] W: 1312, H: 984
frame_length_lines: 1125, line_length_pck: 1706
row_time: -684804.3600 us, VB: -700624.3753 us, HB: 8.8850 us
======================================================
Return: 0
Ret1: 12
Select Video Source: 0x13
================== Sensor mode info ==================
Sensor mode: 0x13, Downsample: (H) 2:3240420872 (V) 3223819084:19
[sensor window] W: 2084, H: 770
[capture window] W: 1984, H: 744
frame_length_lines: 900, line_length_pck: 2560
row_time: -684804.4600 us, VB: -700624.3753 us, HB: 5.5550 us
======================================================
Return: 0
Ret1: 13
*/