Changeset 935


Ignore:
Timestamp:
09/06/10 01:06:37 (3 years ago)
Author:
reyalp
Message:

fix zebra on d10 and (probably) sd990.
Clean up camera specific #ifdef mess in gui_osd.c slightly. Two new camera.h macros

  • CAM_ZEBRA_ASPECT_ADJUST (same functionality as sx200, g11, s90 etc had)
  • CAM_ZEBRA_NOBUF (same functionality as sx20, when combined with above)

This is still a big mess. Some cameras without aspect adjust (ixus100_sd780 ixus95_sd1200) used this functionality, maybe to save memory from border restore ?

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui_osd.c

    r928 r935  
    5252static int step; 
    5353 
     54 
     55#if defined (CAM_ZEBRA_NOBUF) && !defined(CAM_ZEBRA_ASPECT_ADJUST) 
     56// old sx20 #ifdefs were roughly equivalent of both 
     57        #error "defined (CAM_ZEBRA_NOBUF) && !defined(CAM_ZEBRA_ASPECT_ADJUST). Remove this if you've verified it will work!" 
     58#endif 
     59 
     60#ifdef CAM_ZEBRA_ASPECT_ADJUST 
     61// TODO should just not save anything at all instead of 1 px. Also, this shouldn't be tied to aspect correct 
     62  #define ZEBRA_CANONOSD_BORDER_RESTORE   1 
     63  #define ZFIX_TOP    1 
     64  #define ZFIX_BOTTOM 1 
     65#else 
    5466// Width (in pixels) of half-shoot Canon OSD area of the screen buffer, for restore during  
    5567// Zebra draw, to limit RAM usage of zebra. Only these border areas are stored in RAM. 
    5668// Only top and bottom are restored, not left&right. 
    57 #define ZEBRA_CANONOSD_BORDER_RESTORE   1 
    58  
    59 #if defined (CAMERA_sx200is) || defined(CAMERA_g11) || defined (CAMERA_ixus100_sd780) || defined (CAMERA_ixus95_sd1200) || defined (CAMERA_s90) || defined (CAMERA_sx20) 
    60   //there are no memory for that (the screen buffer is big): 960x270 
    61   //TODO use a buffer of screen dimensions 
    62   #define ZFIX_TOP    1 
    63   #define ZFIX_BOTTOM 1 
    64 #else 
     69  #define ZEBRA_CANONOSD_BORDER_RESTORE   1 
    6570  #define ZFIX_TOP    29 
    6671  #define ZFIX_BOTTOM 30 
     
    7681static int timer = 0; 
    7782static unsigned char *buf = NULL; 
    78 #if defined (CAMERA_sx200is) || defined(CAMERA_g11) || defined (CAMERA_ixus100_sd780) || defined (CAMERA_ixus95_sd1200) || defined (CAMERA_s90) || defined (CAMERA_sx20) 
     83 
     84#ifdef CAM_ZEBRA_ASPECT_ADJUST 
    7985static int buffer_size; 
    8086#endif 
     
    221227// free and NULL zebra buffers. free(NULL) is always OK. 
    222228static void gui_osd_zebra_free() { 
    223   #if !defined (CAMERA_sx20) 
     229#if !defined (CAM_ZEBRA_NOBUF) 
    224230        free(buf); 
    225   #endif 
     231#endif 
    226232        buf=NULL; 
    227233#if ZEBRA_CANONOSD_BORDER_RESTORE 
     
    245251    { 
    246252      timer = 0; 
    247       #if defined (CAMERA_sx200is) || defined(CAMERA_g11) || defined (CAMERA_ixus100_sd780)  || defined (CAMERA_ixus95_sd1200) || defined (CAMERA_s90) //nandoide sept-2009 
     253          #if defined (CAM_ZEBRA_NOBUF) 
     254        buffer_size=screen_buffer_size-ZEBRA_HMARGIN0*screen_buffer_width; 
     255        buf=vid_get_bitmap_fb(); 
     256          #elif defined (CAM_ZEBRA_ASPECT_ADJUST) 
    248257        buffer_size=screen_buffer_size-ZEBRA_HMARGIN0*screen_buffer_width; 
    249258        buf = malloc(buffer_size); 
     
    252261          buf=vid_get_bitmap_fb(); //without new buffer: directly into screen buffer: we got some flickering in OSD and histogram but it's usable 
    253262        //~ msleep(50); 
    254       #elif defined (CAMERA_sx20) 
    255         buffer_size=screen_buffer_size-ZEBRA_HMARGIN0*screen_buffer_width; 
    256         buf=vid_get_bitmap_fb(); 
    257263      #else 
    258264        buf = malloc(screen_buffer_size); 
     
    262268            cur_buf_top = malloc(screen_buffer_width * ZFIX_TOP);  
    263269            cur_buf_bot = malloc(screen_buffer_width * ZFIX_BOTTOM);  
    264 #if defined (CAMERA_g11) || defined (CAMERA_s90)                 
     270#if defined (CAM_ZEBRA_ASPECT_ADJUST) 
    265271            if (cur_buf_top) memset(cur_buf_top,0,screen_buffer_width * ZFIX_TOP); 
    266272            if (cur_buf_bot) memset(cur_buf_bot,0,screen_buffer_width * ZFIX_BOTTOM); 
     
    297303//------------------------------------------------------------------- 
    298304static void draw_pixel_buffered(unsigned int offset, color cl) { 
    299    #if defined (CAMERA_sx200is) || defined (CAMERA_sx20) 
     305// shouldn't this be checked on all cams ? 
     306   #if defined CAM_ZEBRA_ASPECT_ADJUST 
    300307      if (offset < buffer_size) 
    301308         buf[offset] = cl; 
     
    377384} 
    378385 
    379 // reyalp - TODO this SHOULD NOT BE CAMERA SPECIFIC. Should be generalized to work with all cameras 
    380 // having a copy/paste/modified version for individual cameras will be a maintenance nightmare. 
    381 #if defined (CAMERA_sx200is) || defined (CAMERA_g11) || defined (CAMERA_ixus100_sd780) || defined (CAMERA_ixus95_sd1200) || defined (CAMERA_s90) || defined (CAMERA_sx20) 
     386// reyalp - TODO this should be rewritten so there is one generic zebra func for all cameras 
     387#if defined(CAM_ZEBRA_ASPECT_ADJUST) 
    382388//nandoide sept-2009  
    383389// viewport is 360x240 and screen buffer 960x270, we need to expand the x coordinate 
     390//reyalp - applies to other cameras where the real bitmap width is is different from what lib.c reports. Also used on some other cameras ... 
    384391int gui_osd_draw_zebra(int show) { 
    385392    unsigned int v, s, x, y, f, over; 
  • trunk/include/camera.h

    r934 r935  
    8888    #undef CAM_QUALITY_OVERRIDE //camera may need shooting quality override (sx200is lacks SuperFine quality) 
    8989 
    90  
     90        #undef CAM_ZEBRA_ASPECT_ADJUST // zebra needs to account for real bitmap size being different from what lib.c reports 
     91                                                                        // also used by some cameras with normal bitmap layouts for memory saving ? 
     92        #undef CAM_ZEBRA_NOBUF // zebra draws directly on bitmap buffer. Requires above as well 
    9193//---------------------------------------------------------- 
    9294// Overridden values for each camera 
     
    10691071        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none 
    10701072 
     1073    #define CAM_ZEBRA_ASPECT_ADJUST 1 
     1074 
    10711075//---------------------------------------------------------- 
    10721076 
     
    19191923        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none 
    19201924 
     1925   #define CAM_ZEBRA_ASPECT_ADJUST 1 
     1926 
    19211927//    #define DNG_EXT_FROM ".CR2" 
    19221928//---------------------------------------------------------- 
     
    20032009    // camera name 
    20042010    #define PARAM_CAMERA_NAME           4                       // parameter number for GetParameterData sd990: OK 
     2011// TODO this was in the original zebra mess, not clear if needed or just for mem saving ? 
     2012   #define CAM_ZEBRA_ASPECT_ADJUST 1 
    20052013//---------------------------------------------------------- 
    20062014 
     
    21762184        // camera name 
    21772185        #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData 
     2186// TODO this was in the original zebra mess, not clear if needed or just for mem saving ? 
     2187   #define CAM_ZEBRA_ASPECT_ADJUST 1 
    21782188//---------------------------------------------------------- 
    21792189 
     
    26252635   #define CAM_QUALITY_OVERRIDE 1 
    26262636   #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1 
     2637   #define CAM_ZEBRA_ASPECT_ADJUST 1 
    26272638//---------------------------------------------------------- 
    26282639 
     
    27132724    #define CAM_ACTIVE_AREA_Y2 2736 
    27142725          /**** From SX200IS, ok for G11 END?*/ 
     2726   #define CAM_ZEBRA_ASPECT_ADJUST 1 
    27152727//---------------------------------------------------------- 
    27162728 
     
    28002812    #define CAM_ACTIVE_AREA_Y2 2736 
    28012813    /**** From SX200IS, ok for S90 END?*/ 
     2814 
     2815   #define CAM_ZEBRA_ASPECT_ADJUST 1 
    28022816//---------------------------------------------------------- 
    28032817 
     
    28862900        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none 
    28872901 
     2902    #define CAM_ZEBRA_ASPECT_ADJUST 1 
     2903    #define CAM_ZEBRA_NOBUF 1 
     2904 
    28882905        #undef CAM_BITMAP_PALETTE 
    28892906        #define CAM_BITMAP_PALETTE              6 
  • trunk/platform/d10/notes.txt

    r933 r935  
    1010Not implemented/Not Working 
    1111- movie_rec: meaning all movie related functions 
    12 - zebra 
    1312- dark frame subtraction control. Don't try to use this, it will break horribly. 
    1413- USB remote support 
     
    2726- DNG matrix (DavidB) 
    2827- OSD size/aspect (DavidB,reyalP) 
     28- zebra 
    2929 
    3030Scripts tested successfully 
  • trunk/platform/ixus980_sd990/notes.txt

    r934 r935  
    2323Features known BROKEN or NOT supported: 
    2424- DNG extension over USB. 
    25 - Zebra 
    26 - Edge overlay 
    2725- Custom curves 
    2826- Microphone mute/unmute 
Note: See TracChangeset for help on using the changeset viewer.