Changeset 1509


Ignore:
Timestamp:
12/26/11 13:26:00 (17 months ago)
Author:
tsv
Message:

Separate dng to loadable module

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/Makefile

    r1505 r1509  
    6161     histogram.o gui_batt.o gui_space.o gui_osd.o raw.o \ 
    6262     gui_usb.o gui_lang.o gui_grid.o modules.o module_load.o\ 
    63      levent.o shot_histogram.o dng.o bitvector.o console.o $(OPT_OBJS) 
     63     levent.o shot_histogram.o bitvector.o console.o $(OPT_OBJS) 
    6464 
    6565gui.o: FORCE 
  • trunk/core/conf.c

    r1497 r1509  
    66#include "camera.h" 
    77#include "raw.h" 
    8 #include "dng.h" 
     8#include "modules.h" 
    99#include "gui_draw.h" 
    1010#include "gui_osd.h" 
     
    488488#if DNG_SUPPORT 
    489489 if (conf.dng_raw) { 
    490   if (!badpixel_list_loaded_b()) load_bad_pixels_list_b("A/CHDK/badpixel.bin"); 
    491   if (!badpixel_list_loaded_b()) conf.dng_raw=0; 
     490        if ( !module_dng_load(LIBDNG_OWNED_BY_RAW) ) 
     491                return; 
     492        if (!libdng.badpixel_list_loaded_b()) libdng.load_bad_pixels_list_b("A/CHDK/badpixel.bin"); 
     493        if (!libdng.badpixel_list_loaded_b()) conf.dng_raw=0; 
    492494 } 
    493  else unload_bad_pixels_list_b(); 
     495 else if ( libdng.load_bad_pixels_list_b ) { 
     496        libdng.load_bad_pixels_list_b(0);        //unload badpixel.bin 
     497        module_dng_unload(LIBDNG_OWNED_BY_RAW); 
     498 } 
    494499#endif 
    495500} 
  • trunk/core/dng.c

    r1497 r1509  
    77#include "platform.h" 
    88#include "conf.h" 
    9 #include "math.h" 
    109#include "console.h" 
    1110#include "dng.h" 
     
    455454 // Shutter speed tags 
    456455 get_property_case(PROPCASE_TV, &short_prop_val, sizeof(short_prop_val)); 
    457  cam_shutter[0]      = 1000000 * pow(2,-short_prop_val / 96.0); 
     456 cam_shutter[0]      = pow_calc( 1000000, 2, 1, -short_prop_val, 96); 
    458457 cam_apex_shutter[0] = short_prop_val; 
    459458 
    460459 // Date & time tag (note - uses shutter speed from 'short_prop_val' code above) 
    461  if (shutter_open_time) { datetime = shutter_open_time+pow(2,-short_prop_val/96.0); shutter_open_time=0;} // shutter closing time 
     460 if (shutter_open_time) { datetime = shutter_open_time + pow_calc(1, 2, 1, -short_prop_val, 96); shutter_open_time=0;} // shutter closing time 
    462461 else  datetime = time(NULL); 
    463462 ttm = localtime(&datetime); 
     
    465464 
    466465 get_property_case(PROPCASE_AV, &short_prop_val, sizeof(short_prop_val)); 
    467  cam_aperture[0]      = 10 * pow(2,short_prop_val / 192.0); 
     466 cam_aperture[0]      = pow_calc( 10, 2, 1, short_prop_val, 192); 
    468467 cam_apex_aperture[0] = short_prop_val; 
    469468 
     
    498497 int *buf; 
    499498 int i; 
    500  struct stat st; 
     499 struct STD_stat st; 
    501500 struct utimbuf t; 
    502501 
    503  if (stat(fn, &st) != 0 || st.st_size<=hook_raw_size())  return; 
     502 if (safe_stat(fn, &st) != 0 || st.st_size<=hook_raw_size())  return; 
    504503 buf=malloc(BUF_SIZE); 
    505504 if (buf){ 
     
    543542    if (gamma[255]) return; 
    544543#if defined(CAMERA_sx30) || defined(CAMERA_sx40hs) || defined(CAMERA_g12) || defined(CAMERA_ixus310_elph500hs) 
    545     for (i=0; i<12; i++) gamma[i]=255*pow(i/255.0, 0.5); 
    546     for (i=12; i<64; i++) gamma[i]=255*pow(i/255.0, 0.4); 
    547     for (i=64; i<=255; i++) gamma[i]=255*pow(i/255.0, 0.25); 
     544    for (i=0; i<12; i++) gamma[i]=pow_calc_2(255, i, 255, 0.5, 1); 
     545    for (i=12; i<64; i++) gamma[i]=pow_calc_2(255, i, 255, 0.4, 1); 
     546    for (i=64; i<=255; i++) gamma[i]=pow_calc_2(255, i, 255, 0.25, 1); 
    548547#else 
    549     for (i=0; i<=255; i++) gamma[i]=255*pow(i/255.0, 0.5); 
     548    for (i=0; i<=255; i++) gamma[i]=pow_calc_2(255, i, 255, 0.5, 1); 
    550549#endif 
    551550} 
    552551 
    553552void create_thumbnail() { 
    554     register unsigned int i, j, x, y; 
     553    register int i, j, x, y; 
    555554    register char *buf = thumbnail_buf; 
    556555 
     
    638637 
    639638void load_bad_pixels_list_b(char* filename) { 
    640     struct stat st; 
     639    struct STD_stat st; 
    641640    long filesize; 
    642641    void* ptr; 
    643642    FILE *fd; 
     643 
     644        if ( filename==0 ) 
     645         { unload_bad_pixels_list_b(); return; } 
     646 
    644647    binary_count=-1; 
    645     if (stat(filename,&st)!=0) return; 
     648    if (safe_stat(filename,&st)!=0) return; 
    646649    filesize=st.st_size; 
    647650    if (filesize%(2*sizeof(short)) != 0) return; 
     
    783786} 
    784787 
     788//------------------------------------------------------------------- 
     789void write_dng(int fd, char* rawadr, char* altrawadr, unsigned long uncachedbit)  
     790{ 
     791        create_dng_header(); 
     792    write_dng_header(fd); 
     793 
     794    reverse_bytes_order2(rawadr, altrawadr, hook_raw_size()); 
     795 
     796    // Write alternate (inactive) buffer that we reversed the bytes into above (if only one buffer then it will be the active buffer instead) 
     797    write(fd, (char*)(((unsigned long)altrawadr)|uncachedbit), hook_raw_size()); 
     798 
     799    if (rawadr == altrawadr)    // If only one RAW buffer then we have to swap the bytes back 
     800        reverse_bytes_order2(rawadr, altrawadr, hook_raw_size()); 
     801 
     802    free_dng_header(); 
     803} 
     804 
     805/*********** BEGIN OF AUXILARY PART **********************/ 
     806 
     807#include "module_load.h" 
     808 
     809void* MODULE_EXPORT_LIST[] = { 
     810        /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
     811        /* 1 */ (void*)9, 
     812 
     813                        create_badpixel_bin, 
     814                        raw_init_badpixel_bin, 
     815                        capture_data_for_exif, 
     816                        load_bad_pixels_list_b, 
     817                        badpixel_list_loaded_b, 
     818 
     819                        convert_dng_to_chdk_raw, 
     820                        write_dng, 
     821                }; 
     822 
     823int _module_loader( void** chdk_export_list ) 
     824{ 
     825  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
     826     return 1; 
     827 
     828  return 0; 
     829} 
     830 
     831 
     832//--------------------------------------------------------- 
     833// PURPOSE: Finalize module operations (close allocs, etc) 
     834// RETURN VALUE: 0-ok, 1-fail 
     835//--------------------------------------------------------- 
     836int _module_unloader() 
     837{ 
     838 
     839        unload_bad_pixels_list_b(); 
     840    free_dng_header(); 
     841    return 0; 
     842} 
     843 
     844 
     845#else 
     846 
     847/*********** NO DNG SUPPORTED BY CAMERA - EMPTY MODULE **********/ 
     848 
     849#include "module_load.h" 
     850 
     851int _module_loader( void** chdk_export_list ) 
     852{ 
     853        // error bind - DNG is not supported and module is empty 
     854        return 1; 
     855} 
     856 
     857 
     858//--------------------------------------------------------- 
     859// PURPOSE: Finalize module operations (close allocs, etc) 
     860// RETURN VALUE: 0-ok, 1-fail 
     861//--------------------------------------------------------- 
     862int _module_unloader() 
     863{ 
     864  return 0; 
     865} 
     866 
     867 
    785868#endif //DNG_SUPPORT 
     869 
     870 
     871/******************** Module Information structure ******************/ 
     872 
     873struct ModuleInfo _module_info = {      MODULEINFO_V1_MAGICNUM, 
     874                                                                        sizeof(struct ModuleInfo), 
     875 
     876                                                                        ANY_CHDK_BRANCH, 0,                     // Requirements of CHDK version 
     877                                                                        PLATFORMID,                                     // Specify platform dependency 
     878                                                                        MODULEINFO_FLAG_SYSTEM,         // flag 
     879                                                                        (int32_t)"DNG (dll)",   // Module name 
     880                                                                        1, 0,                                           // Module version 
     881                                                                        (int32_t)"Processing of DNG" 
     882                                                                 }; 
     883 
     884 
     885/*************** END OF AUXILARY PART *******************/ 
  • trunk/core/dng.h

    r1497 r1509  
    44#define DNG_H 
    55 
     6// This is to minimize export list to different modules 
     7struct libdng_sym { 
     8        int  size;                             // simple guard to detect changing list of exported by library symbols 
     9        void (*create_badpixel_bin)(); 
     10        int  (*raw_init_badpixel_bin)(); 
     11        void (*capture_data_for_exif)(void); 
     12        void (*load_bad_pixels_list_b)(char* filename); 
     13        int  (*badpixel_list_loaded_b)(void); 
     14 
     15        void (*convert_dng_to_chdk_raw)(char* fn); 
     16        void (*write_dng)(int fd, char* rawadr, char* altrawadr, unsigned long uncachedbit); 
     17}; 
     18 
     19 
    620#if DNG_SUPPORT 
    721 
     22// Defines of exported to chdk symbols 
     23#ifdef THIS_IS_CHDK_CORE 
     24 
     25        // This section is for CHDK core 
     26        extern struct libdng_sym libdng; 
     27#else 
     28         
     29        extern void create_badpixel_bin(); 
    830extern int raw_init_badpixel_bin(); 
    931extern void capture_data_for_exif(void); 
    10 extern void create_dng_header(); 
    11 extern void free_dng_header(void); 
    12 extern void write_dng_header(int fd); 
     32        extern void load_bad_pixels_list_b(char* filename); 
     33        extern int  badpixel_list_loaded_b(void); 
    1334 
    1435extern void convert_dng_to_chdk_raw(char* fn); 
     36        extern void write_dng(int fd, char* rawadr, char* altrawadr, unsigned long uncachedbit); 
    1537 
    16 extern void load_bad_pixels_list_b(char* filename); 
    1738extern void unload_bad_pixels_list_b(void); 
    18 extern int badpixel_list_loaded_b(void); 
    19 extern void create_badpixel_bin(); 
    2039 
    2140#endif 
    2241 
     42 
     43#endif //DNG_SUPPORT 
     44 
     45 
     46 
    2347#endif 
  • trunk/core/gui.c

    r1505 r1509  
    10001000 
    10011001void gui_menuproc_badpixel_create(int arg) { 
    1002     create_badpixel_bin(); 
     1002        // After this action module will not be unloaded until reboot  
     1003        // because not clear when it finished 
     1004        if ( module_dng_load(LIBDNG_OWNED_BY_CREATEBADPIXEL) ) 
     1005        libdng.create_badpixel_bin(); 
    10031006} 
    10041007#endif 
     
    16161619    exposition_thresh = screen_size/500; 
    16171620    voltage_step = (conf.batt_step_25)?25:1; 
    1618     load_bad_pixels_list("A/CHDK/badpixel"); 
    1619     load_bad_pixels_list("A/CHDK/badpixel.txt"); 
     1621    load_from_file( "A/CHDK/badpixel", make_pixel_list ); 
     1622    load_from_file( "A/CHDK/badpixel.txt", make_pixel_list ); 
    16201623#ifdef OPT_CURVES 
    16211624        // initialize curves, loading files if required by current mode 
  • trunk/core/gui_fselect.c

    r1505 r1509  
    10361036} 
    10371037//------------------------------------------------------------------- 
    1038 //#if DNG_SUPPORT 
    10391038void process_dng_to_raw_files(void){ 
    10401039 struct fitem *ptr; 
     
    10581057  gui_fselect_read_dir(current_dir); 
    10591058} 
    1060 //#endif 
    10611059 
    10621060//------------------------------------------------------------------- 
     
    11401138            break; 
    11411139        } 
    1142 //#if DNG_SUPPORT 
    11431140    case MPOPUP_DNG_TO_CRW: 
    11441141            process_dng_to_raw_files(); 
    11451142            break; 
    1146 //#endif 
    11471143    } 
    11481144    gui_fselect_redraw = 2; 
     
    12381234                if(selected->size == hook_raw_size()) 
    12391235                    i |= MPOPUP_RAW_DEVELOP; 
    1240 //#if DNG_SUPPORT 
     1236 
     1237                                if ( module_convert_dng_to_chdk_raw(0) )        // if dng module exist 
    12411238                if((fselect_marked_count()>1)||(selected->size > hook_raw_size())) 
    12421239                    i |= MPOPUP_DNG_TO_CRW; 
    1243 //#endif 
    12441240 
    12451241                if (selected->name[9] == 'B' && selected->name[10] == 'I' && selected->name[11] == 'N') //If item is DCIM folder 
  • trunk/core/module_exportlist.c

    r1505 r1509  
    2727#include "module_load.h" 
    2828#include "raw.h" 
     29#include "action_stack.h" 
     30#include "console.h" 
    2931 
    3032 
    3133extern int fselect_sort_nothumb(const void* v1, const void* v2); 
    3234extern short shooting_get_ev_correction1(); 
     35 
     36extern long shutter_open_time; // defined in platform/generic/capt_seq.c 
    3337 
    3438 
     
    296300                        lang_strhash31, 
    297301 
     302                        action_stack_create, 
     303                        action_pop, 
     304                        action_push, 
     305                        action_push_delay, 
     306                        action_stack_standard, 
     307                        console_clear, 
     308                        console_add_line, 
     309                        shooting_set_tv96_direct, 
     310                        shooting_get_iso_market, 
     311                        get_focal_length, 
     312                        get_effective_focal_length, 
     313                        get_parameter_data, 
     314                        get_property_case, 
     315                        &shutter_open_time, 
     316                        get_raw_pixel, 
     317                        &state_shooting_progress, 
     318                        patch_bad_pixel, 
     319                         
     320                        pow_calc, 
     321                        pow_calc_2, 
     322 
    298323                        0 
    299324}; 
  • trunk/core/modules.c

    r1505 r1509  
    3030#endif 
    3131 
     32// This is to minimize sharing sym to use this lib in other modules 
    3233struct librawop_sym librawop; 
    3334 
     
    243244} 
    244245 
    245 /************* OTHER MODULES ******/ 
    246  
    247 void module_convert_dng_to_chdk_raw(char* fn) 
    248 { 
     246 
     247 
     248/************* MODULE DNG ******/ 
     249 
     250#define MODULE_NAME_DNG "_dng.flt" 
     251 
     252// This is to keep module in memory while it required by anyone 
     253static int module_dng_semaphore; 
     254 
     255struct libdng_sym libdng; 
     256 
    249257#if DNG_SUPPORT 
    250         convert_dng_to_chdk_raw(fn); 
    251 #endif 
    252 } 
     258static int bind_module_dng( void** export_list ) 
     259{ 
     260          // Unbind 
     261        if ( !export_list ) { 
     262                memset(&libdng, 0, sizeof(libdng)); 
     263        return 0; 
     264        } 
     265 
     266        // Bind 
     267        if ( (unsigned int)export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
     268             return 1; 
     269        if ( (unsigned int)export_list[1] < 9 ) 
     270         return 1; 
     271 
     272        libdng.size = ((int)export_list[1])-2; 
     273        libdng.create_badpixel_bin=export_list[2]; 
     274        libdng.raw_init_badpixel_bin=export_list[3]; 
     275        libdng.capture_data_for_exif=export_list[4]; 
     276        libdng.load_bad_pixels_list_b=export_list[5]; 
     277        libdng.badpixel_list_loaded_b=export_list[6]; 
     278 
     279        libdng.convert_dng_to_chdk_raw=export_list[7]; 
     280        libdng.write_dng=export_list[8]; 
     281        return 0; 
     282} 
     283#endif 
     284 
     285void module_dng_unload(int owner) 
     286{ 
     287#if DNG_SUPPORT 
     288        if (libdng.create_badpixel_bin==0) 
     289        return; 
     290 
     291        module_dng_semaphore&=~owner; 
     292        if (module_dng_semaphore) 
     293                return; 
     294 
     295        module_unload(MODULE_NAME_DNG);   
     296#endif 
     297} 
     298 
     299 
     300// Return: 0-fail, otherwise - bind list 
     301struct libdng_sym* module_dng_load(int owner) 
     302{ 
     303#if DNG_SUPPORT 
     304  static int module_idx=-1; 
     305 
     306  module_dng_semaphore|=owner; 
     307  if (libdng.create_badpixel_bin) 
     308     return &libdng; 
     309 
     310  module_idx=module_load(MODULE_NAME_DNG, bind_module_dng ); 
     311  if ( module_idx<0 ) { 
     312         module_unload(MODULE_NAME_DNG);   
     313         module_dng_semaphore=0; 
     314  } 
     315  else { 
     316         // This module could be unloaded only manualy (because store badpixel) 
     317         module_set_flags(module_idx, MODULE_FLAG_DISABLE_AUTOUNLOAD); 
     318  } 
     319 
     320  return (libdng.create_badpixel_bin)?&libdng:0 ; 
     321#else 
     322  return 0; 
     323#endif 
     324} 
     325 
     326// Make convertion or check operation exsitsing 
     327// Parameter: fn = filename or 0 to just check is operation possible 
     328// Return: 0-fail, 1-ok 
     329//-------------------------------------------------------- 
     330int module_convert_dng_to_chdk_raw(char* fn) 
     331{ 
     332#if DNG_SUPPORT 
     333        if ( fn==0 ) 
     334                return module_check_is_exist(MODULE_NAME_DNG); 
     335        if ( !module_dng_load(LIBDNG_OWNED_BY_CONVERT) ) 
     336                return 0; 
     337        libdng.convert_dng_to_chdk_raw(fn); 
     338        module_dng_unload(LIBDNG_OWNED_BY_CONVERT); 
     339        return 1; 
     340#else 
     341        return 0; 
     342#endif 
     343} 
  • trunk/core/modules.h

    r1505 r1509  
    3838 
    3939 
     40// MODULE "DNG" 
     41//-------------------------- 
     42#include "dng.h" 
    4043 
    41 //-------------------------- 
    42 void module_convert_dng_to_chdk_raw(char* fn); 
     44// values of semaphore 
     45#define LIBDNG_OWNED_BY_RAW                     0x1 
     46#define LIBDNG_OWNED_BY_CONVERT                 0x2 
     47#define LIBDNG_OWNED_BY_CREATEBADPIXEL  0x4 
     48 
     49struct libdng_sym* module_dng_load(int owner);          // 0fail, addr-ok 
     50void module_dng_unload(int owner); 
     51 
     52int module_convert_dng_to_chdk_raw(char* fn);           // Return: 0-fail, 1-ok 
     53 
    4354 
    4455 
  • trunk/core/modules/Makefile

    r1505 r1509  
    1818 
    1919OBJS=../gui_calendar.o ../gui_bench.o ../gui_4wins.o ../gui_mastermind.o ../gui_reversi.o \ 
    20          ../gui_sokoban.o ../gui_read.o ../gui_debug.o  ../gui_tetris.o ../gui_snake.o 
     20         ../gui_sokoban.o ../gui_read.o ../gui_debug.o  ../gui_tetris.o ../gui_snake.o ../dng.o 
    2121 
    2222 
     
    2727 
    2828all: exportlist ../flt.h \ 
    29                 benchm.flt calend.flt 4wins.flt mastmind.flt reversi.flt sokoban.flt _rawop10.flt _rawop12.flt \ 
     29                _dng.flt benchm.flt calend.flt 4wins.flt mastmind.flt reversi.flt sokoban.flt _rawop10.flt _rawop12.flt \ 
    3030                txtread.flt memview.flt modinsp.flt tetris.flt snake.flt modmenu.flt $(OPT_FLT) 
    3131 
     
    109109        $(CC) $(CFLAGS) -o $@ -Wl,--start-group $^ $(LDLIBS) -Wl,--end-group $(LDFLAGS) $(LDOPTS) 
    110110 
     111_dng.elf: ../dng.o $(topdir)/lib/armutil/reversebytes.o 
     112        @echo \-\> $@ 
     113        $(CC) $(CFLAGS) -o $@ -Wl,--start-group $^ $(LDLIBS) -Wl,--end-group $(LDFLAGS) $(LDOPTS) 
     114 
    111115_rawop10.elf: raw_merge10.o 
    112116        @echo \-\> $@ 
  • trunk/core/raw.c

    r1505 r1509  
    44#include "raw.h" 
    55#include "console.h" 
    6 #include "dng.h" 
    7 #ifdef OPT_CURVES 
    8     #include "modules.h" 
    9 #endif 
     6#include "math.h" 
     7#include "modules.h" 
    108#include "shot_histogram.h" 
    119 
     
    5250    static int br_counter;  
    5351#if DNG_SUPPORT 
    54     if (conf.dng_raw) capture_data_for_exif(); 
     52    if (conf.dng_raw) {                              
     53                if ( module_dng_load(LIBDNG_OWNED_BY_RAW) ) 
     54                        libdng.capture_data_for_exif(); 
     55        } 
    5556#endif     
    5657    if (state_kbd_script_run && shot_histogram_isenabled()) build_shot_histogram(); 
     
    6263#if DNG_SUPPORT 
    6364    // count/save badpixels if requested 
    64     if(raw_init_badpixel_bin()) { 
     65    if( libdng.raw_init_badpixel_bin &&  
     66                libdng.raw_init_badpixel_bin()) { 
    6567        return 0; 
    6668    } 
     
    145147            if (conf.dng_raw) 
    146148            { 
    147                 create_dng_header(); 
    148                 write_dng_header(fd); 
    149                 reverse_bytes_order2(rawadr, altrawadr, hook_raw_size()); 
    150                 // Write alternate (inactive) buffer that we reversed the bytes into above (if only one buffer then it will be the active buffer instead) 
    151                 write(fd, (char*)(((unsigned long)altrawadr)|CAM_UNCACHED_BIT), hook_raw_size()); 
     149                                if ( module_dng_load(LIBDNG_OWNED_BY_RAW) ) { 
     150                                        libdng.write_dng(fd, rawadr, altrawadr, CAM_UNCACHED_BIT ); 
     151} 
    152152            } 
    153153            else  
     
    158158            close(fd); 
    159159            utime(fn, &t); 
    160  
    161             if (conf.dng_raw) 
    162             { 
    163                 if (rawadr == altrawadr)    // If only one RAW buffer then we have to swap the bytes back 
    164                     reverse_bytes_order2(rawadr, altrawadr, hook_raw_size()); 
    165                 free_dng_header(); 
    166             } 
    167160#else 
    168161            // Write active RAW buffer 
     
    286279} 
    287280 
    288 void make_pixel_list(char * ptr) { 
     281#define PIXELS_BUF_SIZE 8192 
     282int make_pixel_list(char * ptr, int size) { 
    289283    int x,y; 
    290284    struct point *pixel; 
    291285    char *endptr; 
     286         
     287        if ( size <=0 ) return 0; 
     288        if ( size >PIXELS_BUF_SIZE ) ptr[PIXELS_BUF_SIZE]=0; 
     289 
    292290    while(*ptr) { 
    293291        while (*ptr==' ' || *ptr=='\t') ++ptr;    // whitespaces 
     
    315313        if (*ptr) ++ptr; 
    316314    } 
    317 } 
    318  
    319 #define PIXELS_BUF_SIZE 8192 
    320 void load_bad_pixels_list(const char* filename) { 
    321     char *buf; 
    322     int fd; 
    323  
    324     if (filename) { 
    325         buf = umalloc(PIXELS_BUF_SIZE); 
    326         if (!buf) return; 
    327  
    328         fd = open(filename, O_RDONLY, 0777); 
    329         if (fd>=0) { 
    330             int rcnt = read(fd, buf, PIXELS_BUF_SIZE); 
    331             if (rcnt > 0) { 
    332                 if (rcnt == PIXELS_BUF_SIZE)  
    333                 buf[PIXELS_BUF_SIZE-1] = 0; 
     315        return 0; 
     316} 
     317 
     318int pow_calc( int mult, int x, int x_div, int y, int y_div) 
     319{ 
     320        return pow_calc_2( mult, x, x_div, y, y_div); 
     321} 
     322 
     323int pow_calc_2( int mult, int x, int x_div, double y, int y_div) 
     324{ 
     325        double x1 = x; 
     326        if ( x_div != 1 ) { x1=x1/x_div;} 
     327        if ( y_div != 1 ) { y=y/y_div;} 
     328 
     329        if ( mult==1 ) 
     330                return pow( x1, y ); 
    334331                else 
    335                 buf[rcnt] = 0; 
    336             } 
    337             close(fd); 
    338         } 
    339         make_pixel_list(buf);     
    340         ufree(buf); 
    341     } 
    342  
    343 } 
     332                return mult     * pow( x1, y ); 
     333} 
  • trunk/core/raw.h

    r1497 r1509  
    2323extern void raw_postprocess(); 
    2424extern void raw_prepare_develop(const char* filename); 
    25 extern void load_bad_pixels_list(const char* filename); 
     25extern int make_pixel_list(char * ptr, int size); 
    2626extern unsigned short get_raw_pixel(unsigned int x,unsigned  int y); 
    2727extern char* get_raw_image_addr(void); 
    2828extern void patch_bad_pixel(unsigned int x,unsigned  int y); 
    2929 
     30 
     31// = mult * pow ( x/xdiv, y/ydiv) 
     32extern int pow_calc( int mult, int x, int x_div, int y, int y_div); 
     33extern int pow_calc_2( int mult, int x, int x_div, double y, int y_div); 
     34 
    3035//------------------------------------------------------------------- 
    3136#endif 
  • trunk/lib/armutil/Makefile

    r944 r1509  
    33include $(topdir)makefile.inc 
    44 
    5 OBJS = reversebytes.o callfunc.o reboot.o 
     5OBJS = callfunc.o reboot.o 
    66 
    7 all: libarmutil.a 
     7OBJS_ALL = $(OBJS) 
     8OBJS_ALL += reversebytes.o  
     9 
     10all: libarmutil.a reversebytes.o  
    811 
    912libarmutil.a: $(OBJS) 
    1013 
    1114clean: 
    12         rm -f $(OBJS) libarmutil.a 
     15        rm -f $(OBJS_ALL) libarmutil.a 
    1316 
    1417distclean: clean 
    15         rm -f $(OBJS:.o=.d) 
     18        rm -f $(OBJS_ALL:.o=.d) 
    1619 
    1720include $(topdir)bottom.inc 
Note: See TracChangeset for help on using the changeset viewer.