source: trunk/platform/g12/sub/100c/lib.c @ 1086

Revision 1086, 2.0 KB checked in by reyalP, 2 years ago (diff)

sx30 and g12 updates from philmoz in http://chdk.setepontos.com/index.php?topic=650.msg62654#msg62654

  • Fixes startup crash (hopefully) by using different 'Open' firmware function (G12 & SX30). (see
  • Added ND filter to G12 (from CHDK-DE).
  • Faster motion detect by implementing vid_get_viewport_live_fb (G12 & SX30).
  • Fixed bracketing in continuous shooting mode when timer enabled.

generic MD optimization will be in a separate commit

Line 
1#include "platform.h"
2
3/*
4sensor size from code at sub_FFB7861C = (3744*2784)*(12/8) = 0xEE9200 = 15634944
5
6@FFB78650 = 0xea0 = 3744        // raw sensor size
7@FFB78658 = 0xae0 = 2784
8@FFB78660 = 0xe40 = 3648        // cropped size ??
9@FFB78668 = 0xab0 = 2736
10*/
11
12char *hook_raw_image_addr()
13{
14        // Appears to be two raw buffers (this returns active buffer)
15        // Addresses below found in table at FFBBAD50, ref at FF8843F4
16        // used in _sub_FF8841BC__SsImgProcBuf.c__0
17        // checks [0x2E88 + 0xc] --> defines which buffer is active
18
19        if (*((int*)0x2E94) != 0)
20                return (char*) 0x46000000;
21        else
22                return (char*) 0x41269150;      // found at (0xFFB789C8) [search CRAW BUF]
23}
24
25char *hook_alt_raw_image_addr()
26{
27        // Appears to be two raw buffers (this returns inactive buffer)
28        // Addresses below found in table at FFBBAD50, ref at FF8843F4
29        // used in _sub_FF8841BC__SsImgProcBuf.c__0
30        // checks [0x2E88 + 0xc] --> defines which buffer is active
31
32        if (*((int*)0x2E94) == 0)
33                return (char*) 0x46000000;
34        else
35                return (char*) 0x41269150;      // found at (0xFFB789C8) [search CRAW BUF]
36}
37
38long hook_raw_size()
39{
40        return 0xEE9200; // search CRAW BUF SIZE
41}
42
43
44// TODO - check that this works
45char *camera_jpeg_count_str()
46{
47        return (char*)0xBB618; // loc_FFA435FC (search for "9999", passed to sprintf)
48}
49
50
51void *vid_get_bitmap_fb()
52{
53        return (void*)0x40471000; // DispCon_ShowBitmapColorBar
54}
55
56
57void *vid_get_viewport_live_fb()
58{
59        return (void*)(*(int*)(0x21F8));        // Found by searching RAM locations that referenced 0x40587700 (viewport buffer)
60                                                                                // and also changed to the other buffer addresses over time. Then used each here
61                                                                                // and selected value that gave the fastest Motion Detect response using http://dataghost.com/chdk/md_meter.html.
62}
63
64void *vid_get_viewport_fb()
65{
66    return (void *)0x40587700; // search on VRAM Address
67}
68
69void *vid_get_viewport_fb_d()
70{
71        return (void*)(*(int*)(0x2C10+0x58)); // @FF8781AC & FF8781E4 (comp S95)
72}
Note: See TracBrowser for help on using the repository browser.