Changeset 1035 for trunk


Ignore:
Timestamp:
01/09/11 03:15:50 (2 years ago)
Author:
reyalP
Message:

scriptless badpixel.bin creation, from ultimA in http://chdk.setepontos.com/index.php?topic=5793.msg59376#msg59376

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/CHDK/LANG/english.lng

    r928 r1035  
    564564424 "DNG format" 
    565565425 "RAW buffer cached" 
    566 426 "Cannot load CHDK/badpixel.bin\nPlease run \nCHDK/SCRIPTS/TEST/badpixel.lua" 
     566426 "Cannot load CHDK/badpixel.bin\nUse Create badpixel.bin in raw menu" 
    567567427 "Show raw saving time" 
    568568428 "Connect 4" 
     
    595595457 "Always show" 
    596596458 "   Pano overlap (%)" 
     597459 "Create badpixel.bin" 
     598460 "You need to be in REC-mode\nfor this operation." 
  • trunk/CHDK/LANG/german.lng

    r928 r1035  
    577577457 "Kontinuierlich anz." 
    578578458 "   Pano-Überlappung (%)" 
     579459 "badpixel.bin erstellen" 
     580460 "REC-Modus erforderlich." 
  • trunk/CHDK/LANG/hungarian.lng

    r928 r1035  
    583583457 "Folyamatos megjel." 
    584584458 "   Átfedés (%)" 
     585459 "badpixel.bin mentése" 
     586460 "Elöbb lépj REC-modba." 
  • trunk/core/gui.c

    r1034 r1035  
    282282#if DNG_SUPPORT 
    283283static void cb_change_dng();  
     284void gui_menuproc_badpixel_create(int arg); 
    284285#endif 
    285286#if defined (DNG_EXT_FROM) 
     
    822823    {0x5c,LANG_MENU_DNG_FORMAT,              MENUITEM_BOOL | MENUITEM_ARG_CALLBACK, &conf.dng_raw , (int)cb_change_dng }, 
    823824    {0x5c,LANG_MENU_RAW_DNG_EXT,             MENUITEM_BOOL,      &conf.raw_dng_ext}, 
     825    {0x2a,LANG_MENU_BADPIXEL_CREATE,         MENUITEM_PROC,      (int*)gui_menuproc_badpixel_create }, 
    824826#endif 
    825827    {0x5c,LANG_MENU_RAW_CACHED,              MENUITEM_BOOL,      &conf.raw_cache }, 
     
    10081010 conf_change_dng(); 
    10091011 if ((old==1) && (conf.dng_raw==0)) gui_mbox_init(LANG_ERROR, LANG_CANNOT_OPEN_BADPIXEL_FILE, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); 
     1012} 
     1013 
     1014void gui_menuproc_badpixel_create(int arg) { 
     1015    create_badpixel_bin(); 
    10101016} 
    10111017#endif 
  • trunk/core/gui_lang.c

    r928 r1035  
    580580"457 \"Always show\"\n" 
    581581"458 \"   Pano overlap (%)\"\n" 
     582"459 \"Create badpixel.bin\"\n" 
     583"460 \"You need to be in REC-mode\\nfor this operation.\"\n" 
    582584; 
    583585 
  • trunk/core/gui_lang.h

    r928 r1035  
    569569#define LANG_MENU_EDGE_SHOW        457 
    570570#define LANG_MENU_EDGE_PANO_OVERLAP  458 
     571#define LANG_MENU_BADPIXEL_CREATE  459 
     572#define LANG_MSG_RECMODE_REQUIRED  460 
    571573//------------------------------------------------------------------- 
    572574 
    573 #define GUI_LANG_ITEMS                  458 
     575#define GUI_LANG_ITEMS                  460 
    574576 
    575577//------------------------------------------------------------------- 
  • trunk/core/raw.c

    r1017 r1035  
    77        #include "dng.h" 
    88        #include "math.h" 
     9        #include "keyboard.h" 
     10    #include "action_stack.h" 
     11    #include "gui_draw.h" 
     12    #include "gui_mbox.h" 
     13    #include "gui_lang.h" 
    914#endif 
    1015#ifdef OPT_CURVES 
     
    5055//------------------------------------------------------------------- 
    5156 
    52 unsigned int get_bad_count_and_write_file(char *fn){ 
     57unsigned int get_bad_count_and_write_file(const char *fn){ 
    5358 int count=0; 
    5459 unsigned short c[2]; 
     
    123128 
    124129    // ! ! ! exclusively for special script which creates badpixel.bin ! ! ! 
     130    // NOTE: get_bad_count_and_write_file() must be called from here and cannot be called 
     131    // outside of this function. 
    125132    if (conf.save_raw==255) conf.save_raw=get_bad_count_and_write_file("A/CHDK/bad_tmp.bin"); 
    126133    // 
     
    442449 return binary_count; 
    443450} 
    444 #endif 
     451 
     452// ----------------------------------------------- 
     453 
     454enum BadpixelFSM 
     455{ 
     456    BADPIX_START, 
     457    BADPIX_S1, 
     458    BADPIX_S2 
     459}; 
     460 
     461int badpixel_task_stack(long p) 
     462{ 
     463    static unsigned int badpix_cnt1, badpix_cnt2; 
     464    static int raw_conf_bck; 
     465 
     466    switch(p) 
     467    { 
     468 
     469    case BADPIX_START: 
     470        action_pop(); 
     471 
     472        console_clear(); 
     473        console_add_line("Wait please... "); 
     474        console_add_line("This takes a few seconds,"); 
     475        console_add_line("don't panic!"); 
     476         
     477        raw_conf_bck = conf.save_raw; 
     478        conf.save_raw = 255; 
     479         
     480        shooting_set_tv96_direct(96, SET_LATER); 
     481        action_push(BADPIX_S1); 
     482        action_push(AS_SHOOT); 
     483        action_push_delay(3000); 
     484        break; 
     485    case BADPIX_S1: 
     486        action_pop();         
     487 
     488        badpix_cnt1 = conf.save_raw; 
     489        shooting_set_tv96_direct(96, SET_LATER); 
     490 
     491        action_push(BADPIX_S2); 
     492        action_push(AS_SHOOT); 
     493        break; 
     494    case BADPIX_S2: 
     495        action_pop(); 
     496 
     497        badpix_cnt2 = conf.save_raw; 
     498        conf.save_raw = raw_conf_bck; 
     499 
     500        console_clear(); 
     501        if (badpix_cnt1 == badpix_cnt2) 
     502        { 
     503            char msg[32]; 
     504            console_add_line("badpixel.bin created."); 
     505            sprintf(msg, "Bad pixel count: %d", badpix_cnt1); 
     506            console_add_line(msg); 
     507        } 
     508        else 
     509        { 
     510            console_add_line("badpixel.bin failed."); 
     511            console_add_line("Please try again."); 
     512        } 
     513         
     514        action_push_delay(3000); 
     515        break; 
     516    default: 
     517        action_stack_standard(p); 
     518        break; 
     519    } 
     520    
     521    return 1; 
     522} 
     523 
     524 
     525void create_badpixel_bin() 
     526{ 
     527    if (!(mode_get() & MODE_REC)) 
     528    { 
     529        gui_mbox_init(LANG_ERROR, LANG_MSG_RECMODE_REQUIRED, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); 
     530        return; 
     531    } 
     532         
     533    gui_set_mode(GUI_MODE_ALT); 
     534    action_stack_create(&badpixel_task_stack, BADPIX_START); 
     535} 
     536 
     537#endif 
  • trunk/core/raw.h

    r727 r1035  
    2525extern void load_bad_pixels_list(const char* filename); 
    2626unsigned short get_raw_pixel(unsigned int x,unsigned  int y); 
     27 
     28#if DNG_SUPPORT 
    2729void load_bad_pixels_list_b(char* filename); 
    2830void unload_bad_pixels_list_b(void); 
     
    3133int badpixel_list_loaded_b(void); 
    3234char* get_raw_image_addr(void); 
     35void create_badpixel_bin(); 
     36#endif 
    3337 
    3438//------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.