Changeset 931

Show
Ignore:
Timestamp:
09/02/10 21:21:27 (21 months ago)
Author:
fe50
Message:

* Rear curtain option enabled for A710, tested by kms,  http://chdk.setepontos.com/index.php/topic,650.msg54434.html#msg54434

* Optimazions & fixes by ultimA, from  http://chdk.setepontos.com/index.php/topic,650.msg54493.html#msg54493 :

  • Optimizations to edge overlay
  • Make edge overlay more "multitask-friendly"
  • Detect a full shutter press during edge calculations too
  • Wrap pano-modes in edge menu & change icons (by msl)
  • Backport fixes from #928 SX20 1.02d to 1.02b
  • Add experimental PTP support to SX20 1.02d (based on mweerden's PTP proposal 20/07/2010)
  • Center edge overlay horizontally
  • Make the overlay's horizontal area larger (+6 pixels)

* The SX20 1.02b is now enabled (in the main makefile) for the autobuild server

Location:
trunk
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r928 r931  
    235235        $(MAKE) -s --no-print-directory PLATFORM=s90  PLATFORMSUB=101a NO_INC_BUILD=1 firzipsub 
    236236        $(MAKE) -s --no-print-directory PLATFORM=s90  PLATFORMSUB=101c NO_INC_BUILD=1 firzipsub 
    237         #$(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102b NO_INC_BUILD=1 firzipsub 
     237        $(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102b NO_INC_BUILD=1 firzipsub 
    238238        $(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102d NO_INC_BUILD=1 firzipsub 
    239239        $(MAKE) -s --no-print-directory PLATFORM=ixus85_sd770 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsub 
     
    275275        mv $(topdir)bin/$(VER)-s90-101c-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-s90-101c-$(BUILD_NUMBER)_BETA.zip 
    276276        mv $(topdir)bin/$(VER)-ixus100_sd780-100c-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-ixus100_sd780-100c-$(BUILD_NUMBER)_BETA.zip 
    277         #mv $(topdir)bin/$(VER)-sx20-102b-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-sx20-102b-$(BUILD_NUMBER)_BETA.zip 
    278         mv $(topdir)bin/$(VER)-sx20-102d-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-sx20-102d-$(BUILD_NUMBER)_BETA.zip 
     277        mv $(topdir)bin/$(VER)-sx20-102b-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-sx20-102b-$(BUILD_NUMBER).zip 
     278        mv $(topdir)bin/$(VER)-sx20-102d-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-sx20-102d-$(BUILD_NUMBER).zip 
    279279        mv $(topdir)bin/$(VER)-ixus85_sd770-100a-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-ixus85_sd770-100a-$(BUILD_NUMBER)_BETA.zip 
    280280        #mv $(topdir)bin/$(VER)-ixus95_sd1200-100c-$(BUILD_NUMBER).zip $(topdir)bin/$(VER)-ixus95_sd1200-100c-$(BUILD_NUMBER)_BETA.zip 
     
    385385        $(MAKE) -s --no-print-directory PLATFORM=s90  PLATFORMSUB=101a NO_INC_BUILD=1 firzipsubcomplete 
    386386        $(MAKE) -s --no-print-directory PLATFORM=s90  PLATFORMSUB=101c NO_INC_BUILD=1 firzipsubcomplete 
    387         #$(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102b NO_INC_BUILD=1 firzipsubcomplete 
     387        $(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102b NO_INC_BUILD=1 firzipsubcomplete 
    388388        $(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102d NO_INC_BUILD=1 firzipsubcomplete 
    389389        $(MAKE) -s --no-print-directory PLATFORM=ixus85_sd770 PLATFORMSUB=100a NO_INC_BUILD=1 firzipsubcomplete 
     
    458458        mv $(topdir)bin/s90-101c-$(BUILD_NUMBER)-full.zip $(topdir)bin/s90-101c-$(BUILD_NUMBER)-full_BETA.zip 
    459459        mv $(topdir)bin/s90-101c-$(BUILD_NUMBER).zip $(topdir)bin/s90-101c-$(BUILD_NUMBER)_BETA.zip 
    460         #mv $(topdir)bin/sx20-102b-$(BUILD_NUMBER)-full.zip $(topdir)bin/sx20-102b-$(BUILD_NUMBER)-full_BETA.zip 
    461         #mv $(topdir)bin/sx20-102b-$(BUILD_NUMBER).zip $(topdir)bin/sx20-102b-$(BUILD_NUMBER)_BETA.zip 
    462         mv $(topdir)bin/sx20-102d-$(BUILD_NUMBER)-full.zip $(topdir)bin/sx20-102d-$(BUILD_NUMBER)-full_BETA.zip 
    463         mv $(topdir)bin/sx20-102d-$(BUILD_NUMBER).zip $(topdir)bin/sx20-102d-$(BUILD_NUMBER)_BETA.zip 
     460        mv $(topdir)bin/sx20-102b-$(BUILD_NUMBER)-full.zip $(topdir)bin/sx20-102b-$(BUILD_NUMBER)-full.zip 
     461        mv $(topdir)bin/sx20-102b-$(BUILD_NUMBER).zip $(topdir)bin/sx20-102b-$(BUILD_NUMBER).zip 
     462        mv $(topdir)bin/sx20-102d-$(BUILD_NUMBER)-full.zip $(topdir)bin/sx20-102d-$(BUILD_NUMBER)-full.zip 
     463        mv $(topdir)bin/sx20-102d-$(BUILD_NUMBER).zip $(topdir)bin/sx20-102d-$(BUILD_NUMBER).zip 
    464464        mv $(topdir)bin/ixus85_sd770-100a-$(BUILD_NUMBER)-full.zip $(topdir)bin/ixus85_sd770-100a-$(BUILD_NUMBER)-full_BETA.zip 
    465465        mv $(topdir)bin/ixus85_sd770-100a-$(BUILD_NUMBER).zip $(topdir)bin/ixus85_sd770-100a-$(BUILD_NUMBER)_BETA.zip 
     
    569569        $(MAKE) -s --no-print-directory PLATFORM=s90  PLATFORMSUB=101a NO_INC_BUILD=1 clean 
    570570        $(MAKE) -s --no-print-directory PLATFORM=s90  PLATFORMSUB=101c NO_INC_BUILD=1 clean 
    571         #$(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102b NO_INC_BUILD=1 clean 
     571        $(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102b NO_INC_BUILD=1 clean 
    572572        $(MAKE) -s --no-print-directory PLATFORM=sx20 PLATFORMSUB=102d NO_INC_BUILD=1 clean 
    573573        $(MAKE) -s --no-print-directory PLATFORM=ixus85_sd770 PLATFORMSUB=100a NO_INC_BUILD=1 clean 
  • trunk/core/bitvector.c

    r928 r931  
    2323 
    2424// Utility function. Use bv_set instead. 
    25 static inline void bv_setbit(bit_vector_t* bm, int pos, int val) 
     25static inline void bv_setbit(const bit_vector_t* bm, int pos, int val) 
    2626{ 
    2727    int bp = pos - ((pos >> 3) << 3); 
     
    3030    else 
    3131        bm->ptr[pos >> 3] |=  (1 << bp); 
    32  
    33 // Following ASM code is bad. It crashes the camera, but why? 
    34 // It'd be very nice to replace this function with an inline 
    35 // assembly macro in the future (the same for bv_getbit()). 
    36 // The compiler seems to generate suboptimal ASM for me, 
    37 // but this is performance critical code. 
    38 // 
    39 //    char t = bm->ptr[pos >> 3]; 
    40 //    asm volatile ( 
    41 //                 ".syntax unified\n" 
    42 //                 "MOV     %[pos], %[pos], lsr #3\n"           // r1 = pos >> 3 
    43 //                 "SUB     %[pos], %[pos], %[pos], lsl #3\n"        // pos -= pos<<3 
    44 //                 "MOV     r2, #1\n"                    // r2 = 1 
    45 //                 "MOV     r2, r2, lsl %[pos]\n"         // r2 <<= pos 
    46 //                 "CMP     %[val], #0\n"                    // val == 0 
    47 //                 "ITE     EQ\n"                             // if 
    48 //                 "BICEQ     %[t], %[t], r2\n"        // &= ~(1 << bp) 
    49 //                 "ORRNE     %[t], %[t], r2\n"      // |=  (1 << bp) 
    50 //                 ".syntax divided" 
    51 //                 : [t]"+r"(t) 
    52 //                 : [val]"r"(val), [pos]"r"(pos) 
    53 //                 : "r2", "cc" 
    54 //                 ); 
    55 //    bm->ptr[pos >> 3] = t; 
    56  
    5732} 
    5833 
    5934// Utility function. Use bv_get instead. 
    60 static inline int bv_getbit(bit_vector_t* bm, int pos) 
     35static inline int bv_getbit(const bit_vector_t* bm, int pos) 
    6136{ 
    6237    // Note: bv_get() and other code rely on this 
     
    6641 
    6742    int bp = pos - ((pos >> 3) << 3); 
    68     return ((bm->ptr[pos >> 3] & (1 << bp)) > 0) ? 1 : 0; 
     43    return (bm->ptr[pos >> 3] & (1 << bp)) >> bp; 
    6944} 
    7045 
    71 void bv_set(bit_vector_t* bm, int pos, int val) 
     46void bv_set(const bit_vector_t* bm, int pos, int val) 
    7247{ 
    73     int i; 
     48    int i = bm->nBits - 1; 
    7449    int bitpos = pos * bm->nBits; 
    75     for (i = 0; i < bm->nBits; ++i) 
     50    do 
    7651    { 
    7752        bv_setbit(bm, bitpos + i, val & (1<<i)); 
    78     } 
     53    }while(--i >= 0); 
    7954} 
    8055 
    8156// Same as bv_set, but sets val to two consecutive elements 
    8257// instead of just one. 
    83 void bv_set2(bit_vector_t* bm, int pos, int val) 
     58void bv_set2(const bit_vector_t* bm, int pos, int val) 
    8459{ 
    8560    int i; 
     
    9570// Same as bv_set, but sets val to four consecutive elements 
    9671// instead of just one. 
    97 void bv_set4(bit_vector_t* bm, int pos, int val) 
     72void bv_set4(const bit_vector_t* bm, int pos, int val) 
    9873{ 
    9974    int i; 
     
    10984} 
    11085 
    111 int bv_get(bit_vector_t* bm, int pos) 
     86int bv_get(const bit_vector_t* bm, int pos) 
    11287{ 
    113     int i; 
    11488    int ret = 0; 
     89    int i = bm->nBits - 1; 
    11590    int bitpos = pos * bm->nBits; 
    116     for (i = 0; i < bm->nBits; ++i) 
     91    do 
    11792    { 
    11893        ret |= (bv_getbit(bm, bitpos + i) << i); 
    119     } 
     94    }while(--i >= 0); 
    12095 
    12196    return ret; 
  • trunk/core/bitvector.h

    r928 r931  
    55{ 
    66    int nBits; 
    7     char* ptr; 
     7    unsigned char* ptr; 
    88    int ptrLen; 
    99    int nElem; 
     
    1111 
    1212bit_vector_t* bv_create(int len, int nbits); 
    13 void bv_set(bit_vector_t* bm, int pos, int val); 
    14 void bv_set2(bit_vector_t* bm, int pos, int val); 
    15 void bv_set4(bit_vector_t* bm, int pos, int val); 
    16 int bv_get(bit_vector_t* bm, int pos); 
     13void bv_set(const bit_vector_t* bm, int pos, int val); 
     14void bv_set2(const bit_vector_t* bm, int pos, int val); 
     15void bv_set4(const bit_vector_t* bm, int pos, int val); 
     16int bv_get(const bit_vector_t* bm, int pos) __attribute__((pure)); 
    1717void bv_free(bit_vector_t* bm); 
    1818 
  • trunk/core/edgeoverlay.c

    r928 r931  
    66#include "gui_draw.h" 
    77#include "bitvector.h" 
    8   
     8 
    99// the way we save edge overlays on their own... 
    1010#define EDGE_FILE_PREFIX "EDG_" 
    1111#define EDGE_FILE_FORMAT EDGE_FILE_PREFIX "%04d.edg" 
    12   
     12#define EDGE_SLICES     2 
     13 
    1314typedef enum _edge_fsm_state 
    1415{ 
     
    1617    EDGE_FROZEN 
    1718} edge_fsm_state_t; 
    18   
     19 
    1920static edge_fsm_state_t fsm_state = EDGE_LIVE; 
    2021static bit_vector_t* edgebuf = NULL; 
    2122static int xoffset = 0, yoffset = 0; 
    22   
     23static unsigned char* smbuf = NULL; 
     24 
     25static int slice = 0;       // the current slice of the frame we are calculating/drawing 
     26static int slice_height;    // the height of a single slice 
     27 
    2328static int viewport_size;   // whole viewport size in bytes ?? 
    2429static int viewport_width;      // screenwidth * 3, width in bytes of one viewport line ?? 
     
    2732static int viewportw; //nandoide , width of viewport (not necessarily equal to width of screen) 
    2833#endif 
    29    
     34 
    3035static void get_viewport_size() 
    3136{ 
    3237    // since screen_height is used in the drawing downwards, we should use it 
    3338    // here too to calculate the buffer we need... 
    34   
     39 
    3540#if CAM_USES_ASPECT_CORRECTION//nandoide sept-2009 get the viewport dimensions, not the screen dimensions, on sx200is they aren't the same. 
    3641    viewport_height = vid_get_viewport_height()-EDGE_HMARGIN*2; //don't trace bottom lines 
    3742    viewportw = vid_get_viewport_width(); 
    3843    viewport_width = viewportw * 3; 
    39     viewport_size = viewport_height * viewport_width; 
    4044#else 
    4145    viewport_height = screen_height;//vid_get_viewport_height(); 
    4246    viewport_width = screen_width * 3; 
    43     viewport_size = viewport_height * screen_width * 3; 
    4447#endif 
    45 } 
    46   
     48 
     49    viewport_size = viewport_height * viewport_width; 
     50    slice_height = viewport_height / EDGE_SLICES; 
     51 
     52} 
     53 
    4754static void ensure_allocate_imagebuffer() 
    4855{ 
     
    5057    { 
    5158        edgebuf = bv_create(viewport_size, 1); 
    52     } 
    53 } 
    54   
     59        if (edgebuf != NULL) 
     60            memset(edgebuf->ptr, 0, edgebuf->ptrLen); 
     61    } 
     62    if (conf.edge_overlay_filter && (smbuf == NULL)) 
     63    { 
     64        smbuf = (unsigned char*)malloc(viewport_width*3); 
     65        if (smbuf != NULL) 
     66            memset(smbuf, 0, viewport_width*3); 
     67        else 
     68        { 
     69            // Disable filtering if we do not have enough memory for it 
     70            conf.edge_overlay_filter = 0; 
     71        } 
     72    } 
     73} 
     74 
    5575static void reset_edge_overlay() 
    5676{ 
     77    if (smbuf != NULL) 
     78    { 
     79        free(smbuf); 
     80        smbuf = NULL; 
     81    } 
     82 
    5783    bv_free(edgebuf); 
    5884    edgebuf = NULL; 
    5985    fsm_state = EDGE_LIVE; 
    60 } 
    61   
     86    slice = 0; 
     87} 
     88 
    6289static int is_buffer_ready() 
    6390{ 
     
    6693    return 1; 
    6794} 
    68   
     95 
    6996// scans a filename for the number of the edge detection file it contains 
    7097static int get_edge_file_num(const char* fn) 
     
    89116    return num; 
    90117} 
    91    
     118 
    92119// saves the actual active overlay data to a file. 
    93120void save_edge_overlay(void) 
    94121{ 
    95   
     122 
    96123    char fn[64]; 
    97124    char msg[64]; 
     
    104131    static struct utimbuf t; 
    105132    // nothing to save? then dont save 
    106   
     133 
    107134    if( !is_buffer_ready() ) 
    108135    { 
     
    110137        return; 
    111138    } 
    112   
     139 
    113140    zoom = shooting_get_zoom(); 
    114   
     141 
    115142    // first figure out the most appropriate filename to use 
    116143    d = opendir(EDGE_SAVE_DIR); 
     
    119146        return; 
    120147    } 
    121   
     148 
    122149    while( (de = readdir(d)) ) 
    123150    { 
     
    146173    closedir(d); 
    147174} 
    148   
     175 
    149176// load the edge overlay from a file 
    150177void load_edge_overlay(const char* fn) 
    151178{ 
    152179    FILE *fd; 
    153     int ret,ret2; 
    154180    int zoom; 
    155   
     181 
    156182    get_viewport_size(); 
    157183    ensure_allocate_imagebuffer( ); 
     
    159185    if( fd != NULL ) 
    160186    { 
    161         ret = fread(edgebuf->ptr,edgebuf->ptrLen,1,fd); 
    162         ret2 = fread (&zoom,sizeof(zoom),1,fd); 
     187        int ret = fread(edgebuf->ptr,edgebuf->ptrLen,1,fd); 
     188        int ret2 = fread (&zoom,sizeof(zoom),1,fd); 
    163189        fclose(fd); 
    164190        if( (ret == 1) && (ret2 == 1) ) 
     
    172198    } 
    173199} 
    174   
    175 static void average_filter_row(const unsigned char* ptrh1,  // previous row 
    176                                const unsigned char* ptrh2,  // current row 
    177                                const unsigned char* ptrh3,  // next row 
    178                                unsigned char* smptr )       // write results here 
     200 
     201static void average_filter_row(const unsigned char*  ptrh1,  // previous row 
     202                               const unsigned char*  ptrh2,  // current row 
     203                               const unsigned char*  ptrh3,  // next row 
     204                               unsigned char*  smptr )       // write results here 
    179205{ 
    180206    int x; 
    181207#if CAM_USES_ASPECT_CORRECTION 
    182     for (x=12; x<(viewportw - 4) * 3; x+=6) 
     208    const int x_max = (viewportw - 2) * 3; 
    183209#else 
    184     for (x=12; x<(screen_width - 4) * 3; x+=6) 
     210    const int x_max = (screen_width - 2) * 3; 
    185211#endif 
     212 
     213    for (x=6; x<x_max; x+=6) 
    186214    { 
    187215        *(smptr + x + 1) = (*(ptrh1 + x - 1) + 
    188216                            *(ptrh1 + x + 1) + 
    189217                            *(ptrh1 + x + 3) + 
    190   
     218 
    191219                            *(ptrh2 + x - 1) + 
    192220                            *(ptrh2 + x + 1) + 
    193221                            *(ptrh2 + x + 3) + 
    194   
     222 
    195223                            *(ptrh3 + x - 1) + 
    196224                            *(ptrh3 + x + 1) + 
    197                             *(ptrh3 + x + 3)) / 9; 
    198   
     225                            *(ptrh3 + x + 3)) / 9u; 
     226 
    199227        *(smptr + x + 3) = (*(ptrh1 + x + 1) + 
    200228                            *(ptrh1 + x + 3) + 
    201229                            *(ptrh1 + x + 4) + 
    202   
     230 
    203231                            *(ptrh2 + x + 1) + 
    204232                            *(ptrh2 + x + 3) + 
    205233                            *(ptrh2 + x + 4) + 
    206   
     234 
    207235                            *(ptrh3 + x + 1) + 
    208236                            *(ptrh3 + x + 3) + 
    209                             *(ptrh3 + x + 4)) / 9; 
    210   
     237                            *(ptrh3 + x + 4)) / 9u; 
     238 
    211239        *(smptr + x + 4) = (*(ptrh1 + x + 3) + 
    212240                            *(ptrh1 + x + 4) + 
    213241                            *(ptrh1 + x + 5) + 
    214   
     242 
    215243                            *(ptrh2 + x + 3) + 
    216244                            *(ptrh2 + x + 4) + 
    217245                            *(ptrh2 + x + 5) + 
    218   
     246 
    219247                            *(ptrh3 + x + 3) + 
    220248                            *(ptrh3 + x + 4) + 
    221                             *(ptrh3 + x + 5)) / 9; 
    222   
     249                            *(ptrh3 + x + 5)) / 9u; 
     250 
    223251        *(smptr + x + 5) = (*(ptrh1 + x + 4) + 
    224252                            *(ptrh1 + x + 5) + 
    225253                            *(ptrh1 + x + 7) + 
    226   
     254 
    227255                            *(ptrh2 + x + 4) + 
    228256                            *(ptrh2 + x + 5) + 
    229257                            *(ptrh2 + x + 7) + 
    230   
     258 
    231259                            *(ptrh3 + x + 4) + 
    232260                            *(ptrh3 + x + 5) + 
    233                             *(ptrh3 + x + 7)) / 9; 
    234     } 
    235 } 
    236   
     261                            *(ptrh3 + x + 7)) / 9u; 
     262    } 
     263} 
     264 
    237265// Sobel edge detector 
    238 static void calc_edge_overlay() 
    239 { 
     266static int calc_edge_overlay() 
     267{ 
     268    int shutter_fullpress = kbd_is_key_pressed(KEY_SHOOT_FULL); 
     269 
    240270    const int bPlayMode = (mode_get() & MODE_MASK) == MODE_PLAY; 
    241271    const unsigned char* img = bPlayMode ? vid_get_viewport_fb_d() :  vid_get_viewport_fb(); 
    242     const unsigned char * ptrh1 = NULL;    // previous pixel line 
    243     const unsigned char * ptrh2 = NULL;    // current pixel line 
    244     const unsigned char * ptrh3 = NULL;    // next pixel line 
    245     unsigned char* smbuf = NULL; 
    246     unsigned char * smptr = NULL;    // pointer to line in smbuf 
    247     int x, y; 
     272    const unsigned char*  ptrh1 = NULL;    // previous pixel line 
     273    const unsigned char*  ptrh2 = NULL;    // current pixel line 
     274    const unsigned char*  ptrh3 = NULL;    // next pixel line 
     275    unsigned char*  smptr = NULL;    // pointer to line in smbuf 
     276    int x, y, xdiv3; 
    248277    int conv1, conv2; 
    249      
    250     const int y_min = EDGE_HMARGIN; 
    251     const int y_max = EDGE_HMARGIN + viewport_height; 
     278 
     279    const int y_min = EDGE_HMARGIN+ slice   *slice_height; 
     280    const int y_max = EDGE_HMARGIN+(slice+1)*slice_height; 
    252281    const int x_min = 6; 
    253282#if CAM_USES_ASPECT_CORRECTION 
    254     const int x_max = (viewportw - 4) * 3; 
     283    const int x_max = (viewportw - 2) * 3; 
    255284#else 
    256     const int x_max = (screen_width - 4) * 3; 
     285    const int x_max = (screen_width - 2) * 3; 
    257286#endif 
    258287 
    259     xoffset =0; 
    260     yoffset =0; 
    261   
     288    const int vp_width = viewport_width; 
     289 
     290    xoffset = 0; 
     291    yoffset = 0; 
     292 
    262293    // Reserve buffers 
    263294    ensure_allocate_imagebuffer(); 
    264     if( !is_buffer_ready() ) return; 
    265   
    266     // Clear all edges, if any 
    267     memset(edgebuf->ptr, 0, edgebuf->ptrLen); 
    268   
    269     // In every 6 bytes four pixels are described in the 
     295    if( !is_buffer_ready() ) return 0; 
     296 
     297    // In every 6 bytes the Y of four pixels are described in the 
    270298    // viewport (UYVYYY format). For edge detection we only 
    271299    // consider the second in the current and the first 
    272300    // in the next pixel. 
    273   
    274   
     301 
     302    // Clear all edges in the current slice 
     303    int compressed_slice = edgebuf->ptrLen / EDGE_SLICES; 
     304    memset(edgebuf->ptr + slice*compressed_slice, 0, compressed_slice); 
     305 
    275306    if (conf.edge_overlay_filter) 
    276307    { 
    277         smbuf = (unsigned char*)malloc(viewport_width*3); 
    278         memset(smbuf, 0, viewport_width*3); 
    279         if (smbuf==NULL) 
    280             return; 
    281   
    282308        // Prefill smbuf with three lines of avergae-filtered data. 
    283309        // This looks much more complex then it actually is. 
     
    287313        for (y = -1; y <= 1; ++y) 
    288314        { 
    289             ptrh1 = img + (EDGE_HMARGIN+y-1) * viewport_width; 
    290             ptrh2 = img + (EDGE_HMARGIN+y  ) * viewport_width; 
    291             ptrh3 = img + (EDGE_HMARGIN+y+1) * viewport_width; 
    292             smptr = smbuf + (y+1) * viewport_width; 
    293   
     315            shutter_fullpress |= kbd_is_key_pressed(KEY_SHOOT_FULL); 
     316 
     317            ptrh1 = img + (y_min+y-1) * vp_width; 
     318            ptrh2 = img + (y_min+y  ) * vp_width; 
     319            ptrh3 = img + (y_min+y+1) * vp_width; 
     320            smptr = smbuf + (y+1) * vp_width; 
     321 
    294322            average_filter_row(ptrh1, ptrh2, ptrh3, smptr); 
    295323        } 
    296324    } 
    297   
     325 
    298326    for (y = y_min; y < y_max; ++y) 
    299327    { 
     328        shutter_fullpress |= kbd_is_key_pressed(KEY_SHOOT_FULL); 
     329 
    300330        if (conf.edge_overlay_filter) 
    301331        { 
     
    305335            // By storing only three lines of smoothed picture 
    306336            // in memory, we save memory. 
    307   
     337 
    308338            // Shift 
    309             memcpy(smbuf+viewport_width*0, smbuf+viewport_width*1, viewport_width); 
    310             memcpy(smbuf+viewport_width*1, smbuf+viewport_width*2, viewport_width); 
    311   
     339            memcpy(smbuf+vp_width*0, smbuf+vp_width*1, vp_width); 
     340            memcpy(smbuf+vp_width*1, smbuf+vp_width*2, vp_width); 
     341 
    312342            // Filter new line 
    313             ptrh1 = img +  y * viewport_width; 
    314             ptrh2 = img + (y+1)    * viewport_width; 
    315             ptrh3 = img + (y+2) * viewport_width; 
    316             smptr = smbuf + 2 * viewport_width; 
     343            ptrh1 = img +  y * vp_width; 
     344            ptrh2 = img + (y+1) * vp_width; 
     345            ptrh3 = img + (y+2) * vp_width; 
     346            smptr = smbuf + 2   * vp_width; 
    317347            average_filter_row(ptrh1, ptrh2, ptrh3, smptr); 
    318   
    319             ptrh1 = smbuf + 0 * viewport_width; 
    320             ptrh2 = smbuf + 1 * viewport_width; 
    321             ptrh3 = smbuf + 2 * viewport_width; 
     348 
     349            ptrh1 = smbuf + 0 * vp_width; 
     350            ptrh2 = smbuf + 1 * vp_width; 
     351            ptrh3 = smbuf + 2 * vp_width; 
    322352        } 
    323353        else 
    324354        { 
    325             ptrh1 = img + (y-1) * viewport_width; 
    326             ptrh2 = img +  y    * viewport_width; 
    327             ptrh3 = img + (y+1) * viewport_width; 
    328         } 
    329   
     355            ptrh1 = img + (y-1) * vp_width; 
     356            ptrh2 = img +  y    * vp_width; 
     357            ptrh3 = img + (y+1) * vp_width; 
     358        } 
     359 
    330360        // Now we do sobel on the current line 
    331   
    332         for (x = x_min; x < x_max; x += 6) 
     361 
     362        for (x = x_min, xdiv3 = x_min/3; x < x_max; x += 6, xdiv3 += 2) 
    333363        { 
    334364            // convolve vert (second Y) 
    335365            conv1 = *(ptrh1 + x + 1) * ( 1) + 
    336366                    *(ptrh1 + x + 4) * (-1) + 
    337   
     367 
    338368                    *(ptrh2 + x + 1) * ( 2) + 
    339369                    *(ptrh2 + x + 4) * (-2) + 
    340   
     370 
    341371                    *(ptrh3 + x + 1) * ( 1) + 
    342372                    *(ptrh3 + x + 4) * (-1); 
    343373            if  (conv1 < 0)     // abs() 
    344374                conv1 = -conv1; 
    345   
     375 
    346376            // convolve vert (first Y of next pixel) 
    347377            conv2 = *(ptrh1 + x + 1) * ( 1) + 
    348378                    *(ptrh1 + x + 3) * ( 2) + 
    349379                    *(ptrh1 + x + 4) * ( 1) + 
    350   
     380 
    351381                    *(ptrh3 + x + 1) * (-1) + 
    352382                    *(ptrh3 + x + 3) * (-2) + 
     
    354384            if  (conv2 < 0)     // abs() 
    355385                conv2 = -conv2; 
    356   
     386 
    357387            if (conv1 + conv2 > conf.edge_overlay_thresh) 
    358388            { 
    359                 bv_set(edgebuf, (y-EDGE_HMARGIN)*viewport_width + x/3, 1); 
     389                bv_set(edgebuf, (y-EDGE_HMARGIN)*vp_width + xdiv3, 1); 
    360390            } 
    361   
     391 
    362392            // Do it once again for the next 'pixel' 
    363   
     393 
    364394            // convolve vert (second Y) 
    365395            conv1 = *(ptrh1 + x + 5) * ( 1) + 
    366396                    *(ptrh1 + x + 9) * (-1) + 
    367   
     397 
    368398                    *(ptrh2 + x + 5) * ( 2) + 
    369399                    *(ptrh2 + x + 9) * (-2) + 
    370   
     400 
    371401                    *(ptrh3 + x + 5) * ( 1) + 
    372402                    *(ptrh3 + x + 9) * (-1); 
    373403            if  (conv1 < 0)     // abs() 
    374404                conv1 = -conv1; 
    375   
     405 
    376406            // convolve vert (first Y of next pixel) 
    377407            conv2 = *(ptrh1 + x + 5) * ( 1) + 
    378408                    *(ptrh1 + x + 7) * ( 2) + 
    379409                    *(ptrh1 + x + 9) * ( 1) + 
    380   
     410 
    381411                    *(ptrh3 + x + 5) * (-1) + 
    382412                    *(ptrh3 + x + 7) * (-2) + 
     
    384414            if  (conv2 < 0)     // abs() 
    385415                conv2 = -conv2; 
    386   
     416 
    387417            if (conv1 + conv2 > conf.edge_overlay_thresh) 
    388418            { 
    389                 bv_set(edgebuf, (y-EDGE_HMARGIN)*viewport_width + x/3+1, 1); 
     419                bv_set(edgebuf, (y-EDGE_HMARGIN)*vp_width + xdiv3+1, 1); 
    390420            } 
    391421        }   // for x 
    392422    }   // for y 
    393   
    394     if (smbuf != NULL) 
    395     { 
    396         free(smbuf); 
    397         smbuf = NULL; 
    398     } 
    399   
    400 //  For an even more improved edge overlay, enabling the following lines will  
     423 
     424 
     425//  For an even more improved edge overlay, enabling the following lines will 
    401426//  post-filter the results of the edge detection, removing false edge 'dots' 
    402427//  from the display. However, the speed hit is large. In the developer's opinion 
    403 //  this code is not needed, but if you want that additional quality and do not  
     428//  this code is not needed, but if you want that additional quality and do not 
    404429//  care so much about performance, you can enable it. 
    405 //  
     430// 
    406431//    if (conf.edge_overlay_filter) 
    407432//    { 
     
    418443//            for (y = 1; y < viewport_height-1; ++y) 
    419444//            { 
     445//                shutter_fullpress |= kbd_is_key_pressed(KEY_SHOOT_FULL); 
     446// 
    420447//#if CAM_USES_ASPECT_CORRECTION 
    421448//                for (x=12; x<(viewportw - 4); ++x) 
     
    458485//        }   // NULL-check 
    459486//    }   // if filtering 
    460   
    461 } 
    462   
    463 static void draw_edge_overlay() 
    464 { 
     487 
     488    return shutter_fullpress; 
     489} 
     490 
     491static int draw_edge_overlay() 
     492{ 
     493    int shutter_fullpress = kbd_is_key_pressed(KEY_SHOOT_FULL); 
     494 
    465495    int x, y; 
    466496    int x_off, y_off; 
    467   
     497 
     498    const color cl = conf.edge_overlay_color; 
     499    const int y_slice_min = EDGE_HMARGIN+ slice   *slice_height; 
     500    const int y_slice_max = EDGE_HMARGIN+(slice+1)*slice_height; 
    468501    const int y_min = EDGE_HMARGIN; 
    469502    const int y_max = EDGE_HMARGIN+viewport_height; 
    470     const int x_min = 6; 
     503    const int x_min = 2; 
    471504#if CAM_USES_ASPECT_CORRECTION 
    472     const int x_max = (viewportw - 4); 
     505    const int x_max = (viewportw - 2); 
    473506#else 
    474     const int x_max = (screen_width - 4); 
     507    const int x_max = (screen_width - 2); 
    475508#endif 
    476509 
    477     if( !is_buffer_ready() ) return; 
    478   
    479     for (y = y_min; y < y_max; ++y) 
     510    if( !is_buffer_ready() ) return 0; 
     511 
     512    for (y = y_slice_min; y < y_slice_max; ++y) 
    480513    { 
    481514        y_off = y + yoffset; 
    482   
    483         if ((y_off > y_min) && (y_off < y_max)) // do not draw outside of allowed area 
    484         { 
     515         
     516        shutter_fullpress |= kbd_is_key_pressed(KEY_SHOOT_FULL); 
     517 
     518        if ((unsigned)(y_off-y_min) < (y_max-y_min)) // is the same as ((y_off > y_min) && (y_off < y_max)) // do not draw outside of allowed area 
     519        { 
     520            const int y_edgebuf = (y-y_min) * viewport_width; 
     521 
    485522            for (x = x_min; x < x_max; ++x) 
    486523            { 
    487524                x_off = x + xoffset; 
    488   
    489                 if ((x_off > x_min) && (x_off < x_max)) // do not draw outside of allowed area 
     525 
     526                if ((unsigned)(x_off-x_min) < (x_max-x_min)) // is the same as  ((x_off > x_min) && (x_off < x_max)) // do not draw outside of allowed area 
    490527                { 
    491528                    // Draw a pixel to the screen wherever we detected an edge. 
    492529                    // If there is no edge based on the newest data, but there is one painted on the screen 
    493530                    // from previous calls, delete it from the screen. 
    494                     if (bv_get(edgebuf, (y-y_min)*viewport_width + x)) 
    495                         draw_pixel(ASPECT_VIEWPORT_XCORRECTION(x_off), y_off, conf.edge_overlay_color ); 
    496                     else if (draw_get_pixel(ASPECT_VIEWPORT_XCORRECTION(x_off), y_off) == conf.edge_overlay_color) 
    497                         draw_pixel(ASPECT_VIEWPORT_XCORRECTION(x_off), y_off, 0 ); 
     531                    const int aspect_correct_x_off = ASPECT_VIEWPORT_XCORRECTION(x_off); 
     532                    const int bEdge = bv_get(edgebuf, y_edgebuf + x); 
     533                    const int bDraw = bEdge || (draw_get_pixel(aspect_correct_x_off, y_off) == conf.edge_overlay_color); 
     534                    const color cl = bEdge ? conf.edge_overlay_color : 0; 
     535                    if (bEdge || bDraw) 
     536                        draw_pixel(aspect_correct_x_off, y_off, cl); 
     537                     
    498538                } 
    499539            }   // for x 
    500540        } 
    501541    }   // for y 
    502   
    503   
     542 
     543 
    504544    // Drawing the overlay is over. 
    505545    // But as a finishing touch we clear up garbage on the screen 
    506546    // by clearing those parts that the overlay has left. 
    507   
     547 
    508548    if (xoffset != 0) 
    509549    { 
    510550        // Cleans up leftover from horizontal motion 
    511   
     551 
    512552        const int x_min_c = (xoffset < 0) ? x_max + xoffset : x_min; 
    513553        const int x_max_c = (xoffset > 0) ? x_min + xoffset : x_max; 
    514   
     554 
    515555        for (y = y_min; y < y_max; ++y) 
    516556        { 
    517557            for (x = x_min_c; x < x_max_c; ++x) 
    518558            { 
    519                 if (draw_get_pixel(ASPECT_VIEWPORT_XCORRECTION(x), y) == conf.edge_overlay_color)  // if there is an edge drawn on the screen but there is no edge there based on the newest data, delete it from the screen 
    520                     draw_pixel(ASPECT_VIEWPORT_XCORRECTION(x), y, 0 ); 
     559                const int aspect_correct_x = ASPECT_VIEWPORT_XCORRECTION(x); 
     560                if (draw_get_pixel(aspect_correct_x, y) == cl)  // if there is an edge drawn on the screen but there is no edge there based on the newest data, delete it from the screen 
     561                    draw_pixel(aspect_correct_x, y, 0 ); 
    521562            } 
    522563        } 
    523564    } 
    524   
     565 
    525566    if (yoffset != 0) 
    526567    { 
    527568        // Cleans up leftover from vertical motion 
    528   
     569 
    529570        const int y_min_c = (yoffset < 0) ? y_max + yoffset : y_min; 
    530571        const int y_max_c = (yoffset > 0) ? y_min + yoffset : y_max; 
    531   
     572 
    532573        for (y = y_min_c; y < y_max_c; ++y) 
    533574        { 
    534575            for (x = x_min; x < x_max; ++x) 
    535576            { 
    536                 if (draw_get_pixel(ASPECT_VIEWPORT_XCORRECTION(x), y) == conf.edge_overlay_color)  // if there is an edge drawn on the screen but there is no edge there based on the newest data, delete it from the screen 
    537                     draw_pixel(ASPECT_VIEWPORT_XCORRECTION(x), y, 0 ); 
     577                const int aspect_correct_x = ASPECT_VIEWPORT_XCORRECTION(x); 
     578                if (draw_get_pixel(aspect_correct_x, y) == cl)  // if there is an edge drawn on the screen but there is no edge there based on the newest data, delete it from the screen 
     579                    draw_pixel(aspect_correct_x, y, 0 ); 
    538580            } 
    539581        } 
    540582    } 
     583 
     584    return shutter_fullpress; 
    541585} 
    542586 
     
    545589    const int y_max = viewport_height; 
    546590#if CAM_USES_ASPECT_CORRECTION 
    547     const int x_max = (viewportw - 4); 
     591    const int x_max = (viewportw - 2); 
    548592#else 
    549     const int x_max = (screen_width - 4); 
     593    const int x_max = (screen_width - 2); 
    550594#endif 
    551595 
     
    575619    } 
    576620} 
    577   
    578   
     621 
     622 
    579623// Main edge overlay function. 
    580624// It works by detecting edges using the Sobel operator 
     
    586630void edge_overlay() 
    587631{ 
     632 
    588633    // Was the shutter fully pressed the last time we ran? 
    589634    // We use this to make sure that the user has released 
     
    592637    // per press. 
    593638    static int bFullPress_prev = 0; 
    594   
     639 
    595640    // Have we already started taking pictures in panorama mode? 
    596641    // We use this variable to be able to detect if panorama 
    597642    // mode has been turned off. 
    598643    static int bPanoInProgress = 0; 
    599   
     644 
    600645    // Precalculate some values to make the rest of the 
    601646    // code easier to read. 
     647    int bFullPress = kbd_is_key_pressed(KEY_SHOOT_FULL); 
    602648    const int bHalfPress = kbd_is_key_pressed(KEY_SHOOT_HALF); 
    603     const int bFullPress = kbd_is_key_pressed(KEY_SHOOT_FULL); 
    604649    const int bPlayMode = (mode_get() & MODE_MASK) == MODE_PLAY; 
    605650    const int bPanoramaMode = (conf.edge_overlay_pano != 0); 
     
    612657                                ( bPlayMode && bDisplayInPlay)  // or we are in play-mode with the right settings 
    613658                            ); 
    614   
     659 
    615660    if (bPanoInProgress && !bPanoramaMode) 
    616661    { 
     
    621666        bPanoInProgress = 0; 
    622667    } 
    623   
     668 
    624669    get_viewport_size(); 
    625670 
     
    633678        // In this state we assume no edge overlay in memory, 
    634679        // but we are ready to create one if the user presses wishes so. 
    635   
    636         if (bFullPress && !bFullPress_prev && bGuiModeNone) 
    637         { 
    638             calc_edge_overlay(); 
     680 
     681        int bRealtimeUpdate = bCanDisplay && (bGuiModeAlt || bGuiModeNone); 
     682        if (bRealtimeUpdate) 
     683        { 
     684            // We try to detect button presses during the lengthy 
     685            // calculations. 
     686            bFullPress |= calc_edge_overlay(); 
     687            bFullPress |= draw_edge_overlay(); 
     688        } 
     689 
     690        int bSwitch2Frozen = bFullPress && !bFullPress_prev && bGuiModeNone; 
     691        if (bSwitch2Frozen) 
     692        { 
     693            // Switch to Frozen mode 
     694 
     695            // Make sure we have one whole consistent frame 
     696            for (slice = 0; slice < EDGE_SLICES; ++slice) 
     697                calc_edge_overlay(); 
     698 
    639699            set_offset_from_overlap(); 
    640700            fsm_state = EDGE_FROZEN; 
    641              
    642701            bPanoInProgress = bPanoramaMode; 
    643702        } 
    644         else if (bCanDisplay && (bGuiModeAlt || bGuiModeNone)) 
    645         { 
    646             calc_edge_overlay(); 
    647             draw_edge_overlay(); 
    648         } 
    649         else 
     703 
     704        if (!bRealtimeUpdate && !bSwitch2Frozen) 
    650705        { 
    651706            // Nothing happens. So do nothing. 
    652707            // Or rather, we could clean up if we are that bored. 
    653             bv_free(edgebuf); 
    654             edgebuf = NULL; 
    655         } 
    656   
     708            reset_edge_overlay(); 
     709        } 
    657710        break; 
    658711    } 
     
    661714        // We have a stored edge overlay in memory and we display 
    662715        // it on screen in 'frozen' mode. 
    663   
     716 
    664717        // Move edge overlay around. 
    665718        if (gui_get_mode() == GUI_MODE_ALT) 
     
    674727                yoffset -=YINC; 
    675728        } 
    676   
     729 
     730        if (bCanDisplay && (bGuiModeAlt || bGuiModeNone)) 
     731        { 
     732            // We try to detect button presses during the lengthy 
     733            // calculations. 
     734            bFullPress |= draw_edge_overlay(); 
     735            draw_string(0, 0, "Frozen", conf.osd_color); 
     736        } 
     737 
    677738        // In event of a FullPress, we either capture a new 
    678739        // overlay and stay frozen, OR we go back to live mode. 
    679740        if (bFullPress && !bFullPress_prev && bGuiModeNone) 
    680741        { 
     742            // Possible mode switch 
    681743            if (bPanoramaMode) 
    682744            { 
    683                 calc_edge_overlay(); 
     745                // Make sure we have one whole consistent frame 
     746                for (slice = 0; slice < EDGE_SLICES; ++slice) 
     747                    calc_edge_overlay(); 
     748 
    684749                set_offset_from_overlap(); 
    685750                bPanoInProgress = 1; 
     
    688753                fsm_state = EDGE_LIVE; 
    689754        } 
    690         else if (bCanDisplay && (bGuiModeAlt || bGuiModeNone)) 
    691         { 
    692             draw_edge_overlay(); 
    693             draw_string(0, 0, "Frozen", conf.osd_color); 
    694         } 
    695   
     755 
    696756        break; 
    697757    }   // case 
    698758    }   // switch 
    699   
     759 
     760 
    700761    bFullPress_prev = bFullPress; 
     762 
     763    if (++slice >= EDGE_SLICES) 
     764        slice = 0; 
     765 
    701766}   // function 
    702   
    703   
    704   
    705   
  • trunk/core/gui.c

    r928 r931  
    638638    {0x5c,LANG_MENU_EDGE_OVERLAY_ENABLE,     MENUITEM_BOOL,          &conf.edge_overlay_enable }, 
    639639    {0x5c,LANG_MENU_EDGE_FILTER,     MENUITEM_BOOL,          &conf.edge_overlay_filter }, 
    640     {0x5c,LANG_MENU_EDGE_PANO,     MENUITEM_ENUM,          (int*)gui_edge_pano_enum }, 
    641     {0x7f,LANG_MENU_EDGE_PANO_OVERLAP,   MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.edge_overlay_pano_overlap, MENU_MINMAX(0, 100)}, 
     640    {0x5f,LANG_MENU_EDGE_PANO,     MENUITEM_ENUM,          (int*)gui_edge_pano_enum }, 
     641    {0x5e,LANG_MENU_EDGE_PANO_OVERLAP,   MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.edge_overlay_pano_overlap, MENU_MINMAX(0, 100)}, 
    642642    {0x5c,LANG_MENU_EDGE_SHOW,     MENUITEM_BOOL,          &conf.edge_overlay_show }, 
    643     {0x7f,LANG_MENU_EDGE_OVERLAY_TRESH,      MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.edge_overlay_thresh, MENU_MINMAX(0, 255)}, 
     643    {0x5e,LANG_MENU_EDGE_OVERLAY_TRESH,      MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.edge_overlay_thresh, MENU_MINMAX(0, 255)}, 
    644644    {0x65,LANG_MENU_EDGE_OVERLAY_COLOR,      MENUITEM_COLOR_FG,      (int*)&conf.edge_overlay_color }, 
    645645    {0x5c,LANG_MENU_EDGE_PLAY,                  MENUITEM_BOOL,          &conf.edge_overlay_play }, //does not work on cams like s-series, which dont have a real "hardware" play/rec switch, need a workaround, probably another button 
     
    34203420 
    34213421    conf.edge_overlay_pano+=change; 
    3422     if (conf.edge_overlay_pano<0) 
    3423         conf.edge_overlay_pano=0; 
    3424     else if (conf.edge_overlay_pano>=(sizeof(modes)/sizeof(modes[0]))) 
    3425         conf.edge_overlay_pano=sizeof(modes)/sizeof(modes[0])-1; 
    3426  
     3422    if (conf.edge_overlay_pano<0)  
     3423        conf.edge_overlay_pano=(sizeof(modes)/sizeof(modes[0]))-1;  
     3424    else if (conf.edge_overlay_pano>=(sizeof(modes)/sizeof(modes[0])))  
     3425        conf.edge_overlay_pano=0;  
    34273426    return modes[conf.edge_overlay_pano];  
    34283427} 
  • trunk/include/camera.h

    r930 r931  
    845845    #define CAM_EV_IN_VIDEO             1 
    846846    #define DNG_SUPPORT                 1 
     847    #define CAM_REAR_CURTAIN            1 // http://chdk.setepontos.com/index.php/topic,650.msg54434.html#msg54434  
    847848    // pattern 
    848849    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue 
  • trunk/platform/sx20/sub/102b/boot.c

    r900 r931  
    1515 if (p[0]==0xff85f3cc)  p[0]=(int)JogDial_task_my; 
    1616 if (p[0]==0xFF879034)  p[0]=(int)movie_record_task; 
     17} 
     18void taskCreateHook2(int *p) {  
     19p-=17; 
     20if (p[0]==0xFF89A8CC)  p[0]=(int)init_file_modules_task; 
     21if (p[0]==0xFF8C1430)  p[0]=(int)exp_drv_task; 
    1722} 
    1823 
     
    119124void __attribute__((naked,noinline)) sub_FF810354_my() { 
    120125        //http://chdk.setepontos.com/index.php/topic,4194.0.html 
     126        *(int*)0x1934 = (int)taskCreateHook2;   // this is inferred, but not actually tested 
    121127        *(int*)0x1938 = (int)taskCreateHook3; 
     128    *(int*)(0x2564)= (*(int*)0xC0220134)&1 ? 0x2000000 : 0x1000000; // replacement of sub_FF8331CC for correct power-on. 
    122129 
    123130        asm volatile ( 
     
    265272                "B      loc_FF81F89C\n" 
    266273"loc_FF81F8A0:\n" 
    267                 "BL     sub_FF8331CC\n" 
     274//              "BL     sub_FF8331CC\n"         // see begin of sub_FF810354_my 
    268275//              "BL     j_nullsub_235\n" 
    269276                "BL     sub_FF8388E4\n" 
  • trunk/platform/sx20/sub/102b/capt_seq.c

    r900 r931  
    44#include "conf.h" 
    55 
    6 static long *nrflag = (long*)0x9B40; 
     6static long *nrflag = (long*)0x7910; 
    77 
    88#include "../../../generic/capt_seq.c" 
     
    373373                "SUB    R3, R3, #8\n" 
    374374                "BL     sub_FF96481C\n" 
    375                 "LDR    R0, [R4,#0x1C]\n" 
    376                 "CMP    R0, #0\n" // get here! 
    377                 "MOVNE  R0, #1\n" 
    378                 "STRNE  R0, [R5]\n" 
    379                 "LDR    R0, [R5,#4]\n" 
    380                 "BL     sub_FF9254CC\n" 
    381                 "LDR    R0, [R5,#8]\n" 
    382                 "BL     sub_FF8C83DC\n" 
    383                 "MOV    R0, #1\n" 
    384                 "BL     sub_FF8C83E8\n" // BX LR 
    385                 "LDR    R0, =0xFF961D60\n" 
    386                 "MOV    R1, R4\n" 
    387                 "BL     sub_FF8C83B8\n" 
    388                 "LDR    R0, [R5]\n" 
    389                 "CMP    R0, #5\n" // get here! 
    390                 "ADDLS  PC, PC, R0,LSL#2\n" // badly wrong setting pc here 
    391                 "BL     wait_until_remote_button_is_released\n" 
    392                 "BL     capt_seq_hook_set_nr\n"                     // + 
    393                 "B      sub_FF96251C\n"                             // continue function in firmware 
     375                 "BL      wait_until_remote_button_is_released\n" 
     376                 "BL      capt_seq_hook_set_nr\n"                     // + 
     377                 "B       sub_FF962410\n"                             // continue function in firmware 
     378//              "LDR    R0, [R4,#0x1C]\n" 
     379//              "CMP    R0, #0\n" // get here! 
     380//              "MOVNE  R0, #1\n" 
     381//              "STRNE  R0, [R5]\n" 
     382//              "LDR    R0, [R5,#4]\n" 
     383//              "BL     sub_FF9254CC\n" 
     384//              "LDR    R0, [R5,#8]\n" 
     385//              "BL     sub_FF8C83DC\n" 
     386//              "MOV    R0, #1\n" 
     387//              "BL     sub_FF8C83E8\n" // BX LR 
     388//              "LDR    R0, =0xFF961D60\n" 
     389//              "MOV    R1, R4\n" 
     390//              "BL     sub_FF8C83B8\n" 
     391//              "LDR    R0, [R5]\n" 
     392//              "CMP    R0, #5\n" // get here! 
     393//              "ADDLS  PC, PC, R0,LSL#2\n" // badly wrong setting pc here 
     394//                "BL     wait_until_remote_button_is_released\n" 
     395//                "BL     capt_seq_hook_set_nr\n"                     // + 
     396//              "B      sub_FF96251C\n"                             // continue function in firmware 
    394397 ); 
    395398 
     
    523526                "BL     sub_FF962CF4\n" // changed 
    524527                "MOV    R0, R4\n" 
    525                                         "BL     sub_FF962364\n" //changed sub_FF962364_my - badly wrong if we use _my 
     528                                        "BL     sub_FF962364_my\n" 
    526529                "MOV    R7, R0\n" 
    527530                                        "BL      capt_seq_hook_raw_here\n"      // + 
  • trunk/platform/sx20/sub/102b/stubs_auto.S

    r900 r931  
    218218STUB(FF96227C) 
    219219STUB(FF962364) 
     220STUB(FF962410) 
    220221STUB(FF96251C) 
    221222STUB(FF962618) 
  • trunk/platform/sx20/sub/102d/boot.c

    r928 r931  
    2424void CreateTask_spytask() { 
    2525        _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0); 
     26#ifdef CAM_CHDK_PTP 
     27    _CreateTask("InitCHDKPTP", 0x19, 0x2000, init_chdk_ptp, 0); 
     28#endif 
    2629}; 
    2730 
  • trunk/platform/sx20/sub/102d/stubs_entry_2.S

    r919 r931  
    4747NHSTUB(RenameFile_Fut,                                  0xFF834B74) // doesn't look like SX10 but works 
    4848NHSTUB(strrchr,                                                 0xFF813FE4) // incorrectly detected 
     49NHSTUB(add_ptp_handler,                                 0xFFA49320)  
    4950 
    5051# Might be wrong