This source file includes following definitions.
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- shutdown_soft
- get_flash_params_count
- JogDial_CW
- JogDial_CCW
- hook_raw_image_addr
- vid_get_viewport_fb
- vid_get_viewport_fb_d
- vid_get_viewport_live_fb
- vid_get_viewport_width
- vid_get_viewport_height
- vid_get_viewport_yoffset
- vid_get_viewport_display_xoffset
- vid_get_viewport_display_yoffset
- vid_get_bitmap_fb
- vid_get_viewport_display_xoffset_proper
- vid_get_viewport_display_yoffset_proper
- vid_get_viewport_byte_width
- vid_get_viewport_fullscreen_width
- vid_get_viewport_fullscreen_height
- vid_get_viewport_buffer_width_proper
- vid_get_viewport_type
- vid_get_bitmap_active_buffer
- vid_get_opacity_active_buffer
- camera_jpeg_count_str
- update_screen_dimensions
1 #include "platform.h"
2 #include "lolevel.h"
3 #include "live_view.h"
4
5 extern int displaytype;
6 extern void _LogCameraEvent(int id, const char *fmt,...);
7 extern int active_bitmap_buffer;
8 extern void* bitmap_buffer[];
9 extern char* raw_buffers_canon_raw[];
10 extern char* raw_buffers_jpeg[];
11
12 void vid_bitmap_refresh() {
13
14 extern void _transfer_src_overlay(int);
15 _transfer_src_overlay(0);
16 _transfer_src_overlay(1);
17 }
18
19 void shutdown() {
20
21
22
23
24
25
26
27
28
29
30
31
32
33 while(1);
34 }
35
36 #define LED_PR 0xd20b0994
37
38 void debug_led(int state) {
39 volatile long *p = (void*)LED_PR;
40 *p = ((state) ? 0x4d0002 : 0x4c0003);
41 }
42
43
44
45 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
46 static char led_table[2]={0,4};
47 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
48 }
49
50 void shutdown_soft() {
51 _PostLogicalEventForNotPowerType(0x1005,0);
52 }
53
54 int get_flash_params_count(void) {
55 return 0xde;
56 }
57
58 void JogDial_CW(void) {
59 _PostLogicalEventToUI(0x8ad, 1);
60 }
61
62 void JogDial_CCW(void) {
63 _PostLogicalEventToUI(0x8ae, 1);
64 }
65
66 extern int active_raw_buffer;
67 extern char* current_raw_addr;
68
69 char *hook_raw_image_addr()
70 {
71 if (current_raw_addr) {
72 return current_raw_addr;
73 }
74
75
76 int i=active_raw_buffer&3;
77
78
79
80
81
82 if(i>2) {
83 i=0;
84 }
85 if( camera_info.state.mode_shooting == MODE_AUTO) {
86
87 return (char *)0x435ee300;
88 }else if(shooting_get_prop(PROPCASE_IMAGE_FORMAT) == 1) {
89
90 return raw_buffers_jpeg[i];
91 } else {
92
93 return raw_buffers_canon_raw[i];
94 }
95
96 }
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114 void *vid_get_viewport_fb() {
115 return (void*)0x43334300;
116
117
118
119
120 }
121
122
123 void *vid_get_viewport_fb_d() {
124 extern void *current_fb_d;
125 return current_fb_d;
126 }
127
128
129
130
131
132
133
134
135
136
137
138 extern void* viewport_buffers[];
139 extern void *current_viewport_buffer;
140
141 void *vid_get_viewport_live_fb()
142 {
143
144 int i;
145 for(i=0;i<4;i++) {
146 if(current_viewport_buffer == viewport_buffers[i]) {
147 return viewport_buffers[(i+1)&3];
148 }
149 }
150 return 0;
151 }
152
153
154 int vid_get_viewport_width() {
155
156
157
158
159
160
161 if (camera_info.state.mode_play)
162 {
163 return camera_screen.physical_width;
164
165 }
166 extern int _GetVRAMHPixelsSize();
167 return _GetVRAMHPixelsSize();
168 }
169
170 long vid_get_viewport_height() {
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194 extern int _GetVRAMVPixelsSize();
195
196 if (camera_info.state.mode_play)
197 return camera_screen.buffer_height;
198 return _GetVRAMVPixelsSize();
199 }
200
201
202
203 static long vp_xo[5] = { 0, 0, 0, 80, 128 };
204 static long vp_yo[5] = {0, 60, 28, 0, 0};
205
206 int vid_get_viewport_yoffset() {
207
208
209 return 0;
210 }
211
212
213 int vid_get_viewport_display_xoffset() {
214
215 if (camera_info.state.mode_play) {
216 return 0;
217 }
218
219 if(camera_info.state.mode_video || is_video_recording()) {
220 return 0;
221 }
222 return vp_xo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
223
224 }
225
226 int vid_get_viewport_display_yoffset() {
227 if (camera_info.state.mode_play) {
228 return 0;
229 }
230 else {
231 if(camera_info.state.mode_video || is_video_recording()) {
232 return 0;
233 }
234 }
235 return (vp_yo[shooting_get_prop(PROPCASE_ASPECT_RATIO)]);
236
237 }
238
239
240
241
242
243
244 void *vid_get_bitmap_fb() {
245
246 return bitmap_buffer[0];
247 }
248
249
250
251 int vid_get_viewport_display_xoffset_proper() { return vid_get_viewport_display_xoffset() ; }
252 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset() ; }
253 int vid_get_viewport_byte_width() {
254
255 return (640 * 2);
256 }
257 int vid_get_viewport_fullscreen_width() { return camera_screen.width; }
258 int vid_get_viewport_fullscreen_height() { return camera_screen.height; }
259 int vid_get_viewport_buffer_width_proper() { return camera_screen.buffer_width; }
260 int vid_get_viewport_type() { return LV_FB_YUV8B; }
261
262 void *vid_get_bitmap_active_buffer() {
263 return bitmap_buffer[active_bitmap_buffer&1];
264 }
265
266
267
268 volatile char *opacity_buffer[2] = {(char*)0x4163b400, (void*)0x416b9d00};
269 void *vid_get_opacity_active_buffer() {
270 return (void *)opacity_buffer[active_bitmap_buffer&1];
271 }
272
273
274
275
276 char *camera_jpeg_count_str()
277 {
278 extern char jpeg_count_str[];
279 return jpeg_count_str;
280 }
281 #ifdef CAM_SUPPORT_BITMAP_RES_CHANGE
282
283
284
285
286 void update_screen_dimensions() {
287 extern int displaytype;
288 static int old_displaytype = -1;
289
290 if (old_displaytype == displaytype) {
291 return;
292 }
293
294 _LogCameraEvent(0x60,"lc: odt: %d dt: %d csw: %d csh: %d css: %d",
295 old_displaytype, displaytype, camera_screen.width,
296 camera_screen.height, camera_screen.size);
297 camera_screen.width = camera_screen.physical_width = camera_screen.buffer_width = 640;
298 camera_screen.height = camera_screen.buffer_height = 480;
299 camera_screen.size = camera_screen.buffer_size = 640*480;
300 old_displaytype = displaytype;
301 switch(displaytype) {
302 case 0:
303 case 3:
304 case 4:
305
306 camera_screen.width = camera_screen.physical_width = camera_screen.buffer_width = 640;
307 camera_screen.height = camera_screen.buffer_height = 480;
308 camera_screen.size = camera_screen.buffer_size = 640*480;
309 break;
310 case 5:
311 case 1:
312 case 2:
313 case 8:
314 case 9:
315
316 camera_screen.width = 720;
317 camera_screen.physical_width = camera_screen.buffer_width = 736;
318 camera_screen.height = camera_screen.buffer_height = 480;
319 camera_screen.size = 720*480;
320 camera_screen.buffer_size = 736*480;
321 break;
322 case 6:
323
324 camera_screen.width = camera_screen.physical_width = camera_screen.buffer_width = 960;
325 camera_screen.height = camera_screen.buffer_height = 540;
326 camera_screen.size = camera_screen.buffer_size = 960*540;
327 break;
328 }
329 }
330 #endif
331