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

Revision 1086, 2.1 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

  • Property svn:eol-style set to native
Line 
1#include "platform.h"
2
3/*
4sensor size from code at sub_FFB59B8C = (4464*3276)*(12/8) = 0x14EB7E0 = 21936096
5
6@FFB59BCC = 0xea0 = 4464        // raw sensor size
7@FFB59BD4 = 0xae0 = 3276
8@FFB59BDC = 0xe40 = 4320        // cropped size ??
9@FFB59BE4 = 0xab0 = 3240
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 FFB9922C, ref at FF88883C
16        // used in _sub_FF888630__SsImgProcBuf.c__0
17        // checks [0x36a0 + 0xc] --> defines which buffer is active
18
19        if (*((int*)0x36ac) != 0)
20                return (char*) 0x443B4960;
21        else
22                return (char*) 0x4235F6B0;      // found at (0xFFB59F40) [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 FFB9922C, ref at FF88883C
29        // used in _sub_FF888630__SsImgProcBuf.c__0
30        // checks [0x36a0 + 0xc] --> defines which buffer is active
31
32        if (*((int*)0x36ac) == 0)
33                return (char*) 0x443B4960;
34        else
35                return (char*) 0x4235F6B0;      // found at (0xFFB59F40) [search CRAW BUF]
36}
37
38long hook_raw_size()
39{
40        return 0x14EB7E0; // search CRAW BUF SIZE
41}
42
43
44char *camera_jpeg_count_str()
45{
46        return (char*)0xCF2FC; // loc_FFA3BCD8 (search "9999", passed to sprintf)
47}
48
49
50void *vid_get_bitmap_fb()
51{
52        return (void*)0x40471000; // sub_FF93062C
53}
54
55
56void *vid_get_viewport_live_fb()
57{
58        // Values below found by searching firmware for references & usage of viewport buffer address 0x40587700
59        // then experimenting to see what gave best Motion Detector speed results using http://dataghost.com/chdk/md_meter.html.
60        long* t = (long*)0xFFB96A6C;                                            // Table of viewport buffer addresses (@FF853F24 in _sub_FF853DC0__LiveImage.c__10)
61        unsigned char i = *((unsigned char*)(0x20a8));          // Index value (byte) stored here (@FF853F50 in _sub_FF853DC0__LiveImage.c__10)
62        return (void*)t[(i-1)&3];                                                       // Appears to be 4 buffers, current index - 1 seems best
63}
64
65void *vid_get_viewport_fb()
66{
67        return (void*)0x40587700; // sub_FF8E8C58
68}
69
70void *vid_get_viewport_fb_d()
71{
72        return (void*)(*(int*)(0x32B0+0x58)); // @FF878AB0 & FF878AE8 (comp to S95)
73}
Note: See TracBrowser for help on using the repository browser.