Changeset 1245 for trunk


Ignore:
Timestamp:
07/23/11 22:51:40 (3 years ago)
Author:
reyalp
Message:

G12+SX30 Patch to disable raw/dng saving in 'low light' + cleanup from philmoz in http://chdk.setepontos.com/index.php?topic=650.msg70704#msg70704

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/conf.c

    r1234 r1245  
    666666 
    667667//------------------------------------------------------------------- 
     668// Common code extracted from raw.c (raw_savefile) and gui_osd.c (gui_osd_draw_raw_info) 
     669// returns 0 if RAW save is disabled due to mode settings, etc, return 1 if RAW save OK 
     670int is_raw_enabled() 
     671{ 
     672    int m = mode_get() & MODE_SHOOTING_MASK; 
     673 
     674    // NOTE: the conf.save_raw_in variables are negative logic 
     675    //       1 = disable saving raw in this mode, 0 = allow saving raw 
     676    //       variables should be named conf.disable_save_raw_in_XXX 
     677 
     678    return !(   // Return false if any of these tests are true 
     679        ((movie_status > 1) && conf.save_raw_in_video) ||                                   // True is movie mode and save_raw_in_video is disabled 
     680#ifdef CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE 
     681        (shooting_get_prop(PROPCASE_RESOLUTION)==7) ||                                      // True if shooting resolution is 'low light' 
     682#endif 
     683        (shooting_get_prop(PROPCASE_RESOLUTION)==5) ||                                      // True if shooting resolution is ??? (what is mode 5) 
     684        ((m==MODE_SPORTS) && conf.save_raw_in_sports) ||                                    // True if sports mode and save_raw_in_sports is disabled 
     685        ((m==MODE_AUTO) && conf.save_raw_in_auto) ||                                        // True if auto mode and save_raw_in_auto is disabled 
     686        (conf.edge_overlay_enable && conf.save_raw_in_edgeoverlay) ||                       // True if edge overlay on and save_raw_in_edgeoverlay is disabled 
     687        ((shooting_get_drive_mode()==1) && conf.save_raw_in_burst && !(m==MODE_SPORTS)) ||  // True if drive mode is continuous and save_raw_in_burst is disabled and not sports mode 
     688        ((shooting_get_drive_mode()>=2) && conf.save_raw_in_timer) ||                       // True if drive mode is timer and save_raw_in_timer is disabled 
     689        ((shooting_get_prop(PROPCASE_BRACKET_MODE)==1) && conf.save_raw_in_ev_bracketing)   // True if bracketing enabled and save_raw_in_ev_bracketing is disabled 
     690    ); 
     691} 
     692 
     693//------------------------------------------------------------------- 
  • trunk/core/gui_osd.c

    r1187 r1245  
    10771077void gui_osd_draw_raw_info()  
    10781078    { 
    1079     int x, m=(mode_get()&MODE_SHOOTING_MASK); 
    10801079    static int b; 
    1081     if ((!((movie_status > 1) && conf.save_raw_in_video   )) && (!(shooting_get_prop(PROPCASE_RESOLUTION)==5)) && (!((m==MODE_SPORTS) && conf.save_raw_in_sports)) && (!((m==MODE_AUTO) && conf.save_raw_in_auto)) && (!(conf.edge_overlay_enable && conf.save_raw_in_edgeoverlay)) && (!((shooting_get_drive_mode()==1) && conf.save_raw_in_burst && !(m==MODE_SPORTS)))  && (!((shooting_get_drive_mode()>=2) && conf.save_raw_in_timer)) && (!((shooting_get_prop(PROPCASE_BRACKET_MODE)==1) && conf.save_raw_in_ev_bracketing)) ) 
     1080    if (is_raw_enabled()) 
    10821081    {  
    1083     if (conf.show_remaining_raw)  
     1082        if (conf.show_remaining_raw)  
    10841083        { 
    1085         int raw_count=GetRawCount();   
     1084            int raw_count=GetRawCount();   
    10861085            if (raw_count>conf.remaining_raw_treshold) 
    1087                 { 
    1088                 if (conf.dng_raw) sprintf(osd_buf, "DNG:%3d", raw_count); else sprintf(osd_buf, "RAW:%3d", raw_count); 
     1086            { 
     1087                sprintf(osd_buf, "%s:%3d", (conf.dng_raw)?"DNG":"RAW", raw_count); 
    10891088                draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, osd_buf, conf.osd_color); 
    1090                 } 
     1089            } 
    10911090            else 
    1092                 { 
    1093  
    1094                 if (conf.dng_raw) sprintf(osd_buf, "DNG:%3d", raw_count); else sprintf(osd_buf, "RAW:%3d", raw_count); 
     1091            { 
     1092                sprintf(osd_buf, "%s:%3d", (conf.dng_raw)?"DNG":"RAW", raw_count); 
    10951093                 
    10961094                if (b > 6) 
     
    11061104                } 
    11071105        } 
    1108     else if (conf.dng_raw) draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, "DNG", conf.osd_color); else draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, "RAW", conf.osd_color); 
     1106        else 
     1107            draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, (conf.dng_raw)?"DNG":"RAW", conf.osd_color);  
    11091108        }    
    11101109        else if (conf.raw_exceptions_warn) 
    1111                 { 
    1112                         if (conf.dng_raw) gui_print_osd_state_string_chr("DNG Disabled",""); else gui_print_osd_state_string_chr("RAW Disabled",""); 
    1113                 } 
    1114                  
    1115                           
     1110        { 
     1111        gui_print_osd_state_string_chr((conf.dng_raw)?"DNG Disabled":"RAW Disabled","");  
     1112        } 
    11161113} 
    11171114//------------------------------------------------------------------- 
  • trunk/core/raw.c

    r1122 r1245  
    137137int raw_savefile() { 
    138138    int ret = 0; 
    139     int fd, m=(mode_get()&MODE_SHOOTING_MASK); 
     139    int fd; 
    140140    static struct utimbuf t; 
    141141    static int br_counter;  
     
    191191    state_shooting_progress = SHOOTING_PROGRESS_PROCESSING; 
    192192 
    193     if (conf.save_raw 
    194         && (!(shooting_get_prop(PROPCASE_RESOLUTION)==5)) 
    195         && (!((movie_status > 1) && conf.save_raw_in_video))  
    196         && (!((m==MODE_SPORTS) && conf.save_raw_in_sports))  
    197         && (!((m==MODE_AUTO) && conf.save_raw_in_auto))  
    198         && (!(conf.edge_overlay_enable && conf.save_raw_in_edgeoverlay)) 
    199         && (!((shooting_get_drive_mode()==1) && conf.save_raw_in_burst && !(m==MODE_SPORTS)))  
    200         && (!((shooting_get_drive_mode()>=2) && conf.save_raw_in_timer)) 
    201         && (!((shooting_get_prop(PROPCASE_BRACKET_MODE)==1) && conf.save_raw_in_ev_bracketing)) ) 
     193    if (conf.save_raw && is_raw_enabled()) 
    202194    { 
    203195        int timer; char txt[30]; 
     
    237229            timer=get_tick_count(); 
    238230#if DNG_SUPPORT 
    239             if (conf.dng_raw) { 
     231            if (conf.dng_raw) 
     232            { 
    240233                fill_gamma_buf(); 
    241234                create_dng_header(exif_data); 
     
    248241                    reverse_bytes_order2(rawadr, altrawadr, hook_raw_size()); 
    249242                } 
    250             } 
    251 #endif 
    252             if (conf.dng_raw) { 
    253243                // Write alternate (inactive) buffer that we reversed the bytes into above (if only one buffer then it will be the active buffer instead) 
    254244                write(fd, (char*)(((unsigned long)altrawadr)|CAM_UNCACHED_BIT), hook_raw_size()); 
    255             } else { 
     245            } 
     246            else  
     247            { 
    256248                // Write active RAW buffer 
    257249                write(fd, (char*)(((unsigned long)rawadr)|CAM_UNCACHED_BIT), hook_raw_size()); 
     
    259251            close(fd); 
    260252            utime(fn, &t); 
    261 #if DNG_SUPPORT 
     253 
    262254            if (conf.dng_raw) { 
    263255                if (get_dng_header() && thumbnail_buf) { 
     
    269261                if (thumbnail_buf) free(thumbnail_buf); 
    270262            } 
     263#else 
     264            // Write active RAW buffer 
     265            write(fd, (char*)(((unsigned long)rawadr)|CAM_UNCACHED_BIT), hook_raw_size()); 
     266            close(fd); 
     267            utime(fn, &t); 
    271268#endif 
    272269            if (conf.raw_timer) { 
  • trunk/include/camera.h

    r1243 r1245  
    163163#undef CAM_AV_OVERRIDE_IRIS_FIX                                 // for cameras that require _MoveIrisWithAv function to override Av (for bracketing). 
    164164 
     165#undef CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE        // For cameras with 'low light' mode that does now work with raw define this 
     166 
    165167//---------------------------------------------------------- 
    166168// Override Default values for Camera if necessary 
  • trunk/include/conf.h

    r993 r1245  
    322322extern const char *video_bitrate_strings[VIDEO_BITRATE_STEPS]; 
    323323 
     324extern int is_raw_enabled(); 
     325 
    324326#endif 
  • trunk/include/propset4.h

    r1243 r1245  
    4545#define PROPCASE_EV_CORRECTION_2                 211 
    4646#define PROPCASE_IS_FLASH_READY                  212 
    47 #define PROPCASE_RESOLUTION                      222 
     47#define PROPCASE_RESOLUTION                      222    // 0 = L, 1 = M1, 2 = M2, 4 = S, 7 = Low Light (G12) 
    4848#define PROPCASE_ORIENTATION_SENSOR              223 
    4949#define PROPCASE_TIMER_MODE                      227 
  • trunk/platform/g12/platform_camera.h

    r1237 r1245  
    9999        #define ZEBRA_HMARGIN0  30 //this 30 rows are not used by the display buffer is 720x240 effective, no 960x270, i.e. (270-240) reduction in widht possible but not done (more difficult to manage it and slower). 
    100100         
    101         #define CAM_DATE_FOLDER_NAMING  1 
     101        #define CAM_DATE_FOLDER_NAMING      1 
    102102 
    103103        #define CAM_STARTUP_CRASH_FILE_OPEN_FIX 1                               // enable fix for camera crash at startup when opening the conf / font files 
    104104                                                                                                                        // see http://chdk.setepontos.com/index.php?topic=6179.0 
    105105 
    106     #define CAM_FIRMWARE_MEMINFO    1       // Use 'GetMemInfo' to get free memory size. 
     106    #define CAM_FIRMWARE_MEMINFO        1       // Use 'GetMemInfo' to get free memory size. 
    107107 
    108108    #define CAM_DRIVE_MODE_FROM_TIMER_MODE      // use PROPCASE_TIMER_MODE to check for multiple shot custom timer. 
     
    110110                                                // see http://chdk.setepontos.com/index.php/topic,3994.405.html 
    111111         
    112         #define CAM_AV_OVERRIDE_IRIS_FIX        1                               // for cameras that require _MoveIrisWithAv function to override Av. 
     112        #define CAM_AV_OVERRIDE_IRIS_FIX        1                               // for cameras that require _MoveIrisWithAv function to override Av in bracketing. 
     113 
     114    #define CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE   1       // For cameras with 'low light' mode that does now work with raw define this 
     115 
    113116//---------------------------------------------------------- 
    114117 
  • trunk/platform/sx30/platform_camera.h

    r1237 r1245  
    9898                                                                                                                        // see http://chdk.setepontos.com/index.php?topic=6179.0 
    9999 
    100     #define CAM_KEY_CLICK_DELAY 150 // SX30 appears to need extra delay for clicks 
     100    #define CAM_KEY_CLICK_DELAY         150 // SX30 appears to need extra delay for clicks 
    101101 
    102     #define CAM_FIRMWARE_MEMINFO    1       // Use 'GetMemInfo' to get free memory size. 
     102    #define CAM_FIRMWARE_MEMINFO        1       // Use 'GetMemInfo' to get free memory size. 
    103103 
    104104    #define CAM_DRIVE_MODE_FROM_TIMER_MODE      // use PROPCASE_TIMER_MODE to check for multiple shot custom timer. 
     
    106106                                                // see http://chdk.setepontos.com/index.php/topic,3994.405.html 
    107107         
    108         #define CAM_AV_OVERRIDE_IRIS_FIX        1                               // for cameras that require _MoveIrisWithAv function to override Av. 
     108        #define CAM_AV_OVERRIDE_IRIS_FIX        1                               // for cameras that require _MoveIrisWithAv function to override Av in bracketing. 
     109 
     110    #define CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE   1       // For cameras with 'low light' mode that does now work with raw define this 
     111 
    109112//---------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.